Files
lotteryAdmin/src/modules/config/config-nav-model.ts

62 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Single source of truth for config sub-navigation and breadcrumb routes.
* Add new config pages here and create the matching `app/admin/(shell)/config/.../page.tsx`.
*
* ## 导航层级约定(避免「侧栏 + 顶栏 + 页内 Tab」叠三层
* 1. **侧栏**:模块入口(如「运营配置」)— 全站唯一一级。
* 2. **本文件顶栏ConfigSubNav**:运营配置下的「业务子域」切换(玩法、赔率、奖池…)— 最多一层。
* 3. **页面内**:默认 **禁止再建 Tab/子路由**;改参数与查流水用 **同页分区ConfigSection** 或锚点 `#records`。
* 仅当子域体量极大、且与配置完全无关时再考虑独立路由,且不得与顶栏同名。
*/
export type ConfigNavGroup = {
id: string;
items: readonly {
href: string;
key: string;
}[];
};
export const CONFIG_NAV_GROUPS: readonly ConfigNavGroup[] = [
{
id: "betting",
items: [
{
href: "/admin/config/plays",
key: "plays",
},
{
href: "/admin/config/odds",
key: "odds",
},
{
href: "/admin/config/rebate",
key: "rebate",
},
{
href: "/admin/config/jackpot",
key: "jackpot",
},
],
},
{
id: "risk",
items: [
{
href: "/admin/config/risk-cap",
key: "risk-cap",
},
],
},
] as const;
export function flattenConfigNavHrefs(): string[] {
const out: string[] = [];
for (const g of CONFIG_NAV_GROUPS) {
for (const it of g.items) {
out.push(it.href);
}
}
return out;
}