From 13f454de9c0b48c4b29dbc210b6186e76a318e7f Mon Sep 17 00:00:00 2001 From: hypercross Date: Mon, 6 Jul 2026 16:12:34 +0800 Subject: [PATCH] feat: add URL parameter syncing for session and player Implement URL search parameter synchronization for `session` and `player` to allow for bookmarkable links. Added `sessionName` to the journal stream state to support displaying human-readable session names in the UI. Improved layout transitions and updated the JournalPanel to show more detailed connection information. --- src/App.tsx | 7 +- src/components/journal/ConnectionBar.tsx | 5 +- src/components/journal/JournalPanel.tsx | 30 +++++++-- src/components/stores/journalStream.ts | 81 +++++++++++++++++++++++- 4 files changed, 110 insertions(+), 13 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 13bc11c..7700558 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -114,8 +114,11 @@ const App: Component = () => { - {/* fill th rest of the space*/} -
+ {/* fill the rest of the space */} +
{ const handleSessionSelect = async (id: string) => { try { await hydrateFromServer(id); - journalSetState("sessionId", id); + setSessionId(id); } catch (e) { setError("Failed to load session"); } @@ -56,7 +57,7 @@ export const ConnectionBar: Component = () => { connected - {stream.sessionId} + {stream.sessionName || stream.sessionId}
diff --git a/src/components/journal/JournalPanel.tsx b/src/components/journal/JournalPanel.tsx index d2dd146..e849917 100644 --- a/src/components/journal/JournalPanel.tsx +++ b/src/components/journal/JournalPanel.tsx @@ -11,6 +11,7 @@ import { hydrateFromServer, useJournalStream, setMyName, + setSessionId, } from "../stores/journalStream"; import { ConnectionBar } from "./ConnectionBar"; import { StreamView } from "./StreamView"; @@ -26,9 +27,9 @@ export const JournalPanel: Component = (props) => { return ( <> - {/* Backdrop — hidden on desktop since panel doesn't overlay content */} + {/* Backdrop — only on mobile, starts below header */}
@@ -43,10 +44,9 @@ export const JournalPanel: Component = (props) => { > {/* Header */}
-
-

Journal

+
= (props) => { }} title={stream.connectionStatus} /> + + Disconnected + + } + > +
+

+ {stream.myName} +

+

+ {stream.sessionName || stream.sessionId} +

+
+