Files
lotteryAdmin/src/lib/admin-nav-label.ts
kang 0d984b00f0
Some checks failed
lotteryadmin CI / build (push) Has been cancelled
feat(admin): 仪表盘重构、代理线路修复与后台体验优化
- 各角色仪表盘:KPI 可点击跳转、快捷入口、去重冗余区块,代理/站点降级 analytics
- 代理线路:创建玩家权限、侧栏搜索、深链 URL、档案保存与删除预检等修复
- 统一密码最短 6 位;代理模块表格/侧栏背景色一致(admin-table-inset)
- 报表、钱包、对账、开奖、结算、配置等模块结构与 i18n 同步更新
2026-06-26 14:39:22 +08:00

45 lines
1.1 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.
import type { TFunction } from "i18next";
/** 与 {@link AdminBreadcrumb} / 侧栏共用:仅用 i18n避免 API 旧 label 作 defaultValue 导致水合不一致 */
const NAV_SEGMENT_I18N_KEYS: Record<string, string> = {
dashboard: "dashboard",
admin_users: "admin_users",
admin_roles: "admin_roles",
players: "players",
currencies: "currencies",
wallet: "wallet",
draws: "draws",
rules_plays: "rules_plays",
rules_odds: "rules_odds",
jackpot: "jackpot",
risk_cap: "risk_cap",
risk: "risk",
settlement: "settlement",
settlement_center: "settlement_center",
reconcile: "reconcile",
reports: "reports",
tickets: "tickets",
audit: "audit",
settings: "settings",
integration: "integration",
agents: "agents",
config: "config",
};
const LEGACY_NAV_SEGMENT_I18N_KEYS: Record<string, string> = {
agent_list: "agents",
};
export function adminNavLabel(
segment: string,
t: TFunction,
apiLabel?: string | null,
): string {
const key = NAV_SEGMENT_I18N_KEYS[segment] ?? LEGACY_NAV_SEGMENT_I18N_KEYS[segment];
if (key) {
return t(`nav.${key}`, { ns: "common" });
}
return apiLabel?.trim() ? apiLabel : segment;
}