R29-1 R29-6: 重构海音达工作台壳层与高频页面
这个提交包含在:
@@ -1,32 +1,11 @@
|
||||
import { useEffect } from "react";
|
||||
import { Outlet, useLocation } from "react-router-dom";
|
||||
import { NAV_ITEMS } from "../components/navigation/NavLinks";
|
||||
import { ErrorBoundary } from "../components/common/ErrorBoundary";
|
||||
import { Sidebar } from "../components/navigation/Sidebar";
|
||||
import { Topbar } from "../components/navigation/Topbar";
|
||||
import { resolvePageMeta } from "../features/navigation/schema";
|
||||
import { writeRecentVisit } from "../lib/recentVisits";
|
||||
|
||||
const EXTRA_TITLE_ENTRIES = [
|
||||
{ path: "/notifications", title: "通知中心" },
|
||||
{ path: "/reimbursements/", title: "报销详情" },
|
||||
{ path: "/workflow/tasks/", title: "审批详情" },
|
||||
{ path: "/people/", title: "员工档案" },
|
||||
];
|
||||
|
||||
function resolveVisitTitle(pathname: string) {
|
||||
const candidates = [
|
||||
...NAV_ITEMS.map((item) => ({ path: item.to, title: item.label })),
|
||||
...EXTRA_TITLE_ENTRIES,
|
||||
].sort((left, right) => right.path.length - left.path.length);
|
||||
|
||||
const matched = candidates.find((item) => pathname === item.path || pathname.startsWith(item.path));
|
||||
if (matched) {
|
||||
return matched.title;
|
||||
}
|
||||
|
||||
return pathname === "/" ? "Portal" : pathname;
|
||||
}
|
||||
|
||||
export function AppShellLayout() {
|
||||
const location = useLocation();
|
||||
|
||||
@@ -35,17 +14,17 @@ export function AppShellLayout() {
|
||||
if (!pathname || pathname === "/login" || pathname.startsWith("/mobile/")) {
|
||||
return;
|
||||
}
|
||||
writeRecentVisit(pathname, resolveVisitTitle(pathname));
|
||||
writeRecentVisit(pathname, resolvePageMeta(pathname).title);
|
||||
}, [location.pathname]);
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen bg-zinc-50">
|
||||
<div className="flex min-h-screen bg-[var(--color-bg-canvas)]">
|
||||
<Sidebar />
|
||||
|
||||
<main className="flex-1 flex flex-col min-w-0 lg:ml-64">
|
||||
<main className="flex min-w-0 flex-1 flex-col lg:ml-72">
|
||||
<Topbar />
|
||||
|
||||
<div className="flex-1 p-4 sm:p-8">
|
||||
<div className="flex-1 px-4 py-6 sm:px-8 sm:py-8">
|
||||
<div className="layout-container max-w-none">
|
||||
<ErrorBoundary>
|
||||
<Outlet />
|
||||
|
||||
在新工单中引用
屏蔽一个用户