import { useParams } from 'react-router'; import { DEFAULT_OFFSCALE_SECTION, isOffscaleSection, type OffscaleSectionId } from './shared'; // The URL is the source of truth for which section is open — not a panel channel. See docs/navigation-audit.md: // selection held in a channel means the id lives only in an onClick closure, so the section can't be linked to, // opened in a new tab, or reached with the back button. OffscaleScreen redirects anything unrecognised, so the // fallback here is only for the instant before that lands. export function useOffscaleSection(): OffscaleSectionId { const { section } = useParams(); return isOffscaleSection(section) ? section : DEFAULT_OFFSCALE_SECTION; }