Files
thebet365/apps/admin/src/utils/admin-breadcrumb.ts
Mars 648c314e23 feat(admin+api): 列表页子路由重构、结算历史与充值截图清理
赛事/代理管理从表格展开改为子路由详情页;结算页增加预览弹窗与历史记录;媒体库支持截图存储统计与自动/手动清理;Player 端充值截图压缩为 WebP 300KB。
2026-06-22 12:28:25 +08:00

72 lines
2.0 KiB
TypeScript

export interface AdminBreadcrumbItem {
label: string;
to?: string;
}
/** 子页面顶栏面包屑(一级菜单 + 当前子页) */
export function resolveAdminBreadcrumb(
path: string,
t: (key: string) => string,
query: Record<string, unknown> = {},
): AdminBreadcrumbItem[] | null {
if (/^\/users\/agents\/[^/]+\/players/.test(path)) {
return [
{ label: t('nav.agents_players'), to: '/users' },
{ label: t('breadcrumb.agent_direct_players') },
];
}
if (path === '/users/settings') {
return [
{ label: t('nav.agents_players'), to: '/users' },
{ label: t('user.page_settings') },
];
}
if (/^\/matches\/leagues\/[^/]+/.test(path)) {
return [
{ label: t('nav.matches'), to: '/matches' },
{ label: t('breadcrumb.league_fixtures') },
];
}
if (/^\/matches\/outrights\/leagues\/[^/]+/.test(path)) {
return [
{ label: t('nav.matches'), to: '/matches/outrights' },
{ label: t('breadcrumb.league_outrights') },
];
}
if (/^\/settlement\/[^/]+/.test(path)) {
const returnTo =
typeof query.returnTo === 'string' && query.returnTo.startsWith('/')
? query.returnTo
: '/matches';
return [
{ label: t('nav.matches'), to: returnTo },
{ label: t('breadcrumb.settlement') },
];
}
if (/^\/matches\/[^/]+\/edit/.test(path)) {
return [
{ label: t('nav.matches'), to: '/matches' },
{ label: t('breadcrumb.match_edit') },
];
}
if (/^\/matches\/[^/]+\/markets/.test(path)) {
return [
{ label: t('nav.matches'), to: '/matches' },
{ label: t('breadcrumb.match_markets') },
];
}
if (path === '/dashboard/players') {
return [
{ label: t('nav.dashboard'), to: '/' },
{ label: t('nav.dashboard.players') },
];
}
if (/^\/outrights\/[^/]+\/edit/.test(path)) {
return [
{ label: t('nav.matches'), to: '/matches' },
{ label: t('nav.matches.outrights'), to: '/matches/outrights' },
];
}
return null;
}