section-registry.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. Copyright (C) 2023-2026 QuantumNous
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. For commercial licensing, please contact support@quantumnous.com
  14. */
  15. import { createSectionRegistry } from '@/features/system-settings/utils/section-registry'
  16. /**
  17. * Usage logs page section definitions
  18. */
  19. const USAGE_LOGS_SECTIONS = [
  20. {
  21. id: 'common',
  22. titleKey: 'API Logs',
  23. build: () => null, // Content is rendered directly in the page component
  24. },
  25. {
  26. id: 'audit',
  27. titleKey: 'Audit Logs',
  28. build: () => null, // Content is rendered directly in the page component
  29. },
  30. {
  31. id: 'drawing',
  32. titleKey: 'Drawing Logs',
  33. build: () => null, // Content is rendered directly in the page component
  34. },
  35. {
  36. id: 'task',
  37. titleKey: 'Task Logs',
  38. build: () => null, // Content is rendered directly in the page component
  39. },
  40. ] as const
  41. export type UsageLogsSectionId = (typeof USAGE_LOGS_SECTIONS)[number]['id']
  42. const usageLogsRegistry = createSectionRegistry<
  43. UsageLogsSectionId,
  44. Record<string, never>,
  45. []
  46. >({
  47. sections: USAGE_LOGS_SECTIONS,
  48. defaultSection: 'common',
  49. basePath: '/usage-logs',
  50. urlStyle: 'path',
  51. })
  52. export const USAGE_LOGS_SECTION_IDS = usageLogsRegistry.sectionIds
  53. export const USAGE_LOGS_DEFAULT_SECTION = usageLogsRegistry.defaultSection
  54. /** Type guard for validating section IDs without casting. Use with z.string().refine() or params checks. */
  55. export function isUsageLogsSectionId(s: string): s is UsageLogsSectionId {
  56. return (USAGE_LOGS_SECTION_IDS as readonly string[]).includes(s)
  57. }
  58. export const getUsageLogsSectionNavItems = usageLogsRegistry.getSectionNavItems