feat(config): 重构配置模块导航与版本切换,新增版本删除能力
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
BreadcrumbSeparator,
|
||||
} from "@/components/ui/breadcrumb";
|
||||
import { adminShellNavItems, ADMIN_BASE } from "@/modules/_config/admin-nav";
|
||||
import { CONFIG_ROUTE_LABELS } from "@/modules/config/config-nav-model";
|
||||
import React from "react";
|
||||
|
||||
const DRAW_ROUTE_LABELS: Record<string, string> = {
|
||||
@@ -26,6 +27,12 @@ function titleCase(value: string): string {
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
type BreadcrumbCrumb = {
|
||||
label: string;
|
||||
href: string;
|
||||
isCurrent: boolean;
|
||||
};
|
||||
|
||||
export function AdminBreadcrumb() {
|
||||
const pathname = usePathname();
|
||||
|
||||
@@ -33,7 +40,7 @@ export function AdminBreadcrumb() {
|
||||
const segments = pathname.split("/").filter(Boolean);
|
||||
|
||||
// 基础面包屑:首页/仪表盘
|
||||
const breadcrumbs = [
|
||||
const breadcrumbs: BreadcrumbCrumb[] = [
|
||||
{
|
||||
label: "首页",
|
||||
href: ADMIN_BASE,
|
||||
@@ -58,7 +65,12 @@ export function AdminBreadcrumb() {
|
||||
|
||||
if (segments.length > 2) {
|
||||
const subSegment = segments[2];
|
||||
const subLabel = subSegment ? DRAW_ROUTE_LABELS[subSegment] ?? titleCase(subSegment) : "";
|
||||
let subLabel = "";
|
||||
if (businessSegment === "config" && subSegment) {
|
||||
subLabel = CONFIG_ROUTE_LABELS[subSegment] ?? titleCase(subSegment);
|
||||
} else {
|
||||
subLabel = subSegment ? DRAW_ROUTE_LABELS[subSegment] ?? titleCase(subSegment) : "";
|
||||
}
|
||||
if (subLabel) {
|
||||
breadcrumbs.push({
|
||||
label: subLabel,
|
||||
|
||||
Reference in New Issue
Block a user