52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
export const MINIMAL_MENU_PREFIXES = [
|
|
'/home',
|
|
'/chat-with-llm',
|
|
'/contract-template',
|
|
'/cross-checking',
|
|
'/files',
|
|
'/documents',
|
|
'/rules',
|
|
'/rule-groups',
|
|
'/rules-files',
|
|
'/settings',
|
|
'/entry-modules',
|
|
'/role-permissions',
|
|
'/document-types'
|
|
] as const;
|
|
|
|
export const MINIMAL_HOME_TARGETS = [
|
|
'/home',
|
|
'/files/upload',
|
|
'/documents',
|
|
'/chat-with-llm/chat',
|
|
'/cross-checking',
|
|
] 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;
|
|
}
|