fix: hide unsupported menus in minimal scope

This commit is contained in:
wren
2026-04-29 18:14:04 +08:00
parent 3d3d8d6e6b
commit 1b67358e5b
3 changed files with 64 additions and 2 deletions
+41
View File
@@ -0,0 +1,41 @@
export const MINIMAL_MENU_PREFIXES = [
'/home',
'/chat-with-llm',
'/files',
'/documents'
] as const;
export const MINIMAL_HOME_TARGETS = [
'/home',
'/files/upload',
'/documents',
'/chat-with-llm/chat'
] as const;
export function isMinimalMenuPath(path?: string | null): boolean {
if (!path) {
return false;
}
return MINIMAL_MENU_PREFIXES.some(prefix => path === prefix || path.startsWith(`${prefix}/`));
}
export function normalizeHomeTargetPath(path?: string | null, hasDocumentTypes: boolean = false): string | null {
if (!path) {
return null;
}
if (path === '/contract-template/search' && hasDocumentTypes) {
return '/files/upload';
}
if (path === '/cross-checking') {
return null;
}
if (MINIMAL_HOME_TARGETS.some(prefix => path === prefix || path.startsWith(`${prefix}/`))) {
return path;
}
return hasDocumentTypes ? '/files/upload' : null;
}