From 2f09465f4164ade09c59025f61bf2c90efd84f0b Mon Sep 17 00:00:00 2001 From: "Visal .In" Date: Tue, 8 Oct 2024 08:55:28 +0700 Subject: [PATCH] add starbase embed --- .../(theme)/embed/starbase/page-client.tsx | 25 +++++++++++++++++++ src/app/(theme)/embed/starbase/page.tsx | 10 ++++++++ src/drivers/iframe-driver.ts | 7 ++++++ 3 files changed, 42 insertions(+) create mode 100644 src/app/(theme)/embed/starbase/page-client.tsx create mode 100644 src/app/(theme)/embed/starbase/page.tsx diff --git a/src/app/(theme)/embed/starbase/page-client.tsx b/src/app/(theme)/embed/starbase/page-client.tsx new file mode 100644 index 0000000..572b814 --- /dev/null +++ b/src/app/(theme)/embed/starbase/page-client.tsx @@ -0,0 +1,25 @@ +"use client"; +import { Studio } from "@/components/gui/studio"; +import { IframeSQLiteDriver } from "@/drivers/iframe-driver"; +import { useSearchParams } from "next/navigation"; +import { useEffect, useMemo } from "react"; + +export default function EmbedPageClient() { + const searchParams = useSearchParams(); + const driver = useMemo( + () => new IframeSQLiteDriver({ supportPragmaList: false }), + [] + ); + + useEffect(() => { + return driver.listen(); + }, [driver]); + + return ( + + ); +} diff --git a/src/app/(theme)/embed/starbase/page.tsx b/src/app/(theme)/embed/starbase/page.tsx new file mode 100644 index 0000000..da0029d --- /dev/null +++ b/src/app/(theme)/embed/starbase/page.tsx @@ -0,0 +1,10 @@ +import ThemeLayout from "../../theme_layout"; +import EmbedPageClient from "./page-client"; + +export default async function EmbedPage() { + return ( + + + + ); +} diff --git a/src/drivers/iframe-driver.ts b/src/drivers/iframe-driver.ts index 8738776..c2f2ff6 100644 --- a/src/drivers/iframe-driver.ts +++ b/src/drivers/iframe-driver.ts @@ -76,6 +76,13 @@ class IframeConnection { export class IframeSQLiteDriver extends SqliteLikeBaseDriver { protected conn = new IframeConnection(); + constructor(options?: { supportPragmaList: boolean }) { + super(); + if (options?.supportPragmaList) { + this.supportPragmaList = true; + } + } + listen() { this.conn.listen(); }