423931eb1d
新增 records-route.ts:按菜单 key 过滤可见的记录/版本页。 TDD: task-138.test.ts 8 用例 RED→GREEN。
11 lines
588 B
TypeScript
11 lines
588 B
TypeScript
/** 记录与版本中心页可见性(任务 138):依据菜单 key 决定历史/版本/数字人版本页是否展示;纯逻辑。 */
|
|
|
|
export const RECORDS_PAGE_KEYS = ['history', 'version', 'digital-human-version'] as const
|
|
export type RecordsPageKey = (typeof RECORDS_PAGE_KEYS)[number]
|
|
|
|
/** 由菜单 key 集合过滤出可见的记录页(按固定顺序)。 */
|
|
export function visibleRecordsPages(menuKeys: readonly string[] | null | undefined): RecordsPageKey[] {
|
|
if (!Array.isArray(menuKeys)) return []
|
|
return RECORDS_PAGE_KEYS.filter((key) => menuKeys.includes(key))
|
|
}
|