fix: hide unsupported menus in minimal scope
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user