@processfocus/runtime-local 0.1.0-next.0
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/LICENSE.md +28 -0
- package/README.md +290 -0
- package/dist/authentication-server.mjs +188 -0
- package/dist/chunk-2sb4v2sx.js +70 -0
- package/dist/chunk-9weqs8n8.js +56031 -0
- package/dist/chunk-mvkr77wp.js +54113 -0
- package/dist/chunk-tkn4cnc8.js +453 -0
- package/dist/chunk-vpsm84e8.js +85 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/app-icons/[...path]/route.ts +63 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/health/page.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/public-form-branding/[...path]/route.ts +95 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +248 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +751 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +375 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +73 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +11 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/abandon-execution-dialog.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/execution-card-menu.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +1549 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-dialog.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-modal-client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-route-fallback.tsx +18 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/restart-execution-feedback.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +215 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +678 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +228 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +147 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +246 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +71 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +315 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +259 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-detail-title.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/loading.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/org-chart-client.tsx +74 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +188 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +320 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +152 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +105 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-submit-button.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +282 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/mobile-process-catalog.ts +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/start-process-actions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +504 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +153 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/loading.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/process-documentation.tsx +209 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/use-workflow-auto-refresh.ts +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/loading.tsx +1 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/access-handbook.tsx +110 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-loading.tsx +25 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-tabs.tsx +47 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-helpers.ts +17 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-source.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/evaluate-cedar.ts +43 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +526 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-cedar.ts +174 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +390 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/org-data.ts +70 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +594 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-skeleton.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +186 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +69 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers-table.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles-table.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +244 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +329 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/error.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/not-found.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/stats-data-fetcher.tsx +93 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +143 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +50 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +50 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +58 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +154 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +1317 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +259 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +127 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +33 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-options/route.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-verify/route.ts +142 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register/route.ts +103 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register-verify/route.ts +136 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/registration-session/route.ts +129 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +153 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +122 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +177 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-completed/route.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +38 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +266 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +118 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/test-host/route.ts +125 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/calendar-slots/route.ts +44 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/complete/route.ts +56 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/request-fresh-link/route.ts +41 -0
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +393 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/loading.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +51 -0
- package/dist/dashboard-source/apps/frontend/app/embed/embedded.css +48 -0
- package/dist/dashboard-source/apps/frontend/app/embed/layout.tsx +15 -0
- package/dist/dashboard-source/apps/frontend/app/global.css +13 -0
- package/dist/dashboard-source/apps/frontend/app/layout.tsx +102 -0
- package/dist/dashboard-source/apps/frontend/app/login/layout.tsx +9 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-button.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form-content.tsx +117 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +52 -0
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +226 -0
- package/dist/dashboard-source/apps/frontend/app/login/secret-login-form.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/manifest.ts +7 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/error.tsx +63 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/layout.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/page.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-card.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-context.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-html.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +553 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-state-content.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +33 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/layout.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/page.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +292 -0
- package/dist/dashboard-source/apps/frontend/app/theme.css +117 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +693 -0
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +481 -0
- package/dist/dashboard-source/apps/frontend/components/OrgUnitNode.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +245 -0
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +158 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-card.tsx +218 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-header-row.tsx +97 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/copy-button.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-activity.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-skeleton.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/components/feature-permissions-provider.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +66 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-host.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-identify.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-provider.tsx +55 -0
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +378 -0
- package/dist/dashboard-source/apps/frontend/components/mobile-home-switchboard.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/components/mocks-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/components/org-settings-provider.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/components/process-workflow-link.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/components/session-reissue.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +89 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-stats-views.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/components/theme-provider.tsx +132 -0
- package/dist/dashboard-source/apps/frontend/components/todo-count-badge.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +304 -0
- package/dist/dashboard-source/apps/frontend/components/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dialog.tsx +142 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dropdown-menu.tsx +256 -0
- package/dist/dashboard-source/apps/frontend/components/ui/input.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/components/ui/pagination.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sheet.tsx +138 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +741 -0
- package/dist/dashboard-source/apps/frontend/components/ui/skeleton.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/components/ui/table.tsx +115 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tooltip.tsx +60 -0
- package/dist/dashboard-source/apps/frontend/components/without-waiting-badge.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +116 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/swimlane-node.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +189 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +79 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +74 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-mobile.ts +27 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-notification-preference.ts +246 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +56 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +101 -0
- package/dist/dashboard-source/apps/frontend/index.d.ts +12 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.node.ts +25 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/app-icons-metadata.ts +66 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +128 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +355 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/config.ts +18 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/reconnect-registry.ts +34 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/act-on-behalf-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/callback-error.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +32 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client.ts +46 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/config.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/issuer.ts +164 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/jwt.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +117 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +52 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/redirect.ts +105 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/secret-login-presentation.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-cache-scope.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-role.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +277 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +95 -0
- package/dist/dashboard-source/apps/frontend/lib/authorization-tabs.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/cedar-highlight.ts +116 -0
- package/dist/dashboard-source/apps/frontend/lib/client-plugin-error-reporting.ts +28 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +1119 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-scope.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/database-error-ui.tsx +61 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution-collection-provider.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +161 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution-collection-provider.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +215 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +394 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-registry.ts +196 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-database-name.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-lifecycle.ts +368 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-provider.tsx +577 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +133 -0
- package/dist/dashboard-source/apps/frontend/lib/current-provider-user.ts +30 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/frontend-port-file.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-events.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/error-boundary.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/index.ts +31 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +168 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +206 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +36 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +94 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/index.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest-store.ts +20 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +152 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-request-origin.ts +39 -0
- package/dist/dashboard-source/apps/frontend/lib/errors/get-display-error-message.ts +22 -0
- package/dist/dashboard-source/apps/frontend/lib/execution-menu-actions-registry.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/feature-permissions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-boot-health.tsx +161 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-client-plugin-registry.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest-store.ts +214 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-plugin-loaders.ts +191 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/fragment-masking.ts +87 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +292 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +443 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-consumer.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-error-reporting.ts +268 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-provider.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dashboard-activity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +78 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/endpoint.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/execution-queries.ts +70 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/file-upload-provider.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/graphql-identifiers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +327 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +63 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-queries.ts +67 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/provider-user-queries.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +80 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +15 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +634 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views-server.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +138 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-home-view-model.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-shell-policy.ts +124 -0
- package/dist/dashboard-source/apps/frontend/lib/mock-data.ts +364 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +251 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +178 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notifications-runtime.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/use-todo-notifications.tsx +103 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-depth-config.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-layout.ts +149 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-types.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-loaders.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-preparation.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins-client.tsx +99 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-graphql-errors.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +200 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +209 -0
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/restart-execution-action.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/runtime-config.ts +23 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/constants.ts +5 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/otlp-config.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/register-otel.ts +308 -0
- package/dist/dashboard-source/apps/frontend/lib/theme.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-types.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +144 -0
- package/dist/dashboard-source/apps/frontend/lib/types/org-identity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/utils.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/constants.ts +118 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/edge-routing.ts +195 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/form-preview.ts +8 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +878 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/types.ts +63 -0
- package/dist/dashboard-source/apps/frontend/next.config.ts +238 -0
- package/dist/dashboard-source/apps/frontend/package.json +71 -0
- package/dist/dashboard-source/apps/frontend/postcss.config.mjs +5 -0
- package/dist/dashboard-source/apps/frontend/proxy.ts +293 -0
- package/dist/dashboard-source/apps/frontend/public/.gitkeep +0 -0
- package/dist/dashboard-source/apps/frontend/public/favicon.ico +0 -0
- package/dist/dashboard-source/apps/frontend/public/processfocus-embed.js +553 -0
- package/dist/dashboard-source/apps/frontend/tsconfig.json +35 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +7 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +1397 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +18 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +346 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +172 -0
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +263 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +34 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/errors.ts +47 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +595 -0
- package/dist/dashboard-source/modules/auth-session/src/index.ts +22 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/issuer-url.ts +192 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +76 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/session-cache-scope.ts +24 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +54 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/url.ts +2 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +3 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/acm.ts +50 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/otlp-config.ts +66 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/runtime-ssm.ts +28 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/index.ts +1 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +65 -0
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +78 -0
- package/dist/dashboard-source/modules/form/src/index.ts +20 -0
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +152 -0
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +1421 -0
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +85 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +58 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +34 -0
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +1554 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +440 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +13 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +336 -0
- package/dist/dashboard-source/modules/form-rule/src/index.ts +21 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +531 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +102 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +121 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +8 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +44 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/deferred-value.ts +21 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +50 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +82 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +58 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +975 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +60 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +45 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/endpoint.ts +137 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/index.ts +11 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/port-files.ts +219 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/index.ts +2 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +201 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +408 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/index.ts +29 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +288 -0
- package/dist/dashboard-source/modules/openauth/src/client.ts +1045 -0
- package/dist/dashboard-source/modules/openauth/src/error.ts +140 -0
- package/dist/dashboard-source/modules/openauth/src/pkce.ts +40 -0
- package/dist/dashboard-source/modules/openauth/src/random.ts +24 -0
- package/dist/dashboard-source/modules/openauth/src/subject.ts +132 -0
- package/dist/dashboard-source/modules/openauth/src/util.ts +13 -0
- package/dist/dashboard-source/modules/request-time/src/index.ts +1 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +30 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/draft-process-execution-schema.json +45 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +217 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/process-schema.json +77 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/todo-schema.json +94 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/index.ts +2 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +181 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +166 -0
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +60 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/boolean-field.tsx +73 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/calendar-slot-field.tsx +808 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +127 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/field-set.tsx +14 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-field.tsx +321 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-upload-context.tsx +45 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/form-context.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +394 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/radio-field.tsx +96 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/select-field.tsx +106 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/text-field.tsx +245 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/button.tsx +63 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/command.tsx +101 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/field.tsx +275 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/input.tsx +29 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/label.tsx +23 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/separator.tsx +27 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/textarea.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/utils/utils.ts +4 -0
- package/dist/dashboard-source.json +70 -0
- package/dist/graphql-server.mjs +1319 -0
- package/dist/job-worker.mjs +989 -0
- package/dist/main.mjs +495 -0
- package/dist/prepare-dashboard.mjs +35 -0
- package/dist/resources/cedar/policies.cedar +315 -0
- package/dist/resources/cedar/schema.cedarschema +276 -0
- package/dist/resources/graphql-schema/rxdb.graphql +401 -0
- package/dist/resources/graphql-schema/system.graphql +1200 -0
- package/package.json +98 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useMemo, useState } from "react"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
interface TimelineSegmentData {
|
|
7
|
+
readonly status: string
|
|
8
|
+
readonly startDate: string
|
|
9
|
+
readonly endDate: string | null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface TimelineItemData {
|
|
13
|
+
readonly id: string
|
|
14
|
+
readonly label: string
|
|
15
|
+
readonly currentStatus: string
|
|
16
|
+
readonly startDate: string
|
|
17
|
+
readonly endDate: string | null
|
|
18
|
+
readonly segments: readonly TimelineSegmentData[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface JourneyTimelineProps {
|
|
22
|
+
readonly items: readonly TimelineItemData[]
|
|
23
|
+
readonly now: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const statusColors: Record<string, string> = {
|
|
27
|
+
received: "bg-slate-400 dark:bg-slate-500",
|
|
28
|
+
"waiting for parent to book tour": "bg-amber-400 dark:bg-amber-500",
|
|
29
|
+
"tour booked": "bg-sky-500 dark:bg-sky-600",
|
|
30
|
+
"parent cancelled": "bg-stone-400 dark:bg-stone-500",
|
|
31
|
+
"waiting for formal application": "bg-violet-400 dark:bg-violet-500",
|
|
32
|
+
enrolling: "bg-indigo-500 dark:bg-indigo-600",
|
|
33
|
+
testing: "bg-cyan-400 dark:bg-cyan-500",
|
|
34
|
+
enrolled: "bg-emerald-500 dark:bg-emerald-600",
|
|
35
|
+
"not enrolled": "bg-rose-500 dark:bg-rose-600",
|
|
36
|
+
"enrolled at other school": "bg-orange-400 dark:bg-orange-500",
|
|
37
|
+
rejected: "bg-red-600 dark:bg-red-700",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const statusLabelColors: Record<string, string> = {
|
|
41
|
+
received: "text-slate-600 dark:text-slate-400",
|
|
42
|
+
"waiting for parent to book tour": "text-amber-600 dark:text-amber-400",
|
|
43
|
+
"tour booked": "text-sky-600 dark:text-sky-400",
|
|
44
|
+
"parent cancelled": "text-stone-600 dark:text-stone-400",
|
|
45
|
+
"waiting for formal application": "text-violet-600 dark:text-violet-400",
|
|
46
|
+
enrolling: "text-indigo-600 dark:text-indigo-400",
|
|
47
|
+
testing: "text-cyan-600 dark:text-cyan-400",
|
|
48
|
+
enrolled: "text-emerald-600 dark:text-emerald-400",
|
|
49
|
+
"not enrolled": "text-rose-600 dark:text-rose-400",
|
|
50
|
+
"enrolled at other school": "text-orange-600 dark:text-orange-400",
|
|
51
|
+
rejected: "text-red-600 dark:text-red-400",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function getStatusColor(status: string): string {
|
|
55
|
+
return statusColors[status] ?? "bg-slate-300 dark:bg-slate-600"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getStatusLabelColor(status: string): string {
|
|
59
|
+
return statusLabelColors[status] ?? "text-slate-500 dark:text-slate-400"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function formatDuration(ms: number): string {
|
|
63
|
+
const days = Math.floor(ms / (1000 * 60 * 60 * 24))
|
|
64
|
+
if (days >= 1) return `${days}d`
|
|
65
|
+
const hours = Math.floor(ms / (1000 * 60 * 60))
|
|
66
|
+
if (hours >= 1) return `${hours}h`
|
|
67
|
+
const mins = Math.floor(ms / (1000 * 60))
|
|
68
|
+
return `${mins}m`
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function formatDate(iso: string): string {
|
|
72
|
+
const d = new Date(iso)
|
|
73
|
+
return d.toLocaleDateString("en-NZ", {
|
|
74
|
+
day: "numeric",
|
|
75
|
+
month: "short",
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const RowTooltip = ({
|
|
80
|
+
item,
|
|
81
|
+
segment,
|
|
82
|
+
now,
|
|
83
|
+
}: {
|
|
84
|
+
item: TimelineItemData
|
|
85
|
+
segment: TimelineSegmentData
|
|
86
|
+
now: number
|
|
87
|
+
}) => {
|
|
88
|
+
const start = new Date(segment.startDate).getTime()
|
|
89
|
+
const end = segment.endDate ? new Date(segment.endDate).getTime() : now
|
|
90
|
+
return (
|
|
91
|
+
<div className="pointer-events-none absolute bottom-full left-1/2 z-20 mb-2 -translate-x-1/2 whitespace-nowrap rounded-lg border border-slate-200 bg-white px-3 py-2 text-xs shadow-lg dark:border-slate-700 dark:bg-slate-800">
|
|
92
|
+
<div className="font-semibold text-slate-900 dark:text-slate-100">
|
|
93
|
+
{segment.status}
|
|
94
|
+
</div>
|
|
95
|
+
<div className="text-slate-500 dark:text-slate-400">{item.label}</div>
|
|
96
|
+
<div className="mt-1 text-slate-400 dark:text-slate-500">
|
|
97
|
+
{formatDate(segment.startDate)}
|
|
98
|
+
{segment.endDate ? ` → ${formatDate(segment.endDate)}` : " → now"}
|
|
99
|
+
{" · "}
|
|
100
|
+
{formatDuration(end - start)}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function JourneyTimeline({ items, now }: JourneyTimelineProps) {
|
|
107
|
+
const [hoveredSegment, setHoveredSegment] = useState<string | null>(null)
|
|
108
|
+
|
|
109
|
+
const { globalStart, globalEnd, sortedItems } = useMemo(() => {
|
|
110
|
+
if (items.length === 0) {
|
|
111
|
+
return {
|
|
112
|
+
globalStart: 0,
|
|
113
|
+
globalEnd: 1,
|
|
114
|
+
sortedItems: [],
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let min = Infinity
|
|
119
|
+
let max = -Infinity
|
|
120
|
+
|
|
121
|
+
for (const item of items) {
|
|
122
|
+
const s = new Date(item.startDate).getTime()
|
|
123
|
+
if (s < min) min = s
|
|
124
|
+
const e = item.endDate ? new Date(item.endDate).getTime() : now
|
|
125
|
+
if (e > max) max = e
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (min === max) max = min + 1
|
|
129
|
+
|
|
130
|
+
const sorted = [...items].sort(
|
|
131
|
+
(a, b) =>
|
|
132
|
+
new Date(a.startDate).getTime() - new Date(b.startDate).getTime(),
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
return { globalStart: min, globalEnd: max, sortedItems: sorted }
|
|
136
|
+
}, [items, now])
|
|
137
|
+
|
|
138
|
+
const totalRange = globalEnd - globalStart
|
|
139
|
+
|
|
140
|
+
const pct = useMemo(
|
|
141
|
+
() => (time: number) => ((time - globalStart) / totalRange) * 100,
|
|
142
|
+
[globalStart, totalRange],
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
const axisMarks = useMemo(() => {
|
|
146
|
+
const marks: { key: string; label: string; pct: number }[] = []
|
|
147
|
+
const start = new Date(globalStart)
|
|
148
|
+
start.setDate(1)
|
|
149
|
+
start.setHours(0, 0, 0, 0)
|
|
150
|
+
|
|
151
|
+
const end = new Date(globalEnd)
|
|
152
|
+
const cursor = new Date(start)
|
|
153
|
+
|
|
154
|
+
while (cursor.getTime() <= end.getTime()) {
|
|
155
|
+
const t = cursor.getTime()
|
|
156
|
+
if (t >= globalStart) {
|
|
157
|
+
marks.push({
|
|
158
|
+
key: `${cursor.getFullYear()}-${cursor.getMonth()}`,
|
|
159
|
+
label: cursor.toLocaleDateString("en-NZ", {
|
|
160
|
+
month: "short",
|
|
161
|
+
}),
|
|
162
|
+
pct: pct(t),
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
cursor.setMonth(cursor.getMonth() + 1)
|
|
166
|
+
}
|
|
167
|
+
return marks
|
|
168
|
+
}, [globalStart, globalEnd, pct])
|
|
169
|
+
|
|
170
|
+
const legendStatuses = useMemo(() => {
|
|
171
|
+
const seen = new Set<string>()
|
|
172
|
+
for (const item of items) {
|
|
173
|
+
for (const seg of item.segments) {
|
|
174
|
+
seen.add(seg.status)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return [...seen]
|
|
178
|
+
}, [items])
|
|
179
|
+
|
|
180
|
+
if (items.length === 0) {
|
|
181
|
+
return null
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<div className="rounded-2xl border border-slate-200 bg-white p-5 shadow-sm dark:border-slate-800 dark:bg-slate-900/60">
|
|
186
|
+
<div className="mb-3 flex flex-wrap items-center justify-end gap-3">
|
|
187
|
+
<div className="flex flex-wrap gap-x-4 gap-y-1.5">
|
|
188
|
+
{legendStatuses.map((status) => (
|
|
189
|
+
<div
|
|
190
|
+
key={status}
|
|
191
|
+
className="flex items-center gap-1.5 text-xs text-slate-500 dark:text-slate-400"
|
|
192
|
+
>
|
|
193
|
+
<span
|
|
194
|
+
className={cn("h-2.5 w-2.5 rounded-sm", getStatusColor(status))}
|
|
195
|
+
/>
|
|
196
|
+
<span className="capitalize">{status}</span>
|
|
197
|
+
</div>
|
|
198
|
+
))}
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
{/* Time axis */}
|
|
203
|
+
<div className="relative ml-44 mb-1 h-5 select-none border-b border-slate-100 dark:border-slate-800">
|
|
204
|
+
{axisMarks.map((mark) => (
|
|
205
|
+
<div
|
|
206
|
+
key={mark.key}
|
|
207
|
+
className="absolute top-0 flex flex-col items-center"
|
|
208
|
+
style={{ left: `${mark.pct}%` }}
|
|
209
|
+
>
|
|
210
|
+
<span className="text-[10px] text-slate-400 dark:text-slate-500">
|
|
211
|
+
{mark.label}
|
|
212
|
+
</span>
|
|
213
|
+
<span className="h-2 w-px bg-slate-200 dark:bg-slate-700" />
|
|
214
|
+
</div>
|
|
215
|
+
))}
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
{/* Timeline rows */}
|
|
219
|
+
<div className="space-y-1">
|
|
220
|
+
{sortedItems.map((item) => {
|
|
221
|
+
const itemStart = new Date(item.startDate).getTime()
|
|
222
|
+
const itemEnd = item.endDate ? new Date(item.endDate).getTime() : now
|
|
223
|
+
const leftPct = pct(itemStart)
|
|
224
|
+
const widthPct = Math.max(pct(itemEnd) - leftPct, 0.5)
|
|
225
|
+
|
|
226
|
+
return (
|
|
227
|
+
<div key={item.id} className="group flex items-center gap-2">
|
|
228
|
+
{/* Label */}
|
|
229
|
+
<div className="w-42 flex-shrink-0 truncate text-right text-xs text-slate-600 dark:text-slate-400">
|
|
230
|
+
{item.label}
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
{/* Bar container */}
|
|
234
|
+
<div className="relative h-7 flex-1 overflow-hidden rounded">
|
|
235
|
+
{/* Grid lines */}
|
|
236
|
+
{axisMarks.map((mark) => (
|
|
237
|
+
<div
|
|
238
|
+
key={mark.key}
|
|
239
|
+
className="absolute top-0 h-full w-px bg-slate-50 dark:bg-slate-800/50"
|
|
240
|
+
style={{ left: `${mark.pct}%` }}
|
|
241
|
+
/>
|
|
242
|
+
))}
|
|
243
|
+
|
|
244
|
+
{/* Bar */}
|
|
245
|
+
<div
|
|
246
|
+
className="absolute top-1 flex h-5 items-center overflow-hidden rounded"
|
|
247
|
+
style={{
|
|
248
|
+
left: `${leftPct}%`,
|
|
249
|
+
width: `${widthPct}%`,
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
{item.segments.map((seg, i) => {
|
|
253
|
+
const segStart = new Date(seg.startDate).getTime()
|
|
254
|
+
const segEnd = seg.endDate
|
|
255
|
+
? new Date(seg.endDate).getTime()
|
|
256
|
+
: now
|
|
257
|
+
const segLeft =
|
|
258
|
+
((segStart - itemStart) / (itemEnd - itemStart || 1)) *
|
|
259
|
+
100
|
|
260
|
+
const segWidth =
|
|
261
|
+
((segEnd - segStart) / (itemEnd - itemStart || 1)) * 100
|
|
262
|
+
const segKey = `${item.id}-${i}`
|
|
263
|
+
const isHovered = hoveredSegment === segKey
|
|
264
|
+
return (
|
|
265
|
+
<div
|
|
266
|
+
key={segKey}
|
|
267
|
+
className={cn(
|
|
268
|
+
"relative h-full transition-opacity",
|
|
269
|
+
getStatusColor(seg.status),
|
|
270
|
+
isHovered ? "opacity-80" : "opacity-100",
|
|
271
|
+
)}
|
|
272
|
+
style={{
|
|
273
|
+
position: "absolute",
|
|
274
|
+
left: `${segLeft}%`,
|
|
275
|
+
width: `${Math.max(segWidth, 0.5)}%`,
|
|
276
|
+
}}
|
|
277
|
+
role="img"
|
|
278
|
+
aria-label={`${seg.status}: ${formatDate(seg.startDate)}${seg.endDate ? ` to ${formatDate(seg.endDate)}` : " to now"}`}
|
|
279
|
+
onMouseEnter={() => setHoveredSegment(segKey)}
|
|
280
|
+
onMouseLeave={() => setHoveredSegment(null)}
|
|
281
|
+
>
|
|
282
|
+
{isHovered && (
|
|
283
|
+
<RowTooltip item={item} segment={seg} now={now} />
|
|
284
|
+
)}
|
|
285
|
+
</div>
|
|
286
|
+
)
|
|
287
|
+
})}
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
{/* Outcome badge */}
|
|
292
|
+
<div className="w-24 flex-shrink-0 text-right text-xs">
|
|
293
|
+
<span
|
|
294
|
+
className={cn(
|
|
295
|
+
"font-medium",
|
|
296
|
+
getStatusLabelColor(item.currentStatus),
|
|
297
|
+
)}
|
|
298
|
+
>
|
|
299
|
+
{item.currentStatus}
|
|
300
|
+
</span>
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
)
|
|
304
|
+
})}
|
|
305
|
+
</div>
|
|
306
|
+
|
|
307
|
+
{/* Summary stats */}
|
|
308
|
+
<div className="mt-4 flex flex-wrap gap-x-6 gap-y-2 border-t border-slate-100 pt-3 dark:border-slate-800">
|
|
309
|
+
{(() => {
|
|
310
|
+
const enrolled = items.filter(
|
|
311
|
+
(i) => i.currentStatus === "enrolled",
|
|
312
|
+
).length
|
|
313
|
+
const declined = items.filter(
|
|
314
|
+
(i) =>
|
|
315
|
+
i.currentStatus === "not enrolled" ||
|
|
316
|
+
i.currentStatus === "rejected" ||
|
|
317
|
+
i.currentStatus === "enrolled at other school",
|
|
318
|
+
).length
|
|
319
|
+
const pending = items.length - enrolled - declined
|
|
320
|
+
|
|
321
|
+
const completed = items.filter(
|
|
322
|
+
(i) => i.endDate !== null && i.endDate !== undefined,
|
|
323
|
+
)
|
|
324
|
+
const avgDays =
|
|
325
|
+
completed.length > 0
|
|
326
|
+
? completed.reduce((sum, i) => {
|
|
327
|
+
const endMs = new Date(i.endDate as string).getTime()
|
|
328
|
+
const ms = endMs - new Date(i.startDate).getTime()
|
|
329
|
+
return sum + ms / (1000 * 60 * 60 * 24)
|
|
330
|
+
}, 0) / completed.length
|
|
331
|
+
: 0
|
|
332
|
+
|
|
333
|
+
return (
|
|
334
|
+
<>
|
|
335
|
+
<Stat label="Total" value={String(items.length)} />
|
|
336
|
+
<Stat
|
|
337
|
+
label="Enrolled"
|
|
338
|
+
value={String(enrolled)}
|
|
339
|
+
tone="text-emerald-600 dark:text-emerald-400"
|
|
340
|
+
/>
|
|
341
|
+
<Stat
|
|
342
|
+
label="Declined"
|
|
343
|
+
value={String(declined)}
|
|
344
|
+
tone="text-rose-600 dark:text-rose-400"
|
|
345
|
+
/>
|
|
346
|
+
<Stat label="Pending" value={String(pending)} />
|
|
347
|
+
<Stat
|
|
348
|
+
label="Avg time to outcome"
|
|
349
|
+
value={avgDays > 0 ? `${Math.round(avgDays * 10) / 10}d` : "—"}
|
|
350
|
+
/>
|
|
351
|
+
</>
|
|
352
|
+
)
|
|
353
|
+
})()}
|
|
354
|
+
</div>
|
|
355
|
+
</div>
|
|
356
|
+
)
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function Stat({
|
|
360
|
+
label,
|
|
361
|
+
value,
|
|
362
|
+
tone,
|
|
363
|
+
}: {
|
|
364
|
+
label: string
|
|
365
|
+
value: string
|
|
366
|
+
tone?: string
|
|
367
|
+
}) {
|
|
368
|
+
return (
|
|
369
|
+
<div className="flex items-center gap-1.5 text-xs">
|
|
370
|
+
<span className="text-slate-400 dark:text-slate-500">{label}</span>
|
|
371
|
+
<span
|
|
372
|
+
className={cn("font-semibold text-slate-700 dark:text-slate-300", tone)}
|
|
373
|
+
>
|
|
374
|
+
{value}
|
|
375
|
+
</span>
|
|
376
|
+
</div>
|
|
377
|
+
)
|
|
378
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { ChevronRight, CircleCheckBig, PlayCircle } from "lucide-react"
|
|
4
|
+
import Link from "next/link"
|
|
5
|
+
import type { ReactNode } from "react"
|
|
6
|
+
import type { MobileHomeViewModel } from "@/lib/mobile-home-view-model"
|
|
7
|
+
|
|
8
|
+
export function MobileHomeSwitchboard({
|
|
9
|
+
viewModel,
|
|
10
|
+
}: {
|
|
11
|
+
viewModel: MobileHomeViewModel
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<section aria-label={viewModel.title}>
|
|
15
|
+
<div
|
|
16
|
+
className="mx-auto flex w-full max-w-md flex-col gap-4"
|
|
17
|
+
data-testid="mobile-home-switchboard"
|
|
18
|
+
>
|
|
19
|
+
<MobileHomeCard
|
|
20
|
+
href={viewModel.cards.todos.href}
|
|
21
|
+
title={viewModel.cards.todos.title}
|
|
22
|
+
detail={viewModel.cards.todos.detail}
|
|
23
|
+
supportingText={viewModel.cards.todos.supportingText}
|
|
24
|
+
icon={<CircleCheckBig className="h-5 w-5" />}
|
|
25
|
+
accentClassName="bg-blue-600 text-white"
|
|
26
|
+
detailTestId="mobile-home-open-task-count"
|
|
27
|
+
cardTestId="mobile-home-todos-card"
|
|
28
|
+
/>
|
|
29
|
+
<MobileHomeCard
|
|
30
|
+
href={viewModel.cards.startProcess.href}
|
|
31
|
+
title={viewModel.cards.startProcess.title}
|
|
32
|
+
detail={viewModel.cards.startProcess.detail}
|
|
33
|
+
supportingText={viewModel.cards.startProcess.supportingText}
|
|
34
|
+
icon={<PlayCircle className="h-5 w-5" />}
|
|
35
|
+
accentClassName="bg-emerald-600 text-white"
|
|
36
|
+
cardTestId="mobile-home-start-process-card"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
</section>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function MobileHomeCard({
|
|
44
|
+
href,
|
|
45
|
+
title,
|
|
46
|
+
detail,
|
|
47
|
+
supportingText,
|
|
48
|
+
icon,
|
|
49
|
+
accentClassName,
|
|
50
|
+
detailTestId,
|
|
51
|
+
cardTestId,
|
|
52
|
+
}: {
|
|
53
|
+
href: string
|
|
54
|
+
title: string
|
|
55
|
+
detail: string
|
|
56
|
+
supportingText: string
|
|
57
|
+
icon: ReactNode
|
|
58
|
+
accentClassName: string
|
|
59
|
+
detailTestId?: string
|
|
60
|
+
cardTestId: string
|
|
61
|
+
}) {
|
|
62
|
+
return (
|
|
63
|
+
<Link
|
|
64
|
+
href={href}
|
|
65
|
+
className="group block rounded-3xl border border-slate-200 bg-white p-5 shadow-sm transition-transform duration-150 hover:-translate-y-0.5 hover:border-slate-300 hover:shadow-md dark:border-slate-800 dark:bg-slate-950 dark:hover:border-slate-700"
|
|
66
|
+
data-testid={cardTestId}
|
|
67
|
+
>
|
|
68
|
+
<div className="flex items-start justify-between gap-4">
|
|
69
|
+
<div className="space-y-3">
|
|
70
|
+
<span
|
|
71
|
+
className={`inline-flex h-11 w-11 items-center justify-center rounded-2xl ${accentClassName}`}
|
|
72
|
+
aria-hidden="true"
|
|
73
|
+
>
|
|
74
|
+
{icon}
|
|
75
|
+
</span>
|
|
76
|
+
<div className="space-y-1">
|
|
77
|
+
<h2 className="text-xl font-semibold text-slate-950 dark:text-slate-50">
|
|
78
|
+
{title}
|
|
79
|
+
</h2>
|
|
80
|
+
<p
|
|
81
|
+
className="text-lg font-medium text-slate-900 dark:text-slate-100"
|
|
82
|
+
data-testid={detailTestId}
|
|
83
|
+
>
|
|
84
|
+
{detail}
|
|
85
|
+
</p>
|
|
86
|
+
<p className="max-w-xs text-sm leading-6 text-slate-600 dark:text-slate-400">
|
|
87
|
+
{supportingText}
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<ChevronRight
|
|
92
|
+
className="mt-1 h-5 w-5 shrink-0 text-slate-400 transition-transform group-hover:translate-x-0.5 dark:text-slate-500"
|
|
93
|
+
aria-hidden="true"
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
</Link>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, useState } from "react"
|
|
4
|
+
|
|
5
|
+
interface MocksContextValue {
|
|
6
|
+
showMocks: boolean
|
|
7
|
+
setShowMocks: (show: boolean) => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const MocksContext = createContext<MocksContextValue>({
|
|
11
|
+
showMocks: false,
|
|
12
|
+
setShowMocks: () => {},
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export function MocksProvider({ children }: { children: React.ReactNode }) {
|
|
16
|
+
const [showMocks, setShowMocks] = useState(false)
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<MocksContext.Provider value={{ showMocks, setShowMocks }}>
|
|
20
|
+
{children}
|
|
21
|
+
</MocksContext.Provider>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function useMocks() {
|
|
26
|
+
return useContext(MocksContext)
|
|
27
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Bell, BellOff, BellRing, LoaderCircle } from "lucide-react"
|
|
4
|
+
import { useEffect, useState } from "react"
|
|
5
|
+
import {
|
|
6
|
+
Tooltip,
|
|
7
|
+
TooltipContent,
|
|
8
|
+
TooltipProvider,
|
|
9
|
+
TooltipTrigger,
|
|
10
|
+
} from "@/components/ui/tooltip"
|
|
11
|
+
import { useNotificationPreference } from "@/hooks/use-notification-preference"
|
|
12
|
+
import { cn } from "@/lib/utils"
|
|
13
|
+
|
|
14
|
+
interface NotificationBellProps {
|
|
15
|
+
/** The current user's ID for scoping the preference */
|
|
16
|
+
userId: string
|
|
17
|
+
/** The current org's ID for scoping the preference */
|
|
18
|
+
orgId: string
|
|
19
|
+
/** Optional CSS class for styling */
|
|
20
|
+
className?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Header bell control for desktop notifications.
|
|
25
|
+
*
|
|
26
|
+
* This component provides a self-service toggle for browser-local desktop
|
|
27
|
+
* notifications. The preference is scoped to the current user and org.
|
|
28
|
+
*
|
|
29
|
+
* Features:
|
|
30
|
+
* - Hidden in browsers without Notification API support
|
|
31
|
+
* - Click to request permission and enable
|
|
32
|
+
* - Click again to disable
|
|
33
|
+
* - Shows disabled state when permission is denied
|
|
34
|
+
* - Persists preference in localStorage
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <NotificationBell userId={session.userId} orgId={session.orgUnitId} />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function NotificationBell({
|
|
42
|
+
userId,
|
|
43
|
+
orgId,
|
|
44
|
+
className,
|
|
45
|
+
}: NotificationBellProps) {
|
|
46
|
+
const [mounted, setMounted] = useState(false)
|
|
47
|
+
const {
|
|
48
|
+
state,
|
|
49
|
+
toggle,
|
|
50
|
+
isSupported,
|
|
51
|
+
isPermissionRequestPending,
|
|
52
|
+
browserPromptHint,
|
|
53
|
+
} = useNotificationPreference(userId, orgId)
|
|
54
|
+
|
|
55
|
+
// Avoid hydration mismatch - don't render until client-side
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
setMounted(true)
|
|
58
|
+
}, [])
|
|
59
|
+
|
|
60
|
+
// Don't show anything during SSR or in unsupported browsers
|
|
61
|
+
if (!mounted || !isSupported) {
|
|
62
|
+
return null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const isEnabled = state.isEnabled
|
|
66
|
+
const isDenied = state.permission === "denied"
|
|
67
|
+
const isPending = isPermissionRequestPending
|
|
68
|
+
|
|
69
|
+
// Determine icon and tooltip based on state
|
|
70
|
+
const Icon = isPending
|
|
71
|
+
? LoaderCircle
|
|
72
|
+
: isEnabled
|
|
73
|
+
? BellRing
|
|
74
|
+
: isDenied
|
|
75
|
+
? BellOff
|
|
76
|
+
: Bell
|
|
77
|
+
const tooltipContent = browserPromptHint
|
|
78
|
+
? browserPromptHint
|
|
79
|
+
: isEnabled
|
|
80
|
+
? "Desktop notifications enabled (click to disable)"
|
|
81
|
+
: isDenied
|
|
82
|
+
? "Desktop notifications blocked in browser settings"
|
|
83
|
+
: "Enable desktop notifications"
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div className="relative">
|
|
87
|
+
<TooltipProvider delayDuration={300}>
|
|
88
|
+
<Tooltip>
|
|
89
|
+
<TooltipTrigger asChild>
|
|
90
|
+
<button
|
|
91
|
+
type="button"
|
|
92
|
+
onClick={toggle}
|
|
93
|
+
disabled={isDenied || isPending}
|
|
94
|
+
className={cn(
|
|
95
|
+
"relative flex h-10 w-10 items-center justify-center rounded-full border border-slate-200 bg-white shadow-sm transition-colors",
|
|
96
|
+
isEnabled
|
|
97
|
+
? "text-blue-600 hover:bg-blue-50 dark:border-slate-700 dark:bg-slate-900 dark:text-blue-400 dark:hover:bg-slate-800"
|
|
98
|
+
: isDenied || isPending
|
|
99
|
+
? "cursor-not-allowed text-slate-300 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-600"
|
|
100
|
+
: "text-slate-500 hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400 dark:hover:bg-slate-800",
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
aria-label={tooltipContent}
|
|
104
|
+
data-testid="notification-bell"
|
|
105
|
+
data-state={
|
|
106
|
+
isPending
|
|
107
|
+
? "pending"
|
|
108
|
+
: isEnabled
|
|
109
|
+
? "enabled"
|
|
110
|
+
: isDenied
|
|
111
|
+
? "denied"
|
|
112
|
+
: "disabled"
|
|
113
|
+
}
|
|
114
|
+
>
|
|
115
|
+
<Icon className={cn("h-5 w-5", isPending && "animate-spin")} />
|
|
116
|
+
{isEnabled && (
|
|
117
|
+
<span className="absolute top-1 right-1 h-2 w-2 rounded-full bg-blue-500" />
|
|
118
|
+
)}
|
|
119
|
+
</button>
|
|
120
|
+
</TooltipTrigger>
|
|
121
|
+
<TooltipContent side="bottom" align="center">
|
|
122
|
+
<p>{tooltipContent}</p>
|
|
123
|
+
</TooltipContent>
|
|
124
|
+
</Tooltip>
|
|
125
|
+
</TooltipProvider>
|
|
126
|
+
{browserPromptHint && (
|
|
127
|
+
// Keep the Firefox guidance visible even when the tooltip is closed.
|
|
128
|
+
<div
|
|
129
|
+
className="absolute top-full right-0 z-50 mt-2 w-72 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 shadow-lg dark:border-amber-900/60 dark:bg-slate-900 dark:text-amber-100"
|
|
130
|
+
role="status"
|
|
131
|
+
>
|
|
132
|
+
{browserPromptHint}
|
|
133
|
+
</div>
|
|
134
|
+
)}
|
|
135
|
+
</div>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { createContext, useContext } from "react"
|
|
3
|
+
|
|
4
|
+
interface OrgSettings {
|
|
5
|
+
startDayOfWeek: number
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const OrgSettingsContext = createContext<OrgSettings>({ startDayOfWeek: 0 })
|
|
9
|
+
|
|
10
|
+
export function OrgSettingsProvider({
|
|
11
|
+
startDayOfWeek,
|
|
12
|
+
children,
|
|
13
|
+
}: {
|
|
14
|
+
startDayOfWeek: number
|
|
15
|
+
children: React.ReactNode
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<OrgSettingsContext.Provider value={{ startDayOfWeek }}>
|
|
19
|
+
{children}
|
|
20
|
+
</OrgSettingsContext.Provider>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function useOrgSettings() {
|
|
25
|
+
return useContext(OrgSettingsContext)
|
|
26
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Info } from "lucide-react"
|
|
4
|
+
import Link from "next/link"
|
|
5
|
+
import { useState } from "react"
|
|
6
|
+
import { toUrlPath } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
export function ProcessWorkflowLink({
|
|
9
|
+
processName,
|
|
10
|
+
processPath,
|
|
11
|
+
}: {
|
|
12
|
+
processName: string
|
|
13
|
+
processPath: string | undefined
|
|
14
|
+
}) {
|
|
15
|
+
const [prefetchOnIntent, setPrefetchOnIntent] = useState(false)
|
|
16
|
+
const urlPath = processPath ? toUrlPath(processPath) : ""
|
|
17
|
+
|
|
18
|
+
if (!urlPath) return null
|
|
19
|
+
|
|
20
|
+
const accessibleName = `View workflow information for ${processName}`
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Link
|
|
24
|
+
href={`/processes/workflow/${urlPath}`}
|
|
25
|
+
// The shared shell includes workflow assets; defer that cost until intent.
|
|
26
|
+
prefetch={prefetchOnIntent ? null : false}
|
|
27
|
+
onMouseEnter={() => setPrefetchOnIntent(true)}
|
|
28
|
+
onFocus={() => setPrefetchOnIntent(true)}
|
|
29
|
+
aria-label={accessibleName}
|
|
30
|
+
title={accessibleName}
|
|
31
|
+
className="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-blue-500/10 text-blue-500 transition-colors hover:bg-blue-500/20 hover:text-blue-600 dark:bg-blue-400/10 dark:text-blue-200 dark:hover:bg-blue-400/20 dark:hover:text-white"
|
|
32
|
+
>
|
|
33
|
+
<Info aria-hidden="true" className="h-6 w-6" />
|
|
34
|
+
</Link>
|
|
35
|
+
)
|
|
36
|
+
}
|