import { useEffect } from 'react'; import type { ReactNode } from 'react'; import { useLocation } from 'react-router-dom'; import { NavTree } from './NavTree'; import { Breadcrumb } from './Breadcrumb'; import { ThemeToggle } from './ThemeToggle'; import { findTrail } from './nav-utils'; interface Props { children: ReactNode; } /** 品牌 mark:漏斗三阶 glyph(与 favicon 一致),mint 方块内白色。 */ function BrandGlyph() { return ( ); } /** Shell: top bar + left nav (L1/L2/L3 tree) + content area (docs/02 §9). */ export function AppLayout({ children }: Props) { const { pathname } = useLocation(); // 页面标题随路由变:「<当前页> · HS-Data」。 useEffect(() => { const trail = findTrail(pathname); const leaf = trail[trail.length - 1]; document.title = leaf ? `${leaf.label} · HS Data` : 'HS Data · 数据平台'; }, [pathname]); return (
{/* 顶栏白、侧栏浅 slate —— 低反差,顶 ≠ 左 */}
HS Data 数据平台
MVP
{/* scrollbar-gutter: stable —— 始终预留滚动条宽度,内容增高出现滚动条时不再横向抖动 */}
{children}
); } export default AppLayout;