From 0e58f488df63f2143fdc5efa9ea85b1751bf7c10 Mon Sep 17 00:00:00 2001 From: Jay V Date: Tue, 10 Jun 2025 11:52:02 -0500 Subject: moving share urls --- packages/web/src/components/Share.tsx | 4 ++- packages/web/src/pages/s/[id].astro | 58 +++++++++++++++++++++++++++++++++++ packages/web/src/pages/s/index.astro | 52 ------------------------------- 3 files changed, 61 insertions(+), 53 deletions(-) create mode 100644 packages/web/src/pages/s/[id].astro delete mode 100644 packages/web/src/pages/s/index.astro diff --git a/packages/web/src/components/Share.tsx b/packages/web/src/components/Share.tsx index 16abe9668..9e057ee66 100644 --- a/packages/web/src/components/Share.tsx +++ b/packages/web/src/components/Share.tsx @@ -425,12 +425,14 @@ function ToolFooter(props: { time: number }) { } export default function Share(props: { + id: string api: string info: SessionInfo messages: Record }) { + const id = props.id + let params = new URLSearchParams(document.location.search) - const id = params.get("id") const [store, setStore] = createStore<{ info?: SessionInfo diff --git a/packages/web/src/pages/s/[id].astro b/packages/web/src/pages/s/[id].astro new file mode 100644 index 000000000..523fa7e6c --- /dev/null +++ b/packages/web/src/pages/s/[id].astro @@ -0,0 +1,58 @@ +--- +import config from "virtual:starlight/user-config"; + +import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro'; +import Share from "../../components/Share.tsx"; + +const apiUrl = import.meta.env.VITE_API_URL; + +const { id } = Astro.params; +const res = await fetch(`${apiUrl}/share_data?id=${id}`); +const data = await res.json(); + +const title = data.info.title; +const ogImage = data.ogImage; + +--- + + + + + diff --git a/packages/web/src/pages/s/index.astro b/packages/web/src/pages/s/index.astro deleted file mode 100644 index a6b74ecde..000000000 --- a/packages/web/src/pages/s/index.astro +++ /dev/null @@ -1,52 +0,0 @@ ---- -import config from "virtual:starlight/user-config"; - -import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro'; -import Share from "../../components/Share.tsx"; - -const apiUrl = import.meta.env.VITE_API_URL; - -const id = Astro.url.searchParams.get('id') -const res = await fetch(`${apiUrl}/share_data?id=${id}`); -const data = await res.json(); - -const title = data.info.title; -const ogImage = data.ogImage; - ---- - - - - - -- cgit v1.2.3