Files
leaudit-platform-frontend/app/config/minimal-scope.ts
T

45 lines
973 B
TypeScript

export const MINIMAL_MENU_PREFIXES = [
'/home',
'/chat-with-llm',
'/files',
'/documents',
'/settings',
'/entry-modules',
'/role-permissions'
] 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;
}