- 状态统一写「排队中」;「待审批」改「等你批准」,「其它」改「其他」 - 整理结果原因用「已整理 / 部分整理」;去掉引擎旧状态的「(旧)」 - 导航说明去掉「偏好标签」「留痕」等旧称与重复 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
179 lines
5.4 KiB
TypeScript
179 lines
5.4 KiB
TypeScript
import {
|
|
Bot,
|
|
CalendarClock,
|
|
Compass,
|
|
Download,
|
|
FileStack,
|
|
FolderTree,
|
|
Gauge,
|
|
Globe,
|
|
House,
|
|
Library,
|
|
ListChecks,
|
|
type LucideIcon,
|
|
ScrollText,
|
|
Settings,
|
|
} from "lucide-react";
|
|
|
|
export type NavItem = {
|
|
to: string;
|
|
label: string;
|
|
icon: LucideIcon;
|
|
description: string;
|
|
};
|
|
export type NavGroup = { title: string; items: NavItem[] };
|
|
|
|
/** 控制台路由前缀 */
|
|
export const CONSOLE_BASE = "/console";
|
|
|
|
/** 拼控制台路径:consolePath("library", id) → /console/library/<id> */
|
|
export function consolePath(...segments: (string | number)[]): string {
|
|
const rest = segments.map((s) => encodeURIComponent(String(s))).join("/");
|
|
return rest ? `${CONSOLE_BASE}/${rest}` : CONSOLE_BASE;
|
|
}
|
|
|
|
/**
|
|
* 「获取」组的组名(IA-2):站点、订阅、规则合成一组。用户原话"都算做规则",组名可能再改,只改这一处。
|
|
*/
|
|
export const ACQUIRE_GROUP_TITLE = "获取";
|
|
|
|
/**
|
|
* 侧栏 4 组 13 项(IA-2,docs/design/console-ia.md):概览 → 获取 → 整理 → 系统。
|
|
* RSS 属于站点(站点详情的 RSS Tab),不再单独占一项。
|
|
* 没有「待处理」(2026-10-06 取消):问题在发生处处理,铃铛只放等你批准的智能体操作与系统健康;移动端抽屉用同一份表。
|
|
* 系统组只有三项(界面第二轮):日志(任务、定时与自动、登录、审计合一,定时任务设置是其中一个页签)、运行状态、设置。
|
|
*/
|
|
export const NAV_GROUPS: NavGroup[] = [
|
|
{
|
|
title: "概览",
|
|
items: [
|
|
{
|
|
to: "/console",
|
|
label: "首页",
|
|
icon: House,
|
|
description: "进行中的任务、等你批准的操作、最近的整理",
|
|
},
|
|
{
|
|
to: "/console/agent",
|
|
label: "智能体会话",
|
|
icon: Bot,
|
|
description: "给智能体一个目标,看它做了什么",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: ACQUIRE_GROUP_TITLE,
|
|
items: [
|
|
{
|
|
to: "/console/sites",
|
|
label: "站点",
|
|
icon: Globe,
|
|
description: "PT 站、公开 BT 站和自定义 RSS 源",
|
|
},
|
|
{ to: "/console/discover", label: "发现", icon: Compass, description: "bgm.tv 每日放送与豆瓣热门" },
|
|
{ to: "/console/subscriptions", label: "订阅", icon: CalendarClock, description: "单次收录与持续追踪" },
|
|
{ to: "/console/rules", label: "规则", icon: ListChecks, description: "收录策略与规则组" },
|
|
],
|
|
},
|
|
{
|
|
title: "整理",
|
|
items: [
|
|
{ to: "/console/downloads", label: "下载面板", icon: Download, description: "进行中与已完成的下载、下载盘" },
|
|
{
|
|
to: "/console/organize",
|
|
label: "整理记录",
|
|
icon: FileStack,
|
|
description: "每次整理的前后路径与逐文件结果",
|
|
},
|
|
{
|
|
to: "/console/files",
|
|
label: "文件管理",
|
|
icon: FolderTree,
|
|
description: "浏览下载目录和媒体库,改名、移动、删除与整理",
|
|
},
|
|
{
|
|
to: "/console/library",
|
|
label: "媒体库",
|
|
icon: Library,
|
|
description: "作品、季与集、未识别资源",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "系统",
|
|
items: [
|
|
{
|
|
to: "/console/logs",
|
|
label: "日志",
|
|
icon: ScrollText,
|
|
description: "任务、定时任务、登录与操作记录,可实时查看",
|
|
},
|
|
{
|
|
to: "/console/status",
|
|
label: "运行状态",
|
|
icon: Gauge,
|
|
description: "服务是否正常、CPU 与内存、磁盘与数据库",
|
|
},
|
|
{
|
|
to: "/console/settings",
|
|
label: "设置",
|
|
icon: Settings,
|
|
description: "下载器、媒体服务器、媒体库目录、站点账号、模型服务与自动化",
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
/** 并进别的导航项的旧页面:按前缀归到对应项(任务详情独立页属于日志) */
|
|
const NAV_ALIASES: Record<string, string> = {
|
|
"/console/tasks": "/console/logs",
|
|
};
|
|
|
|
/** 不在侧栏但有页面的路由:顶栏标题用 */
|
|
const EXTRA_TITLES: Record<string, string> = {
|
|
"/console/preferences": "规则",
|
|
"/console/search": "搜索",
|
|
};
|
|
|
|
export const NAV_ITEMS = NAV_GROUPS.flatMap((g) => g.items);
|
|
|
|
/** 设置页深链(IA-2):`/console/settings#分区[/节]`。调用方只认新分区名 */
|
|
export type SettingsSection =
|
|
| "downloaders"
|
|
| "media-servers"
|
|
| "sites"
|
|
| "metadata"
|
|
| "acquire"
|
|
| "library"
|
|
| "organize"
|
|
| "agent"
|
|
| "system"
|
|
| "cache"
|
|
| "account"
|
|
| "interface";
|
|
export function settingsPath(section: SettingsSection, anchor?: string): string {
|
|
return `${CONSOLE_BASE}/settings#${section}${anchor ? `/${anchor}` : ""}`;
|
|
}
|
|
|
|
/** 按路径找当前导航项(最长前缀匹配) */
|
|
export function findNavItem(pathname: string): NavItem | undefined {
|
|
const alias = Object.entries(NAV_ALIASES).find(([from]) => pathname === from || pathname.startsWith(`${from}/`));
|
|
if (alias) return NAV_ITEMS.find((i) => i.to === alias[1]);
|
|
return (
|
|
NAV_ITEMS.find((i) => i.to === pathname.replace(/\/+$/, "")) ??
|
|
NAV_ITEMS.filter((i) => i.to !== CONSOLE_BASE && pathname.startsWith(`${i.to}/`)).sort(
|
|
(a, b) => b.to.length - a.to.length,
|
|
)[0]
|
|
);
|
|
}
|
|
|
|
/** 顶栏标题:导航项名,或不在侧栏的页面名 */
|
|
export function pageTitle(pathname: string): string | undefined {
|
|
const path = pathname.replace(/\/+$/, "");
|
|
return (
|
|
findNavItem(pathname)?.label ??
|
|
EXTRA_TITLES[path] ??
|
|
(path.startsWith("/console/media/tmdb/") ? "作品详情" : undefined)
|
|
);
|
|
}
|