feat: 统一管理端多语言、配置与票据/结算页面重构
This commit is contained in:
@@ -21,6 +21,23 @@ const DRAW_ROUTE_LABELS: Record<string, string> = {
|
||||
results: "Results",
|
||||
};
|
||||
|
||||
const NAV_TRANSLATION_KEYS: Record<string, string> = {
|
||||
dashboard: "dashboard",
|
||||
admin_users: "admin_users",
|
||||
admin_roles: "admin_roles",
|
||||
players: "players",
|
||||
wallet: "wallet",
|
||||
draws: "draws",
|
||||
config: "config",
|
||||
risk: "risk",
|
||||
settlement: "settlement",
|
||||
reconcile: "reconcile",
|
||||
tickets: "tickets",
|
||||
reports: "reports",
|
||||
audit: "audit",
|
||||
settings: "settings",
|
||||
};
|
||||
|
||||
function titleCase(value: string): string {
|
||||
return value
|
||||
.split("-")
|
||||
@@ -60,22 +77,24 @@ export function AdminBreadcrumb() {
|
||||
});
|
||||
|
||||
if (navItem && navItem.href !== ADMIN_BASE) {
|
||||
const navLabelMap: Record<string, string> = {
|
||||
dashboard: t("title", { ns: "dashboard" }),
|
||||
reports: t("title", { ns: "reports" }),
|
||||
"audit-logs": t("title", { ns: "audit" }),
|
||||
};
|
||||
const translatedNavLabel =
|
||||
NAV_TRANSLATION_KEYS[navItem.segment] != null
|
||||
? t(`nav.${NAV_TRANSLATION_KEYS[navItem.segment]}`, {
|
||||
ns: "common",
|
||||
defaultValue: navItem.label,
|
||||
})
|
||||
: navItem.label;
|
||||
breadcrumbs.push({
|
||||
label:
|
||||
navItem.segment === "draws"
|
||||
? "Draws"
|
||||
: navLabelMap[navItem.segment] ?? navItem.label,
|
||||
label: translatedNavLabel,
|
||||
href: navItem.href,
|
||||
isCurrent: pathname === navItem.href || segments.length === 2,
|
||||
});
|
||||
} else {
|
||||
breadcrumbs.push({
|
||||
label: titleCase(businessSegment),
|
||||
label: t(`nav.${businessSegment}`, {
|
||||
ns: "common",
|
||||
defaultValue: titleCase(businessSegment),
|
||||
}),
|
||||
href: `${ADMIN_BASE}/${businessSegment}`,
|
||||
isCurrent: segments.length === 2,
|
||||
});
|
||||
@@ -111,7 +130,7 @@ export function AdminBreadcrumb() {
|
||||
{breadcrumbs.map((crumb, index) => {
|
||||
const isLast = index === breadcrumbs.length - 1;
|
||||
const itemKey = `${crumb.href}-${index}`;
|
||||
|
||||
|
||||
return (
|
||||
<React.Fragment key={itemKey}>
|
||||
<BreadcrumbItem>
|
||||
|
||||
Reference in New Issue
Block a user