- 新增零依赖路由器 (src/router):路由表 + useSyncExternalStore hook + Link 组件 - 抽出 HomePage,document.title 改由路由表驱动 - MorePage 改用 Tailwind 并复用 Header/Footer,移除 more.css - 清理未使用依赖 (clsx/tailwind-merge/cva/tw-animate-css)、utils.ts、空 icons 目录、未用的 shadcn 主题变量及重复背景图
9 lines
341 B
TypeScript
9 lines
341 B
TypeScript
import { useSyncExternalStore } from "react";
|
|
import { getPath, subscribe } from "./history";
|
|
import { matchRoute, type RouteDefinition } from "./routes";
|
|
|
|
export function useRoute(): { path: string; route: RouteDefinition } {
|
|
const path = useSyncExternalStore(subscribe, getPath, () => "/");
|
|
return { path, route: matchRoute(path) };
|
|
}
|