@jmruthers/pace-core 0.6.5 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +104 -0
- package/README.md +5 -403
- package/audit-tool/00-dependencies.cjs +394 -0
- package/audit-tool/audits/01-pace-core-compliance.cjs +556 -0
- package/audit-tool/audits/02-project-structure.cjs +255 -0
- package/audit-tool/audits/03-architecture.cjs +196 -0
- package/audit-tool/audits/04-code-quality.cjs +149 -0
- package/audit-tool/audits/05-styling.cjs +224 -0
- package/audit-tool/audits/06-security-rbac.cjs +544 -0
- package/audit-tool/audits/07-api-tech-stack.cjs +301 -0
- package/audit-tool/audits/08-testing-documentation.cjs +202 -0
- package/audit-tool/audits/09-operations.cjs +208 -0
- package/audit-tool/index.cjs +291 -0
- package/audit-tool/utils/code-utils.cjs +218 -0
- package/audit-tool/utils/file-utils.cjs +230 -0
- package/audit-tool/utils/report-utils.cjs +241 -0
- package/core-usage-manifest.json +93 -0
- package/cursor-rules/00-standards-overview.mdc +156 -0
- package/cursor-rules/01-pace-core-compliance.mdc +586 -0
- package/cursor-rules/02-project-structure.mdc +42 -4
- package/cursor-rules/{03-solid-principles.mdc → 03-architecture.mdc} +126 -10
- package/cursor-rules/04-code-quality.mdc +419 -0
- package/cursor-rules/{08-markup-quality.mdc → 05-styling.mdc} +104 -34
- package/cursor-rules/06-security-rbac.mdc +518 -0
- package/cursor-rules/07-api-tech-stack.mdc +377 -0
- package/cursor-rules/08-testing-documentation.mdc +324 -0
- package/cursor-rules/09-operations.mdc +365 -0
- package/dist/{AuthService-Cb34EQs3.d.ts → AuthService-DmfO5rGS.d.ts} +10 -0
- package/dist/DataTable-7PMH7XN7.js +15 -0
- package/dist/{DataTable-BMRU8a1j.d.ts → DataTable-DRUIgtUH.d.ts} +1 -1
- package/dist/{PublicPageProvider-QTFVrL-Z.d.ts → PublicPageProvider-DlsCaR5v.d.ts} +33 -72
- package/dist/UnifiedAuthProvider-ZT6TIGM7.js +7 -0
- package/dist/api-Y4MQWOFW.js +4 -0
- package/dist/audit-MYQXYZFU.js +3 -0
- package/dist/{chunk-DGUM43GV.js → chunk-3RG5ZIWI.js} +1 -4
- package/dist/{chunk-QXHPKYJV.js → chunk-4SXLQIZO.js} +1 -26
- package/dist/{chunk-UPPMRMYG.js → chunk-5X4QLXRG.js} +73 -151
- package/dist/chunk-6F3IILHI.js +62 -0
- package/dist/{chunk-E66EQZE6.js → chunk-6GLLNA6U.js} +3 -9
- package/dist/{chunk-ZSAAAMVR.js → chunk-6QYDGKQY.js} +1 -4
- package/dist/{chunk-FMUCXFII.js → chunk-7ILTDCL2.js} +9 -5
- package/dist/{chunk-M43Y4SSO.js → chunk-A3W6LW53.js} +15 -13
- package/dist/{chunk-63FOKYGO.js → chunk-AHU7G2R5.js} +2 -11
- package/dist/{chunk-HU2C6SSC.js → chunk-BM4CQ5P3.js} +606 -559
- package/dist/chunk-C7NSAPTL.js +1 -0
- package/dist/{chunk-J36DSWQK.js → chunk-FEJLJNWA.js} +7 -41
- package/dist/{chunk-IHB5DR3H.js → chunk-FTCRZOG2.js} +188 -387
- package/dist/{chunk-G37KK66H.js → chunk-FYHN4DD5.js} +60 -19
- package/dist/chunk-GHYHJTYV.js +994 -0
- package/dist/{chunk-VBXEHIUJ.js → chunk-HF6O3O37.js} +6 -88
- package/dist/{chunk-FFQEQTNW.js → chunk-IUBRCBSY.js} +134 -45
- package/dist/{chunk-6COVEUS7.js → chunk-JGWDVX64.js} +983 -1034
- package/dist/{chunk-RGAWHO7N.js → chunk-L4XMVJKY.js} +77 -222
- package/dist/chunk-MBADTM7L.js +64 -0
- package/dist/{chunk-M7MPQISP.js → chunk-OJ4SKRSV.js} +3 -16
- package/dist/{chunk-IVOFDYWT.js → chunk-Q7Q7V5NV.js} +2109 -1604
- package/dist/{chunk-JGRYX5UX.js → chunk-S7DKJPLT.js} +29 -58
- package/dist/{chunk-PWLANIRT.js → chunk-TTRFSOKR.js} +1 -7
- package/dist/{chunk-5DRSZLL2.js → chunk-UH3NTO3F.js} +1 -6
- package/dist/{chunk-NTM7ZSB6.js → chunk-VBCS3DUA.js} +261 -168
- package/dist/{chunk-EFN2EIMK.js → chunk-ZFYPMX46.js} +271 -87
- package/dist/{chunk-L4OXEN46.js → chunk-ZKAWKYT4.js} +10 -24
- package/dist/components.d.ts +7 -5
- package/dist/components.js +46 -257
- package/dist/{database.generated-CzIvgcPu.d.ts → database.generated-CcnC_DRc.d.ts} +4795 -3691
- package/dist/eslint-rules/index.cjs +35 -0
- package/{src/eslint-rules/pace-core-compliance.cjs → dist/eslint-rules/rules/01-pace-core-compliance.cjs} +234 -235
- package/dist/eslint-rules/rules/04-code-quality.cjs +290 -0
- package/dist/eslint-rules/rules/05-styling.cjs +61 -0
- package/dist/eslint-rules/rules/06-security-rbac.cjs +806 -0
- package/dist/eslint-rules/rules/07-api-tech-stack.cjs +263 -0
- package/dist/eslint-rules/rules/08-testing.cjs +94 -0
- package/dist/eslint-rules/utils/helpers.cjs +42 -0
- package/dist/eslint-rules/utils/manifest-loader.cjs +75 -0
- package/dist/hooks.d.ts +6 -6
- package/dist/hooks.js +62 -172
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/index.d.ts +12 -11
- package/dist/index.js +67 -660
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +8 -35
- package/dist/rbac/eslint-rules.d.ts +46 -44
- package/dist/rbac/eslint-rules.js +7 -4
- package/dist/rbac/index.d.ts +109 -586
- package/dist/rbac/index.js +14 -207
- package/dist/styles/index.js +2 -12
- package/dist/theming/runtime.d.ts +14 -1
- package/dist/theming/runtime.js +3 -19
- package/dist/{timezone-CHhWg6b4.d.ts → timezone-BZe_eUxx.d.ts} +175 -1
- package/dist/{types-CkbwOr4Y.d.ts → types-DXstZpNI.d.ts} +4 -17
- package/dist/types-t9H8qKRw.d.ts +55 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +7 -94
- package/dist/{usePublicRouteParams-ClnV4tnv.d.ts → usePublicRouteParams-MamNgwqe.d.ts} +20 -20
- package/dist/utils.d.ts +24 -117
- package/dist/utils.js +54 -392
- package/docs/README.md +17 -7
- package/docs/api/README.md +4 -402
- package/docs/api/modules.md +301 -871
- package/docs/api-reference/components.md +21 -21
- package/docs/api-reference/deprecated.md +31 -6
- package/docs/api-reference/hooks.md +80 -80
- package/docs/api-reference/rpc-functions.md +78 -3
- package/docs/api-reference/types.md +1 -1
- package/docs/api-reference/utilities.md +1 -1
- package/docs/architecture/README.md +1 -1
- package/docs/core-concepts/events.md +3 -3
- package/docs/core-concepts/organisations.md +6 -6
- package/docs/core-concepts/permissions.md +6 -6
- package/docs/documentation-index.md +12 -18
- package/docs/getting-started/cursor-rules.md +3 -23
- package/docs/getting-started/dependencies.md +650 -0
- package/docs/getting-started/documentation-index.md +1 -1
- package/docs/getting-started/examples/README.md +4 -4
- package/docs/getting-started/examples/full-featured-app.md +1 -1
- package/docs/getting-started/faq.md +2 -2
- package/docs/getting-started/installation-guide.md +20 -7
- package/docs/getting-started/quick-reference.md +4 -4
- package/docs/getting-started/quick-start.md +23 -12
- package/docs/implementation-guides/authentication.md +15 -15
- package/docs/implementation-guides/component-styling.md +1 -1
- package/docs/implementation-guides/data-tables.md +126 -33
- package/docs/implementation-guides/datatable-rbac-usage.md +1 -1
- package/docs/implementation-guides/dynamic-colors.md +3 -3
- package/docs/implementation-guides/file-upload-storage.md +2 -2
- package/docs/implementation-guides/hierarchical-datatable.md +40 -60
- package/docs/implementation-guides/inactivity-tracking.md +3 -3
- package/docs/implementation-guides/large-datasets.md +3 -2
- package/docs/implementation-guides/organisation-security.md +2 -2
- package/docs/implementation-guides/performance.md +2 -2
- package/docs/implementation-guides/permission-enforcement.md +5 -1
- package/docs/migration/V0.3.44_organisation-context-timing-fix.md +1 -1
- package/docs/migration/V0.4.0_rbac-migration.md +6 -6
- package/docs/rbac/MIGRATION_GUIDE.md +819 -0
- package/docs/rbac/RBAC_CONTRACT.md +724 -0
- package/docs/rbac/README.md +17 -8
- package/docs/rbac/advanced-patterns.md +6 -6
- package/docs/rbac/api-reference.md +20 -20
- package/docs/rbac/edge-functions-guide.md +376 -0
- package/docs/rbac/event-based-apps.md +3 -3
- package/docs/rbac/examples.md +41 -41
- package/docs/rbac/getting-started.md +37 -37
- package/docs/rbac/performance.md +1 -1
- package/docs/rbac/quick-start.md +52 -52
- package/docs/rbac/secure-client-protection.md +1 -35
- package/docs/rbac/troubleshooting.md +1 -1
- package/docs/security/README.md +5 -5
- package/docs/standards/0-standards-overview.md +220 -0
- package/docs/standards/1-pace-core-compliance-standards.md +986 -0
- package/docs/standards/2-project-structure-standards.md +949 -0
- package/docs/standards/3-architecture-standards.md +606 -0
- package/docs/standards/4-code-quality-standards.md +728 -0
- package/docs/standards/5-styling-standards.md +348 -0
- package/docs/standards/{07-rbac-and-rls-standard.md → 6-security-rbac-standards.md} +269 -66
- package/docs/standards/7-api-tech-stack-standards.md +662 -0
- package/docs/standards/8-testing-documentation-standards.md +401 -0
- package/docs/standards/9-operations-standards.md +1102 -0
- package/docs/standards/README.md +185 -57
- package/docs/troubleshooting/README.md +4 -4
- package/docs/troubleshooting/common-issues.md +2 -2
- package/docs/troubleshooting/debugging.md +9 -9
- package/docs/troubleshooting/migration.md +4 -4
- package/docs/troubleshooting/organisation-context-setup.md +42 -19
- package/eslint-config-pace-core.cjs +33 -6
- package/package.json +35 -23
- package/scripts/install-cursor-rules.cjs +25 -6
- package/scripts/install-eslint-config.cjs +284 -0
- package/src/__tests__/fixtures/supabase.ts +1 -1
- package/src/__tests__/helpers/__tests__/component-test-utils.test.tsx +3 -3
- package/src/__tests__/helpers/__tests__/optimized-test-setup.test.ts +1 -1
- package/src/__tests__/helpers/__tests__/supabaseMock.test.ts +1 -1
- package/src/__tests__/helpers/__tests__/test-providers.test.tsx +2 -2
- package/src/__tests__/helpers/__tests__/test-utils.test.tsx +13 -13
- package/src/__tests__/helpers/component-test-utils.tsx +1 -1
- package/src/__tests__/helpers/supabaseMock.ts +2 -2
- package/src/__tests__/integration/UserProfile.test.tsx +14 -14
- package/src/__tests__/public-recipe-view.test.ts +38 -9
- package/src/__tests__/rbac/PagePermissionGuard.test.tsx +6 -6
- package/src/__tests__/templates/accessibility.test.template.tsx +9 -9
- package/src/__tests__/templates/component.test.template.tsx +18 -15
- package/src/components/Button/Button.tsx +5 -1
- package/src/components/Calendar/Calendar.tsx +201 -47
- package/src/components/ContextSelector/ContextSelector.tsx +106 -119
- package/src/components/DataTable/AUDIT_REPORT.md +293 -0
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +10 -2
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +10 -4
- package/src/components/DataTable/__tests__/test-utils/sharedTestUtils.tsx +9 -9
- package/src/components/DataTable/components/ColumnFilter.tsx +63 -74
- package/src/components/DataTable/components/ColumnVisibilityDropdown.tsx +43 -41
- package/src/components/DataTable/components/DataTableCore.tsx +186 -13
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +9 -11
- package/src/components/DataTable/components/DataTableLayout.tsx +35 -21
- package/src/components/DataTable/components/EditFields.tsx +23 -3
- package/src/components/DataTable/components/EditableRow.tsx +12 -9
- package/src/components/DataTable/components/EmptyState.tsx +10 -9
- package/src/components/DataTable/components/FilterRow.tsx +2 -4
- package/src/components/DataTable/components/ImportModal.tsx +124 -126
- package/src/components/DataTable/components/LoadingState.tsx +5 -6
- package/src/components/DataTable/components/RowComponent.tsx +12 -0
- package/src/components/DataTable/components/SortIndicator.tsx +50 -0
- package/src/components/DataTable/components/__tests__/COVERAGE_NOTE.md +4 -4
- package/src/components/DataTable/components/__tests__/ColumnFilter.test.tsx +23 -82
- package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +37 -9
- package/src/components/DataTable/components/__tests__/EmptyState.test.tsx +7 -4
- package/src/components/DataTable/components/__tests__/FilterRow.test.tsx +12 -4
- package/src/components/DataTable/components/__tests__/LoadingState.test.tsx +41 -27
- package/src/components/DataTable/components/hooks/usePermissionTracking.ts +0 -4
- package/src/components/DataTable/components/index.ts +2 -1
- package/src/components/DataTable/hooks/__tests__/useDataTableState.test.ts +51 -47
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +24 -21
- package/src/components/DataTable/hooks/useDataTableState.ts +125 -9
- package/src/components/DataTable/hooks/useTableColumns.ts +40 -2
- package/src/components/DataTable/hooks/useTableHandlers.ts +11 -0
- package/src/components/DataTable/types.ts +5 -18
- package/src/components/DataTable/utils/a11yUtils.ts +17 -0
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +2 -1
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx +11 -15
- package/src/components/DateTimeField/DateTimeField.tsx +10 -9
- package/src/components/Dialog/Dialog.test.tsx +128 -104
- package/src/components/Dialog/Dialog.tsx +742 -24
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +77 -79
- package/src/components/FileDisplay/FileDisplay.test.tsx +4 -2
- package/src/components/FileDisplay/FileDisplay.tsx +23 -17
- package/src/components/FileUpload/FileUpload.test.tsx +52 -14
- package/src/components/FileUpload/FileUpload.tsx +112 -130
- package/src/components/Form/Form.test.tsx +6 -8
- package/src/components/Form/Form.tsx +365 -4
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +14 -13
- package/src/components/NavigationMenu/useNavigationFiltering.ts +11 -21
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +6 -4
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +11 -15
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +108 -61
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +27 -3
- package/src/components/Progress/Progress.tsx +2 -4
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +8 -8
- package/src/components/Select/Select.tsx +109 -98
- package/src/components/Select/types.ts +4 -1
- package/src/components/UserMenu/UserMenu.tsx +9 -6
- package/src/hooks/__tests__/ServiceHooks.test.tsx +16 -16
- package/src/hooks/__tests__/hooks.integration.test.tsx +55 -57
- package/src/hooks/__tests__/useAppConfig.unit.test.ts +129 -67
- package/src/hooks/__tests__/useFocusTrap.unit.test.tsx +97 -97
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +149 -67
- package/src/hooks/__tests__/usePublicEvent.test.ts +149 -79
- package/src/hooks/__tests__/usePublicEvent.unit.test.ts +158 -109
- package/src/hooks/__tests__/useSessionDraft.test.ts +163 -0
- package/src/hooks/__tests__/useSessionRestoration.unit.test.tsx +10 -5
- package/src/hooks/public/usePublicEvent.ts +67 -195
- package/src/hooks/public/usePublicEventLogo.test.ts +70 -17
- package/src/hooks/public/usePublicEventLogo.ts +24 -14
- package/src/hooks/public/usePublicFileDisplay.ts +2 -2
- package/src/hooks/public/usePublicRouteParams.ts +5 -5
- package/src/hooks/useAppConfig.ts +28 -26
- package/src/hooks/useEventTheme.test.ts +217 -239
- package/src/hooks/useEventTheme.ts +16 -28
- package/src/hooks/useFileDisplay.ts +2 -2
- package/src/hooks/useOrganisationPermissions.ts +5 -7
- package/src/hooks/useQueryCache.ts +0 -1
- package/src/hooks/useSessionDraft.ts +380 -0
- package/src/hooks/useSessionRestoration.ts +3 -1
- package/src/icons/index.ts +27 -0
- package/src/index.ts +5 -0
- package/src/providers/OrganisationProvider.tsx +23 -14
- package/src/providers/UnifiedAuthProvider.smoke.test.tsx +21 -21
- package/src/providers/__tests__/AuthProvider.test.tsx +21 -21
- package/src/providers/__tests__/EventProvider.test.tsx +61 -61
- package/src/providers/__tests__/InactivityProvider.test.tsx +56 -56
- package/src/providers/__tests__/OrganisationProvider.test.tsx +75 -75
- package/src/providers/__tests__/ProviderLifecycle.test.tsx +37 -37
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +103 -103
- package/src/providers/services/EventServiceProvider.tsx +1 -24
- package/src/providers/services/UnifiedAuthProvider.tsx +5 -48
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +7 -7
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +13 -10
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +7 -457
- package/src/rbac/__tests__/auth-rbac.e2e.test.tsx +33 -7
- package/src/rbac/adapters.tsx +7 -295
- package/src/rbac/api.test.ts +44 -56
- package/src/rbac/api.ts +10 -17
- package/src/rbac/cache-invalidation.ts +0 -1
- package/src/rbac/compliance/index.ts +10 -0
- package/src/rbac/compliance/pattern-detector.ts +553 -0
- package/src/rbac/compliance/runtime-compliance.ts +22 -0
- package/src/rbac/components/AccessDenied.tsx +150 -0
- package/src/rbac/components/NavigationGuard.tsx +12 -20
- package/src/rbac/components/PagePermissionGuard.tsx +4 -24
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +21 -8
- package/src/rbac/components/index.ts +3 -41
- package/src/rbac/eslint-rules.js +1 -1
- package/src/rbac/hooks/index.ts +0 -3
- package/src/rbac/hooks/permissions/index.ts +0 -3
- package/src/rbac/hooks/permissions/useAccessLevel.ts +4 -8
- package/src/rbac/hooks/usePermissions.ts +0 -3
- package/src/rbac/hooks/useResolvedScope.test.ts +57 -47
- package/src/rbac/hooks/useResolvedScope.ts +58 -140
- package/src/rbac/hooks/useResourcePermissions.test.ts +124 -38
- package/src/rbac/hooks/useResourcePermissions.ts +139 -48
- package/src/rbac/hooks/useRoleManagement.test.ts +65 -22
- package/src/rbac/hooks/useRoleManagement.ts +147 -19
- package/src/rbac/hooks/useSecureSupabase.ts +4 -8
- package/src/rbac/index.ts +7 -9
- package/src/rbac/utils/contextValidator.ts +9 -7
- package/src/services/AuthService.ts +130 -18
- package/src/services/EventService.ts +4 -97
- package/src/services/InactivityService.ts +16 -0
- package/src/services/OrganisationService.ts +7 -44
- package/src/services/__tests__/OrganisationService.test.ts +26 -8
- package/src/services/base/BaseService.ts +0 -3
- package/src/styles/core.css +7 -0
- package/src/theming/__tests__/parseEventColours.test.ts +9 -3
- package/src/theming/parseEventColours.ts +22 -10
- package/src/types/database.generated.ts +4733 -3809
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +42 -39
- package/src/utils/__tests__/organisationContext.unit.test.ts +9 -10
- package/src/utils/context/organisationContext.test.ts +13 -28
- package/src/utils/context/organisationContext.ts +21 -52
- package/src/utils/dynamic/dynamicUtils.ts +1 -1
- package/src/utils/file-reference/index.ts +39 -15
- package/src/utils/formatting/formatDateTime.test.ts +3 -2
- package/src/utils/google-places/loadGoogleMapsScript.ts +29 -4
- package/src/utils/index.ts +4 -1
- package/src/utils/persistence/__tests__/keyDerivation.test.ts +135 -0
- package/src/utils/persistence/__tests__/sensitiveFieldDetection.test.ts +123 -0
- package/src/utils/persistence/keyDerivation.ts +304 -0
- package/src/utils/persistence/sensitiveFieldDetection.ts +212 -0
- package/src/utils/security/secureStorage.ts +5 -5
- package/src/utils/storage/README.md +1 -1
- package/src/utils/storage/helpers.ts +3 -3
- package/src/utils/supabase/createBaseClient.ts +147 -0
- package/src/utils/timezone/timezone.test.ts +1 -2
- package/src/utils/timezone/timezone.ts +1 -1
- package/src/utils/validation/csrf.ts +4 -4
- package/cursor-rules/00-pace-core-compliance.mdc +0 -331
- package/cursor-rules/01-standards-compliance.mdc +0 -244
- package/cursor-rules/04-testing-standards.mdc +0 -268
- package/cursor-rules/05-bug-reports-and-features.mdc +0 -246
- package/cursor-rules/06-code-quality.mdc +0 -309
- package/cursor-rules/07-tech-stack-compliance.mdc +0 -214
- package/cursor-rules/CHANGELOG.md +0 -119
- package/cursor-rules/README.md +0 -192
- package/dist/DataTable-AOVNCPTX.js +0 -175
- package/dist/DataTable-AOVNCPTX.js.map +0 -1
- package/dist/UnifiedAuthProvider-4SBX4LU5.js +0 -18
- package/dist/UnifiedAuthProvider-4SBX4LU5.js.map +0 -1
- package/dist/api-O6HTBX5Y.js +0 -52
- package/dist/api-O6HTBX5Y.js.map +0 -1
- package/dist/audit-V53FV5AG.js +0 -17
- package/dist/audit-V53FV5AG.js.map +0 -1
- package/dist/chunk-5DRSZLL2.js.map +0 -1
- package/dist/chunk-63FOKYGO.js.map +0 -1
- package/dist/chunk-6COVEUS7.js.map +0 -1
- package/dist/chunk-AFVQODI2.js +0 -263
- package/dist/chunk-AFVQODI2.js.map +0 -1
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-E66EQZE6.js.map +0 -1
- package/dist/chunk-EFN2EIMK.js.map +0 -1
- package/dist/chunk-FFQEQTNW.js.map +0 -1
- package/dist/chunk-FMUCXFII.js.map +0 -1
- package/dist/chunk-G37KK66H.js.map +0 -1
- package/dist/chunk-G7QEZTYQ.js +0 -2053
- package/dist/chunk-G7QEZTYQ.js.map +0 -1
- package/dist/chunk-HU2C6SSC.js.map +0 -1
- package/dist/chunk-IHB5DR3H.js.map +0 -1
- package/dist/chunk-IVOFDYWT.js.map +0 -1
- package/dist/chunk-J36DSWQK.js.map +0 -1
- package/dist/chunk-JGRYX5UX.js.map +0 -1
- package/dist/chunk-KQCRWDSA.js +0 -1
- package/dist/chunk-KQCRWDSA.js.map +0 -1
- package/dist/chunk-L4OXEN46.js.map +0 -1
- package/dist/chunk-LMC26NLJ.js +0 -84
- package/dist/chunk-LMC26NLJ.js.map +0 -1
- package/dist/chunk-M43Y4SSO.js.map +0 -1
- package/dist/chunk-M7MPQISP.js.map +0 -1
- package/dist/chunk-NTM7ZSB6.js.map +0 -1
- package/dist/chunk-PWLANIRT.js.map +0 -1
- package/dist/chunk-QXHPKYJV.js.map +0 -1
- package/dist/chunk-RGAWHO7N.js.map +0 -1
- package/dist/chunk-UPPMRMYG.js.map +0 -1
- package/dist/chunk-VBXEHIUJ.js.map +0 -1
- package/dist/chunk-ZSAAAMVR.js.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/contextValidator-5OGXSPKS.js +0 -9
- package/dist/contextValidator-5OGXSPKS.js.map +0 -1
- package/dist/eslint-rules/pace-core-compliance.cjs +0 -510
- package/dist/hooks.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/providers.js.map +0 -1
- package/dist/rbac/eslint-rules.js.map +0 -1
- package/dist/rbac/index.js.map +0 -1
- package/dist/styles/index.js.map +0 -1
- package/dist/theming/runtime.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/docs/best-practices/README.md +0 -472
- package/docs/best-practices/accessibility.md +0 -601
- package/docs/best-practices/common-patterns.md +0 -516
- package/docs/best-practices/deployment.md +0 -1103
- package/docs/best-practices/performance.md +0 -1328
- package/docs/best-practices/security.md +0 -940
- package/docs/best-practices/testing.md +0 -1034
- package/docs/rbac/compliance/compliance-guide.md +0 -544
- package/docs/standards/01-architecture-standard.md +0 -44
- package/docs/standards/02-api-and-rpc-standard.md +0 -39
- package/docs/standards/03-component-standard.md +0 -32
- package/docs/standards/04-code-style-standard.md +0 -32
- package/docs/standards/05-security-standard.md +0 -44
- package/docs/standards/06-testing-and-docs-standard.md +0 -29
- package/docs/standards/pace-core-compliance.md +0 -432
- package/scripts/audit/core/checks/accessibility.cjs +0 -197
- package/scripts/audit/core/checks/api-usage.cjs +0 -191
- package/scripts/audit/core/checks/bundle.cjs +0 -142
- package/scripts/audit/core/checks/compliance.cjs +0 -2706
- package/scripts/audit/core/checks/config.cjs +0 -54
- package/scripts/audit/core/checks/coverage.cjs +0 -84
- package/scripts/audit/core/checks/dependencies.cjs +0 -994
- package/scripts/audit/core/checks/documentation.cjs +0 -268
- package/scripts/audit/core/checks/environment.cjs +0 -116
- package/scripts/audit/core/checks/error-handling.cjs +0 -340
- package/scripts/audit/core/checks/forms.cjs +0 -172
- package/scripts/audit/core/checks/heuristics.cjs +0 -68
- package/scripts/audit/core/checks/hooks.cjs +0 -334
- package/scripts/audit/core/checks/imports.cjs +0 -244
- package/scripts/audit/core/checks/performance.cjs +0 -325
- package/scripts/audit/core/checks/routes.cjs +0 -117
- package/scripts/audit/core/checks/state.cjs +0 -130
- package/scripts/audit/core/checks/structure.cjs +0 -65
- package/scripts/audit/core/checks/style.cjs +0 -584
- package/scripts/audit/core/checks/testing.cjs +0 -122
- package/scripts/audit/core/checks/typescript.cjs +0 -61
- package/scripts/audit/core/scanner.cjs +0 -199
- package/scripts/audit/core/utils.cjs +0 -137
- package/scripts/audit/index.cjs +0 -223
- package/scripts/audit/reporters/console.cjs +0 -151
- package/scripts/audit/reporters/json.cjs +0 -54
- package/scripts/audit/reporters/markdown.cjs +0 -124
- package/scripts/audit-consuming-app.cjs +0 -86
- package/src/components/DataTable/components/DataTableBody.tsx +0 -454
- package/src/components/DataTable/components/DraggableColumnHeader.tsx +0 -156
- package/src/components/DataTable/components/ExpandButton.tsx +0 -113
- package/src/components/DataTable/components/GroupHeader.tsx +0 -54
- package/src/components/DataTable/components/ViewRowModal.tsx +0 -68
- package/src/components/DataTable/components/VirtualizedDataTable.tsx +0 -525
- package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +0 -462
- package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +0 -393
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +0 -476
- package/src/components/DataTable/components/__tests__/VirtualizedDataTable.test.tsx +0 -128
- package/src/components/DataTable/core/DataTableContext.tsx +0 -216
- package/src/components/DataTable/core/__tests__/DataTableContext.test.tsx +0 -136
- package/src/components/DataTable/hooks/__tests__/useColumnReordering.test.ts +0 -570
- package/src/components/DataTable/hooks/useColumnReordering.ts +0 -123
- package/src/components/DataTable/utils/debugTools.ts +0 -514
- package/src/eslint-rules/pace-core-compliance.js +0 -638
- package/src/rbac/components/EnhancedNavigationMenu.test.tsx +0 -555
- package/src/rbac/components/EnhancedNavigationMenu.tsx +0 -293
- package/src/rbac/components/NavigationProvider.test.tsx +0 -481
- package/src/rbac/components/NavigationProvider.tsx +0 -345
- package/src/rbac/components/PagePermissionProvider.test.tsx +0 -476
- package/src/rbac/components/PagePermissionProvider.tsx +0 -279
- package/src/rbac/components/PermissionEnforcer.tsx +0 -312
- package/src/rbac/components/RoleBasedRouter.tsx +0 -440
- package/src/rbac/components/SecureDataProvider.test.tsx +0 -543
- package/src/rbac/components/SecureDataProvider.tsx +0 -339
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +0 -620
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +0 -726
- package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +0 -661
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +0 -881
- package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +0 -783
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +0 -645
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +0 -659
- package/src/rbac/hooks/permissions/useCachedPermissions.ts +0 -79
- package/src/rbac/hooks/permissions/useHasAllPermissions.ts +0 -90
- package/src/rbac/hooks/permissions/useHasAnyPermission.ts +0 -90
|
@@ -1,96 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from
|
|
28
|
-
import {
|
|
29
|
-
useCan,
|
|
30
|
-
usePermissions,
|
|
31
|
-
useRBAC,
|
|
32
|
-
useResolvedScope
|
|
33
|
-
} from "./chunk-HU2C6SSC.js";
|
|
34
|
-
import {
|
|
35
|
-
createFileReferenceService,
|
|
36
|
-
generateFileUrlsBatch,
|
|
37
|
-
getPublicUrl,
|
|
38
|
-
getSignedUrl,
|
|
39
|
-
uploadFileWithReference,
|
|
40
|
-
useAddressAutocomplete,
|
|
41
|
-
useEventTheme,
|
|
42
|
-
useFileDisplay,
|
|
43
|
-
usePreventTabReload,
|
|
44
|
-
usePublicFileDisplay
|
|
45
|
-
} from "./chunk-UPPMRMYG.js";
|
|
46
|
-
import {
|
|
47
|
-
useToast
|
|
48
|
-
} from "./chunk-JGRYX5UX.js";
|
|
49
|
-
import {
|
|
50
|
-
ErrorBoundary,
|
|
51
|
-
PublicPageContext,
|
|
52
|
-
useAppConfig,
|
|
53
|
-
useEvents,
|
|
54
|
-
useIsPublicPage
|
|
55
|
-
} from "./chunk-NTM7ZSB6.js";
|
|
56
|
-
import {
|
|
57
|
-
EventServiceContext,
|
|
58
|
-
useOrganisations,
|
|
59
|
-
useSessionRestoration,
|
|
60
|
-
useUnifiedAuth
|
|
61
|
-
} from "./chunk-IHB5DR3H.js";
|
|
62
|
-
import {
|
|
63
|
-
isSuperAdmin
|
|
64
|
-
} from "./chunk-EFN2EIMK.js";
|
|
65
|
-
import {
|
|
66
|
-
EventContextRequiredError,
|
|
67
|
-
OrganisationContextRequiredError
|
|
68
|
-
} from "./chunk-AFVQODI2.js";
|
|
69
|
-
import {
|
|
70
|
-
assertAppId
|
|
71
|
-
} from "./chunk-QXHPKYJV.js";
|
|
72
|
-
import {
|
|
73
|
-
LoadingSpinner,
|
|
74
|
-
getAppId
|
|
75
|
-
} from "./chunk-J36DSWQK.js";
|
|
76
|
-
import {
|
|
77
|
-
cn
|
|
78
|
-
} from "./chunk-M43Y4SSO.js";
|
|
79
|
-
import {
|
|
80
|
-
getCurrentAppName
|
|
81
|
-
} from "./chunk-M7MPQISP.js";
|
|
82
|
-
import {
|
|
83
|
-
clearPalette
|
|
84
|
-
} from "./chunk-L4OXEN46.js";
|
|
85
|
-
import {
|
|
86
|
-
createLogger,
|
|
87
|
-
logger
|
|
88
|
-
} from "./chunk-PWLANIRT.js";
|
|
1
|
+
import { AccessDenied } from './chunk-6F3IILHI.js';
|
|
2
|
+
import { Input, Dialog, DialogContent, DialogHeader, DialogBody, DialogFooter, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Alert, AlertDescription, Label, SelectLabel, SelectSeparator, DialogTitle, deriveFormKey, useSessionDraft, filterSensitiveFields, isSensitiveField, SelectGroup, AlertTitle, Progress } from './chunk-Q7Q7V5NV.js';
|
|
3
|
+
import { Button, useRBAC, useResolvedScope, usePermissions, useEvents, useCan } from './chunk-BM4CQ5P3.js';
|
|
4
|
+
import { useAddressAutocomplete, createFileReferenceService, uploadFileWithReference, usePublicFileDisplay, useFileDisplay, getPublicUrl, getSignedUrl, generateFileUrlsBatch, useEventTheme, usePreventTabReload } from './chunk-5X4QLXRG.js';
|
|
5
|
+
import { clearPalette } from './chunk-ZKAWKYT4.js';
|
|
6
|
+
import { useToast } from './chunk-S7DKJPLT.js';
|
|
7
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, useIsPublicPage, PublicPageContext, useAppConfig, ErrorBoundary } from './chunk-VBCS3DUA.js';
|
|
8
|
+
import { useUnifiedAuth, useOrganisations, UnifiedAuthContext, EventServiceContext, useSessionRestoration } from './chunk-FTCRZOG2.js';
|
|
9
|
+
import { EventContextRequiredError, OrganisationContextRequiredError, isSuperAdmin } from './chunk-ZFYPMX46.js';
|
|
10
|
+
import { assertAppId } from './chunk-4SXLQIZO.js';
|
|
11
|
+
import { getAppId } from './chunk-FEJLJNWA.js';
|
|
12
|
+
import { LoadingSpinner } from './chunk-A3W6LW53.js';
|
|
13
|
+
import { getCurrentAppName } from './chunk-OJ4SKRSV.js';
|
|
14
|
+
import { cn } from './chunk-7ILTDCL2.js';
|
|
15
|
+
import { createLogger, logger } from './chunk-TTRFSOKR.js';
|
|
16
|
+
import * as React6 from 'react';
|
|
17
|
+
import React6__default, { useState, useRef, useMemo, useCallback, useEffect, useContext } from 'react';
|
|
18
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
19
|
+
import { FileText, ExternalLink, X, ChevronDown, KeyRound, LogOut, AlertCircle, RefreshCw, Calendar as Calendar$1, Building2, File, Check } from 'lucide-react';
|
|
20
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
21
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
22
|
+
import { useDayPicker, DayPicker } from 'react-day-picker';
|
|
23
|
+
import { enAU } from 'date-fns/locale';
|
|
24
|
+
import { format } from 'date-fns';
|
|
25
|
+
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
26
|
+
import { useForm, useWatch, FormProvider, useFormContext, Controller } from 'react-hook-form';
|
|
27
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
28
|
+
import { useLocation, Link, useNavigate, Outlet, Navigate } from 'react-router-dom';
|
|
89
29
|
|
|
90
|
-
|
|
91
|
-
import * as React from "react";
|
|
92
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
93
|
-
var AddressField = React.forwardRef(
|
|
30
|
+
var AddressField = React6.forwardRef(
|
|
94
31
|
({
|
|
95
32
|
apiKey,
|
|
96
33
|
value: controlledValue,
|
|
@@ -109,13 +46,13 @@ var AddressField = React.forwardRef(
|
|
|
109
46
|
cacheTTL,
|
|
110
47
|
...props
|
|
111
48
|
}, ref) => {
|
|
112
|
-
const [internalValue, setInternalValue] =
|
|
113
|
-
const [isOpen, setIsOpen] =
|
|
114
|
-
const [selectedIndex, setSelectedIndex] =
|
|
115
|
-
const [inputFocused, setInputFocused] =
|
|
116
|
-
const inputRef =
|
|
117
|
-
const suggestionsRef =
|
|
118
|
-
const containerRef =
|
|
49
|
+
const [internalValue, setInternalValue] = React6.useState(defaultValue);
|
|
50
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
51
|
+
const [selectedIndex, setSelectedIndex] = React6.useState(-1);
|
|
52
|
+
const [inputFocused, setInputFocused] = React6.useState(false);
|
|
53
|
+
const inputRef = React6.useRef(null);
|
|
54
|
+
const suggestionsRef = React6.useRef(null);
|
|
55
|
+
const containerRef = React6.useRef(null);
|
|
119
56
|
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
120
57
|
const { suggestions, isLoading, error: autocompleteError, selectAddress, clearSuggestions } = useAddressAutocomplete(apiKey, value, {
|
|
121
58
|
autocompleteOptions,
|
|
@@ -123,14 +60,14 @@ var AddressField = React.forwardRef(
|
|
|
123
60
|
cacheEnabled,
|
|
124
61
|
cacheTTL
|
|
125
62
|
});
|
|
126
|
-
|
|
63
|
+
React6.useEffect(() => {
|
|
127
64
|
if (suggestions.length > 0 && inputFocused && value.trim()) {
|
|
128
65
|
setIsOpen(true);
|
|
129
66
|
} else if (suggestions.length === 0 || !value.trim()) {
|
|
130
67
|
setIsOpen(false);
|
|
131
68
|
}
|
|
132
69
|
}, [suggestions, inputFocused, value]);
|
|
133
|
-
const handleInputChange =
|
|
70
|
+
const handleInputChange = React6.useCallback(
|
|
134
71
|
(e) => {
|
|
135
72
|
const newValue = e.target.value;
|
|
136
73
|
if (controlledValue === void 0) {
|
|
@@ -145,7 +82,7 @@ var AddressField = React.forwardRef(
|
|
|
145
82
|
},
|
|
146
83
|
[controlledValue, onInputChange, onChange, clearSuggestions]
|
|
147
84
|
);
|
|
148
|
-
const handleSelectAddress =
|
|
85
|
+
const handleSelectAddress = React6.useCallback(
|
|
149
86
|
async (placeId) => {
|
|
150
87
|
setIsOpen(false);
|
|
151
88
|
setSelectedIndex(-1);
|
|
@@ -162,7 +99,7 @@ var AddressField = React.forwardRef(
|
|
|
162
99
|
},
|
|
163
100
|
[selectAddress, onChange, onInputChange, controlledValue]
|
|
164
101
|
);
|
|
165
|
-
const handleKeyDown =
|
|
102
|
+
const handleKeyDown = React6.useCallback(
|
|
166
103
|
(e) => {
|
|
167
104
|
if (!isOpen || suggestions.length === 0) {
|
|
168
105
|
if (e.key === "Escape") {
|
|
@@ -200,13 +137,13 @@ var AddressField = React.forwardRef(
|
|
|
200
137
|
},
|
|
201
138
|
[isOpen, suggestions, selectedIndex, handleSelectAddress]
|
|
202
139
|
);
|
|
203
|
-
const handleFocus =
|
|
140
|
+
const handleFocus = React6.useCallback(() => {
|
|
204
141
|
setInputFocused(true);
|
|
205
142
|
if (suggestions.length > 0 && value.trim()) {
|
|
206
143
|
setIsOpen(true);
|
|
207
144
|
}
|
|
208
145
|
}, [suggestions, value]);
|
|
209
|
-
const handleBlur =
|
|
146
|
+
const handleBlur = React6.useCallback(
|
|
210
147
|
(e) => {
|
|
211
148
|
setTimeout(() => {
|
|
212
149
|
if (!containerRef.current?.contains(document.activeElement)) {
|
|
@@ -218,7 +155,7 @@ var AddressField = React.forwardRef(
|
|
|
218
155
|
},
|
|
219
156
|
[]
|
|
220
157
|
);
|
|
221
|
-
|
|
158
|
+
React6.useEffect(() => {
|
|
222
159
|
const handleClickOutside = (event) => {
|
|
223
160
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
224
161
|
setIsOpen(false);
|
|
@@ -232,8 +169,8 @@ var AddressField = React.forwardRef(
|
|
|
232
169
|
};
|
|
233
170
|
}
|
|
234
171
|
}, [isOpen]);
|
|
235
|
-
const suggestionsId =
|
|
236
|
-
|
|
172
|
+
const suggestionsId = React6.useId();
|
|
173
|
+
React6.useEffect(() => {
|
|
237
174
|
if (selectedIndex >= 0) {
|
|
238
175
|
const selectedItem = document.getElementById(
|
|
239
176
|
`${suggestionsId}-item-${selectedIndex}`
|
|
@@ -243,7 +180,7 @@ var AddressField = React.forwardRef(
|
|
|
243
180
|
}
|
|
244
181
|
}
|
|
245
182
|
}, [selectedIndex, suggestionsId]);
|
|
246
|
-
|
|
183
|
+
React6.useImperativeHandle(ref, () => inputRef.current);
|
|
247
184
|
const hasError = error || !!autocompleteError;
|
|
248
185
|
return /* @__PURE__ */ jsxs("form", { ref: containerRef, className: cn("relative w-full", className), children: [
|
|
249
186
|
/* @__PURE__ */ jsx(
|
|
@@ -283,7 +220,7 @@ var AddressField = React.forwardRef(
|
|
|
283
220
|
"list-none p-0 m-0"
|
|
284
221
|
),
|
|
285
222
|
"data-testid": "address-suggestions",
|
|
286
|
-
children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs(
|
|
223
|
+
children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs(React6.Fragment, { children: [
|
|
287
224
|
/* @__PURE__ */ jsx(
|
|
288
225
|
"dt",
|
|
289
226
|
{
|
|
@@ -312,75 +249,8 @@ var AddressField = React.forwardRef(
|
|
|
312
249
|
}
|
|
313
250
|
);
|
|
314
251
|
AddressField.displayName = "AddressField";
|
|
315
|
-
|
|
316
|
-
// src/components/Label/Label.tsx
|
|
317
|
-
import * as React2 from "react";
|
|
318
|
-
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
319
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
320
|
-
var getLabelClasses = () => {
|
|
321
|
-
return "font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70";
|
|
322
|
-
};
|
|
323
|
-
var Label = React2.forwardRef(({
|
|
324
|
-
className,
|
|
325
|
-
required = false,
|
|
326
|
-
requiredIndicator,
|
|
327
|
-
hideRequiredIndicator = false,
|
|
328
|
-
helperText,
|
|
329
|
-
helperTextClassName,
|
|
330
|
-
error,
|
|
331
|
-
errorClassName,
|
|
332
|
-
children,
|
|
333
|
-
htmlFor,
|
|
334
|
-
...props
|
|
335
|
-
}, ref) => {
|
|
336
|
-
const hasError = !!error;
|
|
337
|
-
const showHelperText = helperText && !hasError;
|
|
338
|
-
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
339
|
-
/* @__PURE__ */ jsxs2(
|
|
340
|
-
LabelPrimitive.Root,
|
|
341
|
-
{
|
|
342
|
-
ref,
|
|
343
|
-
className: cn(
|
|
344
|
-
getLabelClasses(),
|
|
345
|
-
hasError && "text-destructive",
|
|
346
|
-
className
|
|
347
|
-
),
|
|
348
|
-
htmlFor,
|
|
349
|
-
...props,
|
|
350
|
-
children: [
|
|
351
|
-
children,
|
|
352
|
-
required && /* @__PURE__ */ jsx2(
|
|
353
|
-
"span",
|
|
354
|
-
{
|
|
355
|
-
"aria-label": "required",
|
|
356
|
-
className: cn(
|
|
357
|
-
"text-destructive ml-1",
|
|
358
|
-
hideRequiredIndicator && "sr-only"
|
|
359
|
-
),
|
|
360
|
-
children: requiredIndicator || "*"
|
|
361
|
-
}
|
|
362
|
-
)
|
|
363
|
-
]
|
|
364
|
-
}
|
|
365
|
-
),
|
|
366
|
-
showHelperText && /* @__PURE__ */ jsx2("p", { className: cn("text-muted-foreground", helperTextClassName), children: helperText }),
|
|
367
|
-
hasError && /* @__PURE__ */ jsx2(
|
|
368
|
-
"p",
|
|
369
|
-
{
|
|
370
|
-
role: "alert",
|
|
371
|
-
"aria-live": "polite",
|
|
372
|
-
className: cn("text-destructive", errorClassName),
|
|
373
|
-
children: error
|
|
374
|
-
}
|
|
375
|
-
)
|
|
376
|
-
] });
|
|
377
|
-
});
|
|
378
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
379
|
-
|
|
380
|
-
// src/components/Textarea/Textarea.tsx
|
|
381
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
382
252
|
function Textarea({ className, variant = "default", size = "md", error, ref, ...props }) {
|
|
383
|
-
return /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ jsx(
|
|
384
254
|
"textarea",
|
|
385
255
|
{
|
|
386
256
|
className: cn(
|
|
@@ -405,21 +275,14 @@ function Textarea({ className, variant = "default", size = "md", error, ref, ...
|
|
|
405
275
|
);
|
|
406
276
|
}
|
|
407
277
|
Textarea.displayName = "Textarea";
|
|
408
|
-
|
|
409
|
-
// src/components/FileDisplay/FileDisplay.tsx
|
|
410
|
-
import React3, { useState as useState3, useEffect as useEffect3, useCallback as useCallback3, useRef as useRef3, useContext, useMemo } from "react";
|
|
411
|
-
import { FileText, ExternalLink } from "lucide-react";
|
|
412
|
-
|
|
413
|
-
// src/hooks/useFileUrl.ts
|
|
414
|
-
import { useState as useState2, useEffect as useEffect2, useCallback as useCallback2, useRef as useRef2 } from "react";
|
|
415
278
|
var log = createLogger("useFileUrl");
|
|
416
279
|
function useFileUrl(fileReference, options) {
|
|
417
280
|
const { organisation_id, supabase, autoLoad = true } = options;
|
|
418
|
-
const [url, setUrl] =
|
|
419
|
-
const [isLoading, setIsLoading] =
|
|
420
|
-
const [error, setError] =
|
|
421
|
-
const fileReferenceIdRef =
|
|
422
|
-
const loadUrl =
|
|
281
|
+
const [url, setUrl] = useState(null);
|
|
282
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
283
|
+
const [error, setError] = useState(null);
|
|
284
|
+
const fileReferenceIdRef = useRef(null);
|
|
285
|
+
const loadUrl = useCallback(async () => {
|
|
423
286
|
if (!fileReference) {
|
|
424
287
|
setUrl(null);
|
|
425
288
|
setIsLoading(false);
|
|
@@ -461,13 +324,13 @@ function useFileUrl(fileReference, options) {
|
|
|
461
324
|
setIsLoading(false);
|
|
462
325
|
}
|
|
463
326
|
}, [fileReference, supabase, organisation_id, isLoading, url]);
|
|
464
|
-
const clear =
|
|
327
|
+
const clear = useCallback(() => {
|
|
465
328
|
setUrl(null);
|
|
466
329
|
setError(null);
|
|
467
330
|
setIsLoading(false);
|
|
468
331
|
fileReferenceIdRef.current = null;
|
|
469
332
|
}, []);
|
|
470
|
-
|
|
333
|
+
useEffect(() => {
|
|
471
334
|
if (autoLoad) {
|
|
472
335
|
if (fileReferenceIdRef.current !== fileReference?.id) {
|
|
473
336
|
setUrl(null);
|
|
@@ -486,9 +349,6 @@ function useFileUrl(fileReference, options) {
|
|
|
486
349
|
clear
|
|
487
350
|
};
|
|
488
351
|
}
|
|
489
|
-
|
|
490
|
-
// src/components/FileDisplay/FileDisplay.tsx
|
|
491
|
-
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
492
352
|
var fallbackSizeClasses = {
|
|
493
353
|
xs: "size-4 text-xs",
|
|
494
354
|
sm: "size-6 text-sm",
|
|
@@ -509,7 +369,7 @@ function defaultGenerateFallbackText(fileName) {
|
|
|
509
369
|
if (words.length === 0) return "FL";
|
|
510
370
|
return words.map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
511
371
|
}
|
|
512
|
-
var FileDisplayContent =
|
|
372
|
+
var FileDisplayContent = React6__default.memo(function FileDisplayContent2({
|
|
513
373
|
isLoading,
|
|
514
374
|
error,
|
|
515
375
|
fileUrl,
|
|
@@ -536,21 +396,21 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
536
396
|
enableChildren = false,
|
|
537
397
|
showMetadata = true
|
|
538
398
|
}) {
|
|
539
|
-
const [imageError, setImageError] =
|
|
540
|
-
const [internalFileUrls, setInternalFileUrls] =
|
|
541
|
-
const [deleteDialogOpen, setDeleteDialogOpen] =
|
|
542
|
-
const fileReferencesRef =
|
|
543
|
-
const imgRef =
|
|
544
|
-
const currentSrcRef =
|
|
545
|
-
const isImageLoadingRef =
|
|
399
|
+
const [imageError, setImageError] = useState(false);
|
|
400
|
+
const [internalFileUrls, setInternalFileUrls] = useState(new Map(fileUrls));
|
|
401
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
402
|
+
const fileReferencesRef = useRef([]);
|
|
403
|
+
const imgRef = useRef(null);
|
|
404
|
+
const currentSrcRef = useRef(null);
|
|
405
|
+
const isImageLoadingRef = useRef(false);
|
|
546
406
|
const stableFileUrl = useMemo(() => fileUrl, [fileUrl]);
|
|
547
|
-
const handleImageLoadStart =
|
|
407
|
+
const handleImageLoadStart = useCallback(() => {
|
|
548
408
|
isImageLoadingRef.current = true;
|
|
549
409
|
if (stableFileUrl) {
|
|
550
410
|
currentSrcRef.current = stableFileUrl;
|
|
551
411
|
}
|
|
552
412
|
}, [stableFileUrl]);
|
|
553
|
-
const handleImageLoad =
|
|
413
|
+
const handleImageLoad = useCallback(() => {
|
|
554
414
|
isImageLoadingRef.current = false;
|
|
555
415
|
if (stableFileUrl) {
|
|
556
416
|
currentSrcRef.current = stableFileUrl;
|
|
@@ -564,7 +424,7 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
564
424
|
const fallbackClasses = useMemo(() => {
|
|
565
425
|
return getFallbackClasses(fallbackSize);
|
|
566
426
|
}, [fallbackSize]);
|
|
567
|
-
|
|
427
|
+
useEffect(() => {
|
|
568
428
|
const currentIds = fileReferences.map((f) => f.id).join(",");
|
|
569
429
|
const prevIds = fileReferencesRef.current.map((f) => f.id).join(",");
|
|
570
430
|
if (currentIds !== prevIds) {
|
|
@@ -610,17 +470,17 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
610
470
|
};
|
|
611
471
|
if (error) {
|
|
612
472
|
if (ErrorComponent) {
|
|
613
|
-
return /* @__PURE__ */
|
|
473
|
+
return /* @__PURE__ */ jsx(ErrorComponent, { error, retry: clearError });
|
|
614
474
|
}
|
|
615
475
|
if (showFallback) {
|
|
616
|
-
return /* @__PURE__ */
|
|
476
|
+
return /* @__PURE__ */ jsx("figure", { className, title: "File unavailable", children: /* @__PURE__ */ jsx("p", { className: fallbackClasses, children: computedFallbackText }) });
|
|
617
477
|
}
|
|
618
|
-
return /* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */
|
|
478
|
+
return /* @__PURE__ */ jsxs("figure", { className, title: "Error", children: [
|
|
479
|
+
/* @__PURE__ */ jsxs("p", { className: getFallbackClasses(fallbackSize || "md"), children: [
|
|
620
480
|
"Error loading file: ",
|
|
621
481
|
error instanceof Error ? error.message : String(error)
|
|
622
482
|
] }),
|
|
623
|
-
clearError && /* @__PURE__ */
|
|
483
|
+
clearError && /* @__PURE__ */ jsx(
|
|
624
484
|
Button,
|
|
625
485
|
{
|
|
626
486
|
onClick: clearError,
|
|
@@ -633,38 +493,38 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
633
493
|
}
|
|
634
494
|
if (fileCount === 0 && !isLoading) {
|
|
635
495
|
if (showFallback) {
|
|
636
|
-
return /* @__PURE__ */
|
|
637
|
-
/* @__PURE__ */
|
|
496
|
+
return /* @__PURE__ */ jsxs("figure", { className, title: "No file", children: [
|
|
497
|
+
/* @__PURE__ */ jsx("p", { className: fallbackClasses, children: computedFallbackText }),
|
|
638
498
|
children
|
|
639
499
|
] });
|
|
640
500
|
}
|
|
641
|
-
return /* @__PURE__ */
|
|
642
|
-
/* @__PURE__ */
|
|
501
|
+
return /* @__PURE__ */ jsxs("figure", { className: `text-sec-500 text-center p-4 ${className}`, children: [
|
|
502
|
+
/* @__PURE__ */ jsx("p", { children: "No files found" }),
|
|
643
503
|
children
|
|
644
504
|
] });
|
|
645
505
|
}
|
|
646
506
|
if (isLoading && showFallback && fileCount === 0) {
|
|
647
|
-
return /* @__PURE__ */
|
|
648
|
-
/* @__PURE__ */
|
|
507
|
+
return /* @__PURE__ */ jsxs("figure", { className, title: "Loading...", children: [
|
|
508
|
+
/* @__PURE__ */ jsx("p", { className: fallbackClasses, children: computedFallbackText }),
|
|
649
509
|
children
|
|
650
510
|
] });
|
|
651
511
|
}
|
|
652
512
|
if (isLoading) {
|
|
653
513
|
if (LoadingComponent) {
|
|
654
|
-
return /* @__PURE__ */
|
|
514
|
+
return /* @__PURE__ */ jsx(LoadingComponent, {});
|
|
655
515
|
}
|
|
656
|
-
return /* @__PURE__ */
|
|
516
|
+
return /* @__PURE__ */ jsx("figure", { className, title: "Loading", children: /* @__PURE__ */ jsx("p", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ jsx(LoadingSpinner, {}) }) });
|
|
657
517
|
}
|
|
658
518
|
if ((category || displayOnly) && fileReference) {
|
|
659
519
|
const isImage = fileReference.file_metadata.fileType?.startsWith("image/");
|
|
660
520
|
if (displayOnly && isImage && !showDelete && !enableChildren) {
|
|
661
521
|
if (imageError && showFallback) {
|
|
662
|
-
return /* @__PURE__ */
|
|
522
|
+
return /* @__PURE__ */ jsx("figure", { className, title: fileReference.file_metadata.fileName || "File", children: /* @__PURE__ */ jsx("p", { className: fallbackClasses, children: computedFallbackText }) });
|
|
663
523
|
}
|
|
664
524
|
if (!stableFileUrl) {
|
|
665
|
-
return /* @__PURE__ */
|
|
525
|
+
return /* @__PURE__ */ jsx("figure", { className: className || "max-w-full h-48", title: "Loading", children: /* @__PURE__ */ jsx("p", { className: fallbackClasses, children: /* @__PURE__ */ jsx(LoadingSpinner, {}) }) });
|
|
666
526
|
}
|
|
667
|
-
return /* @__PURE__ */
|
|
527
|
+
return /* @__PURE__ */ jsx("figure", { className: className || "", children: /* @__PURE__ */ jsx(
|
|
668
528
|
"img",
|
|
669
529
|
{
|
|
670
530
|
ref: imgRef,
|
|
@@ -682,8 +542,8 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
682
542
|
if (displayOnly && !isImage && stableFileUrl && fileReference && !showDelete) {
|
|
683
543
|
const fileName = fileReference.file_metadata?.fileName || "Document";
|
|
684
544
|
const ariaLabel = `Open ${fileName} in new tab`;
|
|
685
|
-
return /* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */
|
|
545
|
+
return /* @__PURE__ */ jsxs("figure", { className, children: [
|
|
546
|
+
/* @__PURE__ */ jsxs(
|
|
687
547
|
"a",
|
|
688
548
|
{
|
|
689
549
|
href: stableFileUrl || void 0,
|
|
@@ -692,15 +552,15 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
692
552
|
"aria-label": ariaLabel,
|
|
693
553
|
className: "flex items-center gap-2 p-3 bg-sec-50 border border-sec-200 rounded-lg hover:bg-sec-100 transition-colors text-main-600 hover:text-main-700 focus:outline-none focus:ring-2 focus:ring-main-500 focus:ring-offset-2",
|
|
694
554
|
children: [
|
|
695
|
-
/* @__PURE__ */
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
555
|
+
/* @__PURE__ */ jsx(FileText, { className: "size-5 shrink-0", "aria-hidden": "true" }),
|
|
556
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 font-medium truncate", children: fileName }),
|
|
557
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "size-5 shrink-0", "aria-hidden": "true" })
|
|
698
558
|
]
|
|
699
559
|
}
|
|
700
560
|
),
|
|
701
|
-
showMetadata && /* @__PURE__ */
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
fileReference.file_metadata.fileSize && /* @__PURE__ */
|
|
561
|
+
showMetadata && /* @__PURE__ */ jsxs("figcaption", { children: [
|
|
562
|
+
/* @__PURE__ */ jsx("p", { children: fileName }),
|
|
563
|
+
fileReference.file_metadata.fileSize && /* @__PURE__ */ jsxs("p", { children: [
|
|
704
564
|
formatFileSize(fileReference.file_metadata.fileSize),
|
|
705
565
|
" \u2022 ",
|
|
706
566
|
fileReference.file_metadata.fileType
|
|
@@ -709,10 +569,10 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
709
569
|
] });
|
|
710
570
|
}
|
|
711
571
|
if (displayOnly && showFallback && (!stableFileUrl || imageError || !isImage)) {
|
|
712
|
-
return /* @__PURE__ */
|
|
572
|
+
return /* @__PURE__ */ jsx("figure", { className, title: fileReference.file_metadata.fileName || "File", children: /* @__PURE__ */ jsx("p", { className: fallbackClasses, children: computedFallbackText }) });
|
|
713
573
|
}
|
|
714
|
-
return /* @__PURE__ */
|
|
715
|
-
/* @__PURE__ */
|
|
574
|
+
return /* @__PURE__ */ jsx("figure", { className: `relative ${className}`, children: isImage && stableFileUrl && !imageError ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
575
|
+
/* @__PURE__ */ jsx(
|
|
716
576
|
"img",
|
|
717
577
|
{
|
|
718
578
|
src: stableFileUrl,
|
|
@@ -723,8 +583,8 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
723
583
|
},
|
|
724
584
|
fileReference.id
|
|
725
585
|
),
|
|
726
|
-
showDelete && /* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */
|
|
586
|
+
showDelete && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
587
|
+
/* @__PURE__ */ jsx(
|
|
728
588
|
Button,
|
|
729
589
|
{
|
|
730
590
|
variant: "destructive",
|
|
@@ -736,19 +596,19 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
736
596
|
children: "\xD7"
|
|
737
597
|
}
|
|
738
598
|
),
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ jsx(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs(DialogContent, { size: "sm", title: "Confirm Delete", children: [
|
|
600
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx("h2", { children: "Confirm Delete" }) }),
|
|
601
|
+
/* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsx("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
|
|
602
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
603
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
|
|
604
|
+
/* @__PURE__ */ jsx(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
|
|
745
605
|
] })
|
|
746
606
|
] }) })
|
|
747
607
|
] }),
|
|
748
608
|
children,
|
|
749
|
-
showMetadata && /* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
(fileReference.file_metadata.fileSize || fileReference.file_metadata.fileType) && /* @__PURE__ */
|
|
609
|
+
showMetadata && /* @__PURE__ */ jsxs("figcaption", { children: [
|
|
610
|
+
/* @__PURE__ */ jsx("p", { children: fileReference.file_metadata.fileName || "Unknown file" }),
|
|
611
|
+
(fileReference.file_metadata.fileSize || fileReference.file_metadata.fileType) && /* @__PURE__ */ jsxs("p", { children: [
|
|
752
612
|
fileReference.file_metadata.fileSize && formatFileSize(fileReference.file_metadata.fileSize),
|
|
753
613
|
fileReference.file_metadata.fileSize && fileReference.file_metadata.fileType && " \u2022 ",
|
|
754
614
|
fileReference.file_metadata.fileType
|
|
@@ -756,23 +616,23 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
756
616
|
] })
|
|
757
617
|
] }) : isImage && imageError && showFallback ? (
|
|
758
618
|
// Show fallback when image fails to load and fallback is enabled
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
620
|
+
/* @__PURE__ */ jsx("p", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText }),
|
|
761
621
|
children,
|
|
762
|
-
showMetadata && /* @__PURE__ */
|
|
763
|
-
/* @__PURE__ */
|
|
764
|
-
(fileReference.file_metadata.fileSize || fileReference.file_metadata.fileType) && /* @__PURE__ */
|
|
622
|
+
showMetadata && /* @__PURE__ */ jsxs("figcaption", { children: [
|
|
623
|
+
/* @__PURE__ */ jsx("p", { children: fileReference.file_metadata.fileName || "Unknown file" }),
|
|
624
|
+
(fileReference.file_metadata.fileSize || fileReference.file_metadata.fileType) && /* @__PURE__ */ jsxs("p", { children: [
|
|
765
625
|
fileReference.file_metadata.fileSize && formatFileSize(fileReference.file_metadata.fileSize),
|
|
766
626
|
fileReference.file_metadata.fileSize && fileReference.file_metadata.fileType && " \u2022 ",
|
|
767
627
|
fileReference.file_metadata.fileType
|
|
768
628
|
] })
|
|
769
629
|
] })
|
|
770
630
|
] })
|
|
771
|
-
) : /* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
showDelete && /* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
631
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
632
|
+
/* @__PURE__ */ jsxs("p", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
633
|
+
/* @__PURE__ */ jsx("span", { className: "text-2xl", children: getFileIcon(fileReference.file_metadata.fileType || "") }),
|
|
634
|
+
showDelete && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
635
|
+
/* @__PURE__ */ jsx(
|
|
776
636
|
Button,
|
|
777
637
|
{
|
|
778
638
|
variant: "destructive",
|
|
@@ -784,20 +644,20 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
784
644
|
children: "\xD7"
|
|
785
645
|
}
|
|
786
646
|
),
|
|
787
|
-
/* @__PURE__ */
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
-
/* @__PURE__ */
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
647
|
+
/* @__PURE__ */ jsx(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs(DialogContent, { size: "sm", title: "Confirm Delete", children: [
|
|
648
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx("h2", { children: "Confirm Delete" }) }),
|
|
649
|
+
/* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsx("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
|
|
650
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
651
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
|
|
652
|
+
/* @__PURE__ */ jsx(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
|
|
793
653
|
] })
|
|
794
654
|
] }) })
|
|
795
655
|
] })
|
|
796
656
|
] }),
|
|
797
657
|
children,
|
|
798
|
-
showMetadata && /* @__PURE__ */
|
|
799
|
-
/* @__PURE__ */
|
|
800
|
-
(fileReference.file_metadata.fileSize || fileReference.file_metadata.fileType) && /* @__PURE__ */
|
|
658
|
+
showMetadata && /* @__PURE__ */ jsxs("figcaption", { children: [
|
|
659
|
+
/* @__PURE__ */ jsx("p", { children: fileReference.file_metadata.fileName || "Unknown file" }),
|
|
660
|
+
(fileReference.file_metadata.fileSize || fileReference.file_metadata.fileType) && /* @__PURE__ */ jsxs("p", { children: [
|
|
801
661
|
fileReference.file_metadata.fileSize && formatFileSize(fileReference.file_metadata.fileSize),
|
|
802
662
|
fileReference.file_metadata.fileSize && fileReference.file_metadata.fileType && " \u2022 ",
|
|
803
663
|
fileReference.file_metadata.fileType
|
|
@@ -805,13 +665,13 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
805
665
|
] })
|
|
806
666
|
] }) });
|
|
807
667
|
}
|
|
808
|
-
return /* @__PURE__ */
|
|
668
|
+
return /* @__PURE__ */ jsxs("figure", { className: `space-y-2 ${className}`, children: [
|
|
809
669
|
fileReferences.map((fileRef) => {
|
|
810
670
|
const isImage = fileRef.file_metadata.fileType?.startsWith("image/");
|
|
811
671
|
const fileUrl2 = internalFileUrls.get(fileRef.id) || null;
|
|
812
672
|
const canDownload = !isImage && fileUrl2;
|
|
813
|
-
return /* @__PURE__ */
|
|
814
|
-
isImage && fileUrl2 ? /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ jsxs("figure", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
674
|
+
isImage && fileUrl2 ? /* @__PURE__ */ jsx(
|
|
815
675
|
"img",
|
|
816
676
|
{
|
|
817
677
|
src: fileUrl2 || void 0,
|
|
@@ -821,10 +681,10 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
821
681
|
loading: "lazy"
|
|
822
682
|
},
|
|
823
683
|
fileRef.id
|
|
824
|
-
) : /* @__PURE__ */
|
|
825
|
-
showMetadata && /* @__PURE__ */
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
-
(fileRef.file_metadata.fileSize || fileRef.file_metadata.fileType || fileRef.file_metadata.category) && /* @__PURE__ */
|
|
684
|
+
) : /* @__PURE__ */ jsx("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
|
|
685
|
+
showMetadata && /* @__PURE__ */ jsxs("figcaption", { className: "flex-1 min-w-0", children: [
|
|
686
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium text-sec-900 truncate", children: fileRef.file_metadata.fileName || "Unknown file" }),
|
|
687
|
+
(fileRef.file_metadata.fileSize || fileRef.file_metadata.fileType || fileRef.file_metadata.category) && /* @__PURE__ */ jsxs("p", { className: "text-sm text-sec-500", children: [
|
|
828
688
|
fileRef.file_metadata.fileSize && formatFileSize(fileRef.file_metadata.fileSize),
|
|
829
689
|
fileRef.file_metadata.fileSize && fileRef.file_metadata.fileType && " \u2022 ",
|
|
830
690
|
fileRef.file_metadata.fileType,
|
|
@@ -832,8 +692,8 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
832
692
|
fileRef.file_metadata.category
|
|
833
693
|
] })
|
|
834
694
|
] }),
|
|
835
|
-
/* @__PURE__ */
|
|
836
|
-
canDownload && /* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ jsxs("p", { className: "flex items-center space-x-2", children: [
|
|
696
|
+
canDownload && /* @__PURE__ */ jsx(
|
|
837
697
|
"a",
|
|
838
698
|
{
|
|
839
699
|
href: fileRef.file_path,
|
|
@@ -843,7 +703,7 @@ var FileDisplayContent = React3.memo(function FileDisplayContent2({
|
|
|
843
703
|
children: "\u2193"
|
|
844
704
|
}
|
|
845
705
|
),
|
|
846
|
-
showDelete && onDelete && /* @__PURE__ */
|
|
706
|
+
showDelete && onDelete && /* @__PURE__ */ jsx(
|
|
847
707
|
Button,
|
|
848
708
|
{
|
|
849
709
|
variant: "destructive",
|
|
@@ -882,9 +742,26 @@ function FileDisplayPublic({
|
|
|
882
742
|
}) {
|
|
883
743
|
const publicPageContext = useContext(PublicPageContext);
|
|
884
744
|
const supabase = publicPageContext?.supabase ?? null;
|
|
745
|
+
const {
|
|
746
|
+
fileUrl,
|
|
747
|
+
fileReference,
|
|
748
|
+
fileReferences,
|
|
749
|
+
fileUrls,
|
|
750
|
+
fileCount,
|
|
751
|
+
isLoading,
|
|
752
|
+
error,
|
|
753
|
+
refetch
|
|
754
|
+
} = usePublicFileDisplay(
|
|
755
|
+
table_name,
|
|
756
|
+
record_id,
|
|
757
|
+
organisation_id,
|
|
758
|
+
category,
|
|
759
|
+
{ supabase }
|
|
760
|
+
// Type assertion needed due to type mismatch between contexts
|
|
761
|
+
);
|
|
885
762
|
if (!supabase) {
|
|
886
763
|
if (showFallback) {
|
|
887
|
-
return /* @__PURE__ */
|
|
764
|
+
return /* @__PURE__ */ jsx(
|
|
888
765
|
FileDisplayContent,
|
|
889
766
|
{
|
|
890
767
|
isLoading: false,
|
|
@@ -914,24 +791,8 @@ function FileDisplayPublic({
|
|
|
914
791
|
}
|
|
915
792
|
);
|
|
916
793
|
}
|
|
917
|
-
return /* @__PURE__ */
|
|
794
|
+
return /* @__PURE__ */ jsx("figure", { className, title: "Error", children: /* @__PURE__ */ jsx("p", { className: getFallbackClasses(fallbackSize || "md"), children: "Supabase client not available in public context" }) });
|
|
918
795
|
}
|
|
919
|
-
const {
|
|
920
|
-
fileUrl,
|
|
921
|
-
fileReference,
|
|
922
|
-
fileReferences,
|
|
923
|
-
fileUrls,
|
|
924
|
-
fileCount,
|
|
925
|
-
isLoading,
|
|
926
|
-
error,
|
|
927
|
-
refetch
|
|
928
|
-
} = usePublicFileDisplay(
|
|
929
|
-
table_name,
|
|
930
|
-
record_id,
|
|
931
|
-
organisation_id,
|
|
932
|
-
category,
|
|
933
|
-
{ supabase }
|
|
934
|
-
);
|
|
935
796
|
if (error) {
|
|
936
797
|
logger.error("FileDisplayPublic", "Error fetching file", {
|
|
937
798
|
table_name,
|
|
@@ -958,7 +819,7 @@ function FileDisplayPublic({
|
|
|
958
819
|
finalFileCount = 1;
|
|
959
820
|
finalFileUrl = fileUrls.get(targetFile.id) || null;
|
|
960
821
|
}
|
|
961
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ jsx(
|
|
962
823
|
FileDisplayContent,
|
|
963
824
|
{
|
|
964
825
|
isLoading,
|
|
@@ -1009,7 +870,7 @@ function FileDisplayAuthenticated({
|
|
|
1009
870
|
showMetadata
|
|
1010
871
|
}) {
|
|
1011
872
|
const { supabase } = useUnifiedAuth();
|
|
1012
|
-
const [displayOnlyFileReference, setDisplayOnlyFileReference] =
|
|
873
|
+
const [displayOnlyFileReference, setDisplayOnlyFileReference] = useState(null);
|
|
1013
874
|
const {
|
|
1014
875
|
fileUrl,
|
|
1015
876
|
fileReference,
|
|
@@ -1036,7 +897,7 @@ function FileDisplayAuthenticated({
|
|
|
1036
897
|
}
|
|
1037
898
|
);
|
|
1038
899
|
const displayOnlyFileUrl = displayOnlyFileUrlFromMap || displayOnlyFileUrlHook.url;
|
|
1039
|
-
|
|
900
|
+
useEffect(() => {
|
|
1040
901
|
if (displayOnly && !category && fileReferences.length > 0) {
|
|
1041
902
|
const imageFiles = fileReferences.filter(
|
|
1042
903
|
(f) => f.file_metadata.fileType?.startsWith("image/")
|
|
@@ -1048,7 +909,7 @@ function FileDisplayAuthenticated({
|
|
|
1048
909
|
}
|
|
1049
910
|
}, [displayOnly, category, fileReferences, fileUrls]);
|
|
1050
911
|
if (!supabase) {
|
|
1051
|
-
return /* @__PURE__ */
|
|
912
|
+
return /* @__PURE__ */ jsx("figure", { className, title: "Error", children: /* @__PURE__ */ jsx("p", { className: getFallbackClasses(fallbackSize || "md"), children: "Supabase client not available in authenticated context" }) });
|
|
1052
913
|
}
|
|
1053
914
|
const handleDelete = async () => {
|
|
1054
915
|
};
|
|
@@ -1068,7 +929,7 @@ function FileDisplayAuthenticated({
|
|
|
1068
929
|
finalError = error || displayOnlyFileUrlHook.error;
|
|
1069
930
|
}
|
|
1070
931
|
}
|
|
1071
|
-
return /* @__PURE__ */
|
|
932
|
+
return /* @__PURE__ */ jsx(
|
|
1072
933
|
FileDisplayContent,
|
|
1073
934
|
{
|
|
1074
935
|
isLoading: finalIsLoading,
|
|
@@ -1121,7 +982,7 @@ function FileDisplay({
|
|
|
1121
982
|
}) {
|
|
1122
983
|
const isPublicPage = useIsPublicPage();
|
|
1123
984
|
if (isPublicPage) {
|
|
1124
|
-
return /* @__PURE__ */
|
|
985
|
+
return /* @__PURE__ */ jsx(
|
|
1125
986
|
FileDisplayPublic,
|
|
1126
987
|
{
|
|
1127
988
|
table_name,
|
|
@@ -1145,7 +1006,7 @@ function FileDisplay({
|
|
|
1145
1006
|
}
|
|
1146
1007
|
);
|
|
1147
1008
|
}
|
|
1148
|
-
return /* @__PURE__ */
|
|
1009
|
+
return /* @__PURE__ */ jsx(
|
|
1149
1010
|
FileDisplayAuthenticated,
|
|
1150
1011
|
{
|
|
1151
1012
|
table_name,
|
|
@@ -1169,10 +1030,7 @@ function FileDisplay({
|
|
|
1169
1030
|
}
|
|
1170
1031
|
);
|
|
1171
1032
|
}
|
|
1172
|
-
|
|
1173
|
-
// src/hooks/useFileReference.ts
|
|
1174
|
-
import { useState as useState4, useCallback as useCallback4, useEffect as useEffect4, useRef as useRef4, useMemo as useMemo2 } from "react";
|
|
1175
|
-
var log2 = createLogger("useFileReference");
|
|
1033
|
+
createLogger("useFileReference");
|
|
1176
1034
|
var urlRefreshManager = {
|
|
1177
1035
|
subscriptions: /* @__PURE__ */ new Map(),
|
|
1178
1036
|
subscribe(key, callback) {
|
|
@@ -1204,10 +1062,10 @@ var urlRefreshManager = {
|
|
|
1204
1062
|
}
|
|
1205
1063
|
};
|
|
1206
1064
|
function useFileReference(supabase) {
|
|
1207
|
-
const [isLoading, setIsLoading] =
|
|
1208
|
-
const [error, setError] =
|
|
1209
|
-
const service =
|
|
1210
|
-
const uploadFile =
|
|
1065
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
1066
|
+
const [error, setError] = useState(null);
|
|
1067
|
+
const service = useMemo(() => createFileReferenceService(supabase), [supabase]);
|
|
1068
|
+
const uploadFile = useCallback(async (options, file) => {
|
|
1211
1069
|
setIsLoading(true);
|
|
1212
1070
|
setError(null);
|
|
1213
1071
|
try {
|
|
@@ -1221,7 +1079,7 @@ function useFileReference(supabase) {
|
|
|
1221
1079
|
setIsLoading(false);
|
|
1222
1080
|
}
|
|
1223
1081
|
}, [supabase]);
|
|
1224
|
-
const getFileReference =
|
|
1082
|
+
const getFileReference = useCallback(async (table_name, record_id, organisation_id) => {
|
|
1225
1083
|
setIsLoading(true);
|
|
1226
1084
|
setError(null);
|
|
1227
1085
|
try {
|
|
@@ -1234,7 +1092,7 @@ function useFileReference(supabase) {
|
|
|
1234
1092
|
setIsLoading(false);
|
|
1235
1093
|
}
|
|
1236
1094
|
}, [service]);
|
|
1237
|
-
const getFileUrl =
|
|
1095
|
+
const getFileUrl = useCallback(async (table_name, record_id, organisation_id) => {
|
|
1238
1096
|
setIsLoading(true);
|
|
1239
1097
|
setError(null);
|
|
1240
1098
|
try {
|
|
@@ -1247,7 +1105,7 @@ function useFileReference(supabase) {
|
|
|
1247
1105
|
setIsLoading(false);
|
|
1248
1106
|
}
|
|
1249
1107
|
}, [service]);
|
|
1250
|
-
const getSignedUrl3 =
|
|
1108
|
+
const getSignedUrl3 = useCallback(async (table_name, record_id, organisation_id, expires_in) => {
|
|
1251
1109
|
setIsLoading(true);
|
|
1252
1110
|
setError(null);
|
|
1253
1111
|
try {
|
|
@@ -1260,7 +1118,7 @@ function useFileReference(supabase) {
|
|
|
1260
1118
|
setIsLoading(false);
|
|
1261
1119
|
}
|
|
1262
1120
|
}, [service]);
|
|
1263
|
-
const updateFileReference =
|
|
1121
|
+
const updateFileReference = useCallback(async (id, updates) => {
|
|
1264
1122
|
setIsLoading(true);
|
|
1265
1123
|
setError(null);
|
|
1266
1124
|
try {
|
|
@@ -1273,7 +1131,7 @@ function useFileReference(supabase) {
|
|
|
1273
1131
|
setIsLoading(false);
|
|
1274
1132
|
}
|
|
1275
1133
|
}, [service]);
|
|
1276
|
-
const deleteFileReference =
|
|
1134
|
+
const deleteFileReference = useCallback(async (table_name, record_id, organisation_id, delete_file) => {
|
|
1277
1135
|
setIsLoading(true);
|
|
1278
1136
|
setError(null);
|
|
1279
1137
|
try {
|
|
@@ -1286,7 +1144,7 @@ function useFileReference(supabase) {
|
|
|
1286
1144
|
setIsLoading(false);
|
|
1287
1145
|
}
|
|
1288
1146
|
}, [service]);
|
|
1289
|
-
const listFileReferences =
|
|
1147
|
+
const listFileReferences = useCallback(async (table_name, record_id, organisation_id) => {
|
|
1290
1148
|
setIsLoading(true);
|
|
1291
1149
|
setError(null);
|
|
1292
1150
|
try {
|
|
@@ -1299,7 +1157,7 @@ function useFileReference(supabase) {
|
|
|
1299
1157
|
setIsLoading(false);
|
|
1300
1158
|
}
|
|
1301
1159
|
}, [service]);
|
|
1302
|
-
const getFileCount =
|
|
1160
|
+
const getFileCount = useCallback(async (table_name, record_id, organisation_id) => {
|
|
1303
1161
|
setIsLoading(true);
|
|
1304
1162
|
setError(null);
|
|
1305
1163
|
try {
|
|
@@ -1312,7 +1170,7 @@ function useFileReference(supabase) {
|
|
|
1312
1170
|
setIsLoading(false);
|
|
1313
1171
|
}
|
|
1314
1172
|
}, [service]);
|
|
1315
|
-
const getFileReferenceById =
|
|
1173
|
+
const getFileReferenceById = useCallback(async (id, organisation_id) => {
|
|
1316
1174
|
setIsLoading(true);
|
|
1317
1175
|
setError(null);
|
|
1318
1176
|
try {
|
|
@@ -1325,7 +1183,7 @@ function useFileReference(supabase) {
|
|
|
1325
1183
|
setIsLoading(false);
|
|
1326
1184
|
}
|
|
1327
1185
|
}, [service]);
|
|
1328
|
-
const getFilesByCategory =
|
|
1186
|
+
const getFilesByCategory = useCallback(async (table_name, record_id, category, organisation_id) => {
|
|
1329
1187
|
setIsLoading(true);
|
|
1330
1188
|
setError(null);
|
|
1331
1189
|
try {
|
|
@@ -1338,7 +1196,7 @@ function useFileReference(supabase) {
|
|
|
1338
1196
|
setIsLoading(false);
|
|
1339
1197
|
}
|
|
1340
1198
|
}, [service]);
|
|
1341
|
-
const clearError =
|
|
1199
|
+
const clearError = useCallback(() => {
|
|
1342
1200
|
setError(null);
|
|
1343
1201
|
}, []);
|
|
1344
1202
|
return {
|
|
@@ -1369,32 +1227,32 @@ function useFileReferenceForRecord(supabase, table_name, record_id, organisation
|
|
|
1369
1227
|
getFileCount,
|
|
1370
1228
|
clearError
|
|
1371
1229
|
} = useFileReference(supabase);
|
|
1372
|
-
const [fileUrl, setFileUrl] =
|
|
1373
|
-
const [fileReference, setFileReference] =
|
|
1374
|
-
const [fileReferences, setFileReferences] =
|
|
1375
|
-
const [fileCount, setFileCount] =
|
|
1376
|
-
const refreshSubscriptionRef =
|
|
1377
|
-
const loadFileReference =
|
|
1230
|
+
const [fileUrl, setFileUrl] = useState(null);
|
|
1231
|
+
const [fileReference, setFileReference] = useState(null);
|
|
1232
|
+
const [fileReferences, setFileReferences] = useState([]);
|
|
1233
|
+
const [fileCount, setFileCount] = useState(0);
|
|
1234
|
+
const refreshSubscriptionRef = useRef(null);
|
|
1235
|
+
const loadFileReference = useCallback(async () => {
|
|
1378
1236
|
const reference = await getFileReference(table_name, record_id, organisation_id);
|
|
1379
1237
|
setFileReference(reference);
|
|
1380
1238
|
return reference;
|
|
1381
1239
|
}, [getFileReference, table_name, record_id, organisation_id]);
|
|
1382
|
-
const loadFileUrl =
|
|
1240
|
+
const loadFileUrl = useCallback(async () => {
|
|
1383
1241
|
const url = await getFileUrl(table_name, record_id, organisation_id);
|
|
1384
1242
|
setFileUrl(url);
|
|
1385
1243
|
return url;
|
|
1386
1244
|
}, [getFileUrl, table_name, record_id, organisation_id]);
|
|
1387
|
-
const loadFileReferences =
|
|
1245
|
+
const loadFileReferences = useCallback(async () => {
|
|
1388
1246
|
const references = await listFileReferences(table_name, record_id, organisation_id);
|
|
1389
1247
|
setFileReferences(references);
|
|
1390
1248
|
return references;
|
|
1391
1249
|
}, [listFileReferences, table_name, record_id, organisation_id]);
|
|
1392
|
-
const loadFileCount =
|
|
1250
|
+
const loadFileCount = useCallback(async () => {
|
|
1393
1251
|
const count = await getFileCount(table_name, record_id, organisation_id);
|
|
1394
1252
|
setFileCount(count);
|
|
1395
1253
|
return count;
|
|
1396
1254
|
}, [getFileCount, table_name, record_id, organisation_id]);
|
|
1397
|
-
const deleteFile =
|
|
1255
|
+
const deleteFile = useCallback(async (delete_file) => {
|
|
1398
1256
|
const success = await deleteFileReference(table_name, record_id, organisation_id, delete_file);
|
|
1399
1257
|
if (success) {
|
|
1400
1258
|
setFileReference(null);
|
|
@@ -1403,7 +1261,7 @@ function useFileReferenceForRecord(supabase, table_name, record_id, organisation
|
|
|
1403
1261
|
}
|
|
1404
1262
|
return success;
|
|
1405
1263
|
}, [deleteFileReference, table_name, record_id, organisation_id, loadFileCount]);
|
|
1406
|
-
|
|
1264
|
+
useEffect(() => {
|
|
1407
1265
|
if (refreshSubscriptionRef.current) {
|
|
1408
1266
|
refreshSubscriptionRef.current();
|
|
1409
1267
|
refreshSubscriptionRef.current = null;
|
|
@@ -1445,9 +1303,9 @@ function useFileReferenceById(supabase, fileReferenceId, organisationId) {
|
|
|
1445
1303
|
getFileReferenceById,
|
|
1446
1304
|
clearError
|
|
1447
1305
|
} = useFileReference(supabase);
|
|
1448
|
-
const [fileReference, setFileReference] =
|
|
1449
|
-
const [fileUrl, setFileUrl] =
|
|
1450
|
-
const loadFileReference =
|
|
1306
|
+
const [fileReference, setFileReference] = useState(null);
|
|
1307
|
+
const [fileUrl, setFileUrl] = useState(null);
|
|
1308
|
+
const loadFileReference = useCallback(async () => {
|
|
1451
1309
|
if (!fileReferenceId || !organisationId) {
|
|
1452
1310
|
setFileReference(null);
|
|
1453
1311
|
setFileUrl(null);
|
|
@@ -1457,10 +1315,10 @@ function useFileReferenceById(supabase, fileReferenceId, organisationId) {
|
|
|
1457
1315
|
setFileReference(reference);
|
|
1458
1316
|
return reference;
|
|
1459
1317
|
}, [getFileReferenceById, fileReferenceId, organisationId]);
|
|
1460
|
-
|
|
1318
|
+
useEffect(() => {
|
|
1461
1319
|
loadFileReference();
|
|
1462
1320
|
}, [loadFileReference]);
|
|
1463
|
-
|
|
1321
|
+
useEffect(() => {
|
|
1464
1322
|
if (!fileReference || !fileReferenceId || !organisationId) {
|
|
1465
1323
|
setFileUrl(null);
|
|
1466
1324
|
return;
|
|
@@ -1496,9 +1354,9 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
|
|
|
1496
1354
|
getFilesByCategory,
|
|
1497
1355
|
clearError
|
|
1498
1356
|
} = useFileReference(supabase);
|
|
1499
|
-
const [fileReferences, setFileReferences] =
|
|
1500
|
-
const [fileUrls, setFileUrls] =
|
|
1501
|
-
const loadFiles =
|
|
1357
|
+
const [fileReferences, setFileReferences] = useState([]);
|
|
1358
|
+
const [fileUrls, setFileUrls] = useState(/* @__PURE__ */ new Map());
|
|
1359
|
+
const loadFiles = useCallback(async () => {
|
|
1502
1360
|
if (!category || !organisation_id) {
|
|
1503
1361
|
setFileReferences([]);
|
|
1504
1362
|
setFileUrls(/* @__PURE__ */ new Map());
|
|
@@ -1514,7 +1372,7 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
|
|
|
1514
1372
|
setFileUrls(urlMap);
|
|
1515
1373
|
return files;
|
|
1516
1374
|
}, [table_name, record_id, category, organisation_id, supabase, getFilesByCategory]);
|
|
1517
|
-
|
|
1375
|
+
useEffect(() => {
|
|
1518
1376
|
loadFiles();
|
|
1519
1377
|
}, [loadFiles]);
|
|
1520
1378
|
return {
|
|
@@ -1526,10 +1384,6 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
|
|
|
1526
1384
|
clearError
|
|
1527
1385
|
};
|
|
1528
1386
|
}
|
|
1529
|
-
|
|
1530
|
-
// src/components/Avatar/Avatar.tsx
|
|
1531
|
-
import * as React4 from "react";
|
|
1532
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1533
1387
|
var sizeClasses = {
|
|
1534
1388
|
xs: "size-4 text-xs",
|
|
1535
1389
|
sm: "size-6 text-sm",
|
|
@@ -1538,7 +1392,7 @@ var sizeClasses = {
|
|
|
1538
1392
|
xl: "size-16 text-xl",
|
|
1539
1393
|
"2xl": "size-20 text-2xl"
|
|
1540
1394
|
};
|
|
1541
|
-
var Avatar =
|
|
1395
|
+
var Avatar = React6.forwardRef(
|
|
1542
1396
|
({
|
|
1543
1397
|
table_name,
|
|
1544
1398
|
record_id,
|
|
@@ -1552,7 +1406,7 @@ var Avatar = React4.forwardRef(
|
|
|
1552
1406
|
size = "md",
|
|
1553
1407
|
...props
|
|
1554
1408
|
}, ref) => {
|
|
1555
|
-
const [imageError, setImageError] =
|
|
1409
|
+
const [imageError, setImageError] = React6.useState(false);
|
|
1556
1410
|
const { supabase } = useUnifiedAuth();
|
|
1557
1411
|
const canFetchFileId = Boolean(fileId && organisation_id && supabase);
|
|
1558
1412
|
const { fileReference, fileUrl: fileIdUrl, isLoading: fileIdLoading } = useFileReferenceById(
|
|
@@ -1569,23 +1423,23 @@ var Avatar = React4.forwardRef(
|
|
|
1569
1423
|
const fallbackClasses = "size-full grid place-items-center text-center text-sec-50 bg-sec-500";
|
|
1570
1424
|
const imageClasses = "object-cover size-full";
|
|
1571
1425
|
const containerClasses = cn(baseClasses, className);
|
|
1572
|
-
const handleImageError =
|
|
1426
|
+
const handleImageError = React6.useCallback(() => {
|
|
1573
1427
|
setImageError(true);
|
|
1574
1428
|
}, []);
|
|
1575
|
-
|
|
1429
|
+
React6.useEffect(() => {
|
|
1576
1430
|
if (src) {
|
|
1577
1431
|
setImageError(false);
|
|
1578
1432
|
}
|
|
1579
1433
|
}, [src]);
|
|
1580
|
-
return /* @__PURE__ */
|
|
1434
|
+
return /* @__PURE__ */ jsx(
|
|
1581
1435
|
"figure",
|
|
1582
1436
|
{
|
|
1583
1437
|
ref,
|
|
1584
1438
|
className: containerClasses,
|
|
1585
1439
|
...props,
|
|
1586
|
-
children: showFallback ? /* @__PURE__ */
|
|
1440
|
+
children: showFallback ? /* @__PURE__ */ jsx("figcaption", { className: fallbackClasses, "aria-label": alt || fallback, children: fallback }) : hasFileProps ? (
|
|
1587
1441
|
// File reference props approach - use FileDisplay
|
|
1588
|
-
/* @__PURE__ */
|
|
1442
|
+
/* @__PURE__ */ jsx(
|
|
1589
1443
|
FileDisplay,
|
|
1590
1444
|
{
|
|
1591
1445
|
table_name,
|
|
@@ -1600,7 +1454,7 @@ var Avatar = React4.forwardRef(
|
|
|
1600
1454
|
)
|
|
1601
1455
|
) : hasFileId && fileIdUrl ? (
|
|
1602
1456
|
// File ID approach - use img tag with fetched URL
|
|
1603
|
-
/* @__PURE__ */
|
|
1457
|
+
/* @__PURE__ */ jsx(
|
|
1604
1458
|
"img",
|
|
1605
1459
|
{
|
|
1606
1460
|
src: fileIdUrl,
|
|
@@ -1611,7 +1465,7 @@ var Avatar = React4.forwardRef(
|
|
|
1611
1465
|
)
|
|
1612
1466
|
) : hasDirectUrl ? (
|
|
1613
1467
|
// Direct URL approach - use img tag
|
|
1614
|
-
/* @__PURE__ */
|
|
1468
|
+
/* @__PURE__ */ jsx(
|
|
1615
1469
|
"img",
|
|
1616
1470
|
{
|
|
1617
1471
|
src,
|
|
@@ -1622,16 +1476,13 @@ var Avatar = React4.forwardRef(
|
|
|
1622
1476
|
)
|
|
1623
1477
|
) : (
|
|
1624
1478
|
// Fallback if nothing else works
|
|
1625
|
-
/* @__PURE__ */
|
|
1479
|
+
/* @__PURE__ */ jsx("figcaption", { className: fallbackClasses, "aria-label": alt || fallback, children: fallback })
|
|
1626
1480
|
)
|
|
1627
1481
|
}
|
|
1628
1482
|
);
|
|
1629
1483
|
}
|
|
1630
1484
|
);
|
|
1631
1485
|
Avatar.displayName = "Avatar";
|
|
1632
|
-
|
|
1633
|
-
// src/components/Badge/Badge.tsx
|
|
1634
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1635
1486
|
var shadeConfig = {
|
|
1636
1487
|
muted: {
|
|
1637
1488
|
bg: 200,
|
|
@@ -1705,7 +1556,7 @@ function Badge({ className, variant = "solid-main-normal", ref, ...props }) {
|
|
|
1705
1556
|
const classesWithoutShadows = variantClasses.replace(/\bshadow-badge-soft\b/g, "").replace(/\bshadow-\w+-\d+\b/g, "").replace(/\s+/g, " ").trim();
|
|
1706
1557
|
const mergedClasses = cn(classesWithoutShadows, className);
|
|
1707
1558
|
const finalClasses = `${mergedClasses} shadow-badge-soft ${shadowColorClass}`.trim();
|
|
1708
|
-
return /* @__PURE__ */
|
|
1559
|
+
return /* @__PURE__ */ jsx(
|
|
1709
1560
|
"span",
|
|
1710
1561
|
{
|
|
1711
1562
|
ref,
|
|
@@ -1714,7 +1565,7 @@ function Badge({ className, variant = "solid-main-normal", ref, ...props }) {
|
|
|
1714
1565
|
}
|
|
1715
1566
|
);
|
|
1716
1567
|
}
|
|
1717
|
-
return /* @__PURE__ */
|
|
1568
|
+
return /* @__PURE__ */ jsx(
|
|
1718
1569
|
"span",
|
|
1719
1570
|
{
|
|
1720
1571
|
ref,
|
|
@@ -1724,12 +1575,7 @@ function Badge({ className, variant = "solid-main-normal", ref, ...props }) {
|
|
|
1724
1575
|
);
|
|
1725
1576
|
}
|
|
1726
1577
|
Badge.displayName = "Badge";
|
|
1727
|
-
|
|
1728
|
-
// src/components/Switch/Switch.tsx
|
|
1729
|
-
import * as React5 from "react";
|
|
1730
|
-
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
1731
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1732
|
-
var Switch = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
1578
|
+
var Switch = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1733
1579
|
SwitchPrimitive.Root,
|
|
1734
1580
|
{
|
|
1735
1581
|
className: cn(
|
|
@@ -1751,7 +1597,7 @@ var Switch = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
1751
1597
|
),
|
|
1752
1598
|
...props,
|
|
1753
1599
|
ref,
|
|
1754
|
-
children: /* @__PURE__ */
|
|
1600
|
+
children: /* @__PURE__ */ jsx(
|
|
1755
1601
|
SwitchPrimitive.Thumb,
|
|
1756
1602
|
{
|
|
1757
1603
|
className: cn(
|
|
@@ -1770,14 +1616,9 @@ var Switch = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
1770
1616
|
}
|
|
1771
1617
|
));
|
|
1772
1618
|
Switch.displayName = SwitchPrimitive.Root.displayName;
|
|
1773
|
-
|
|
1774
|
-
// src/components/Tabs/Tabs.tsx
|
|
1775
|
-
import * as React6 from "react";
|
|
1776
|
-
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
1777
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1778
|
-
var Tabs = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx8(TabsPrimitive.Root, { asChild: true, ...props, children: /* @__PURE__ */ jsx8("section", { ref, className, children }) }));
|
|
1619
|
+
var Tabs = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.Root, { asChild: true, ...props, children: /* @__PURE__ */ jsx("section", { ref, className, children }) }));
|
|
1779
1620
|
Tabs.displayName = TabsPrimitive.Root.displayName || "Tabs";
|
|
1780
|
-
var TabsList = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
1621
|
+
var TabsList = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.List, { asChild: true, ...props, children: /* @__PURE__ */ jsx(
|
|
1781
1622
|
"nav",
|
|
1782
1623
|
{
|
|
1783
1624
|
ref,
|
|
@@ -1790,7 +1631,7 @@ var TabsList = React6.forwardRef(({ className, children, ...props }, ref) => /*
|
|
|
1790
1631
|
) }));
|
|
1791
1632
|
TabsList.displayName = TabsPrimitive.List.displayName || "TabsList";
|
|
1792
1633
|
var TabsTrigger = React6.forwardRef(({ className, variant, size, children, ...props }, ref) => {
|
|
1793
|
-
return /* @__PURE__ */
|
|
1634
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.Trigger, { asChild: true, ...props, children: /* @__PURE__ */ jsx(
|
|
1794
1635
|
Button,
|
|
1795
1636
|
{
|
|
1796
1637
|
ref,
|
|
@@ -1808,7 +1649,7 @@ var TabsTrigger = React6.forwardRef(({ className, variant, size, children, ...pr
|
|
|
1808
1649
|
) });
|
|
1809
1650
|
});
|
|
1810
1651
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName || "TabsTrigger";
|
|
1811
|
-
var TabsContent = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
1652
|
+
var TabsContent = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.Content, { asChild: true, ...props, children: /* @__PURE__ */ jsx(
|
|
1812
1653
|
"aside",
|
|
1813
1654
|
{
|
|
1814
1655
|
ref,
|
|
@@ -1820,15 +1661,6 @@ var TabsContent = React6.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
1820
1661
|
}
|
|
1821
1662
|
) }));
|
|
1822
1663
|
TabsContent.displayName = TabsPrimitive.Content.displayName || "TabsContent";
|
|
1823
|
-
|
|
1824
|
-
// src/components/Calendar/Calendar.tsx
|
|
1825
|
-
import * as React7 from "react";
|
|
1826
|
-
import {
|
|
1827
|
-
DayPicker,
|
|
1828
|
-
useDayPicker
|
|
1829
|
-
} from "react-day-picker";
|
|
1830
|
-
import { enAU } from "date-fns/locale";
|
|
1831
|
-
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1832
1664
|
var assignToRef = (ref, value) => {
|
|
1833
1665
|
if (!ref) {
|
|
1834
1666
|
return;
|
|
@@ -1839,10 +1671,10 @@ var assignToRef = (ref, value) => {
|
|
|
1839
1671
|
}
|
|
1840
1672
|
ref.current = value;
|
|
1841
1673
|
};
|
|
1842
|
-
var Calendar =
|
|
1843
|
-
({ className, classNames, mode, components, locale, month: controlledMonth, onMonthChange: controlledOnMonthChange, onSelect, ...props }, ref) => {
|
|
1844
|
-
const tableRef =
|
|
1845
|
-
const setForwardedRef =
|
|
1674
|
+
var Calendar = React6.forwardRef(
|
|
1675
|
+
({ className, classNames, mode, components, locale, month: controlledMonth, onMonthChange: controlledOnMonthChange, onSelect, captionLayout, startMonth, endMonth, ...props }, ref) => {
|
|
1676
|
+
const tableRef = React6.useRef(null);
|
|
1677
|
+
const setForwardedRef = React6.useCallback(
|
|
1846
1678
|
(node) => {
|
|
1847
1679
|
tableRef.current = node;
|
|
1848
1680
|
if (!ref) {
|
|
@@ -1856,14 +1688,14 @@ var Calendar = React7.forwardRef(
|
|
|
1856
1688
|
},
|
|
1857
1689
|
[ref]
|
|
1858
1690
|
);
|
|
1859
|
-
const rootPropsRef =
|
|
1691
|
+
const rootPropsRef = React6.useRef(null);
|
|
1860
1692
|
const selected = props.selected;
|
|
1861
1693
|
const isMonthControlled = controlledMonth !== void 0;
|
|
1862
|
-
const [internalMonth, setInternalMonth] =
|
|
1694
|
+
const [internalMonth, setInternalMonth] = React6.useState(() => {
|
|
1863
1695
|
const now = /* @__PURE__ */ new Date();
|
|
1864
1696
|
return new Date(now.getFullYear(), now.getMonth(), 1);
|
|
1865
1697
|
});
|
|
1866
|
-
const month =
|
|
1698
|
+
const month = React6.useMemo(() => {
|
|
1867
1699
|
const monthToUse = isMonthControlled ? controlledMonth : internalMonth;
|
|
1868
1700
|
if (!monthToUse) {
|
|
1869
1701
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -1872,16 +1704,16 @@ var Calendar = React7.forwardRef(
|
|
|
1872
1704
|
const normalized = new Date(monthToUse.getFullYear(), monthToUse.getMonth(), 1);
|
|
1873
1705
|
return normalized;
|
|
1874
1706
|
}, [isMonthControlled, controlledMonth, internalMonth]);
|
|
1875
|
-
const handleMonthChange =
|
|
1707
|
+
const handleMonthChange = React6.useCallback((newMonth) => {
|
|
1876
1708
|
if (!isMonthControlled) {
|
|
1877
1709
|
setInternalMonth(newMonth);
|
|
1878
1710
|
}
|
|
1879
1711
|
controlledOnMonthChange?.(newMonth);
|
|
1880
1712
|
}, [isMonthControlled, controlledOnMonthChange]);
|
|
1881
|
-
const wrappedHandleMonthChange =
|
|
1713
|
+
const wrappedHandleMonthChange = React6.useCallback((newMonth) => {
|
|
1882
1714
|
handleMonthChange(newMonth);
|
|
1883
1715
|
}, [handleMonthChange]);
|
|
1884
|
-
const CustomRoot =
|
|
1716
|
+
const CustomRoot = React6.memo(({ children, rootRef: dayPickerRootRef, ...rootProps }) => {
|
|
1885
1717
|
const {
|
|
1886
1718
|
className: rootClassName,
|
|
1887
1719
|
style: rootStyle,
|
|
@@ -1894,32 +1726,103 @@ var Calendar = React7.forwardRef(
|
|
|
1894
1726
|
rootRef: dayPickerRootRef,
|
|
1895
1727
|
restProps
|
|
1896
1728
|
};
|
|
1897
|
-
return /* @__PURE__ */
|
|
1729
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1898
1730
|
});
|
|
1899
1731
|
CustomRoot.displayName = "CustomRoot";
|
|
1900
|
-
const CustomMonths =
|
|
1901
|
-
|
|
1732
|
+
const CustomMonths = React6.memo(({ children }) => {
|
|
1733
|
+
const childrenArray = React6.Children.toArray(children);
|
|
1734
|
+
const filteredChildren = childrenArray.filter((child) => {
|
|
1735
|
+
if (!React6.isValidElement(child)) return true;
|
|
1736
|
+
const childType = child.type;
|
|
1737
|
+
const displayName = childType?.displayName || childType?.name;
|
|
1738
|
+
if (displayName === "MonthCaption" || displayName === "Dropdown" || displayName === "DropdownMonth" || displayName === "DropdownYear" || typeof childType === "string" && childType.includes("dropdown")) {
|
|
1739
|
+
return false;
|
|
1740
|
+
}
|
|
1741
|
+
if (childType === "div") {
|
|
1742
|
+
const childProps = child.props;
|
|
1743
|
+
if (childProps?.children) {
|
|
1744
|
+
const childChildren = React6.Children.toArray(childProps.children);
|
|
1745
|
+
const hasCaptionSpan = childChildren.some((cc) => {
|
|
1746
|
+
if (!React6.isValidElement(cc) || cc.type !== "span") return false;
|
|
1747
|
+
const spanProps = cc.props;
|
|
1748
|
+
return spanProps?.role === "status" && spanProps?.["aria-live"] === "polite";
|
|
1749
|
+
});
|
|
1750
|
+
if (hasCaptionSpan) {
|
|
1751
|
+
return false;
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
return true;
|
|
1756
|
+
});
|
|
1757
|
+
return /* @__PURE__ */ jsx(Fragment, { children: filteredChildren });
|
|
1902
1758
|
});
|
|
1903
1759
|
CustomMonths.displayName = "CustomMonths";
|
|
1904
|
-
const CustomMonthGrid =
|
|
1905
|
-
return /* @__PURE__ */
|
|
1760
|
+
const CustomMonthGrid = React6.forwardRef((props2, forwardedRef) => {
|
|
1761
|
+
return /* @__PURE__ */ jsx("table", { ref: forwardedRef, ...props2 });
|
|
1906
1762
|
});
|
|
1907
1763
|
CustomMonthGrid.displayName = "CustomMonthGrid";
|
|
1908
|
-
const
|
|
1764
|
+
const CustomMonthCaption = React6.memo(({ displayMonth, startMonth: captionStartMonth, endMonth: captionEndMonth, locale: captionLocale }) => {
|
|
1765
|
+
const { goToMonth } = useDayPicker();
|
|
1766
|
+
const calendarLocale = captionLocale || enAU;
|
|
1767
|
+
const fromDate = captionStartMonth || new Date(1900, 0);
|
|
1768
|
+
const toDate = captionEndMonth || new Date(2100, 11);
|
|
1769
|
+
const monthOptions = React6.useMemo(() => {
|
|
1770
|
+
const months = [];
|
|
1771
|
+
for (let i = 0; i < 12; i++) {
|
|
1772
|
+
const monthDate = new Date(displayMonth.getFullYear(), i, 1);
|
|
1773
|
+
const label = format(monthDate, "MMMM", { locale: calendarLocale });
|
|
1774
|
+
months.push({ value: i.toString(), label });
|
|
1775
|
+
}
|
|
1776
|
+
return months;
|
|
1777
|
+
}, [calendarLocale, displayMonth]);
|
|
1778
|
+
const yearOptions = React6.useMemo(() => {
|
|
1779
|
+
const years = [];
|
|
1780
|
+
const startYear = fromDate.getFullYear();
|
|
1781
|
+
const endYear = toDate.getFullYear();
|
|
1782
|
+
for (let year = startYear; year <= endYear; year++) {
|
|
1783
|
+
years.push({ value: year.toString(), label: year.toString() });
|
|
1784
|
+
}
|
|
1785
|
+
return years;
|
|
1786
|
+
}, [fromDate, toDate]);
|
|
1787
|
+
const currentMonth = displayMonth.getMonth();
|
|
1788
|
+
const currentYear = displayMonth.getFullYear();
|
|
1789
|
+
const handleMonthChange2 = React6.useCallback((value) => {
|
|
1790
|
+
const newMonth = parseInt(value, 10);
|
|
1791
|
+
const newDate = new Date(currentYear, newMonth, 1);
|
|
1792
|
+
goToMonth(newDate);
|
|
1793
|
+
}, [currentYear, goToMonth]);
|
|
1794
|
+
const handleYearChange = React6.useCallback((value) => {
|
|
1795
|
+
const newYear = parseInt(value, 10);
|
|
1796
|
+
const newDate = new Date(newYear, currentMonth, 1);
|
|
1797
|
+
goToMonth(newDate);
|
|
1798
|
+
}, [currentMonth, goToMonth]);
|
|
1799
|
+
return /* @__PURE__ */ jsxs("nav", { className: "relative flex items-center justify-center gap-2", children: [
|
|
1800
|
+
/* @__PURE__ */ jsxs(Select, { value: currentMonth.toString(), onValueChange: handleMonthChange2, children: [
|
|
1801
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-auto min-w-[120px]", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
1802
|
+
/* @__PURE__ */ jsx(SelectContent, { children: monthOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
1803
|
+
] }),
|
|
1804
|
+
/* @__PURE__ */ jsxs(Select, { value: currentYear.toString(), onValueChange: handleYearChange, children: [
|
|
1805
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-auto min-w-[100px]", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
1806
|
+
/* @__PURE__ */ jsx(SelectContent, { children: yearOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
1807
|
+
] })
|
|
1808
|
+
] });
|
|
1809
|
+
});
|
|
1810
|
+
CustomMonthCaption.displayName = "CustomMonthCaption";
|
|
1811
|
+
const CustomMonth = React6.memo(({ calendarMonth, displayIndex, className: className2, children, captionLayout: monthCaptionLayout, startMonth: monthStartMonth, endMonth: monthEndMonth }) => {
|
|
1909
1812
|
const { formatters, components: components2, labels, classNames: classNames2, previousMonth, nextMonth, goToMonth } = useDayPicker();
|
|
1910
1813
|
const caption = formatters.formatCaption(calendarMonth.date, {});
|
|
1911
1814
|
const Chevron = components2?.Chevron;
|
|
1912
|
-
const childrenArray =
|
|
1815
|
+
const childrenArray = React6.Children.toArray(children);
|
|
1913
1816
|
const monthGridIndex = childrenArray.findIndex((child) => {
|
|
1914
|
-
if (!
|
|
1817
|
+
if (!React6.isValidElement(child)) return false;
|
|
1915
1818
|
const childType = child.type;
|
|
1916
1819
|
return typeof childType === "function" && childType.displayName === "MonthGrid" || child.type === "table";
|
|
1917
1820
|
});
|
|
1918
|
-
return /* @__PURE__ */
|
|
1919
|
-
if (
|
|
1821
|
+
return /* @__PURE__ */ jsx(Fragment, { children: childrenArray.map((child, index) => {
|
|
1822
|
+
if (React6.isValidElement(child) && child.type?.displayName === "MonthCaption") {
|
|
1920
1823
|
return null;
|
|
1921
1824
|
}
|
|
1922
|
-
if (index === monthGridIndex &&
|
|
1825
|
+
if (index === monthGridIndex && React6.isValidElement(child)) {
|
|
1923
1826
|
const monthGridChild = child;
|
|
1924
1827
|
const applyRootProps = displayIndex === 0 && index === monthGridIndex;
|
|
1925
1828
|
const storedRootProps = applyRootProps ? rootPropsRef.current : null;
|
|
@@ -1969,16 +1872,25 @@ var Calendar = React7.forwardRef(
|
|
|
1969
1872
|
}
|
|
1970
1873
|
assignToRef(monthGridElement.ref, node);
|
|
1971
1874
|
} : void 0;
|
|
1972
|
-
|
|
1875
|
+
const isDropdownLayout = monthCaptionLayout === "dropdown";
|
|
1876
|
+
return React6.cloneElement(
|
|
1973
1877
|
monthGridElement,
|
|
1974
1878
|
{
|
|
1975
1879
|
key: child.key ?? `month-grid-${displayIndex}`,
|
|
1976
1880
|
...tableProps,
|
|
1977
1881
|
...mergedRef ? { ref: mergedRef } : {}
|
|
1978
1882
|
},
|
|
1979
|
-
/* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
1981
|
-
|
|
1883
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1884
|
+
/* @__PURE__ */ jsx("caption", { className: "relative", children: isDropdownLayout ? /* @__PURE__ */ jsx(
|
|
1885
|
+
CustomMonthCaption,
|
|
1886
|
+
{
|
|
1887
|
+
displayMonth: calendarMonth.date,
|
|
1888
|
+
startMonth: monthStartMonth,
|
|
1889
|
+
endMonth: monthEndMonth,
|
|
1890
|
+
locale
|
|
1891
|
+
}
|
|
1892
|
+
) : /* @__PURE__ */ jsxs("nav", { className: "relative flex items-center justify-center gap-1", children: [
|
|
1893
|
+
/* @__PURE__ */ jsx(
|
|
1982
1894
|
"button",
|
|
1983
1895
|
{
|
|
1984
1896
|
type: "button",
|
|
@@ -1995,11 +1907,11 @@ var Calendar = React7.forwardRef(
|
|
|
1995
1907
|
"aria-label": previousMonth ? labels.labelPrevious(previousMonth) : void 0,
|
|
1996
1908
|
onClick: handlePreviousClick,
|
|
1997
1909
|
disabled: !previousMonth,
|
|
1998
|
-
children: Chevron ? /* @__PURE__ */
|
|
1910
|
+
children: Chevron ? /* @__PURE__ */ jsx(Chevron, { orientation: "left", className: "size-4", disabled: !previousMonth }) : /* @__PURE__ */ jsx("span", { children: "\u2039" })
|
|
1999
1911
|
}
|
|
2000
1912
|
),
|
|
2001
|
-
/* @__PURE__ */
|
|
2002
|
-
/* @__PURE__ */
|
|
1913
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: caption }),
|
|
1914
|
+
/* @__PURE__ */ jsx(
|
|
2003
1915
|
"button",
|
|
2004
1916
|
{
|
|
2005
1917
|
type: "button",
|
|
@@ -2016,7 +1928,7 @@ var Calendar = React7.forwardRef(
|
|
|
2016
1928
|
"aria-label": nextMonth ? labels.labelNext(nextMonth) : void 0,
|
|
2017
1929
|
onClick: handleNextClick,
|
|
2018
1930
|
disabled: !nextMonth,
|
|
2019
|
-
children: Chevron ? /* @__PURE__ */
|
|
1931
|
+
children: Chevron ? /* @__PURE__ */ jsx(Chevron, { orientation: "right", className: "size-4", disabled: !nextMonth }) : /* @__PURE__ */ jsx("span", { children: "\u203A" })
|
|
2020
1932
|
}
|
|
2021
1933
|
)
|
|
2022
1934
|
] }) }),
|
|
@@ -2024,25 +1936,41 @@ var Calendar = React7.forwardRef(
|
|
|
2024
1936
|
] })
|
|
2025
1937
|
);
|
|
2026
1938
|
}
|
|
2027
|
-
return
|
|
1939
|
+
return React6.isValidElement(child) ? React6.cloneElement(child, { key: child.key ?? `calendar-child-${index}` }) : child;
|
|
2028
1940
|
}) });
|
|
2029
1941
|
});
|
|
2030
1942
|
CustomMonth.displayName = "CustomMonth";
|
|
2031
|
-
const CustomWeekdays =
|
|
2032
|
-
return /* @__PURE__ */
|
|
1943
|
+
const CustomWeekdays = React6.memo(({ className: className2, children, ...props2 }) => {
|
|
1944
|
+
return /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { className: cn("text-xs text-sec-500", className2), ...props2, children }) });
|
|
2033
1945
|
});
|
|
2034
1946
|
CustomWeekdays.displayName = "CustomWeekdays";
|
|
2035
|
-
const
|
|
1947
|
+
const CustomMonthWithProps = React6.useCallback((props2) => {
|
|
1948
|
+
return /* @__PURE__ */ jsx(
|
|
1949
|
+
CustomMonth,
|
|
1950
|
+
{
|
|
1951
|
+
...props2,
|
|
1952
|
+
captionLayout,
|
|
1953
|
+
startMonth,
|
|
1954
|
+
endMonth
|
|
1955
|
+
}
|
|
1956
|
+
);
|
|
1957
|
+
}, [captionLayout, startMonth, endMonth]);
|
|
1958
|
+
const CustomMonthCaptionWrapper = React6.memo((_props) => {
|
|
1959
|
+
return null;
|
|
1960
|
+
});
|
|
1961
|
+
CustomMonthCaptionWrapper.displayName = "CustomMonthCaptionWrapper";
|
|
1962
|
+
const defaultComponents = React6.useMemo(() => ({
|
|
2036
1963
|
Root: CustomRoot,
|
|
2037
1964
|
Months: CustomMonths,
|
|
2038
|
-
Month:
|
|
1965
|
+
Month: CustomMonthWithProps,
|
|
2039
1966
|
MonthGrid: CustomMonthGrid,
|
|
2040
|
-
// MonthCaption is
|
|
1967
|
+
// MonthCaption returns null - actual caption is rendered in CustomMonth inside <caption>
|
|
1968
|
+
MonthCaption: CustomMonthCaptionWrapper,
|
|
2041
1969
|
Weekdays: CustomWeekdays,
|
|
2042
1970
|
// Spread user components AFTER ours so ours take precedence
|
|
2043
1971
|
...components || {}
|
|
2044
|
-
}), [components, CustomRoot, CustomMonths,
|
|
2045
|
-
return /* @__PURE__ */
|
|
1972
|
+
}), [components, CustomRoot, CustomMonths, CustomMonthWithProps, CustomMonthCaptionWrapper, CustomWeekdays]);
|
|
1973
|
+
return /* @__PURE__ */ jsx(
|
|
2046
1974
|
DayPicker,
|
|
2047
1975
|
{
|
|
2048
1976
|
...mode ? { mode } : {},
|
|
@@ -2118,14 +2046,8 @@ var Calendar = React7.forwardRef(
|
|
|
2118
2046
|
}
|
|
2119
2047
|
);
|
|
2120
2048
|
Calendar.displayName = "Calendar";
|
|
2121
|
-
|
|
2122
|
-
// src/components/Toast/Toast.tsx
|
|
2123
|
-
import * as React8 from "react";
|
|
2124
|
-
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
2125
|
-
import { X } from "lucide-react";
|
|
2126
|
-
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2127
2049
|
var ToastProvider = ToastPrimitives.Provider;
|
|
2128
|
-
var ToastViewport =
|
|
2050
|
+
var ToastViewport = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2129
2051
|
ToastPrimitives.Viewport,
|
|
2130
2052
|
{
|
|
2131
2053
|
ref,
|
|
@@ -2138,8 +2060,8 @@ var ToastViewport = React8.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
2138
2060
|
}
|
|
2139
2061
|
));
|
|
2140
2062
|
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
2141
|
-
var Toast =
|
|
2142
|
-
return /* @__PURE__ */
|
|
2063
|
+
var Toast = React6.forwardRef(({ className, ...props }, ref) => {
|
|
2064
|
+
return /* @__PURE__ */ jsx(
|
|
2143
2065
|
ToastPrimitives.Root,
|
|
2144
2066
|
{
|
|
2145
2067
|
ref,
|
|
@@ -2153,7 +2075,7 @@ var Toast = React8.forwardRef(({ className, ...props }, ref) => {
|
|
|
2153
2075
|
);
|
|
2154
2076
|
});
|
|
2155
2077
|
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
2156
|
-
var ToastAction =
|
|
2078
|
+
var ToastAction = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2157
2079
|
ToastPrimitives.Action,
|
|
2158
2080
|
{
|
|
2159
2081
|
ref,
|
|
@@ -2166,7 +2088,7 @@ var ToastAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2166
2088
|
}
|
|
2167
2089
|
));
|
|
2168
2090
|
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
2169
|
-
var ToastClose =
|
|
2091
|
+
var ToastClose = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2170
2092
|
ToastPrimitives.Close,
|
|
2171
2093
|
{
|
|
2172
2094
|
ref,
|
|
@@ -2177,11 +2099,11 @@ var ToastClose = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2177
2099
|
),
|
|
2178
2100
|
"toast-close": "",
|
|
2179
2101
|
...props,
|
|
2180
|
-
children: /* @__PURE__ */
|
|
2102
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4" })
|
|
2181
2103
|
}
|
|
2182
2104
|
));
|
|
2183
2105
|
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
2184
|
-
var ToastTitle =
|
|
2106
|
+
var ToastTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2185
2107
|
ToastPrimitives.Title,
|
|
2186
2108
|
{
|
|
2187
2109
|
ref,
|
|
@@ -2191,7 +2113,7 @@ var ToastTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2191
2113
|
}
|
|
2192
2114
|
));
|
|
2193
2115
|
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
2194
|
-
var ToastDescription =
|
|
2116
|
+
var ToastDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2195
2117
|
ToastPrimitives.Description,
|
|
2196
2118
|
{
|
|
2197
2119
|
ref,
|
|
@@ -2203,24 +2125,19 @@ var ToastDescription = React8.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
2203
2125
|
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
2204
2126
|
function Toaster() {
|
|
2205
2127
|
const { toasts } = useToast();
|
|
2206
|
-
return /* @__PURE__ */
|
|
2207
|
-
/* @__PURE__ */
|
|
2128
|
+
return /* @__PURE__ */ jsxs(ToastProvider, { "data-testid": "toast-provider", children: [
|
|
2129
|
+
/* @__PURE__ */ jsx(ToastViewport, {}),
|
|
2208
2130
|
toasts.map((toast) => {
|
|
2209
2131
|
const { id, title, description, action, dismiss, duration, ...toastProps } = toast;
|
|
2210
|
-
return /* @__PURE__ */
|
|
2211
|
-
title && /* @__PURE__ */
|
|
2212
|
-
description && /* @__PURE__ */
|
|
2132
|
+
return /* @__PURE__ */ jsxs(Toast, { ...toastProps, duration, children: [
|
|
2133
|
+
title && /* @__PURE__ */ jsx(ToastTitle, { children: title }),
|
|
2134
|
+
description && /* @__PURE__ */ jsx(ToastDescription, { children: description }),
|
|
2213
2135
|
action && action,
|
|
2214
|
-
/* @__PURE__ */
|
|
2136
|
+
/* @__PURE__ */ jsx(ToastClose, { onClick: dismiss })
|
|
2215
2137
|
] }, id);
|
|
2216
2138
|
})
|
|
2217
2139
|
] });
|
|
2218
2140
|
}
|
|
2219
|
-
|
|
2220
|
-
// src/components/Form/Form.tsx
|
|
2221
|
-
import { useForm, FormProvider, useFormContext, Controller } from "react-hook-form";
|
|
2222
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
2223
|
-
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2224
2141
|
function Form({
|
|
2225
2142
|
schema,
|
|
2226
2143
|
defaultValues,
|
|
@@ -2230,14 +2147,281 @@ function Form({
|
|
|
2230
2147
|
children,
|
|
2231
2148
|
className
|
|
2232
2149
|
}) {
|
|
2150
|
+
const location = useLocation();
|
|
2151
|
+
const auth = useUnifiedAuth();
|
|
2152
|
+
const userId = auth.user?.id || null;
|
|
2153
|
+
const fieldNames = useMemo(() => {
|
|
2154
|
+
if (schema && "shape" in schema && typeof schema.shape === "object") {
|
|
2155
|
+
return Object.keys(schema.shape);
|
|
2156
|
+
}
|
|
2157
|
+
if (defaultValues) {
|
|
2158
|
+
return Object.keys(defaultValues);
|
|
2159
|
+
}
|
|
2160
|
+
return [];
|
|
2161
|
+
}, [schema, defaultValues]);
|
|
2162
|
+
const persistenceKey = useMemo(() => {
|
|
2163
|
+
return deriveFormKey(
|
|
2164
|
+
{
|
|
2165
|
+
fieldNames
|
|
2166
|
+
},
|
|
2167
|
+
null,
|
|
2168
|
+
// Parent context (Dialog) - not available yet, can be enhanced later
|
|
2169
|
+
location,
|
|
2170
|
+
userId
|
|
2171
|
+
);
|
|
2172
|
+
}, [fieldNames, location, userId]);
|
|
2173
|
+
const fieldTypes = useMemo(() => {
|
|
2174
|
+
const types = {};
|
|
2175
|
+
if (schema && "shape" in schema && typeof schema.shape === "object") {
|
|
2176
|
+
const shape = schema.shape;
|
|
2177
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
2178
|
+
if (value && typeof value === "object" && "_def" in value) {
|
|
2179
|
+
const def = value._def;
|
|
2180
|
+
if (def.typeName === "ZodString") {
|
|
2181
|
+
types[key] = "text";
|
|
2182
|
+
} else if (def.typeName === "ZodNumber") {
|
|
2183
|
+
types[key] = "number";
|
|
2184
|
+
} else if (def.typeName === "ZodBoolean") {
|
|
2185
|
+
types[key] = "checkbox";
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
return types;
|
|
2191
|
+
}, [schema]);
|
|
2192
|
+
const { state: persistedValues, setState: setPersistedValues, clearDraft } = useSessionDraft(
|
|
2193
|
+
persistenceKey || "form:no-key",
|
|
2194
|
+
{},
|
|
2195
|
+
{
|
|
2196
|
+
enabled: Boolean(persistenceKey),
|
|
2197
|
+
debounceMs: 300
|
|
2198
|
+
}
|
|
2199
|
+
);
|
|
2200
|
+
const mergedDefaultValues = useMemo(() => {
|
|
2201
|
+
if (!persistenceKey || !persistedValues || Object.keys(persistedValues).length === 0) {
|
|
2202
|
+
return defaultValues;
|
|
2203
|
+
}
|
|
2204
|
+
const filteredPersisted = filterSensitiveFields(
|
|
2205
|
+
persistedValues,
|
|
2206
|
+
fieldNames,
|
|
2207
|
+
fieldTypes
|
|
2208
|
+
);
|
|
2209
|
+
return {
|
|
2210
|
+
...defaultValues,
|
|
2211
|
+
...filteredPersisted
|
|
2212
|
+
};
|
|
2213
|
+
}, [defaultValues, persistedValues, persistenceKey, fieldNames, fieldTypes]);
|
|
2233
2214
|
const methods = useForm({
|
|
2234
2215
|
resolver: schema ? zodResolver(schema) : void 0,
|
|
2235
|
-
defaultValues,
|
|
2216
|
+
defaultValues: mergedDefaultValues,
|
|
2236
2217
|
mode,
|
|
2237
2218
|
shouldUnregister: false
|
|
2238
2219
|
});
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2220
|
+
const hasRestoredRef = useRef(false);
|
|
2221
|
+
const isRestoringRef = useRef(false);
|
|
2222
|
+
const restoreTimeoutRef = useRef(null);
|
|
2223
|
+
const lastRestoredRef = useRef(null);
|
|
2224
|
+
useEffect(() => {
|
|
2225
|
+
if (restoreTimeoutRef.current) {
|
|
2226
|
+
clearTimeout(restoreTimeoutRef.current);
|
|
2227
|
+
}
|
|
2228
|
+
if (isRestoringRef.current) {
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
if (!persistenceKey || !persistedValues || Object.keys(persistedValues).length === 0) {
|
|
2232
|
+
if (!hasRestoredRef.current) {
|
|
2233
|
+
hasRestoredRef.current = true;
|
|
2234
|
+
}
|
|
2235
|
+
return;
|
|
2236
|
+
}
|
|
2237
|
+
const persistedValuesStr = JSON.stringify(persistedValues);
|
|
2238
|
+
if (lastRestoredRef.current === persistedValuesStr && hasRestoredRef.current) {
|
|
2239
|
+
return;
|
|
2240
|
+
}
|
|
2241
|
+
isRestoringRef.current = true;
|
|
2242
|
+
restoreTimeoutRef.current = setTimeout(() => {
|
|
2243
|
+
const persistedKeys = Object.keys(persistedValues);
|
|
2244
|
+
const hasNumericKeys = persistedKeys.length > 0 && persistedKeys.every((key) => /^\d+$/.test(key));
|
|
2245
|
+
let valuesToRestore;
|
|
2246
|
+
if (hasNumericKeys && fieldNames.length === persistedKeys.length) {
|
|
2247
|
+
valuesToRestore = {};
|
|
2248
|
+
for (let i = 0; i < fieldNames.length; i++) {
|
|
2249
|
+
const fieldName = fieldNames[i];
|
|
2250
|
+
const numericKey = String(i);
|
|
2251
|
+
if (numericKey in persistedValues) {
|
|
2252
|
+
valuesToRestore[fieldName] = persistedValues[numericKey];
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
console.log("[Form Persistence] Mapped numeric keys to field names:", {
|
|
2256
|
+
numericKeys: persistedKeys,
|
|
2257
|
+
fieldNames,
|
|
2258
|
+
mappedValues: valuesToRestore
|
|
2259
|
+
});
|
|
2260
|
+
} else {
|
|
2261
|
+
valuesToRestore = persistedValues;
|
|
2262
|
+
}
|
|
2263
|
+
const restoreKeys = Object.keys(valuesToRestore);
|
|
2264
|
+
const filteredPersisted = filterSensitiveFields(
|
|
2265
|
+
valuesToRestore,
|
|
2266
|
+
restoreKeys.length > 0 ? restoreKeys : fieldNames,
|
|
2267
|
+
fieldTypes
|
|
2268
|
+
);
|
|
2269
|
+
const sensitiveFields = restoreKeys.filter((name) => {
|
|
2270
|
+
const type = fieldTypes?.[name];
|
|
2271
|
+
return isSensitiveField(name, type);
|
|
2272
|
+
});
|
|
2273
|
+
console.log("[Form Persistence] \u2705 Restoring persisted values:", {
|
|
2274
|
+
persistenceKey,
|
|
2275
|
+
persistedValuesKeys: persistedKeys,
|
|
2276
|
+
persistedValuesString: JSON.stringify(persistedValues),
|
|
2277
|
+
hasNumericKeys,
|
|
2278
|
+
valuesToRestoreKeys: Object.keys(valuesToRestore),
|
|
2279
|
+
filteredPersistedKeys: Object.keys(filteredPersisted),
|
|
2280
|
+
fieldNames,
|
|
2281
|
+
sensitiveFields,
|
|
2282
|
+
filteredCount: Object.keys(filteredPersisted).length,
|
|
2283
|
+
persistedCount: persistedKeys.length,
|
|
2284
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2285
|
+
});
|
|
2286
|
+
const valuesToSet = {};
|
|
2287
|
+
let hasValuesToSet = false;
|
|
2288
|
+
for (const [key, value] of Object.entries(filteredPersisted)) {
|
|
2289
|
+
const currentValue = methods.getValues(key);
|
|
2290
|
+
if (currentValue !== value) {
|
|
2291
|
+
valuesToSet[key] = value;
|
|
2292
|
+
hasValuesToSet = true;
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
if (hasValuesToSet) {
|
|
2296
|
+
console.log("[Form Persistence] \u{1F504} Setting form values via reset():", {
|
|
2297
|
+
persistenceKey,
|
|
2298
|
+
valuesToSetKeys: Object.keys(valuesToSet),
|
|
2299
|
+
valuesToSet,
|
|
2300
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2301
|
+
});
|
|
2302
|
+
methods.reset({
|
|
2303
|
+
...methods.getValues(),
|
|
2304
|
+
...valuesToSet
|
|
2305
|
+
});
|
|
2306
|
+
console.log("[Form Persistence] \u2705 Form values set successfully", {
|
|
2307
|
+
persistenceKey,
|
|
2308
|
+
currentValues: methods.getValues()
|
|
2309
|
+
});
|
|
2310
|
+
} else {
|
|
2311
|
+
console.log("[Form Persistence] \u23ED\uFE0F No values to set (all values already match)", {
|
|
2312
|
+
persistenceKey
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
lastRestoredRef.current = persistedValuesStr;
|
|
2316
|
+
hasRestoredRef.current = true;
|
|
2317
|
+
isRestoringRef.current = false;
|
|
2318
|
+
restoreTimeoutRef.current = null;
|
|
2319
|
+
}, 100);
|
|
2320
|
+
return () => {
|
|
2321
|
+
if (restoreTimeoutRef.current) {
|
|
2322
|
+
clearTimeout(restoreTimeoutRef.current);
|
|
2323
|
+
restoreTimeoutRef.current = null;
|
|
2324
|
+
}
|
|
2325
|
+
};
|
|
2326
|
+
}, [persistedValues, persistenceKey]);
|
|
2327
|
+
const watchedValues = useWatch({
|
|
2328
|
+
control: methods.control
|
|
2329
|
+
// Don't pass name - we want all values as an object, not an array
|
|
2330
|
+
});
|
|
2331
|
+
const previousValuesRef = useRef(null);
|
|
2332
|
+
const persistTimeoutRef = useRef(null);
|
|
2333
|
+
useEffect(() => {
|
|
2334
|
+
if (!persistenceKey || !watchedValues || isRestoringRef.current) {
|
|
2335
|
+
return;
|
|
2336
|
+
}
|
|
2337
|
+
const currentValuesStr = JSON.stringify(watchedValues);
|
|
2338
|
+
if (currentValuesStr === previousValuesRef.current) {
|
|
2339
|
+
return;
|
|
2340
|
+
}
|
|
2341
|
+
previousValuesRef.current = currentValuesStr;
|
|
2342
|
+
if (persistTimeoutRef.current) {
|
|
2343
|
+
clearTimeout(persistTimeoutRef.current);
|
|
2344
|
+
}
|
|
2345
|
+
persistTimeoutRef.current = setTimeout(() => {
|
|
2346
|
+
const allFieldNames = Object.keys(watchedValues);
|
|
2347
|
+
const filteredValues = filterSensitiveFields(
|
|
2348
|
+
watchedValues,
|
|
2349
|
+
allFieldNames.length > 0 ? allFieldNames : fieldNames,
|
|
2350
|
+
fieldTypes
|
|
2351
|
+
);
|
|
2352
|
+
const sensitiveFields = allFieldNames.filter((name) => {
|
|
2353
|
+
const type = fieldTypes?.[name];
|
|
2354
|
+
return isSensitiveField(name, type);
|
|
2355
|
+
});
|
|
2356
|
+
console.log("[Form Persistence] \u{1F4BE} Persisting form values:", {
|
|
2357
|
+
persistenceKey,
|
|
2358
|
+
filteredValuesKeys: Object.keys(filteredValues),
|
|
2359
|
+
originalValuesKeys: Object.keys(watchedValues),
|
|
2360
|
+
allFieldNames,
|
|
2361
|
+
sensitiveFields,
|
|
2362
|
+
filteredCount: Object.keys(filteredValues).length,
|
|
2363
|
+
originalCount: allFieldNames.length,
|
|
2364
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2365
|
+
});
|
|
2366
|
+
setPersistedValues(filteredValues);
|
|
2367
|
+
if (persistenceKey) {
|
|
2368
|
+
setTimeout(() => {
|
|
2369
|
+
const storageKey = `pace-core:draft:${persistenceKey}`;
|
|
2370
|
+
const stored = sessionStorage.getItem(storageKey);
|
|
2371
|
+
console.log("[Form Persistence] \u{1F4E6} SessionStorage AFTER setPersistedValues:", {
|
|
2372
|
+
persistenceKey,
|
|
2373
|
+
storageKey,
|
|
2374
|
+
stored: stored ? JSON.parse(stored) : null
|
|
2375
|
+
});
|
|
2376
|
+
}, 100);
|
|
2377
|
+
}
|
|
2378
|
+
persistTimeoutRef.current = null;
|
|
2379
|
+
}, 300);
|
|
2380
|
+
return () => {
|
|
2381
|
+
if (persistTimeoutRef.current) {
|
|
2382
|
+
clearTimeout(persistTimeoutRef.current);
|
|
2383
|
+
persistTimeoutRef.current = null;
|
|
2384
|
+
}
|
|
2385
|
+
};
|
|
2386
|
+
}, [watchedValues, persistenceKey]);
|
|
2387
|
+
const handleSubmit = methods.handleSubmit(
|
|
2388
|
+
async (data) => {
|
|
2389
|
+
console.log("[Form Lifecycle] \u{1F4E4} Form submit started", {
|
|
2390
|
+
persistenceKey,
|
|
2391
|
+
dataKeys: Object.keys(data),
|
|
2392
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2393
|
+
});
|
|
2394
|
+
await onSubmit(data);
|
|
2395
|
+
console.log("[Form Lifecycle] \u2705 Form submit successful", {
|
|
2396
|
+
persistenceKey,
|
|
2397
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2398
|
+
});
|
|
2399
|
+
if (persistenceKey && clearDraft) {
|
|
2400
|
+
console.log("[Form Persistence] \u{1F5D1}\uFE0F Clearing draft after successful submit", {
|
|
2401
|
+
persistenceKey
|
|
2402
|
+
});
|
|
2403
|
+
clearDraft();
|
|
2404
|
+
setTimeout(() => {
|
|
2405
|
+
const storageKey = `pace-core:draft:${persistenceKey}`;
|
|
2406
|
+
const stored = sessionStorage.getItem(storageKey);
|
|
2407
|
+
console.log("[Form Persistence] \u{1F4E6} SessionStorage AFTER clearDraft (submit):", {
|
|
2408
|
+
persistenceKey,
|
|
2409
|
+
storageKey,
|
|
2410
|
+
stored: stored ? JSON.parse(stored) : null
|
|
2411
|
+
});
|
|
2412
|
+
}, 100);
|
|
2413
|
+
}
|
|
2414
|
+
},
|
|
2415
|
+
(errors) => {
|
|
2416
|
+
console.log("[Form Lifecycle] \u274C Form submit failed with errors", {
|
|
2417
|
+
persistenceKey,
|
|
2418
|
+
errors,
|
|
2419
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2420
|
+
});
|
|
2421
|
+
onError?.(errors);
|
|
2422
|
+
}
|
|
2423
|
+
);
|
|
2424
|
+
return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: typeof children === "function" ? children(methods) : children }) });
|
|
2241
2425
|
}
|
|
2242
2426
|
function FormField({
|
|
2243
2427
|
name,
|
|
@@ -2251,12 +2435,12 @@ function FormField({
|
|
|
2251
2435
|
className
|
|
2252
2436
|
}) {
|
|
2253
2437
|
const { control } = useFormContext();
|
|
2254
|
-
return /* @__PURE__ */
|
|
2255
|
-
label && /* @__PURE__ */
|
|
2438
|
+
return /* @__PURE__ */ jsxs("label", { className: cn("space-y-2", className), children: [
|
|
2439
|
+
label && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2256
2440
|
label,
|
|
2257
|
-
validation?.required && /* @__PURE__ */
|
|
2441
|
+
validation?.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", "aria-label": "required", children: "*" })
|
|
2258
2442
|
] }),
|
|
2259
|
-
/* @__PURE__ */
|
|
2443
|
+
/* @__PURE__ */ jsx(
|
|
2260
2444
|
Controller,
|
|
2261
2445
|
{
|
|
2262
2446
|
name,
|
|
@@ -2269,8 +2453,8 @@ function FormField({
|
|
|
2269
2453
|
if (render) {
|
|
2270
2454
|
return render(props);
|
|
2271
2455
|
}
|
|
2272
|
-
return /* @__PURE__ */
|
|
2273
|
-
/* @__PURE__ */
|
|
2456
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2457
|
+
/* @__PURE__ */ jsx(
|
|
2274
2458
|
"input",
|
|
2275
2459
|
{
|
|
2276
2460
|
...field,
|
|
@@ -2286,18 +2470,14 @@ function FormField({
|
|
|
2286
2470
|
...inputProps
|
|
2287
2471
|
}
|
|
2288
2472
|
),
|
|
2289
|
-
errorMessage && /* @__PURE__ */
|
|
2473
|
+
errorMessage && /* @__PURE__ */ jsx("p", { className: "text-destructive", role: "alert", children: errorMessage })
|
|
2290
2474
|
] });
|
|
2291
2475
|
}
|
|
2292
2476
|
}
|
|
2293
2477
|
)
|
|
2294
2478
|
] });
|
|
2295
2479
|
}
|
|
2296
|
-
|
|
2297
|
-
// src/components/LoginForm/LoginForm.tsx
|
|
2298
|
-
import React9, { useState as useState7, useCallback as useCallback7, useMemo as useMemo4 } from "react";
|
|
2299
|
-
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2300
|
-
var LoginForm = React9.memo(({
|
|
2480
|
+
var LoginForm = React6__default.memo(({
|
|
2301
2481
|
onSignIn,
|
|
2302
2482
|
onSuccess,
|
|
2303
2483
|
onError,
|
|
@@ -2309,9 +2489,9 @@ var LoginForm = React9.memo(({
|
|
|
2309
2489
|
onSignUp,
|
|
2310
2490
|
className
|
|
2311
2491
|
}) => {
|
|
2312
|
-
const [formData, setFormData] =
|
|
2313
|
-
const [error, setError] =
|
|
2314
|
-
const isFormValid =
|
|
2492
|
+
const [formData, setFormData] = useState({ email: "", password: "" });
|
|
2493
|
+
const [error, setError] = useState(null);
|
|
2494
|
+
const isFormValid = useMemo(() => {
|
|
2315
2495
|
return formData.email.length > 0 && formData.password.length > 0;
|
|
2316
2496
|
}, [formData.email, formData.password]);
|
|
2317
2497
|
const handleEmailChange = (e) => {
|
|
@@ -2320,7 +2500,7 @@ var LoginForm = React9.memo(({
|
|
|
2320
2500
|
const handlePasswordChange = (e) => {
|
|
2321
2501
|
setFormData((prev) => ({ ...prev, password: e.target.value }));
|
|
2322
2502
|
};
|
|
2323
|
-
const handleSubmit =
|
|
2503
|
+
const handleSubmit = useCallback(async (e) => {
|
|
2324
2504
|
e.preventDefault();
|
|
2325
2505
|
setError(null);
|
|
2326
2506
|
if (!isFormValid || isLoading) return;
|
|
@@ -2336,17 +2516,17 @@ var LoginForm = React9.memo(({
|
|
|
2336
2516
|
const handleSignUpClick = () => {
|
|
2337
2517
|
onSignUp?.();
|
|
2338
2518
|
};
|
|
2339
|
-
const displayTitle =
|
|
2340
|
-
const displaySubtitle =
|
|
2341
|
-
return /* @__PURE__ */
|
|
2342
|
-
/* @__PURE__ */
|
|
2343
|
-
/* @__PURE__ */
|
|
2344
|
-
/* @__PURE__ */
|
|
2519
|
+
const displayTitle = useMemo(() => title || (appName ? `Sign in to ${appName}` : "Sign In"), [title, appName]);
|
|
2520
|
+
const displaySubtitle = useMemo(() => subtitle || "Enter your credentials to continue.", [subtitle]);
|
|
2521
|
+
return /* @__PURE__ */ jsx(Card, { className: cn("w-full max-w-md mx-auto", className), children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, "data-testid": "login-form", children: [
|
|
2522
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "space-y-1", children: [
|
|
2523
|
+
/* @__PURE__ */ jsx(CardTitle, { className: "text-2xl text-center", children: displayTitle }),
|
|
2524
|
+
/* @__PURE__ */ jsx(CardDescription, { className: "text-center", children: displaySubtitle })
|
|
2345
2525
|
] }),
|
|
2346
|
-
/* @__PURE__ */
|
|
2347
|
-
error && /* @__PURE__ */
|
|
2348
|
-
/* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2526
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
2527
|
+
error && /* @__PURE__ */ jsx(Alert, { variant: "destructive", role: "alert", "aria-live": "assertive", children: /* @__PURE__ */ jsx(AlertDescription, { children: error }) }),
|
|
2528
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "email", children: "Email" }),
|
|
2529
|
+
/* @__PURE__ */ jsx(
|
|
2350
2530
|
Input,
|
|
2351
2531
|
{
|
|
2352
2532
|
id: "email",
|
|
@@ -2358,8 +2538,8 @@ var LoginForm = React9.memo(({
|
|
|
2358
2538
|
disabled: isLoading
|
|
2359
2539
|
}
|
|
2360
2540
|
),
|
|
2361
|
-
/* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2541
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "password", children: "Password" }),
|
|
2542
|
+
/* @__PURE__ */ jsx(
|
|
2363
2543
|
Input,
|
|
2364
2544
|
{
|
|
2365
2545
|
id: "password",
|
|
@@ -2372,8 +2552,8 @@ var LoginForm = React9.memo(({
|
|
|
2372
2552
|
}
|
|
2373
2553
|
)
|
|
2374
2554
|
] }),
|
|
2375
|
-
/* @__PURE__ */
|
|
2376
|
-
/* @__PURE__ */
|
|
2555
|
+
/* @__PURE__ */ jsxs(CardFooter, { className: "flex flex-col space-y-4", children: [
|
|
2556
|
+
/* @__PURE__ */ jsx(
|
|
2377
2557
|
Button,
|
|
2378
2558
|
{
|
|
2379
2559
|
type: "submit",
|
|
@@ -2382,7 +2562,7 @@ var LoginForm = React9.memo(({
|
|
|
2382
2562
|
children: isLoading ? "Signing in..." : "Sign In"
|
|
2383
2563
|
}
|
|
2384
2564
|
),
|
|
2385
|
-
showSignUp && (onSignUp ? /* @__PURE__ */
|
|
2565
|
+
showSignUp && (onSignUp ? /* @__PURE__ */ jsx("p", { className: "text-sm text-center text-muted-foreground", children: /* @__PURE__ */ jsx(
|
|
2386
2566
|
"button",
|
|
2387
2567
|
{
|
|
2388
2568
|
type: "button",
|
|
@@ -2390,19 +2570,14 @@ var LoginForm = React9.memo(({
|
|
|
2390
2570
|
className: "text-primary hover:underline",
|
|
2391
2571
|
children: "Don't have an account? Sign up"
|
|
2392
2572
|
}
|
|
2393
|
-
) }) : /* @__PURE__ */
|
|
2573
|
+
) }) : /* @__PURE__ */ jsxs("p", { className: "text-center text-muted-foreground", children: [
|
|
2394
2574
|
"Don't have an account?",
|
|
2395
2575
|
" ",
|
|
2396
|
-
/* @__PURE__ */
|
|
2576
|
+
/* @__PURE__ */ jsx("a", { href: "/signup", className: "text-primary hover:underline", children: "Sign up" })
|
|
2397
2577
|
] }))
|
|
2398
2578
|
] })
|
|
2399
2579
|
] }) });
|
|
2400
2580
|
});
|
|
2401
|
-
|
|
2402
|
-
// src/components/ContextSelector/ContextSelector.tsx
|
|
2403
|
-
import { useMemo as useMemo5 } from "react";
|
|
2404
|
-
import { RefreshCw, AlertCircle, Building2, Calendar as Calendar2 } from "lucide-react";
|
|
2405
|
-
import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2406
2581
|
function ContextSelector({
|
|
2407
2582
|
placeholder = "Select organisation or event",
|
|
2408
2583
|
className,
|
|
@@ -2433,7 +2608,7 @@ function ContextSelector({
|
|
|
2433
2608
|
const isLoading = showOrganisations && orgLoading || showEvents && eventLoading;
|
|
2434
2609
|
const hasError = showOrganisations && orgError || showEvents && eventError;
|
|
2435
2610
|
const hasItems = showOrganisations && (organisations?.length || 0) > 0 || showEvents && (events?.length || 0) > 0;
|
|
2436
|
-
const currentValue =
|
|
2611
|
+
const currentValue = useMemo(() => {
|
|
2437
2612
|
if (showEvents && selectedEvent) {
|
|
2438
2613
|
return `event:${selectedEvent.event_id || selectedEvent.id}`;
|
|
2439
2614
|
}
|
|
@@ -2472,9 +2647,10 @@ function ContextSelector({
|
|
|
2472
2647
|
};
|
|
2473
2648
|
if (isLoading && !hasItems) {
|
|
2474
2649
|
const loadingText = compact ? "Loading..." : showOrganisations && showEvents ? "Loading organisations and events..." : showOrganisations ? "Loading organisations..." : "Loading events...";
|
|
2475
|
-
return /* @__PURE__ */
|
|
2476
|
-
/* @__PURE__ */
|
|
2477
|
-
/* @__PURE__ */
|
|
2650
|
+
return /* @__PURE__ */ jsxs("p", { className, children: [
|
|
2651
|
+
/* @__PURE__ */ jsx(LoadingSpinner, { size: "sm" }),
|
|
2652
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
2653
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: loadingText })
|
|
2478
2654
|
] });
|
|
2479
2655
|
}
|
|
2480
2656
|
if (hasError) {
|
|
@@ -2485,12 +2661,10 @@ function ContextSelector({
|
|
|
2485
2661
|
if (showEvents && eventError) {
|
|
2486
2662
|
errorMessages.push(`Failed to load events: ${eventError.message}`);
|
|
2487
2663
|
}
|
|
2488
|
-
return /* @__PURE__ */
|
|
2489
|
-
/* @__PURE__ */
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
] }),
|
|
2493
|
-
showRetryButton && /* @__PURE__ */ jsxs8(
|
|
2664
|
+
return /* @__PURE__ */ jsxs(Alert, { variant: "destructive", className: `space-y-2 ${className}`, children: [
|
|
2665
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "size-4" }),
|
|
2666
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: errorMessages.join(" ") }),
|
|
2667
|
+
showRetryButton && /* @__PURE__ */ jsxs(
|
|
2494
2668
|
Button,
|
|
2495
2669
|
{
|
|
2496
2670
|
variant: "outline",
|
|
@@ -2499,7 +2673,7 @@ function ContextSelector({
|
|
|
2499
2673
|
disabled: isLoading,
|
|
2500
2674
|
className: "w-full",
|
|
2501
2675
|
children: [
|
|
2502
|
-
/* @__PURE__ */
|
|
2676
|
+
/* @__PURE__ */ jsx(RefreshCw, { className: `size-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
|
|
2503
2677
|
"Retry"
|
|
2504
2678
|
]
|
|
2505
2679
|
}
|
|
@@ -2509,12 +2683,10 @@ function ContextSelector({
|
|
|
2509
2683
|
if (!hasItems) {
|
|
2510
2684
|
if (showNoItemsMessage) {
|
|
2511
2685
|
const noItemsText = showOrganisations && showEvents ? "No organisations or events available. Please contact your administrator." : showOrganisations ? "No organisations available. Please contact your administrator." : "No events available. Please contact your administrator.";
|
|
2512
|
-
return /* @__PURE__ */
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
] }),
|
|
2517
|
-
showRetryButton && /* @__PURE__ */ jsxs8(
|
|
2686
|
+
return /* @__PURE__ */ jsxs(Alert, { className: `space-y-2 ${className}`, children: [
|
|
2687
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "size-4" }),
|
|
2688
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: noItemsText }),
|
|
2689
|
+
showRetryButton && /* @__PURE__ */ jsxs(
|
|
2518
2690
|
Button,
|
|
2519
2691
|
{
|
|
2520
2692
|
variant: "outline",
|
|
@@ -2523,7 +2695,7 @@ function ContextSelector({
|
|
|
2523
2695
|
disabled: isLoading,
|
|
2524
2696
|
className: "w-full",
|
|
2525
2697
|
children: [
|
|
2526
|
-
/* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ jsx(RefreshCw, { className: `size-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
|
|
2527
2699
|
"Check Again"
|
|
2528
2700
|
]
|
|
2529
2701
|
}
|
|
@@ -2532,22 +2704,22 @@ function ContextSelector({
|
|
|
2532
2704
|
}
|
|
2533
2705
|
return null;
|
|
2534
2706
|
}
|
|
2535
|
-
const displayValue =
|
|
2707
|
+
const displayValue = useMemo(() => {
|
|
2536
2708
|
if (showEvents && selectedEvent) {
|
|
2537
|
-
return /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2709
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2710
|
+
/* @__PURE__ */ jsx(Calendar$1, { className: "inline-block size-4 mr-2" }),
|
|
2711
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: selectedEvent.event_name })
|
|
2540
2712
|
] });
|
|
2541
2713
|
}
|
|
2542
2714
|
if (showOrganisations && selectedOrganisation) {
|
|
2543
|
-
return /* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2715
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2716
|
+
/* @__PURE__ */ jsx(Building2, { className: "inline-block size-4 mr-2" }),
|
|
2717
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: selectedOrganisation.display_name })
|
|
2546
2718
|
] });
|
|
2547
2719
|
}
|
|
2548
2720
|
return null;
|
|
2549
2721
|
}, [showOrganisations, showEvents, selectedOrganisation, selectedEvent]);
|
|
2550
|
-
const effectivePlaceholder =
|
|
2722
|
+
const effectivePlaceholder = useMemo(() => {
|
|
2551
2723
|
if (placeholder !== "Select organisation or event") {
|
|
2552
2724
|
return placeholder;
|
|
2553
2725
|
}
|
|
@@ -2562,55 +2734,55 @@ function ContextSelector({
|
|
|
2562
2734
|
}
|
|
2563
2735
|
return placeholder;
|
|
2564
2736
|
}, [placeholder, showOrganisations, showEvents]);
|
|
2565
|
-
return /* @__PURE__ */
|
|
2737
|
+
return /* @__PURE__ */ jsxs(
|
|
2566
2738
|
Select,
|
|
2567
2739
|
{
|
|
2568
2740
|
value: currentValue,
|
|
2569
2741
|
onValueChange: handleValueChange,
|
|
2570
2742
|
disabled: disabled || isLoading,
|
|
2743
|
+
className,
|
|
2744
|
+
"data-testid": "context-selector",
|
|
2571
2745
|
children: [
|
|
2572
|
-
/* @__PURE__ */
|
|
2746
|
+
/* @__PURE__ */ jsx(
|
|
2573
2747
|
SelectTrigger,
|
|
2574
2748
|
{
|
|
2575
2749
|
className: "text-left",
|
|
2576
2750
|
variant: "outline",
|
|
2577
|
-
children: /* @__PURE__ */
|
|
2751
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: effectivePlaceholder, children: displayValue })
|
|
2578
2752
|
}
|
|
2579
2753
|
),
|
|
2580
|
-
/* @__PURE__ */
|
|
2581
|
-
showOrganisations && organisations && organisations.length > 0 && /* @__PURE__ */
|
|
2582
|
-
/* @__PURE__ */
|
|
2583
|
-
/* @__PURE__ */
|
|
2584
|
-
organisations.map((org) => /* @__PURE__ */
|
|
2754
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
2755
|
+
showOrganisations && organisations && organisations.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2756
|
+
/* @__PURE__ */ jsxs(SelectGroup, { children: [
|
|
2757
|
+
/* @__PURE__ */ jsx(SelectLabel, { children: "Organisations" }),
|
|
2758
|
+
organisations.map((org) => /* @__PURE__ */ jsxs(
|
|
2585
2759
|
SelectItem,
|
|
2586
2760
|
{
|
|
2587
2761
|
value: `org:${org.id}`,
|
|
2588
|
-
children:
|
|
2589
|
-
/* @__PURE__ */
|
|
2590
|
-
/* @__PURE__ */
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
] })
|
|
2762
|
+
children: [
|
|
2763
|
+
/* @__PURE__ */ jsx(Building2, { className: "inline-block size-4 mr-2" }),
|
|
2764
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: org.display_name }),
|
|
2765
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
2766
|
+
!compact && org.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: org.description })
|
|
2767
|
+
]
|
|
2595
2768
|
},
|
|
2596
2769
|
org.id
|
|
2597
2770
|
))
|
|
2598
2771
|
] }),
|
|
2599
|
-
showEvents && events && events.length > 0 && /* @__PURE__ */
|
|
2772
|
+
showEvents && events && events.length > 0 && /* @__PURE__ */ jsx(SelectSeparator, {})
|
|
2600
2773
|
] }),
|
|
2601
|
-
showEvents && events && events.length > 0 && /* @__PURE__ */
|
|
2602
|
-
/* @__PURE__ */
|
|
2603
|
-
events.map((event) => /* @__PURE__ */
|
|
2774
|
+
showEvents && events && events.length > 0 && /* @__PURE__ */ jsxs(SelectGroup, { children: [
|
|
2775
|
+
/* @__PURE__ */ jsx(SelectLabel, { children: "Events" }),
|
|
2776
|
+
events.map((event) => /* @__PURE__ */ jsxs(
|
|
2604
2777
|
SelectItem,
|
|
2605
2778
|
{
|
|
2606
2779
|
value: `event:${event.event_id || event.id}`,
|
|
2607
|
-
children:
|
|
2608
|
-
/* @__PURE__ */
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
] })
|
|
2780
|
+
children: [
|
|
2781
|
+
/* @__PURE__ */ jsx(Calendar$1, { className: " inline-block size-4 mr-2" }),
|
|
2782
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: event.event_name }),
|
|
2783
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
2784
|
+
!compact && event.event_date && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: new Date(event.event_date).toLocaleDateString() })
|
|
2785
|
+
]
|
|
2614
2786
|
},
|
|
2615
2787
|
event.event_id || event.id
|
|
2616
2788
|
))
|
|
@@ -2618,17 +2790,13 @@ function ContextSelector({
|
|
|
2618
2790
|
] })
|
|
2619
2791
|
]
|
|
2620
2792
|
}
|
|
2621
|
-
)
|
|
2793
|
+
);
|
|
2622
2794
|
}
|
|
2623
|
-
|
|
2624
|
-
// src/components/PasswordChange/PasswordChangeForm.tsx
|
|
2625
|
-
import { useState as useState8 } from "react";
|
|
2626
|
-
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2627
2795
|
function PasswordChangeForm({ onSubmit, onSuccess, className }) {
|
|
2628
|
-
const [newPassword, setNewPassword] =
|
|
2629
|
-
const [confirmPassword, setConfirmPassword] =
|
|
2630
|
-
const [error, setError] =
|
|
2631
|
-
const [isSubmitting, setIsSubmitting] =
|
|
2796
|
+
const [newPassword, setNewPassword] = useState("");
|
|
2797
|
+
const [confirmPassword, setConfirmPassword] = useState("");
|
|
2798
|
+
const [error, setError] = useState(null);
|
|
2799
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
2632
2800
|
const handleSubmit = async (e) => {
|
|
2633
2801
|
e.preventDefault();
|
|
2634
2802
|
setError(null);
|
|
@@ -2655,11 +2823,11 @@ function PasswordChangeForm({ onSubmit, onSuccess, className }) {
|
|
|
2655
2823
|
setIsSubmitting(false);
|
|
2656
2824
|
}
|
|
2657
2825
|
};
|
|
2658
|
-
return /* @__PURE__ */
|
|
2659
|
-
error && /* @__PURE__ */
|
|
2660
|
-
/* @__PURE__ */
|
|
2826
|
+
return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: [
|
|
2827
|
+
error && /* @__PURE__ */ jsx("p", { className: "grid place-items-center text-center size-full", role: "alert", children: error }),
|
|
2828
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: "new-password", className: "block mb-4", children: [
|
|
2661
2829
|
"New Password",
|
|
2662
|
-
/* @__PURE__ */
|
|
2830
|
+
/* @__PURE__ */ jsx(
|
|
2663
2831
|
Input,
|
|
2664
2832
|
{
|
|
2665
2833
|
id: "new-password",
|
|
@@ -2672,9 +2840,9 @@ function PasswordChangeForm({ onSubmit, onSuccess, className }) {
|
|
|
2672
2840
|
}
|
|
2673
2841
|
)
|
|
2674
2842
|
] }),
|
|
2675
|
-
/* @__PURE__ */
|
|
2843
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: "confirm-password", className: "block mb-4", children: [
|
|
2676
2844
|
"Confirm Password",
|
|
2677
|
-
/* @__PURE__ */
|
|
2845
|
+
/* @__PURE__ */ jsx(
|
|
2678
2846
|
Input,
|
|
2679
2847
|
{
|
|
2680
2848
|
id: "confirm-password",
|
|
@@ -2687,7 +2855,7 @@ function PasswordChangeForm({ onSubmit, onSuccess, className }) {
|
|
|
2687
2855
|
}
|
|
2688
2856
|
)
|
|
2689
2857
|
] }),
|
|
2690
|
-
/* @__PURE__ */
|
|
2858
|
+
/* @__PURE__ */ jsx(
|
|
2691
2859
|
Button,
|
|
2692
2860
|
{
|
|
2693
2861
|
type: "submit",
|
|
@@ -2698,19 +2866,14 @@ function PasswordChangeForm({ onSubmit, onSuccess, className }) {
|
|
|
2698
2866
|
)
|
|
2699
2867
|
] });
|
|
2700
2868
|
}
|
|
2701
|
-
|
|
2702
|
-
// src/components/UserMenu/UserMenu.tsx
|
|
2703
|
-
import React12, { useCallback as useCallback8, useMemo as useMemo6, useState as useState9 } from "react";
|
|
2704
|
-
import { ChevronDown, LogOut, KeyRound } from "lucide-react";
|
|
2705
|
-
import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2706
|
-
var UserMenu = React12.memo(function UserMenu2({
|
|
2869
|
+
var UserMenu = React6__default.memo(function UserMenu2({
|
|
2707
2870
|
user,
|
|
2708
2871
|
onSignOut,
|
|
2709
2872
|
onChangePassword,
|
|
2710
2873
|
className,
|
|
2711
2874
|
showAvatar = true
|
|
2712
2875
|
}) {
|
|
2713
|
-
const userInfo =
|
|
2876
|
+
const userInfo = useMemo(() => {
|
|
2714
2877
|
if (!user) return null;
|
|
2715
2878
|
return {
|
|
2716
2879
|
email: user.email,
|
|
@@ -2719,23 +2882,23 @@ var UserMenu = React12.memo(function UserMenu2({
|
|
|
2719
2882
|
initial: (user.user_metadata?.display_name || user.user_metadata?.full_name || user.email || "U").charAt(0).toUpperCase()
|
|
2720
2883
|
};
|
|
2721
2884
|
}, [user]);
|
|
2722
|
-
const handleSignOut =
|
|
2885
|
+
const handleSignOut = useCallback(async () => {
|
|
2723
2886
|
if (onSignOut) await onSignOut();
|
|
2724
2887
|
}, [onSignOut]);
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
}
|
|
2728
|
-
const [isPasswordDialogOpen, setPasswordDialogOpen] = useState9(false);
|
|
2729
|
-
const handlePasswordChange = useCallback8(async (newPassword, confirmPassword) => {
|
|
2888
|
+
const [isPasswordDialogOpen, setPasswordDialogOpen] = useState(false);
|
|
2889
|
+
const handlePasswordChange = useCallback(async (newPassword, confirmPassword) => {
|
|
2730
2890
|
if (!onChangePassword) {
|
|
2731
2891
|
return { error: { message: "Password change not configured" } };
|
|
2732
2892
|
}
|
|
2733
2893
|
return await onChangePassword(newPassword, confirmPassword);
|
|
2734
2894
|
}, [onChangePassword]);
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2895
|
+
if (!user || !userInfo) {
|
|
2896
|
+
return null;
|
|
2897
|
+
}
|
|
2898
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2899
|
+
/* @__PURE__ */ jsxs(Select, { className, children: [
|
|
2900
|
+
/* @__PURE__ */ jsx(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "flex items-center gap-2", "aria-label": userInfo.displayName, children: [
|
|
2901
|
+
showAvatar && /* @__PURE__ */ jsx(
|
|
2739
2902
|
Avatar,
|
|
2740
2903
|
{
|
|
2741
2904
|
src: userInfo.avatarUrl,
|
|
@@ -2744,36 +2907,36 @@ var UserMenu = React12.memo(function UserMenu2({
|
|
|
2744
2907
|
className: "size-7"
|
|
2745
2908
|
}
|
|
2746
2909
|
),
|
|
2747
|
-
/* @__PURE__ */
|
|
2748
|
-
/* @__PURE__ */
|
|
2910
|
+
/* @__PURE__ */ jsx("span", { children: userInfo.displayName }),
|
|
2911
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "size-4" })
|
|
2749
2912
|
] }) }),
|
|
2750
|
-
/* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
2914
|
+
/* @__PURE__ */ jsx(SelectLabel, { className: "font-normal", children: /* @__PURE__ */ jsxs("li", { className: "pt-2", children: [
|
|
2752
2915
|
userInfo.displayName,
|
|
2753
|
-
/* @__PURE__ */
|
|
2754
|
-
/* @__PURE__ */
|
|
2916
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
2917
|
+
/* @__PURE__ */ jsx("small", { children: userInfo.email })
|
|
2755
2918
|
] }) }),
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
2919
|
+
/* @__PURE__ */ jsx(SelectSeparator, {}),
|
|
2920
|
+
/* @__PURE__ */ jsxs(
|
|
2758
2921
|
SelectItem,
|
|
2759
2922
|
{
|
|
2760
2923
|
value: "change-password",
|
|
2761
2924
|
onClick: () => setPasswordDialogOpen(true),
|
|
2762
2925
|
children: [
|
|
2763
|
-
/* @__PURE__ */
|
|
2926
|
+
/* @__PURE__ */ jsx(KeyRound, { className: "inline-block mr-2 size-4" }),
|
|
2764
2927
|
"Change Password"
|
|
2765
2928
|
]
|
|
2766
2929
|
}
|
|
2767
2930
|
),
|
|
2768
|
-
/* @__PURE__ */
|
|
2769
|
-
/* @__PURE__ */
|
|
2931
|
+
/* @__PURE__ */ jsxs(SelectItem, { value: "sign-out", onClick: handleSignOut, children: [
|
|
2932
|
+
/* @__PURE__ */ jsx(LogOut, { className: "inline-block mr-2 size-4" }),
|
|
2770
2933
|
"Sign out"
|
|
2771
2934
|
] })
|
|
2772
2935
|
] })
|
|
2773
2936
|
] }),
|
|
2774
|
-
/* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
2776
|
-
/* @__PURE__ */
|
|
2937
|
+
/* @__PURE__ */ jsx(Dialog, { open: isPasswordDialogOpen, onOpenChange: setPasswordDialogOpen, children: /* @__PURE__ */ jsxs(DialogContent, { persistOpenState: false, children: [
|
|
2938
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Change Password" }) }),
|
|
2939
|
+
/* @__PURE__ */ jsx(
|
|
2777
2940
|
PasswordChangeForm,
|
|
2778
2941
|
{
|
|
2779
2942
|
onSubmit: async ({ newPassword, confirmPassword }) => {
|
|
@@ -2785,8 +2948,8 @@ var UserMenu = React12.memo(function UserMenu2({
|
|
|
2785
2948
|
] }) })
|
|
2786
2949
|
] });
|
|
2787
2950
|
});
|
|
2788
|
-
var UserMenuLoading =
|
|
2789
|
-
return /* @__PURE__ */
|
|
2951
|
+
var UserMenuLoading = React6__default.memo(function UserMenuLoading2() {
|
|
2952
|
+
return /* @__PURE__ */ jsxs(
|
|
2790
2953
|
Button,
|
|
2791
2954
|
{
|
|
2792
2955
|
type: "button",
|
|
@@ -2795,46 +2958,23 @@ var UserMenuLoading = React12.memo(function UserMenuLoading2() {
|
|
|
2795
2958
|
className: "flex items-center space-x-2",
|
|
2796
2959
|
"aria-label": "Loading user menu",
|
|
2797
2960
|
children: [
|
|
2798
|
-
/* @__PURE__ */
|
|
2799
|
-
/* @__PURE__ */
|
|
2800
|
-
/* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ jsx(LoadingSpinner, { size: "sm", className: "inline-block mr-2" }),
|
|
2962
|
+
/* @__PURE__ */ jsx("span", { className: "truncate max-w-[150px]", children: "Loading..." }),
|
|
2963
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4 text-muted-foreground" })
|
|
2801
2964
|
]
|
|
2802
2965
|
}
|
|
2803
2966
|
);
|
|
2804
2967
|
});
|
|
2805
2968
|
UserMenu.Loading = UserMenuLoading;
|
|
2806
|
-
|
|
2807
|
-
// src/components/NavigationMenu/NavigationMenu.tsx
|
|
2808
|
-
import * as React14 from "react";
|
|
2809
|
-
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
2810
|
-
|
|
2811
|
-
// src/components/NavigationMenu/useNavigationFiltering.ts
|
|
2812
|
-
import * as React13 from "react";
|
|
2813
2969
|
function useNavigationFiltering({
|
|
2814
2970
|
items,
|
|
2815
2971
|
itemsPreFiltered = false,
|
|
2816
2972
|
auditLog = true
|
|
2817
2973
|
}) {
|
|
2818
|
-
const [resolvedAppId, setResolvedAppId] =
|
|
2819
|
-
const previousFilteredItemsRef =
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
authContext = useUnifiedAuth();
|
|
2823
|
-
} catch (error) {
|
|
2824
|
-
logger.warn(
|
|
2825
|
-
"NavigationMenu",
|
|
2826
|
-
"useUnifiedAuth not available, running in unauthenticated mode"
|
|
2827
|
-
);
|
|
2828
|
-
}
|
|
2829
|
-
let rbacContext = null;
|
|
2830
|
-
try {
|
|
2831
|
-
rbacContext = useRBAC();
|
|
2832
|
-
} catch (error) {
|
|
2833
|
-
logger.warn(
|
|
2834
|
-
"NavigationMenu",
|
|
2835
|
-
"useRBAC not available, permission filtering disabled"
|
|
2836
|
-
);
|
|
2837
|
-
}
|
|
2974
|
+
const [resolvedAppId, setResolvedAppId] = React6.useState(void 0);
|
|
2975
|
+
const previousFilteredItemsRef = React6.useRef([]);
|
|
2976
|
+
const authContext = useUnifiedAuth();
|
|
2977
|
+
const rbacContext = useRBAC();
|
|
2838
2978
|
const eventLoadingRaw = authContext?.eventLoading;
|
|
2839
2979
|
const eventLoading = eventLoadingRaw ?? false;
|
|
2840
2980
|
const selectedEvent = authContext?.selectedEvent || null;
|
|
@@ -2844,16 +2984,17 @@ function useNavigationFiltering({
|
|
|
2844
2984
|
const { resolvedScope, isLoading: scopeLoading, error: scopeError } = useResolvedScope({
|
|
2845
2985
|
supabase: itemsPreFiltered ? null : supabase || null,
|
|
2846
2986
|
selectedOrganisationId: itemsPreFiltered ? null : selectedOrganisation?.id || null,
|
|
2847
|
-
selectedEventId: itemsPreFiltered ? null : selectedEvent?.event_id || null
|
|
2987
|
+
selectedEventId: itemsPreFiltered ? null : selectedEvent?.event_id || null,
|
|
2988
|
+
selectedEventOrganisationId: itemsPreFiltered ? null : selectedEvent?.organisation_id || null
|
|
2848
2989
|
});
|
|
2849
|
-
|
|
2990
|
+
React6.useEffect(() => {
|
|
2850
2991
|
if (!scopeLoading && !resolvedScope?.appId && selectedOrganisation?.id && authContext?.appName && authContext?.user?.id && !resolvedAppId) {
|
|
2851
2992
|
if (!authContext.user || !authContext.appName) {
|
|
2852
2993
|
return;
|
|
2853
2994
|
}
|
|
2854
2995
|
const userId2 = authContext.user.id;
|
|
2855
2996
|
const appName = authContext.appName;
|
|
2856
|
-
import(
|
|
2997
|
+
import('./api-Y4MQWOFW.js').then(({ resolveAppContext }) => {
|
|
2857
2998
|
resolveAppContext({
|
|
2858
2999
|
userId: userId2,
|
|
2859
3000
|
appName
|
|
@@ -2874,7 +3015,7 @@ function useNavigationFiltering({
|
|
|
2874
3015
|
authContext?.user?.id,
|
|
2875
3016
|
resolvedAppId
|
|
2876
3017
|
]);
|
|
2877
|
-
const effectiveScope =
|
|
3018
|
+
const effectiveScope = React6.useMemo(() => {
|
|
2878
3019
|
if (resolvedScope?.organisationId) {
|
|
2879
3020
|
return resolvedScope;
|
|
2880
3021
|
}
|
|
@@ -2889,7 +3030,7 @@ function useNavigationFiltering({
|
|
|
2889
3030
|
return null;
|
|
2890
3031
|
}, [resolvedScope, selectedOrganisation?.id, selectedEvent?.event_id, resolvedAppId]);
|
|
2891
3032
|
const scopeKey = effectiveScope ? `${effectiveScope.organisationId || ""}-${effectiveScope.eventId || ""}-${effectiveScope.appId || ""}` : "empty";
|
|
2892
|
-
const stableScope =
|
|
3033
|
+
const stableScope = React6.useMemo(() => {
|
|
2893
3034
|
if (effectiveScope?.organisationId) {
|
|
2894
3035
|
return {
|
|
2895
3036
|
organisationId: effectiveScope.organisationId,
|
|
@@ -2915,7 +3056,7 @@ function useNavigationFiltering({
|
|
|
2915
3056
|
itemsPreFiltered ? void 0 : stableScope.eventId,
|
|
2916
3057
|
itemsPreFiltered ? void 0 : stableScope.appId
|
|
2917
3058
|
);
|
|
2918
|
-
const filteredItems =
|
|
3059
|
+
const filteredItems = React6.useMemo(() => {
|
|
2919
3060
|
if (itemsPreFiltered && items && items.length > 0) {
|
|
2920
3061
|
const visibleItems = (items || []).filter((item) => !item.meta?.hidden);
|
|
2921
3062
|
previousFilteredItemsRef.current = visibleItems;
|
|
@@ -3094,10 +3235,7 @@ function useNavigationFiltering({
|
|
|
3094
3235
|
hasAnyPermission: hasAnyPermission || null
|
|
3095
3236
|
};
|
|
3096
3237
|
}
|
|
3097
|
-
|
|
3098
|
-
// src/components/NavigationMenu/NavigationMenu.tsx
|
|
3099
|
-
import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3100
|
-
var NavigationMenu = React14.forwardRef(({
|
|
3238
|
+
var NavigationMenu = React6.forwardRef(({
|
|
3101
3239
|
items,
|
|
3102
3240
|
mode = "dropdown",
|
|
3103
3241
|
currentPath,
|
|
@@ -3115,8 +3253,8 @@ var NavigationMenu = React14.forwardRef(({
|
|
|
3115
3253
|
itemsPreFiltered = false,
|
|
3116
3254
|
...props
|
|
3117
3255
|
}, ref) => {
|
|
3118
|
-
const [expandedItems, setExpandedItems] =
|
|
3119
|
-
const buttonRef =
|
|
3256
|
+
const [expandedItems, setExpandedItems] = React6.useState(/* @__PURE__ */ new Set());
|
|
3257
|
+
const buttonRef = React6.useRef(null);
|
|
3120
3258
|
const { authContext, rbacContext, filteredItems, permissionMap, hasAnyPermission } = useNavigationFiltering({ items, itemsPreFiltered, auditLog });
|
|
3121
3259
|
const handleHierarchicalKeyDown = (event, item) => {
|
|
3122
3260
|
switch (event.key) {
|
|
@@ -3146,8 +3284,6 @@ var NavigationMenu = React14.forwardRef(({
|
|
|
3146
3284
|
setExpandedItems(newExpanded);
|
|
3147
3285
|
};
|
|
3148
3286
|
const handleItemClick = (item) => {
|
|
3149
|
-
if (auditLog) {
|
|
3150
|
-
}
|
|
3151
3287
|
if (!authContext) {
|
|
3152
3288
|
if (onNavigate) {
|
|
3153
3289
|
onNavigate(item);
|
|
@@ -3239,8 +3375,8 @@ var NavigationMenu = React14.forwardRef(({
|
|
|
3239
3375
|
const hasChildren = item.children && item.children.length > 0;
|
|
3240
3376
|
const isExpanded = expandedItems.has(item.id);
|
|
3241
3377
|
const itemIsActive = isActiveItem(item);
|
|
3242
|
-
return /* @__PURE__ */
|
|
3243
|
-
/* @__PURE__ */
|
|
3378
|
+
return /* @__PURE__ */ jsx("li", { role: "none", children: hasChildren ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3379
|
+
/* @__PURE__ */ jsxs(
|
|
3244
3380
|
"button",
|
|
3245
3381
|
{
|
|
3246
3382
|
onClick: () => toggleExpanded(item.id),
|
|
@@ -3249,21 +3385,21 @@ var NavigationMenu = React14.forwardRef(({
|
|
|
3249
3385
|
"aria-controls": `submenu-${item.id}`,
|
|
3250
3386
|
"aria-current": itemIsActive ? "page" : void 0,
|
|
3251
3387
|
children: [
|
|
3252
|
-
/* @__PURE__ */
|
|
3253
|
-
/* @__PURE__ */
|
|
3388
|
+
/* @__PURE__ */ jsx("span", { children: item.label }),
|
|
3389
|
+
/* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true" })
|
|
3254
3390
|
]
|
|
3255
3391
|
}
|
|
3256
3392
|
),
|
|
3257
|
-
isExpanded && item.children && /* @__PURE__ */
|
|
3393
|
+
isExpanded && item.children && /* @__PURE__ */ jsx(
|
|
3258
3394
|
"ul",
|
|
3259
3395
|
{
|
|
3260
3396
|
id: `submenu-${item.id}`,
|
|
3261
3397
|
role: "menu",
|
|
3262
3398
|
"aria-label": `${item.label} submenu`,
|
|
3263
|
-
children: item.children.map((child) => /* @__PURE__ */
|
|
3399
|
+
children: item.children.map((child) => /* @__PURE__ */ jsx(React6.Fragment, { children: renderHierarchicalItem(child, level + 1) }, child.id))
|
|
3264
3400
|
}
|
|
3265
3401
|
)
|
|
3266
|
-
] }) : /* @__PURE__ */
|
|
3402
|
+
] }) : /* @__PURE__ */ jsx(
|
|
3267
3403
|
"a",
|
|
3268
3404
|
{
|
|
3269
3405
|
href: item.href || "#",
|
|
@@ -3281,26 +3417,26 @@ var NavigationMenu = React14.forwardRef(({
|
|
|
3281
3417
|
) });
|
|
3282
3418
|
};
|
|
3283
3419
|
if (mode === "dropdown") {
|
|
3284
|
-
return /* @__PURE__ */
|
|
3420
|
+
return /* @__PURE__ */ jsxs(
|
|
3285
3421
|
Select,
|
|
3286
3422
|
{
|
|
3287
3423
|
onValueChange: handleNavigationSelect,
|
|
3288
3424
|
className,
|
|
3289
3425
|
"data-testid": "navigation-menu-root",
|
|
3290
3426
|
children: [
|
|
3291
|
-
/* @__PURE__ */
|
|
3427
|
+
/* @__PURE__ */ jsx(
|
|
3292
3428
|
SelectTrigger,
|
|
3293
3429
|
{
|
|
3294
3430
|
ref: buttonRef,
|
|
3295
3431
|
disabled,
|
|
3296
3432
|
"aria-label": buttonText,
|
|
3297
3433
|
"data-testid": "navigation-menu-trigger",
|
|
3298
|
-
children: /* @__PURE__ */
|
|
3434
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: buttonText })
|
|
3299
3435
|
}
|
|
3300
3436
|
),
|
|
3301
|
-
/* @__PURE__ */
|
|
3302
|
-
|
|
3303
|
-
return /* @__PURE__ */
|
|
3437
|
+
/* @__PURE__ */ jsx(SelectContent, { children: filteredItems.map((item) => {
|
|
3438
|
+
isActiveItem(item);
|
|
3439
|
+
return /* @__PURE__ */ jsx(
|
|
3304
3440
|
SelectItem,
|
|
3305
3441
|
{
|
|
3306
3442
|
value: item.id,
|
|
@@ -3315,22 +3451,18 @@ var NavigationMenu = React14.forwardRef(({
|
|
|
3315
3451
|
}
|
|
3316
3452
|
);
|
|
3317
3453
|
}
|
|
3318
|
-
return /* @__PURE__ */
|
|
3454
|
+
return /* @__PURE__ */ jsx(
|
|
3319
3455
|
"nav",
|
|
3320
3456
|
{
|
|
3321
3457
|
ref,
|
|
3322
3458
|
className,
|
|
3323
3459
|
"aria-label": navigationLabel,
|
|
3324
3460
|
...props,
|
|
3325
|
-
children: /* @__PURE__ */
|
|
3461
|
+
children: /* @__PURE__ */ jsx("ul", { role: "menubar", children: filteredItems.map((item) => /* @__PURE__ */ jsx(React6.Fragment, { children: renderHierarchicalItem(item, 0) }, item.id)) })
|
|
3326
3462
|
}
|
|
3327
3463
|
);
|
|
3328
3464
|
});
|
|
3329
3465
|
NavigationMenu.displayName = "NavigationMenu";
|
|
3330
|
-
|
|
3331
|
-
// src/components/Header/Header.tsx
|
|
3332
|
-
import { Link } from "react-router-dom";
|
|
3333
|
-
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3334
3466
|
function Header({
|
|
3335
3467
|
logoUrl,
|
|
3336
3468
|
logoAlt = "Logo",
|
|
@@ -3353,32 +3485,32 @@ function Header({
|
|
|
3353
3485
|
const shouldShowContextSelector = showContextSelector !== false;
|
|
3354
3486
|
const { switchOrganisation } = useOrganisations();
|
|
3355
3487
|
const { events, setSelectedEvent } = useEvents();
|
|
3356
|
-
return /* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ jsx("header", { className: cn(
|
|
3357
3489
|
"w-full border-b border-main-200 h-16 shadow-sm bg-main-100 ",
|
|
3358
3490
|
className
|
|
3359
|
-
), role: "banner", children: /* @__PURE__ */
|
|
3360
|
-
logo ? logoHref ? /* @__PURE__ */
|
|
3491
|
+
), role: "banner", children: /* @__PURE__ */ jsxs("nav", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto grid grid-cols-[auto_1fr_auto_auto_auto_auto] items-center gap-4 h-full", children: [
|
|
3492
|
+
logo ? logoHref ? /* @__PURE__ */ jsx(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: logo }) : logo : logoUrl ? logoHref ? /* @__PURE__ */ jsx(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx(
|
|
3361
3493
|
"img",
|
|
3362
3494
|
{
|
|
3363
3495
|
src: logoUrl,
|
|
3364
3496
|
alt: logoAlt || "Logo",
|
|
3365
3497
|
className: "h-[2.15rem] w-auto max-w-[200px] object-contain rounded-md shadow-md bg-transparent"
|
|
3366
3498
|
}
|
|
3367
|
-
) }) : /* @__PURE__ */
|
|
3499
|
+
) }) : /* @__PURE__ */ jsx(
|
|
3368
3500
|
"img",
|
|
3369
3501
|
{
|
|
3370
3502
|
src: logoUrl,
|
|
3371
3503
|
alt: logoAlt || "Logo",
|
|
3372
3504
|
className: "h-[2.15rem] w-auto max-w-[200px] object-contain rounded-md shadow-md bg-transparent"
|
|
3373
3505
|
}
|
|
3374
|
-
) : logoHref ? /* @__PURE__ */
|
|
3506
|
+
) : logoHref ? /* @__PURE__ */ jsx(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx(
|
|
3375
3507
|
"img",
|
|
3376
3508
|
{
|
|
3377
3509
|
src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23000'/%3E%3Ctext x='16' y='20' text-anchor='middle' fill='white' font-family='Arial' font-size='14' font-weight='bold'%3EL%3C/text%3E%3C/svg%3E",
|
|
3378
3510
|
alt: logoAlt || "Logo",
|
|
3379
3511
|
className: "size-8 shadow-md"
|
|
3380
3512
|
}
|
|
3381
|
-
) }) : /* @__PURE__ */
|
|
3513
|
+
) }) : /* @__PURE__ */ jsx(
|
|
3382
3514
|
"img",
|
|
3383
3515
|
{
|
|
3384
3516
|
src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23000'/%3E%3Ctext x='16' y='20' text-anchor='middle' fill='white' font-family='Arial' font-size='14' font-weight='bold'%3EL%3C/text%3E%3C/svg%3E",
|
|
@@ -3386,7 +3518,7 @@ function Header({
|
|
|
3386
3518
|
className: "size-8 shadow-md"
|
|
3387
3519
|
}
|
|
3388
3520
|
),
|
|
3389
|
-
navItems && navItems.length > 0 && /* @__PURE__ */
|
|
3521
|
+
navItems && navItems.length > 0 && /* @__PURE__ */ jsx(
|
|
3390
3522
|
NavigationMenu,
|
|
3391
3523
|
{
|
|
3392
3524
|
items: navItems,
|
|
@@ -3397,7 +3529,7 @@ function Header({
|
|
|
3397
3529
|
itemsPreFiltered: true
|
|
3398
3530
|
}
|
|
3399
3531
|
),
|
|
3400
|
-
shouldShowContextSelector ? /* @__PURE__ */
|
|
3532
|
+
shouldShowContextSelector ? /* @__PURE__ */ jsx(
|
|
3401
3533
|
ContextSelector,
|
|
3402
3534
|
{
|
|
3403
3535
|
placeholder: "Select organisation or event",
|
|
@@ -3420,7 +3552,7 @@ function Header({
|
|
|
3420
3552
|
}
|
|
3421
3553
|
) : null,
|
|
3422
3554
|
actions,
|
|
3423
|
-
showUserMenu && (userMenu ? userMenu : /* @__PURE__ */
|
|
3555
|
+
showUserMenu && (userMenu ? userMenu : /* @__PURE__ */ jsx(
|
|
3424
3556
|
UserMenu,
|
|
3425
3557
|
{
|
|
3426
3558
|
user: user || null,
|
|
@@ -3431,10 +3563,6 @@ function Header({
|
|
|
3431
3563
|
))
|
|
3432
3564
|
] }) });
|
|
3433
3565
|
}
|
|
3434
|
-
|
|
3435
|
-
// src/components/Footer/Footer.tsx
|
|
3436
|
-
import React15 from "react";
|
|
3437
|
-
import { Fragment as Fragment10, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3438
3566
|
var FooterComponent = ({
|
|
3439
3567
|
companyName = "Solvera Solutions Pty Ltd",
|
|
3440
3568
|
year = (/* @__PURE__ */ new Date()).getFullYear(),
|
|
@@ -3445,21 +3573,16 @@ var FooterComponent = ({
|
|
|
3445
3573
|
children
|
|
3446
3574
|
}) => {
|
|
3447
3575
|
const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
|
|
3448
|
-
return /* @__PURE__ */
|
|
3449
|
-
logo && /* @__PURE__ */
|
|
3450
|
-
children && /* @__PURE__ */
|
|
3451
|
-
/* @__PURE__ */
|
|
3452
|
-
links && links.length > 0 && /* @__PURE__ */
|
|
3576
|
+
return /* @__PURE__ */ jsx("footer", { className: cn("mt-8 py-6 flex justify-center border-t border-border bg-main-100", className), children: /* @__PURE__ */ jsxs("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
|
|
3577
|
+
logo && /* @__PURE__ */ jsx("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
|
|
3578
|
+
children && /* @__PURE__ */ jsx(Fragment, { children }),
|
|
3579
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: copyrightText }),
|
|
3580
|
+
links && links.length > 0 && /* @__PURE__ */ jsx("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
|
|
3453
3581
|
] }) });
|
|
3454
3582
|
};
|
|
3455
3583
|
FooterComponent.displayName = "Footer";
|
|
3456
|
-
var Footer =
|
|
3584
|
+
var Footer = React6__default.memo(FooterComponent);
|
|
3457
3585
|
Footer.displayName = "Footer";
|
|
3458
|
-
|
|
3459
|
-
// src/components/PaceAppLayout/PaceAppLayout.tsx
|
|
3460
|
-
import { useState as useState12, useEffect as useEffect7, useMemo as useMemo8 } from "react";
|
|
3461
|
-
import { Outlet, useNavigate, useLocation } from "react-router-dom";
|
|
3462
|
-
import { Fragment as Fragment11, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3463
3586
|
var EMPTY_PAGE_ID_MAPPING = {};
|
|
3464
3587
|
var EMPTY_ROUTE_PERMISSIONS = {};
|
|
3465
3588
|
function PaceAppLayout({
|
|
@@ -3502,9 +3625,9 @@ function PaceAppLayout({
|
|
|
3502
3625
|
isLoading: organisationLoading
|
|
3503
3626
|
} = useOrganisations();
|
|
3504
3627
|
const { isSuperAdmin: isSuperAdminFromRBAC, isLoading: rbacLoading } = useRBAC();
|
|
3505
|
-
const [isSuperAdminDirect, setIsSuperAdminDirect] =
|
|
3506
|
-
const [isCheckingSuperAdminDirect, setIsCheckingSuperAdminDirect] =
|
|
3507
|
-
|
|
3628
|
+
const [isSuperAdminDirect, setIsSuperAdminDirect] = useState(false);
|
|
3629
|
+
const [isCheckingSuperAdminDirect, setIsCheckingSuperAdminDirect] = useState(false);
|
|
3630
|
+
useEffect(() => {
|
|
3508
3631
|
const checkSuperAdminDirect = async () => {
|
|
3509
3632
|
if (!user?.id) {
|
|
3510
3633
|
setIsSuperAdminDirect(false);
|
|
@@ -3541,13 +3664,14 @@ function PaceAppLayout({
|
|
|
3541
3664
|
const { resolvedScope, isLoading: scopeLoading } = useResolvedScope({
|
|
3542
3665
|
supabase: supabase || null,
|
|
3543
3666
|
selectedOrganisationId: selectedOrganisation?.id || null,
|
|
3544
|
-
selectedEventId: selectedEvent?.event_id || null
|
|
3667
|
+
selectedEventId: selectedEvent?.event_id || null,
|
|
3668
|
+
selectedEventOrganisationId: selectedEvent?.organisation_id || null
|
|
3545
3669
|
});
|
|
3546
3670
|
const resolvedAppId = contextAppId || resolvedScope?.appId;
|
|
3547
3671
|
const scopeOrgId = resolvedScope?.organisationId || selectedOrganisation?.id || "";
|
|
3548
3672
|
const scopeEventId = resolvedScope?.eventId || selectedEvent?.event_id || void 0;
|
|
3549
3673
|
const scopeAppId = resolvedScope?.appId || resolvedAppId || void 0;
|
|
3550
|
-
const scope =
|
|
3674
|
+
const scope = useMemo(() => {
|
|
3551
3675
|
const newScope = {};
|
|
3552
3676
|
if (scopeOrgId) {
|
|
3553
3677
|
newScope.organisationId = scopeOrgId;
|
|
@@ -3560,19 +3684,19 @@ function PaceAppLayout({
|
|
|
3560
3684
|
}
|
|
3561
3685
|
return newScope;
|
|
3562
3686
|
}, [scopeOrgId, scopeEventId, scopeAppId]);
|
|
3563
|
-
const defaultNavItems =
|
|
3687
|
+
const defaultNavItems = useMemo(() => [
|
|
3564
3688
|
{ id: "home", label: "Home", href: "/", icon: "Home" },
|
|
3565
3689
|
{ id: "dashboard", label: "Dashboard", href: "/dashboard", icon: "LayoutDashboard" },
|
|
3566
3690
|
{ id: "settings", label: "Settings", href: "/settings", icon: "Settings" },
|
|
3567
3691
|
{ id: "ui-showcase", label: "UI Showcase", href: "/ui-showcase", icon: "Component" },
|
|
3568
3692
|
{ id: "data-table-showcase", label: "DataTable Showcase", href: "/data-table-showcase", icon: "Table" }
|
|
3569
3693
|
], []);
|
|
3570
|
-
const baseMenuItems =
|
|
3571
|
-
const currentRoutePermission =
|
|
3694
|
+
const baseMenuItems = useMemo(() => navItems || defaultNavItems, [navItems]);
|
|
3695
|
+
const currentRoutePermission = useMemo(() => {
|
|
3572
3696
|
const currentPath = location.pathname;
|
|
3573
3697
|
return routePermissions[currentPath] || defaultPermission;
|
|
3574
3698
|
}, [location.pathname, routePermissions, defaultPermission]);
|
|
3575
|
-
const currentPageId =
|
|
3699
|
+
const currentPageId = useMemo(() => {
|
|
3576
3700
|
const currentPath = location.pathname;
|
|
3577
3701
|
if (pageIdMapping[currentPath]) {
|
|
3578
3702
|
return pageIdMapping[currentPath];
|
|
@@ -3580,7 +3704,7 @@ function PaceAppLayout({
|
|
|
3580
3704
|
const pathSegments = currentPath.slice(1).split("/").filter(Boolean);
|
|
3581
3705
|
return pathSegments[0] || "";
|
|
3582
3706
|
}, [location.pathname, pageIdMapping]);
|
|
3583
|
-
const currentPermission =
|
|
3707
|
+
const currentPermission = useMemo(() => {
|
|
3584
3708
|
if (!enforcePermissions || !currentPageId) {
|
|
3585
3709
|
return "";
|
|
3586
3710
|
}
|
|
@@ -3603,13 +3727,13 @@ function PaceAppLayout({
|
|
|
3603
3727
|
);
|
|
3604
3728
|
const can = isSuperAdmin2 ? true : canFromHook;
|
|
3605
3729
|
const hasPermission = enforcePermissions ? can : true;
|
|
3606
|
-
const isContextError =
|
|
3730
|
+
const isContextError = useMemo(() => {
|
|
3607
3731
|
if (!permissionError) {
|
|
3608
3732
|
return false;
|
|
3609
3733
|
}
|
|
3610
3734
|
return permissionError instanceof EventContextRequiredError || permissionError instanceof OrganisationContextRequiredError || permissionError.name === "EventContextRequiredError" || permissionError.name === "OrganisationContextRequiredError";
|
|
3611
3735
|
}, [permissionError]);
|
|
3612
|
-
|
|
3736
|
+
useEffect(() => {
|
|
3613
3737
|
if (!enforcePermissions) {
|
|
3614
3738
|
return;
|
|
3615
3739
|
}
|
|
@@ -3632,8 +3756,8 @@ function PaceAppLayout({
|
|
|
3632
3756
|
onPageAccessDenied(currentPageId, currentRoutePermission);
|
|
3633
3757
|
}
|
|
3634
3758
|
}, [enforcePermissions, can, isCheckingPermission, isSuperAdmin2, currentPageId, currentRoutePermission, user?.id, strictMode, auditLog, onPageAccessDenied, onStrictModeViolation]);
|
|
3635
|
-
const [filteredMenuItems, setFilteredMenuItems] =
|
|
3636
|
-
|
|
3759
|
+
const [filteredMenuItems, setFilteredMenuItems] = useState(baseMenuItems);
|
|
3760
|
+
useEffect(() => {
|
|
3637
3761
|
let isMounted = true;
|
|
3638
3762
|
const filterItems = async () => {
|
|
3639
3763
|
if (!user?.id) {
|
|
@@ -3643,7 +3767,7 @@ function PaceAppLayout({
|
|
|
3643
3767
|
return;
|
|
3644
3768
|
}
|
|
3645
3769
|
const currentScope = scope;
|
|
3646
|
-
|
|
3770
|
+
currentScope.appId || resolvedAppId;
|
|
3647
3771
|
const hasOrganisationContext = currentScope.organisationId;
|
|
3648
3772
|
const hasUser = !!user?.id;
|
|
3649
3773
|
if (!hasUser) {
|
|
@@ -3659,7 +3783,7 @@ function PaceAppLayout({
|
|
|
3659
3783
|
return;
|
|
3660
3784
|
}
|
|
3661
3785
|
try {
|
|
3662
|
-
const { isSuperAdmin: checkSuperAdminDynamic } = await import(
|
|
3786
|
+
const { isSuperAdmin: checkSuperAdminDynamic } = await import('./api-Y4MQWOFW.js');
|
|
3663
3787
|
const isSuper = await checkSuperAdminDynamic(user.id);
|
|
3664
3788
|
if (isSuper) {
|
|
3665
3789
|
if (isMounted) {
|
|
@@ -3668,13 +3792,12 @@ function PaceAppLayout({
|
|
|
3668
3792
|
return;
|
|
3669
3793
|
}
|
|
3670
3794
|
} catch (error) {
|
|
3671
|
-
if (error && typeof error === "object" && "code" in error && error.code === "RBAC_NOT_INITIALIZED") {
|
|
3672
|
-
} else {
|
|
3795
|
+
if (error && typeof error === "object" && "code" in error && error.code === "RBAC_NOT_INITIALIZED") ; else {
|
|
3673
3796
|
throw error;
|
|
3674
3797
|
}
|
|
3675
3798
|
}
|
|
3676
3799
|
try {
|
|
3677
|
-
const { getPermissionMap } = await import(
|
|
3800
|
+
const { getPermissionMap } = await import('./api-Y4MQWOFW.js');
|
|
3678
3801
|
const permissionScope = {
|
|
3679
3802
|
organisationId: currentScope.organisationId,
|
|
3680
3803
|
eventId: currentScope.eventId,
|
|
@@ -3685,7 +3808,7 @@ function PaceAppLayout({
|
|
|
3685
3808
|
userId: user.id,
|
|
3686
3809
|
scope: permissionScope
|
|
3687
3810
|
});
|
|
3688
|
-
const { getPageScopeType } = await import(
|
|
3811
|
+
const { getPageScopeType } = await import('./api-Y4MQWOFW.js');
|
|
3689
3812
|
const effectiveAppId = currentScope.appId || resolvedAppId;
|
|
3690
3813
|
const effectiveAppName = appName;
|
|
3691
3814
|
const hasEventContext = !!currentScope.eventId;
|
|
@@ -3772,7 +3895,7 @@ function PaceAppLayout({
|
|
|
3772
3895
|
isMounted = false;
|
|
3773
3896
|
};
|
|
3774
3897
|
}, [baseMenuItems, pageIdMapping, routePermissions, defaultPermission, can, user?.id, scope, scopeLoading, contextAppId, resolvedScope?.appId, selectedOrganisation?.id, selectedEvent?.event_id, appName]);
|
|
3775
|
-
|
|
3898
|
+
useEffect(() => {
|
|
3776
3899
|
if (!roleBasedRouting || routeConfig.length === 0) return;
|
|
3777
3900
|
let isMounted = true;
|
|
3778
3901
|
const checkRouteAccess = async () => {
|
|
@@ -3794,7 +3917,7 @@ function PaceAppLayout({
|
|
|
3794
3917
|
let hasAccess = true;
|
|
3795
3918
|
if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
|
|
3796
3919
|
try {
|
|
3797
|
-
const { isPermittedCached } = await import(
|
|
3920
|
+
const { isPermittedCached } = await import('./api-Y4MQWOFW.js');
|
|
3798
3921
|
const hasPagePermission = await isPermittedCached({
|
|
3799
3922
|
userId: user?.id || "",
|
|
3800
3923
|
scope,
|
|
@@ -3810,7 +3933,7 @@ function PaceAppLayout({
|
|
|
3810
3933
|
}
|
|
3811
3934
|
}
|
|
3812
3935
|
if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
|
|
3813
|
-
const { useUnifiedAuth: useUnifiedAuth2 } = await import(
|
|
3936
|
+
const { useUnifiedAuth: useUnifiedAuth2 } = await import('./UnifiedAuthProvider-ZT6TIGM7.js');
|
|
3814
3937
|
hasAccess = true;
|
|
3815
3938
|
}
|
|
3816
3939
|
if (!isMounted) return;
|
|
@@ -3871,62 +3994,58 @@ function PaceAppLayout({
|
|
|
3871
3994
|
}
|
|
3872
3995
|
};
|
|
3873
3996
|
if (user?.id && organisationLoading && !isSuperAdmin2 && !isCheckingSuperAdminDirect && !rbacLoading && !selectedOrganisationId) {
|
|
3874
|
-
return /* @__PURE__ */
|
|
3875
|
-
/* @__PURE__ */
|
|
3997
|
+
return /* @__PURE__ */ jsxs("p", { className: "grid place-items-center text-center size-full", children: [
|
|
3998
|
+
/* @__PURE__ */ jsx(
|
|
3876
3999
|
LoadingSpinner,
|
|
3877
4000
|
{
|
|
3878
4001
|
size: "lg"
|
|
3879
4002
|
}
|
|
3880
4003
|
),
|
|
3881
|
-
/* @__PURE__ */
|
|
4004
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
3882
4005
|
"Loading organisation context..."
|
|
3883
4006
|
] });
|
|
3884
4007
|
}
|
|
3885
4008
|
if (enforcePermissions && isCheckingPermission) {
|
|
3886
|
-
return /* @__PURE__ */
|
|
3887
|
-
/* @__PURE__ */
|
|
4009
|
+
return /* @__PURE__ */ jsxs("p", { className: "grid place-items-center text-center size-full", children: [
|
|
4010
|
+
/* @__PURE__ */ jsx(
|
|
3888
4011
|
LoadingSpinner,
|
|
3889
4012
|
{
|
|
3890
4013
|
size: "lg"
|
|
3891
4014
|
}
|
|
3892
4015
|
),
|
|
3893
|
-
/* @__PURE__ */
|
|
4016
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
3894
4017
|
"Checking permissions..."
|
|
3895
4018
|
] });
|
|
3896
4019
|
}
|
|
3897
4020
|
if (enforcePermissions && permissionError && !isSuperAdmin2 && !isContextError) {
|
|
3898
|
-
return /* @__PURE__ */
|
|
3899
|
-
/* @__PURE__ */
|
|
3900
|
-
/* @__PURE__ */
|
|
3901
|
-
/* @__PURE__ */
|
|
4021
|
+
return /* @__PURE__ */ jsxs("hgroup", { className: "grid place-items-center text-center size-full", children: [
|
|
4022
|
+
/* @__PURE__ */ jsx("h2", { children: "Permission Error" }),
|
|
4023
|
+
/* @__PURE__ */ jsx("p", { children: permissionError.message }),
|
|
4024
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => navigate("/"), children: "Go Home" })
|
|
3902
4025
|
] });
|
|
3903
4026
|
}
|
|
3904
4027
|
if (enforcePermissions && hasPermission === false && !isCheckingSuperAdminDirect && !isSuperAdmin2 && !isContextError) {
|
|
3905
4028
|
if (enforcePagePermissions && pagePermissionFallback) {
|
|
3906
|
-
return /* @__PURE__ */
|
|
4029
|
+
return /* @__PURE__ */ jsx(Fragment, { children: pagePermissionFallback });
|
|
3907
4030
|
}
|
|
3908
4031
|
if (permissionFallback) {
|
|
3909
|
-
return /* @__PURE__ */
|
|
4032
|
+
return /* @__PURE__ */ jsx(Fragment, { children: permissionFallback });
|
|
3910
4033
|
}
|
|
3911
|
-
return /* @__PURE__ */
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
children: "Sign out"
|
|
3924
|
-
}
|
|
3925
|
-
)
|
|
3926
|
-
] });
|
|
4034
|
+
return /* @__PURE__ */ jsx(
|
|
4035
|
+
AccessDenied,
|
|
4036
|
+
{
|
|
4037
|
+
message: "You don't have permission to access this page.",
|
|
4038
|
+
onGoBack: () => navigate("/"),
|
|
4039
|
+
onSignOut: async () => {
|
|
4040
|
+
await handleSignOut();
|
|
4041
|
+
navigate("/login");
|
|
4042
|
+
},
|
|
4043
|
+
showSignOut: true
|
|
4044
|
+
}
|
|
4045
|
+
);
|
|
3927
4046
|
}
|
|
3928
|
-
return /* @__PURE__ */
|
|
3929
|
-
/* @__PURE__ */
|
|
4047
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4048
|
+
/* @__PURE__ */ jsx(
|
|
3930
4049
|
Header,
|
|
3931
4050
|
{
|
|
3932
4051
|
logo: customLogo || void 0,
|
|
@@ -3952,38 +4071,39 @@ function PaceAppLayout({
|
|
|
3952
4071
|
className: headerClassName || "sticky top-0 z-[40] w-full"
|
|
3953
4072
|
}
|
|
3954
4073
|
),
|
|
3955
|
-
/* @__PURE__ */
|
|
3956
|
-
/* @__PURE__ */
|
|
4074
|
+
/* @__PURE__ */ jsx("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: /* @__PURE__ */ jsx(Outlet, {}) }),
|
|
4075
|
+
/* @__PURE__ */ jsx(Footer, {})
|
|
3957
4076
|
] });
|
|
3958
4077
|
}
|
|
3959
|
-
|
|
3960
|
-
// src/components/PaceLoginPage/PaceLoginPage.tsx
|
|
3961
|
-
import { useEffect as useEffect8, useState as useState13, useContext as useContext2 } from "react";
|
|
3962
|
-
import { useNavigate as useNavigate2, useLocation as useLocation2 } from "react-router-dom";
|
|
3963
|
-
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3964
4078
|
var PaceLoginPage = ({
|
|
3965
4079
|
appName = "Pace",
|
|
3966
4080
|
onSuccessRedirectPath = "/",
|
|
3967
4081
|
requireAppAccess = false
|
|
3968
4082
|
}) => {
|
|
3969
|
-
const
|
|
3970
|
-
const navigate =
|
|
3971
|
-
const location =
|
|
3972
|
-
const [isSigningIn, setIsSigningIn] =
|
|
3973
|
-
const [accessError, setAccessError] =
|
|
3974
|
-
const [isCheckingAccess, setIsCheckingAccess] =
|
|
3975
|
-
const eventServiceContext =
|
|
4083
|
+
const authContext = useContext(UnifiedAuthContext);
|
|
4084
|
+
const navigate = useNavigate();
|
|
4085
|
+
const location = useLocation();
|
|
4086
|
+
const [isSigningIn, setIsSigningIn] = useState(false);
|
|
4087
|
+
const [accessError, setAccessError] = useState(null);
|
|
4088
|
+
const [isCheckingAccess, setIsCheckingAccess] = useState(false);
|
|
4089
|
+
const eventServiceContext = useContext(EventServiceContext);
|
|
3976
4090
|
const eventService = eventServiceContext?.eventService || null;
|
|
3977
|
-
|
|
4091
|
+
const signIn = authContext?.signIn || (async () => ({ error: null }));
|
|
4092
|
+
const isAuthenticated = authContext?.isAuthenticated ?? false;
|
|
4093
|
+
const isLoading = authContext?.isLoading ?? false;
|
|
4094
|
+
const authError = authContext?.authError ?? null;
|
|
4095
|
+
const user = authContext?.user ?? null;
|
|
4096
|
+
const supabase = authContext?.supabase ?? null;
|
|
4097
|
+
useEffect(() => {
|
|
3978
4098
|
clearPalette();
|
|
3979
4099
|
}, []);
|
|
3980
|
-
|
|
4100
|
+
useEffect(() => {
|
|
3981
4101
|
const isOnLoginPage = location.pathname === "/login" || location.pathname.startsWith("/login");
|
|
3982
4102
|
if (isOnLoginPage) {
|
|
3983
4103
|
clearPalette();
|
|
3984
4104
|
}
|
|
3985
4105
|
}, [location.pathname]);
|
|
3986
|
-
|
|
4106
|
+
useEffect(() => {
|
|
3987
4107
|
const restoreEvent = async () => {
|
|
3988
4108
|
try {
|
|
3989
4109
|
const isOnLoginPage = window.location.pathname === "/login" || window.location.pathname.startsWith("/login");
|
|
@@ -3998,7 +4118,7 @@ var PaceLoginPage = ({
|
|
|
3998
4118
|
}, 100);
|
|
3999
4119
|
return () => clearTimeout(timeoutId);
|
|
4000
4120
|
}, [eventService]);
|
|
4001
|
-
|
|
4121
|
+
useEffect(() => {
|
|
4002
4122
|
if (!requireAppAccess || !isAuthenticated || isLoading || !user || !supabase) {
|
|
4003
4123
|
return;
|
|
4004
4124
|
}
|
|
@@ -4086,8 +4206,11 @@ var PaceLoginPage = ({
|
|
|
4086
4206
|
setIsSigningIn(false);
|
|
4087
4207
|
}
|
|
4088
4208
|
};
|
|
4089
|
-
|
|
4090
|
-
/* @__PURE__ */
|
|
4209
|
+
if (!authContext) {
|
|
4210
|
+
return /* @__PURE__ */ jsx("main", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ jsx("section", { className: "text-center", children: /* @__PURE__ */ jsx("p", { children: "Loading..." }) }) });
|
|
4211
|
+
}
|
|
4212
|
+
return /* @__PURE__ */ jsxs("main", { className: "min-h-screen grid mx-auto w-fit content-center justify-items-center gap-y-8", "aria-label": `${appName} Login Page`, children: [
|
|
4213
|
+
/* @__PURE__ */ jsx(
|
|
4091
4214
|
"img",
|
|
4092
4215
|
{
|
|
4093
4216
|
src: `/${appName.toLowerCase()}_logo_square.svg`,
|
|
@@ -4095,7 +4218,7 @@ var PaceLoginPage = ({
|
|
|
4095
4218
|
className: "h-48"
|
|
4096
4219
|
}
|
|
4097
4220
|
),
|
|
4098
|
-
/* @__PURE__ */
|
|
4221
|
+
/* @__PURE__ */ jsx(
|
|
4099
4222
|
LoginForm,
|
|
4100
4223
|
{
|
|
4101
4224
|
className: "w-md",
|
|
@@ -4109,20 +4232,17 @@ var PaceLoginPage = ({
|
|
|
4109
4232
|
),
|
|
4110
4233
|
(() => {
|
|
4111
4234
|
const benign = !!(authError && (authError.name === "AuthSessionMissingError" || /Auth session missing/i.test(authError.message)));
|
|
4112
|
-
return authError && !benign ? /* @__PURE__ */
|
|
4235
|
+
return authError && !benign ? /* @__PURE__ */ jsx("em", { className: "mt-4 text-destructive text-center", children: authError.message }) : null;
|
|
4113
4236
|
})(),
|
|
4114
|
-
accessError && /* @__PURE__ */
|
|
4115
|
-
isCheckingAccess && /* @__PURE__ */
|
|
4237
|
+
accessError && /* @__PURE__ */ jsx("em", { className: "mt-4 text-destructive text-center", children: accessError }),
|
|
4238
|
+
isCheckingAccess && /* @__PURE__ */ jsx("em", { className: "mt-4 text-muted-foreground text-center", children: "Checking permissions..." })
|
|
4116
4239
|
] });
|
|
4117
4240
|
};
|
|
4118
|
-
|
|
4119
|
-
// src/components/SessionRestorationLoader/SessionRestorationLoader.tsx
|
|
4120
|
-
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4121
4241
|
var SessionRestorationLoader = ({
|
|
4122
4242
|
message = "Restoring session...",
|
|
4123
4243
|
className
|
|
4124
4244
|
}) => {
|
|
4125
|
-
return /* @__PURE__ */
|
|
4245
|
+
return /* @__PURE__ */ jsxs(
|
|
4126
4246
|
Alert,
|
|
4127
4247
|
{
|
|
4128
4248
|
className: cn(
|
|
@@ -4133,17 +4253,12 @@ var SessionRestorationLoader = ({
|
|
|
4133
4253
|
"aria-live": "polite",
|
|
4134
4254
|
"aria-label": message,
|
|
4135
4255
|
children: [
|
|
4136
|
-
/* @__PURE__ */
|
|
4137
|
-
/* @__PURE__ */
|
|
4256
|
+
/* @__PURE__ */ jsx(LoadingSpinner, { size: "lg" }),
|
|
4257
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-sec-600", children: message })
|
|
4138
4258
|
]
|
|
4139
4259
|
}
|
|
4140
4260
|
);
|
|
4141
4261
|
};
|
|
4142
|
-
|
|
4143
|
-
// src/components/ProtectedRoute/ProtectedRoute.tsx
|
|
4144
|
-
import { useMemo as useMemo9, useEffect as useEffect9, useRef as useRef8, useState as useState14 } from "react";
|
|
4145
|
-
import { Navigate, Outlet as Outlet2 } from "react-router-dom";
|
|
4146
|
-
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4147
4262
|
function ProtectedRoute({
|
|
4148
4263
|
requireEvent = false,
|
|
4149
4264
|
noEventsFallback,
|
|
@@ -4157,17 +4272,17 @@ function ProtectedRoute({
|
|
|
4157
4272
|
const eventLoading = requireEvent ? eventsContext.isLoading || false : false;
|
|
4158
4273
|
const sessionRestoration = useSessionRestoration();
|
|
4159
4274
|
usePreventTabReload({ enabled: true, gracePeriodMs: 2e3 });
|
|
4160
|
-
const wasAuthenticatedRef =
|
|
4161
|
-
const [shouldRedirect, setShouldRedirect] =
|
|
4162
|
-
const tabJustBecameVisibleRef =
|
|
4163
|
-
|
|
4275
|
+
const wasAuthenticatedRef = useRef(false);
|
|
4276
|
+
const [shouldRedirect, setShouldRedirect] = useState(false);
|
|
4277
|
+
const tabJustBecameVisibleRef = useRef(false);
|
|
4278
|
+
useEffect(() => {
|
|
4164
4279
|
if (isAuthenticated) {
|
|
4165
4280
|
wasAuthenticatedRef.current = true;
|
|
4166
4281
|
setShouldRedirect(false);
|
|
4167
4282
|
tabJustBecameVisibleRef.current = false;
|
|
4168
4283
|
}
|
|
4169
4284
|
}, [isAuthenticated]);
|
|
4170
|
-
|
|
4285
|
+
useEffect(() => {
|
|
4171
4286
|
if (typeof document === "undefined") return;
|
|
4172
4287
|
let timeoutId = null;
|
|
4173
4288
|
let wasHidden = document.hidden;
|
|
@@ -4211,13 +4326,13 @@ function ProtectedRoute({
|
|
|
4211
4326
|
}
|
|
4212
4327
|
};
|
|
4213
4328
|
}, [isAuthenticated]);
|
|
4214
|
-
|
|
4329
|
+
useEffect(() => {
|
|
4215
4330
|
if (isAuthenticated) {
|
|
4216
4331
|
setShouldRedirect(false);
|
|
4217
4332
|
tabJustBecameVisibleRef.current = false;
|
|
4218
4333
|
}
|
|
4219
4334
|
}, [isAuthenticated]);
|
|
4220
|
-
const isRestoringSession =
|
|
4335
|
+
const isRestoringSession = useMemo(() => {
|
|
4221
4336
|
return sessionRestoration.isRestoring && !sessionRestoration.restorationComplete && !sessionRestoration.restorationError && !sessionRestoration.hasTimedOut;
|
|
4222
4337
|
}, [
|
|
4223
4338
|
sessionRestoration.isRestoring,
|
|
@@ -4226,13 +4341,13 @@ function ProtectedRoute({
|
|
|
4226
4341
|
sessionRestoration.hasTimedOut
|
|
4227
4342
|
]);
|
|
4228
4343
|
if (isRestoringSession) {
|
|
4229
|
-
return /* @__PURE__ */
|
|
4344
|
+
return /* @__PURE__ */ jsx(SessionRestorationLoader, {});
|
|
4230
4345
|
}
|
|
4231
4346
|
if (requireEvent && eventLoading) {
|
|
4232
|
-
return /* @__PURE__ */
|
|
4347
|
+
return /* @__PURE__ */ jsx(Outlet, {});
|
|
4233
4348
|
}
|
|
4234
4349
|
if (isLoading && !sessionRestoration.hasTimedOut) {
|
|
4235
|
-
return loadingFallback || /* @__PURE__ */
|
|
4350
|
+
return loadingFallback || /* @__PURE__ */ jsx("main", { className: "grid place-items-center size-full", children: /* @__PURE__ */ jsx(LoadingSpinner, {}) });
|
|
4236
4351
|
}
|
|
4237
4352
|
if (!isAuthenticated) {
|
|
4238
4353
|
if (sessionRestoration.hasTimedOut || sessionRestoration.restorationError) {
|
|
@@ -4240,41 +4355,37 @@ function ProtectedRoute({
|
|
|
4240
4355
|
timedOut: sessionRestoration.hasTimedOut,
|
|
4241
4356
|
error: sessionRestoration.restorationError?.message
|
|
4242
4357
|
});
|
|
4243
|
-
return /* @__PURE__ */
|
|
4358
|
+
return /* @__PURE__ */ jsx(Navigate, { to: loginPath, replace: true });
|
|
4244
4359
|
}
|
|
4245
4360
|
if (!wasAuthenticatedRef.current) {
|
|
4246
|
-
return /* @__PURE__ */
|
|
4361
|
+
return /* @__PURE__ */ jsx(Navigate, { to: loginPath, replace: true });
|
|
4247
4362
|
}
|
|
4248
4363
|
const isTabVisible = typeof document !== "undefined" && !document.hidden;
|
|
4249
4364
|
if (tabJustBecameVisibleRef.current || isTabVisible && wasAuthenticatedRef.current && isLoading) {
|
|
4250
|
-
return loadingFallback || /* @__PURE__ */
|
|
4365
|
+
return loadingFallback || /* @__PURE__ */ jsx("main", { className: "grid place-items-center size-full", children: /* @__PURE__ */ jsx(LoadingSpinner, {}) });
|
|
4251
4366
|
}
|
|
4252
4367
|
if (shouldRedirect) {
|
|
4253
|
-
return /* @__PURE__ */
|
|
4368
|
+
return /* @__PURE__ */ jsx(Navigate, { to: loginPath, replace: true });
|
|
4254
4369
|
}
|
|
4255
4370
|
if (isLoading) {
|
|
4256
|
-
return loadingFallback || /* @__PURE__ */
|
|
4371
|
+
return loadingFallback || /* @__PURE__ */ jsx("main", { className: "grid place-items-center size-full", children: /* @__PURE__ */ jsx(LoadingSpinner, {}) });
|
|
4257
4372
|
}
|
|
4258
|
-
return /* @__PURE__ */
|
|
4373
|
+
return /* @__PURE__ */ jsx(Navigate, { to: loginPath, replace: true });
|
|
4259
4374
|
}
|
|
4260
4375
|
if (!requireEvent) {
|
|
4261
|
-
return /* @__PURE__ */
|
|
4376
|
+
return /* @__PURE__ */ jsx(Outlet, {});
|
|
4262
4377
|
}
|
|
4263
4378
|
if (!events || events.length === 0) {
|
|
4264
|
-
return noEventsFallback || /* @__PURE__ */
|
|
4265
|
-
/* @__PURE__ */
|
|
4266
|
-
/* @__PURE__ */
|
|
4379
|
+
return noEventsFallback || /* @__PURE__ */ jsx("main", { className: "grid place-items-center text-center min-h-screen p-8", children: /* @__PURE__ */ jsxs(Alert, { variant: "destructive", className: "max-w-md", children: [
|
|
4380
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "No Events Available" }),
|
|
4381
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: "You don't have access to any events. Please contact your administrator if you believe this is an error." })
|
|
4267
4382
|
] }) });
|
|
4268
4383
|
}
|
|
4269
4384
|
if (!selectedEvent) {
|
|
4270
|
-
return /* @__PURE__ */
|
|
4385
|
+
return /* @__PURE__ */ jsx(Outlet, {});
|
|
4271
4386
|
}
|
|
4272
|
-
return /* @__PURE__ */
|
|
4387
|
+
return /* @__PURE__ */ jsx(Outlet, {});
|
|
4273
4388
|
}
|
|
4274
|
-
|
|
4275
|
-
// src/components/FileUpload/FileUpload.tsx
|
|
4276
|
-
import { useState as useState15, useCallback as useCallback10, useRef as useRef9, useEffect as useEffect10, useMemo as useMemo10 } from "react";
|
|
4277
|
-
import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4278
4389
|
function FileUpload({
|
|
4279
4390
|
supabase,
|
|
4280
4391
|
table_name,
|
|
@@ -4307,14 +4418,14 @@ function FileUpload({
|
|
|
4307
4418
|
}
|
|
4308
4419
|
throw new Error(errorMsg);
|
|
4309
4420
|
}
|
|
4310
|
-
const [isDragging, setIsDragging] =
|
|
4311
|
-
const [uploadStates, setUploadStates] =
|
|
4312
|
-
const [resolvedAppId, setResolvedAppId] =
|
|
4313
|
-
const [isResolvingAppId, setIsResolvingAppId] =
|
|
4314
|
-
const [appIdError, setAppIdError] =
|
|
4315
|
-
const fileInputRef =
|
|
4421
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
4422
|
+
const [uploadStates, setUploadStates] = useState(/* @__PURE__ */ new Map());
|
|
4423
|
+
const [resolvedAppId, setResolvedAppId] = useState(app_id || null);
|
|
4424
|
+
const [isResolvingAppId, setIsResolvingAppId] = useState(!app_id);
|
|
4425
|
+
const [appIdError, setAppIdError] = useState(null);
|
|
4426
|
+
const fileInputRef = useRef(null);
|
|
4316
4427
|
const { uploadFile, isLoading, error } = useFileReference(supabase);
|
|
4317
|
-
|
|
4428
|
+
useEffect(() => {
|
|
4318
4429
|
if (app_id) {
|
|
4319
4430
|
setResolvedAppId(app_id);
|
|
4320
4431
|
setIsResolvingAppId(false);
|
|
@@ -4349,15 +4460,15 @@ function FileUpload({
|
|
|
4349
4460
|
};
|
|
4350
4461
|
resolveAppId();
|
|
4351
4462
|
}, [app_id, supabase]);
|
|
4352
|
-
const isUploading =
|
|
4463
|
+
const isUploading = useMemo(() => {
|
|
4353
4464
|
return uploadStates.size > 0 && Array.from(uploadStates.values()).some(
|
|
4354
4465
|
(state) => state.progress.status === "uploading" || state.progress.status === "processing"
|
|
4355
4466
|
);
|
|
4356
4467
|
}, [uploadStates]);
|
|
4357
|
-
const isDisabled =
|
|
4468
|
+
const isDisabled = useMemo(() => {
|
|
4358
4469
|
return disabled || isUploading || isResolvingAppId || !resolvedAppId;
|
|
4359
4470
|
}, [disabled, isUploading, isResolvingAppId, resolvedAppId]);
|
|
4360
|
-
const generatePreview =
|
|
4471
|
+
const generatePreview = useCallback((file) => {
|
|
4361
4472
|
return new Promise((resolve) => {
|
|
4362
4473
|
if (!file.type.startsWith("image/")) {
|
|
4363
4474
|
resolve(null);
|
|
@@ -4371,7 +4482,7 @@ function FileUpload({
|
|
|
4371
4482
|
reader.readAsDataURL(file);
|
|
4372
4483
|
});
|
|
4373
4484
|
}, []);
|
|
4374
|
-
const validateFile =
|
|
4485
|
+
const validateFile = useCallback((file) => {
|
|
4375
4486
|
if (file.size > maxSize) {
|
|
4376
4487
|
return `File "${file.name}" exceeds maximum size of ${Math.round(maxSize / 1024 / 1024)}MB`;
|
|
4377
4488
|
}
|
|
@@ -4395,15 +4506,13 @@ function FileUpload({
|
|
|
4395
4506
|
}
|
|
4396
4507
|
return null;
|
|
4397
4508
|
}, [accept, maxSize]);
|
|
4398
|
-
const handleFileSelect =
|
|
4509
|
+
const handleFileSelect = useCallback(async (files) => {
|
|
4399
4510
|
if (!files || files.length === 0) return;
|
|
4400
4511
|
const fileArray = Array.from(files);
|
|
4401
|
-
const validationErrors = [];
|
|
4402
4512
|
const validFiles = [];
|
|
4403
4513
|
for (const file of fileArray) {
|
|
4404
4514
|
const error2 = validateFile(file);
|
|
4405
4515
|
if (error2) {
|
|
4406
|
-
validationErrors.push(error2);
|
|
4407
4516
|
onUploadError?.(error2, file);
|
|
4408
4517
|
} else {
|
|
4409
4518
|
validFiles.push(file);
|
|
@@ -4576,19 +4685,19 @@ function FileUpload({
|
|
|
4576
4685
|
}
|
|
4577
4686
|
}
|
|
4578
4687
|
}, [uploadFile, table_name, record_id, organisation_id, resolvedAppId, category, folder, isPublic, maxSize, onUploadSuccess, onUploadError, onProgress, validateFile, generatePreview, showPreview, appIdError, pageContext]);
|
|
4579
|
-
const handleDragOver =
|
|
4688
|
+
const handleDragOver = useCallback((e) => {
|
|
4580
4689
|
e.preventDefault();
|
|
4581
4690
|
e.stopPropagation();
|
|
4582
4691
|
if (!isDisabled) {
|
|
4583
4692
|
setIsDragging(true);
|
|
4584
4693
|
}
|
|
4585
4694
|
}, [isDisabled]);
|
|
4586
|
-
const handleDragLeave =
|
|
4695
|
+
const handleDragLeave = useCallback((e) => {
|
|
4587
4696
|
e.preventDefault();
|
|
4588
4697
|
e.stopPropagation();
|
|
4589
4698
|
setIsDragging(false);
|
|
4590
4699
|
}, []);
|
|
4591
|
-
const handleDrop =
|
|
4700
|
+
const handleDrop = useCallback((e) => {
|
|
4592
4701
|
e.preventDefault();
|
|
4593
4702
|
e.stopPropagation();
|
|
4594
4703
|
setIsDragging(false);
|
|
@@ -4596,13 +4705,13 @@ function FileUpload({
|
|
|
4596
4705
|
const files = e.dataTransfer.files;
|
|
4597
4706
|
handleFileSelect(files);
|
|
4598
4707
|
}, [isDisabled, handleFileSelect]);
|
|
4599
|
-
const handleFileInputChange =
|
|
4708
|
+
const handleFileInputChange = useCallback((e) => {
|
|
4600
4709
|
handleFileSelect(e.target.files);
|
|
4601
4710
|
if (e.target) {
|
|
4602
4711
|
e.target.value = "";
|
|
4603
4712
|
}
|
|
4604
4713
|
}, [handleFileSelect]);
|
|
4605
|
-
const handleClick =
|
|
4714
|
+
const handleClick = useCallback(() => {
|
|
4606
4715
|
if (!isDisabled && fileInputRef.current) {
|
|
4607
4716
|
fileInputRef.current.click();
|
|
4608
4717
|
}
|
|
@@ -4616,9 +4725,9 @@ function FileUpload({
|
|
|
4616
4725
|
};
|
|
4617
4726
|
const dragClasses = isDragging ? "border-main-500 bg-main-50" : "border-sec-300 hover:border-sec-400";
|
|
4618
4727
|
const disabledClasses = isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:bg-sec-50";
|
|
4619
|
-
return /* @__PURE__ */
|
|
4620
|
-
/* @__PURE__ */
|
|
4621
|
-
|
|
4728
|
+
return /* @__PURE__ */ jsxs(Card, { className, children: [
|
|
4729
|
+
/* @__PURE__ */ jsxs(
|
|
4730
|
+
CardHeader,
|
|
4622
4731
|
{
|
|
4623
4732
|
role: "button",
|
|
4624
4733
|
tabIndex: isDisabled ? -1 : 0,
|
|
@@ -4636,8 +4745,8 @@ function FileUpload({
|
|
|
4636
4745
|
}
|
|
4637
4746
|
} : void 0,
|
|
4638
4747
|
children: [
|
|
4639
|
-
children || /* @__PURE__ */
|
|
4640
|
-
/* @__PURE__ */
|
|
4748
|
+
children || /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4749
|
+
/* @__PURE__ */ jsx(
|
|
4641
4750
|
"input",
|
|
4642
4751
|
{
|
|
4643
4752
|
ref: fileInputRef,
|
|
@@ -4651,64 +4760,58 @@ function FileUpload({
|
|
|
4651
4760
|
"aria-label": accept ? `Upload file${multiple ? "s" : ""} (${accept})` : `Upload file${multiple ? "s" : ""}`
|
|
4652
4761
|
}
|
|
4653
4762
|
),
|
|
4654
|
-
/* @__PURE__ */
|
|
4655
|
-
|
|
4763
|
+
/* @__PURE__ */ jsx("p", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4764
|
+
"Click to upload",
|
|
4656
4765
|
" ",
|
|
4657
4766
|
"or drag and drop"
|
|
4658
4767
|
] }) }),
|
|
4659
|
-
/* @__PURE__ */
|
|
4768
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-sec-500", children: [
|
|
4660
4769
|
!isResolvingAppId && accept !== "*/*" && `Accepted formats: ${accept}`,
|
|
4661
4770
|
!isResolvingAppId && maxSize && ` \u2022 Max size: ${Math.round(maxSize / 1024 / 1024)}MB`,
|
|
4662
4771
|
!isResolvingAppId && multiple && " \u2022 Multiple files allowed"
|
|
4663
4772
|
] })
|
|
4664
4773
|
] }),
|
|
4665
|
-
isUploading && !showProgress && /* @__PURE__ */
|
|
4666
|
-
"div",
|
|
4667
|
-
{
|
|
4668
|
-
className: "absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center",
|
|
4669
|
-
role: "status",
|
|
4670
|
-
"aria-live": "polite",
|
|
4671
|
-
"aria-label": "Uploading file",
|
|
4672
|
-
children: /* @__PURE__ */ jsx23("div", { className: "animate-spin rounded-full size-8 border-b-2 border-main-500", "aria-hidden": "true" })
|
|
4673
|
-
}
|
|
4674
|
-
)
|
|
4774
|
+
isUploading && !showProgress && /* @__PURE__ */ jsx(LoadingSpinner, { size: "lg", className: "text-main-500" })
|
|
4675
4775
|
]
|
|
4676
4776
|
}
|
|
4677
4777
|
),
|
|
4678
|
-
showProgress && uploadStates.size > 0 && /* @__PURE__ */
|
|
4778
|
+
showProgress && uploadStates.size > 0 && /* @__PURE__ */ jsx(CardContent, { children: Array.from(uploadStates.entries()).map(([fileId, uploadState]) => {
|
|
4679
4779
|
const { file, progress, preview, result } = uploadState;
|
|
4680
4780
|
const isError = progress.status === "error";
|
|
4681
4781
|
const isCompleted = progress.status === "completed";
|
|
4682
4782
|
const isUploading2 = progress.status === "uploading" || progress.status === "processing";
|
|
4683
|
-
return /* @__PURE__ */
|
|
4684
|
-
|
|
4783
|
+
return /* @__PURE__ */ jsxs(
|
|
4784
|
+
Card,
|
|
4685
4785
|
{
|
|
4686
|
-
className: `
|
|
4786
|
+
className: `grid grid-cols-[auto_1fr_auto] items-center gap-3 ${isError ? "bg-acc-50 border-acc-200" : isCompleted ? "bg-success-50 border-success-200" : "bg-sec-50 border-sec-200"}`,
|
|
4687
4787
|
children: [
|
|
4688
|
-
/* @__PURE__ */
|
|
4788
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "p-0", children: preview ? /* @__PURE__ */ jsx(
|
|
4689
4789
|
"img",
|
|
4690
4790
|
{
|
|
4691
4791
|
src: preview,
|
|
4692
4792
|
alt: file.name,
|
|
4693
|
-
className: "
|
|
4793
|
+
className: "size-12 object-cover rounded"
|
|
4694
4794
|
}
|
|
4695
|
-
) : /* @__PURE__ */
|
|
4696
|
-
/* @__PURE__ */
|
|
4697
|
-
/* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4795
|
+
) : /* @__PURE__ */ jsx(File, { className: "size-12 text-sec-600" }) }),
|
|
4796
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "p-0 min-w-0", children: [
|
|
4797
|
+
/* @__PURE__ */ jsx(CardTitle, { className: "text-base truncate", children: file.name }),
|
|
4798
|
+
/* @__PURE__ */ jsxs(CardDescription, { children: [
|
|
4699
4799
|
formatFileSize(file.size),
|
|
4700
4800
|
isCompleted && result && " \u2022 Uploaded",
|
|
4701
4801
|
isError && progress.error && ` \u2022 ${progress.error}`
|
|
4702
4802
|
] }),
|
|
4703
|
-
showProgress && (isUploading2 || isError) && /* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
|
|
4803
|
+
showProgress && (isUploading2 || isError) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4804
|
+
/* @__PURE__ */ jsx(
|
|
4805
|
+
Progress,
|
|
4706
4806
|
{
|
|
4707
|
-
|
|
4708
|
-
|
|
4807
|
+
value: progress.percentage,
|
|
4808
|
+
max: 100,
|
|
4809
|
+
style: {
|
|
4810
|
+
accentColor: isError ? "var(--color-acc-500)" : "var(--color-main-500)"
|
|
4811
|
+
}
|
|
4709
4812
|
}
|
|
4710
|
-
)
|
|
4711
|
-
isUploading2 && /* @__PURE__ */
|
|
4813
|
+
),
|
|
4814
|
+
isUploading2 && /* @__PURE__ */ jsxs("p", { children: [
|
|
4712
4815
|
progress.percentage,
|
|
4713
4816
|
"% \u2022 ",
|
|
4714
4817
|
formatFileSize(progress.loaded),
|
|
@@ -4717,125 +4820,22 @@ function FileUpload({
|
|
|
4717
4820
|
] })
|
|
4718
4821
|
] })
|
|
4719
4822
|
] }),
|
|
4720
|
-
/* @__PURE__ */
|
|
4721
|
-
isCompleted && /* @__PURE__ */
|
|
4722
|
-
isError && /* @__PURE__ */
|
|
4723
|
-
isUploading2 && /* @__PURE__ */
|
|
4724
|
-
"div",
|
|
4725
|
-
{
|
|
4726
|
-
className: "animate-spin rounded-full size-5 border-b-2 border-main-500",
|
|
4727
|
-
role: "status",
|
|
4728
|
-
"aria-label": "Uploading",
|
|
4729
|
-
"aria-hidden": "true"
|
|
4730
|
-
}
|
|
4731
|
-
)
|
|
4823
|
+
/* @__PURE__ */ jsxs(CardFooter, { className: "p-0", children: [
|
|
4824
|
+
isCompleted && /* @__PURE__ */ jsx(Check, { className: "text-success-500 size-5" }),
|
|
4825
|
+
isError && /* @__PURE__ */ jsx(X, { className: "text-acc-500 size-5" }),
|
|
4826
|
+
isUploading2 && /* @__PURE__ */ jsx(LoadingSpinner, { size: "sm", className: "text-main-500" })
|
|
4732
4827
|
] })
|
|
4733
4828
|
]
|
|
4734
4829
|
},
|
|
4735
4830
|
fileId
|
|
4736
4831
|
);
|
|
4737
4832
|
}) }),
|
|
4738
|
-
appIdError && /* @__PURE__ */
|
|
4739
|
-
"
|
|
4740
|
-
{
|
|
4741
|
-
|
|
4742
|
-
role: "alert",
|
|
4743
|
-
"aria-live": "assertive",
|
|
4744
|
-
children: appIdError
|
|
4745
|
-
}
|
|
4746
|
-
),
|
|
4747
|
-
error && /* @__PURE__ */ jsx23(
|
|
4748
|
-
"div",
|
|
4749
|
-
{
|
|
4750
|
-
className: "p-3 bg-acc-50 border border-acc-200 rounded-lg text-sm text-acc-600",
|
|
4751
|
-
role: "alert",
|
|
4752
|
-
"aria-live": "assertive",
|
|
4753
|
-
children: error
|
|
4754
|
-
}
|
|
4755
|
-
)
|
|
4833
|
+
(appIdError || error) && /* @__PURE__ */ jsxs(CardFooter, { children: [
|
|
4834
|
+
appIdError && /* @__PURE__ */ jsx("p", { className: "grid place-items-center text-center size-full", role: "alert", "aria-live": "assertive", children: appIdError }),
|
|
4835
|
+
error && /* @__PURE__ */ jsx("p", { className: "grid place-items-center text-center size-full", role: "alert", "aria-live": "assertive", children: error })
|
|
4836
|
+
] })
|
|
4756
4837
|
] });
|
|
4757
4838
|
}
|
|
4758
|
-
|
|
4759
|
-
// src/components/Table/Table.tsx
|
|
4760
|
-
import * as React20 from "react";
|
|
4761
|
-
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
4762
|
-
var Table = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4763
|
-
"table",
|
|
4764
|
-
{
|
|
4765
|
-
ref,
|
|
4766
|
-
className: cn("w-full caption-bottom text-sm", className),
|
|
4767
|
-
...props
|
|
4768
|
-
}
|
|
4769
|
-
));
|
|
4770
|
-
Table.displayName = "Table";
|
|
4771
|
-
var TableHeader = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
4772
|
-
TableHeader.displayName = "TableHeader";
|
|
4773
|
-
var TableBody = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4774
|
-
"tbody",
|
|
4775
|
-
{
|
|
4776
|
-
ref,
|
|
4777
|
-
className: cn("[&_tr:last-child]:border-0", className),
|
|
4778
|
-
...props
|
|
4779
|
-
}
|
|
4780
|
-
));
|
|
4781
|
-
TableBody.displayName = "TableBody";
|
|
4782
|
-
var TableFooter = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4783
|
-
"tfoot",
|
|
4784
|
-
{
|
|
4785
|
-
ref,
|
|
4786
|
-
className: cn(
|
|
4787
|
-
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
4788
|
-
className
|
|
4789
|
-
),
|
|
4790
|
-
...props
|
|
4791
|
-
}
|
|
4792
|
-
));
|
|
4793
|
-
TableFooter.displayName = "TableFooter";
|
|
4794
|
-
var TableRow = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4795
|
-
"tr",
|
|
4796
|
-
{
|
|
4797
|
-
ref,
|
|
4798
|
-
className: cn(
|
|
4799
|
-
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
4800
|
-
className
|
|
4801
|
-
),
|
|
4802
|
-
...props
|
|
4803
|
-
}
|
|
4804
|
-
));
|
|
4805
|
-
TableRow.displayName = "TableRow";
|
|
4806
|
-
var TableHead = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4807
|
-
"th",
|
|
4808
|
-
{
|
|
4809
|
-
ref,
|
|
4810
|
-
className: cn(
|
|
4811
|
-
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
4812
|
-
className
|
|
4813
|
-
),
|
|
4814
|
-
...props
|
|
4815
|
-
}
|
|
4816
|
-
));
|
|
4817
|
-
TableHead.displayName = "TableHead";
|
|
4818
|
-
var TableCell = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4819
|
-
"td",
|
|
4820
|
-
{
|
|
4821
|
-
ref,
|
|
4822
|
-
className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className),
|
|
4823
|
-
...props
|
|
4824
|
-
}
|
|
4825
|
-
));
|
|
4826
|
-
TableCell.displayName = "TableCell";
|
|
4827
|
-
var TableCaption = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4828
|
-
"caption",
|
|
4829
|
-
{
|
|
4830
|
-
ref,
|
|
4831
|
-
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
4832
|
-
...props
|
|
4833
|
-
}
|
|
4834
|
-
));
|
|
4835
|
-
TableCaption.displayName = "TableCaption";
|
|
4836
|
-
|
|
4837
|
-
// src/components/PublicLayout/PublicPageLayout.tsx
|
|
4838
|
-
import { Fragment as Fragment13, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4839
4839
|
function PublicPageHeader({
|
|
4840
4840
|
event,
|
|
4841
4841
|
eventCode,
|
|
@@ -4848,11 +4848,11 @@ function PublicPageHeader({
|
|
|
4848
4848
|
customEventLogo
|
|
4849
4849
|
}) {
|
|
4850
4850
|
const { appName } = useAppConfig();
|
|
4851
|
-
return /* @__PURE__ */
|
|
4851
|
+
return /* @__PURE__ */ jsxs("header", { className: cn(
|
|
4852
4852
|
"w-full px-[max(0rem,calc((100vw-var(--app-width))/2-0.5rem))] grid grid-cols-[auto_1fr_auto] place-items-center gap-2",
|
|
4853
4853
|
className
|
|
4854
4854
|
), children: [
|
|
4855
|
-
showAppLogo && appName && /* @__PURE__ */
|
|
4855
|
+
showAppLogo && appName && /* @__PURE__ */ jsx(
|
|
4856
4856
|
"img",
|
|
4857
4857
|
{
|
|
4858
4858
|
className: "ml-4 max-w-36 object-contain row-span-2",
|
|
@@ -4860,9 +4860,9 @@ function PublicPageHeader({
|
|
|
4860
4860
|
alt: appName
|
|
4861
4861
|
}
|
|
4862
4862
|
),
|
|
4863
|
-
event && /* @__PURE__ */
|
|
4864
|
-
/* @__PURE__ */
|
|
4865
|
-
showEventLogo && event && /* @__PURE__ */
|
|
4863
|
+
event && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4864
|
+
/* @__PURE__ */ jsx("h1", { children: event.event_name }),
|
|
4865
|
+
showEventLogo && event && /* @__PURE__ */ jsx(Fragment, { children: customEventLogo || /* @__PURE__ */ jsx(
|
|
4866
4866
|
FileDisplay,
|
|
4867
4867
|
{
|
|
4868
4868
|
table_name: "event",
|
|
@@ -4879,13 +4879,13 @@ function PublicPageHeader({
|
|
|
4879
4879
|
}
|
|
4880
4880
|
}
|
|
4881
4881
|
) }),
|
|
4882
|
-
event.event_venue && /* @__PURE__ */
|
|
4882
|
+
event.event_venue && /* @__PURE__ */ jsx("h4", { children: event.event_venue })
|
|
4883
4883
|
] }),
|
|
4884
|
-
title && /* @__PURE__ */
|
|
4885
|
-
/* @__PURE__ */
|
|
4886
|
-
description && /* @__PURE__ */
|
|
4884
|
+
title && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4885
|
+
/* @__PURE__ */ jsx("h1", { children: title }),
|
|
4886
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-lg text-sec-600 max-w-3xl mx-auto", children: description })
|
|
4887
4887
|
] }),
|
|
4888
|
-
children && /* @__PURE__ */
|
|
4888
|
+
children && /* @__PURE__ */ jsx(Fragment, { children })
|
|
4889
4889
|
] });
|
|
4890
4890
|
}
|
|
4891
4891
|
function PublicPageFooter({
|
|
@@ -4899,11 +4899,11 @@ function PublicPageFooter({
|
|
|
4899
4899
|
children
|
|
4900
4900
|
}) {
|
|
4901
4901
|
const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
|
|
4902
|
-
return /* @__PURE__ */
|
|
4903
|
-
logo && /* @__PURE__ */
|
|
4904
|
-
children && /* @__PURE__ */
|
|
4905
|
-
/* @__PURE__ */
|
|
4906
|
-
links && links.length > 0 && /* @__PURE__ */
|
|
4902
|
+
return /* @__PURE__ */ jsx("footer", { className: cn("mt-8 py-6 flex justify-center", className), children: /* @__PURE__ */ jsxs("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
|
|
4903
|
+
logo && /* @__PURE__ */ jsx("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
|
|
4904
|
+
children && /* @__PURE__ */ jsx(Fragment, { children }),
|
|
4905
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: copyrightText }),
|
|
4906
|
+
links && links.length > 0 && /* @__PURE__ */ jsx("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
|
|
4907
4907
|
] }) });
|
|
4908
4908
|
}
|
|
4909
4909
|
function PublicPageLayout({
|
|
@@ -4926,102 +4926,51 @@ function PublicPageLayout({
|
|
|
4926
4926
|
});
|
|
4927
4927
|
if (isLoading) {
|
|
4928
4928
|
if (LoadingFallback) {
|
|
4929
|
-
return /* @__PURE__ */
|
|
4929
|
+
return /* @__PURE__ */ jsx(LoadingFallback, {});
|
|
4930
4930
|
}
|
|
4931
|
-
return /* @__PURE__ */
|
|
4932
|
-
/* @__PURE__ */
|
|
4931
|
+
return /* @__PURE__ */ jsxs("p", { className: "grid place-items-center text-center size-full", children: [
|
|
4932
|
+
/* @__PURE__ */ jsx(
|
|
4933
4933
|
LoadingSpinner,
|
|
4934
4934
|
{
|
|
4935
4935
|
size: "lg"
|
|
4936
4936
|
}
|
|
4937
4937
|
),
|
|
4938
|
-
/* @__PURE__ */
|
|
4938
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
4939
4939
|
loadingMessage || "Loading..."
|
|
4940
4940
|
] });
|
|
4941
4941
|
}
|
|
4942
4942
|
if (error && showValidationErrors) {
|
|
4943
4943
|
if (ErrorFallback) {
|
|
4944
|
-
return /* @__PURE__ */
|
|
4944
|
+
return /* @__PURE__ */ jsx(ErrorFallback, { error, retry: handleRefetch });
|
|
4945
4945
|
}
|
|
4946
|
-
return /* @__PURE__ */
|
|
4947
|
-
/* @__PURE__ */
|
|
4948
|
-
/* @__PURE__ */
|
|
4946
|
+
return /* @__PURE__ */ jsxs("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
|
|
4947
|
+
/* @__PURE__ */ jsx("h1", { children: "Event Not Found" }),
|
|
4948
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
4949
4949
|
'The event code "',
|
|
4950
4950
|
eventCode,
|
|
4951
4951
|
'" is invalid or the event is not available for public viewing.'
|
|
4952
4952
|
] }),
|
|
4953
|
-
/* @__PURE__ */
|
|
4953
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleRefetch, children: "Try Again" })
|
|
4954
4954
|
] });
|
|
4955
4955
|
}
|
|
4956
4956
|
if (!event && showValidationErrors) {
|
|
4957
|
-
return /* @__PURE__ */
|
|
4958
|
-
/* @__PURE__ */
|
|
4959
|
-
/* @__PURE__ */
|
|
4960
|
-
handleRefetch && /* @__PURE__ */
|
|
4957
|
+
return /* @__PURE__ */ jsxs("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
|
|
4958
|
+
/* @__PURE__ */ jsx("h1", { children: "Event Not Available" }),
|
|
4959
|
+
/* @__PURE__ */ jsx("p", { children: "This event is not available for public viewing." }),
|
|
4960
|
+
handleRefetch && /* @__PURE__ */ jsx(Button, { onClick: handleRefetch, children: "Try Again" })
|
|
4961
4961
|
] });
|
|
4962
4962
|
}
|
|
4963
|
-
return /* @__PURE__ */
|
|
4964
|
-
customHeader || /* @__PURE__ */
|
|
4963
|
+
return /* @__PURE__ */ jsx(ErrorBoundary, { componentName: "PublicPageLayout", children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4964
|
+
customHeader || /* @__PURE__ */ jsx(
|
|
4965
4965
|
PublicPageHeader,
|
|
4966
4966
|
{
|
|
4967
4967
|
event: event || void 0,
|
|
4968
4968
|
eventCode
|
|
4969
4969
|
}
|
|
4970
4970
|
),
|
|
4971
|
-
/* @__PURE__ */
|
|
4972
|
-
showFooter && event && (customFooter || /* @__PURE__ */
|
|
4971
|
+
/* @__PURE__ */ jsx("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children }),
|
|
4972
|
+
showFooter && event && (customFooter || /* @__PURE__ */ jsx(PublicPageFooter, { event }))
|
|
4973
4973
|
] }) });
|
|
4974
4974
|
}
|
|
4975
4975
|
|
|
4976
|
-
export {
|
|
4977
|
-
AddressField,
|
|
4978
|
-
Label,
|
|
4979
|
-
Textarea,
|
|
4980
|
-
FileDisplay,
|
|
4981
|
-
useFileReference,
|
|
4982
|
-
useFileReferenceForRecord,
|
|
4983
|
-
useFileReferenceById,
|
|
4984
|
-
useFilesByCategory,
|
|
4985
|
-
Avatar,
|
|
4986
|
-
Badge,
|
|
4987
|
-
Switch,
|
|
4988
|
-
Tabs,
|
|
4989
|
-
TabsList,
|
|
4990
|
-
TabsTrigger,
|
|
4991
|
-
TabsContent,
|
|
4992
|
-
Calendar,
|
|
4993
|
-
ToastProvider,
|
|
4994
|
-
ToastViewport,
|
|
4995
|
-
Toast,
|
|
4996
|
-
ToastAction,
|
|
4997
|
-
ToastClose,
|
|
4998
|
-
ToastTitle,
|
|
4999
|
-
ToastDescription,
|
|
5000
|
-
Toaster,
|
|
5001
|
-
Form,
|
|
5002
|
-
FormField,
|
|
5003
|
-
LoginForm,
|
|
5004
|
-
ContextSelector,
|
|
5005
|
-
PasswordChangeForm,
|
|
5006
|
-
UserMenu,
|
|
5007
|
-
NavigationMenu,
|
|
5008
|
-
Header,
|
|
5009
|
-
Footer,
|
|
5010
|
-
PaceAppLayout,
|
|
5011
|
-
PaceLoginPage,
|
|
5012
|
-
SessionRestorationLoader,
|
|
5013
|
-
ProtectedRoute,
|
|
5014
|
-
FileUpload,
|
|
5015
|
-
Table,
|
|
5016
|
-
TableHeader,
|
|
5017
|
-
TableBody,
|
|
5018
|
-
TableFooter,
|
|
5019
|
-
TableRow,
|
|
5020
|
-
TableHead,
|
|
5021
|
-
TableCell,
|
|
5022
|
-
TableCaption,
|
|
5023
|
-
PublicPageHeader,
|
|
5024
|
-
PublicPageFooter,
|
|
5025
|
-
PublicPageLayout
|
|
5026
|
-
};
|
|
5027
|
-
//# sourceMappingURL=chunk-6COVEUS7.js.map
|
|
4976
|
+
export { AddressField, Avatar, Badge, Calendar, ContextSelector, FileDisplay, FileUpload, Footer, Form, FormField, Header, LoginForm, NavigationMenu, PaceAppLayout, PaceLoginPage, PasswordChangeForm, ProtectedRoute, PublicPageFooter, PublicPageHeader, PublicPageLayout, SessionRestorationLoader, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, UserMenu, useFileReference, useFileReferenceById, useFileReferenceForRecord, useFilesByCategory };
|