Summary card links to the detailed analysis tab
CI / test (push) Successful in 47s
CI / build (push) Successful in 3m41s
CI / deploy (push) Skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-17 10:43:03 +00:00
co-authored by Claude Opus 5.5
parent 1e95459671
commit 0e01f88f31
4 changed files with 48 additions and 5 deletions
+19 -3
View File
@@ -9,13 +9,29 @@ export type Tab = { id: string; label: string; content: ReactNode };
* shared link opens the same tab. Hidden panels stay mounted: a running
* analysis keeps polling while another tab is open.
*/
/** Opens a tab from anywhere on the page (also when the hash is already that tab). */
export function openTab(id: string) {
history.replaceState(null, "", `#${id}`);
window.dispatchEvent(new HashChangeEvent("hashchange"));
}
export function Tabs({ tabs, label }: { tabs: Tab[]; label: string }) {
const [active, setActive] = useState(tabs[0]?.id);
const buttons = useRef<(HTMLButtonElement | null)[]>([]);
const root = useRef<HTMLDivElement>(null);
// A link to #<tab> (on load, or from elsewhere on the page) opens that tab and scrolls to it.
useEffect(() => {
const fromHash = window.location.hash.slice(1);
if (tabs.some((t) => t.id === fromHash)) setActive(fromHash);
const open = () => {
const id = window.location.hash.slice(1);
if (!tabs.some((t) => t.id === id)) return;
setActive(id);
root.current?.scrollIntoView({ behavior: "smooth", block: "start" });
};
open();
window.addEventListener("hashchange", open);
return () => window.removeEventListener("hashchange", open);
}, [tabs]);
function choose(id: string) {
@@ -33,7 +49,7 @@ export function Tabs({ tabs, label }: { tabs: Tab[]; label: string }) {
}
return (
<div className="tabs">
<div className="tabs" ref={root}>
<div className="tab-list" role="tablist" aria-label={label}>
{tabs.map((t, i) => (
<button