Files
ReporterStationManagementSy…/src/routes.ts
T
2026-08-01 23:09:49 +08:00

41 lines
1.9 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.
// 路由 Page key(替代 types.ts 中的 Page
export type PageKey = 'dashboard' | 'work' | 'review' | 'people' | 'stations'
| 'archive' | 'notices' | 'settings' | 'rules' | 'scores' | 'leaderboard'
| 'appeals' | 'logs' | 'stationmap' | 'cockpit' | 'profile'
import {
LayoutDashboard, FilePenLine, ClipboardCheck, Users, Building2,
Archive, Bell, Settings, ScrollText, BarChart3, Trophy, Gavel,
FileText, MapPin, Gauge, UserCircle,
} from 'lucide-react'
export const pageIcons: Record<PageKey, typeof LayoutDashboard> = {
dashboard: LayoutDashboard, work: FilePenLine, review: ClipboardCheck,
people: Users, stations: Building2, archive: Archive,
notices: Bell, settings: Settings, rules: ScrollText,
scores: BarChart3, leaderboard: Trophy, appeals: Gavel,
logs: FileText, stationmap: MapPin, cockpit: Gauge, profile: UserCircle,
}
export const pathMap: Record<PageKey, string> = {
dashboard: '/', work: '/work', review: '/review',
people: '/people', stations: '/stations', archive: '/archive',
notices: '/notices', settings: '/settings',
rules: '/rules', scores: '/scores', leaderboard: '/leaderboard',
appeals: '/appeals', logs: '/logs',
stationmap: '/stationmap', cockpit: '/cockpit', profile: '/profile',
}
export const navLabels: Record<PageKey, string> = {
dashboard: '工作台', work: '工作记录', review: '审核中心',
people: '人员管理', stations: '记者站管理', archive: '电子档案',
notices: '通知公告', settings: '系统设置',
rules: '考核规则', scores: '评分结果', leaderboard: '积分排行',
appeals: '申诉复议', logs: '操作日志',
stationmap: '全国地图', cockpit: '管理驾驶舱', profile: '能力画像',
}
export function pathToPage(pathname: string): PageKey {
const entry = Object.entries(pathMap).find(([, p]) => p === pathname)
return (entry ? entry[0] : 'dashboard') as PageKey
}