From 9e61f213166f860f0a7cd79927d65eebc49e2e4c Mon Sep 17 00:00:00 2001 From: Moepchi Date: Sun, 25 Oct 2026 08:06:55 +0000 Subject: [PATCH] Open #about / #options links from the ticker in the same window Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- web/src/App.tsx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index 3a8e76a..65156d0 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -3028,6 +3028,9 @@ type NewsItem = const NEWS_DISMISSED_STORAGE_KEY = "webspeak3.newsTicker.dismissed"; +/** Hash links that open a dialog in this client (#about, #options/
). */ +const isInAppHash = (hash: string) => hash === "#about" || OPTIONS_SECTIONS.some((s) => hash === `#options/${s.id}`); + // Like the scrolling news line at the bottom of the native TS3 client. // Dismissing hides the current set of items until a new one shows up. function NewsTicker() { @@ -3074,9 +3077,13 @@ function NewsTicker() { : item.text; const entries = items.map((item) => { const url = item.kind === "theme" ? undefined : item.url; + // https://…/#options/konto or #about: open the dialog here instead of a new tab. + const inApp = url && isInAppHash(new URL(url).hash); return ( - {url ? ( + {inApp ? ( + {label(item)} + ) : url ? ( {label(item)} @@ -9142,6 +9149,19 @@ function AppInner() { const linkedOptionsSection = OPTIONS_SECTIONS.find((s) => window.location.hash === `#options/${s.id}`)?.id; const [optionsDialogOpen, setOptionsDialogOpen] = useState(!!linkedOptionsSection); const [optionsSection, setOptionsSection] = useState(linkedOptionsSection ?? OPTIONS_SECTIONS[0].id); + useEffect(() => { + const onHash = () => { + const hash = window.location.hash; + if (hash === "#about") setAboutOpen(true); + const section = OPTIONS_SECTIONS.find((s) => hash === `#options/${s.id}`)?.id; + if (section) { + setOptionsSection(section); + setOptionsDialogOpen(true); + } + }; + window.addEventListener("hashchange", onHash); + return () => window.removeEventListener("hashchange", onHash); + }, []); const socketRef = useRef(null); /** Multi-join: one gateway WebSocket (+ connector) per session tab. */ const [sessionTabs, setSessionTabs] = useState([]);