@processfocus/runtime-local 0.1.0-next.2 → 0.1.0-next.4
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/README.md +51 -253
- package/dist/authentication-server.mjs +52 -84
- package/dist/chunk-3wzp2sax.js +4806 -0
- package/dist/chunk-5kjvzbwr.js +512 -0
- package/dist/chunk-egeb4821.js +156 -0
- package/dist/chunk-q5v72erd.js +241 -0
- package/dist/{chunk-yhzbn4vx.js → chunk-wvbz0nmd.js} +19485 -34180
- package/dist/{chunk-352j1ayk.js → chunk-y8fnwbx0.js} +51781 -36259
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +12 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +31 -21
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +1 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/connected-apps/disconnect-form.tsx +57 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/connected-apps/page.tsx +97 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -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 +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -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 +169 -18
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +21 -14
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +36 -18
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
- 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 +2 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +69 -1
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
- package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +14 -6
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
- package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
- package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +44 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +14 -8
- package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
- package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
- package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
- package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
- package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +115 -23
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +21 -1
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +66 -9
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +10 -6
- package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
- package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
- package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
- package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +168 -30
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +34 -29
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +889 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +107 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +260 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
- package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
- package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
- package/dist/dashboard-source/apps/frontend/package.json +47 -47
- package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
- package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
- package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
- package/dist/dashboard-source/modules/form/src/index.ts +1 -10
- package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
- package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
- package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
- package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
- package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
- package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
- package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
- package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
- package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
- package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
- package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
- package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +273 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
- package/dist/dashboard-source.json +47 -47
- package/dist/graphql-server.mjs +272 -200
- package/dist/job-worker-supervisor.mjs +262 -0
- package/dist/job-worker.mjs +234 -133
- package/dist/main.mjs +30 -6
- package/dist/prepare-dashboard.mjs +8 -8
- package/dist/resources/cedar/policies.cedar +80 -38
- package/dist/resources/cedar/schema.cedarschema +39 -21
- package/dist/resources/graphql-schema/rxdb.graphql +2 -0
- package/dist/resources/graphql-schema/system.graphql +191 -51
- package/package.json +63 -62
- package/dist/chunk-6ntmymmx.js +0 -85
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
- package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
|
@@ -0,0 +1,1282 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type { Collection } from "@tanstack/db"
|
|
4
|
+
import { useLiveQuery } from "@tanstack/react-db"
|
|
5
|
+
import DOMPurify from "dompurify"
|
|
6
|
+
import Link from "next/link"
|
|
7
|
+
import { type ReactNode, Suspense, use, useMemo, useState } from "react"
|
|
8
|
+
import { deepEqual } from "rxdb/plugins/utils"
|
|
9
|
+
import type { TaskPriority } from "../../../../../modules/rxdb-collections/src/index.ts"
|
|
10
|
+
import { Button, DateTimeDisplay } from "../../../../../modules/shadcn-components/src/index.ts"
|
|
11
|
+
import {
|
|
12
|
+
type MobileTodoListItem,
|
|
13
|
+
createMobileTodoList,
|
|
14
|
+
} from "./lib/mobile-todo-list.ts"
|
|
15
|
+
import { useMocks } from "@/components/mocks-provider"
|
|
16
|
+
import {
|
|
17
|
+
TodoCollectionProvider,
|
|
18
|
+
type TodoDocType,
|
|
19
|
+
useTodoCollection,
|
|
20
|
+
} from "@/lib/collections/todo-collection-provider"
|
|
21
|
+
import { type Task, tasks } from "@/lib/mock-data"
|
|
22
|
+
import {
|
|
23
|
+
type SavedView,
|
|
24
|
+
type TaskStatus,
|
|
25
|
+
taskSavedViews,
|
|
26
|
+
todoStatusSortOrder,
|
|
27
|
+
} from "@/lib/todo-types"
|
|
28
|
+
import {
|
|
29
|
+
computeTodoStatus,
|
|
30
|
+
isDueWithin24Hours,
|
|
31
|
+
useOverdueRefresh,
|
|
32
|
+
} from "@/lib/todo-utils"
|
|
33
|
+
import { toUrlPath } from "@/lib/utils"
|
|
34
|
+
|
|
35
|
+
// Completed Todos can appear in local data, but this page's filters focus on
|
|
36
|
+
// actionable work queues rather than historical completion state.
|
|
37
|
+
const statusOptions: TaskStatus[] = [
|
|
38
|
+
"Active",
|
|
39
|
+
"Correction Required",
|
|
40
|
+
"Upcoming",
|
|
41
|
+
"Draft",
|
|
42
|
+
"Overdue",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
const priorityOptions: TaskPriority[] = ["High", "Medium", "Low"]
|
|
46
|
+
|
|
47
|
+
const sortOptions = [
|
|
48
|
+
"Due date",
|
|
49
|
+
"Priority",
|
|
50
|
+
"Date created",
|
|
51
|
+
"Alphabetical",
|
|
52
|
+
] as const
|
|
53
|
+
|
|
54
|
+
type TaskSortKey = (typeof sortOptions)[number]
|
|
55
|
+
|
|
56
|
+
function cn(...values: Array<string | false | null | undefined>): string {
|
|
57
|
+
return values.filter(Boolean).join(" ")
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const statusTheme: Record<TaskStatus, { badge: string; card: string }> = {
|
|
61
|
+
Active: {
|
|
62
|
+
badge:
|
|
63
|
+
"bg-emerald-100 text-emerald-700 border border-emerald-200 dark:bg-emerald-500/10 dark:text-emerald-300 dark:border-emerald-500/30",
|
|
64
|
+
card: "border-emerald-100 dark:border-emerald-500/20",
|
|
65
|
+
},
|
|
66
|
+
Upcoming: {
|
|
67
|
+
badge:
|
|
68
|
+
"bg-slate-100 text-slate-600 border border-slate-200 dark:bg-slate-700/40 dark:text-slate-300 dark:border-slate-600/60",
|
|
69
|
+
card: "border-dashed border-slate-200 dark:border-slate-700",
|
|
70
|
+
},
|
|
71
|
+
Draft: {
|
|
72
|
+
badge:
|
|
73
|
+
"bg-indigo-100 text-indigo-700 border border-indigo-200 dark:bg-indigo-500/10 dark:text-indigo-300 dark:border-indigo-500/30",
|
|
74
|
+
card: "border-indigo-100 dark:border-indigo-500/20",
|
|
75
|
+
},
|
|
76
|
+
Overdue: {
|
|
77
|
+
badge:
|
|
78
|
+
"bg-rose-100 text-rose-700 border border-rose-200 dark:bg-rose-500/10 dark:text-rose-300 dark:border-rose-500/30",
|
|
79
|
+
card: "border-rose-200 dark:border-rose-500/30 bg-rose-50/70 dark:bg-rose-900/20",
|
|
80
|
+
},
|
|
81
|
+
"Correction Required": {
|
|
82
|
+
badge:
|
|
83
|
+
"bg-amber-100 text-amber-800 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-300 dark:border-amber-500/30",
|
|
84
|
+
card: "border-amber-200 dark:border-amber-500/30 bg-amber-50/70 dark:bg-amber-900/20",
|
|
85
|
+
},
|
|
86
|
+
Completed: {
|
|
87
|
+
badge:
|
|
88
|
+
"bg-slate-100 text-slate-600 border border-slate-200 dark:bg-slate-700/40 dark:text-slate-300 dark:border-slate-600/60",
|
|
89
|
+
card: "border-slate-200 dark:border-slate-700 opacity-80",
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const priorityTheme: Record<TaskPriority, string> = {
|
|
94
|
+
High: "bg-rose-500",
|
|
95
|
+
Medium: "bg-amber-400",
|
|
96
|
+
Low: "bg-slate-400",
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const correctionHelp = "Correct the recipient email and send a new invitation."
|
|
100
|
+
|
|
101
|
+
function ToDosPageContent() {
|
|
102
|
+
const { showMocks } = useMocks()
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div className="flex-1 overflow-y-auto">
|
|
106
|
+
{/* Real todos from RxDB collection */}
|
|
107
|
+
<RealTodosSection />
|
|
108
|
+
|
|
109
|
+
{/* Mock data section below for reference */}
|
|
110
|
+
{showMocks && <MockTodosSection />}
|
|
111
|
+
</div>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export default function ToDosPage() {
|
|
116
|
+
return (
|
|
117
|
+
<TodoCollectionProvider>
|
|
118
|
+
<ToDosPageContent />
|
|
119
|
+
</TodoCollectionProvider>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @deprecated This component displays mock data for design reference.
|
|
125
|
+
* Will be removed once RealTodosSection is fully styled.
|
|
126
|
+
*/
|
|
127
|
+
function MockTodosSection() {
|
|
128
|
+
const [density, setDensity] = useState<"comfortable" | "compact">(
|
|
129
|
+
"comfortable",
|
|
130
|
+
)
|
|
131
|
+
const [selectedView, setSelectedView] = useState<SavedView["id"]>(
|
|
132
|
+
taskSavedViews[0]?.id ?? "all",
|
|
133
|
+
)
|
|
134
|
+
const [statusFilter, setStatusFilter] = useState<TaskStatus[]>(
|
|
135
|
+
taskSavedViews[0]?.statuses ?? [],
|
|
136
|
+
)
|
|
137
|
+
const [priorityFilter, setPriorityFilter] = useState<TaskPriority[]>(
|
|
138
|
+
taskSavedViews[0]?.priorities ?? [],
|
|
139
|
+
)
|
|
140
|
+
const [sortKey, setSortKey] = useState<TaskSortKey>("Due date")
|
|
141
|
+
|
|
142
|
+
const filteredTasks = useMemo(() => {
|
|
143
|
+
return tasks.filter((task) => {
|
|
144
|
+
const statusMatch =
|
|
145
|
+
statusFilter.length === 0 || statusFilter.includes(task.status)
|
|
146
|
+
const priorityMatch =
|
|
147
|
+
priorityFilter.length === 0 || priorityFilter.includes(task.priority)
|
|
148
|
+
return statusMatch && priorityMatch
|
|
149
|
+
})
|
|
150
|
+
}, [priorityFilter, statusFilter])
|
|
151
|
+
|
|
152
|
+
const sortedTasks = useMemo(() => {
|
|
153
|
+
const list = [...filteredTasks]
|
|
154
|
+
if (sortKey === "Priority") {
|
|
155
|
+
const rank: Record<TaskPriority, number> = { High: 0, Medium: 1, Low: 2 }
|
|
156
|
+
list.sort((a, b) => rank[a.priority] - rank[b.priority])
|
|
157
|
+
} else if (sortKey === "Alphabetical") {
|
|
158
|
+
list.sort((a, b) => a.stepName.localeCompare(b.stepName))
|
|
159
|
+
} else if (sortKey === "Due date") {
|
|
160
|
+
list.sort(
|
|
161
|
+
(a, b) => todoStatusSortOrder[a.status] - todoStatusSortOrder[b.status],
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
return list
|
|
165
|
+
}, [filteredTasks, sortKey])
|
|
166
|
+
|
|
167
|
+
function handleSelectView(viewId: SavedView["id"]) {
|
|
168
|
+
setSelectedView(viewId)
|
|
169
|
+
const view = taskSavedViews.find((item) => item.id === viewId)
|
|
170
|
+
if (view) {
|
|
171
|
+
setStatusFilter(view.statuses)
|
|
172
|
+
setPriorityFilter(view.priorities)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function toggleStatusFilter(status: TaskStatus) {
|
|
177
|
+
setStatusFilter((previous) =>
|
|
178
|
+
previous.includes(status)
|
|
179
|
+
? previous.filter((item) => item !== status)
|
|
180
|
+
: [...previous, status],
|
|
181
|
+
)
|
|
182
|
+
setSelectedView("custom")
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function togglePriorityFilter(priority: TaskPriority) {
|
|
186
|
+
setPriorityFilter((previous) =>
|
|
187
|
+
previous.includes(priority)
|
|
188
|
+
? previous.filter((item) => item !== priority)
|
|
189
|
+
: [...previous, priority],
|
|
190
|
+
)
|
|
191
|
+
setSelectedView("custom")
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function clearStatusOnly() {
|
|
195
|
+
setStatusFilter([])
|
|
196
|
+
setSelectedView("custom")
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function clearPriorityOnly() {
|
|
200
|
+
setPriorityFilter([])
|
|
201
|
+
setSelectedView("custom")
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function clearTaskFilters() {
|
|
205
|
+
clearStatusOnly()
|
|
206
|
+
clearPriorityOnly()
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const overdueCount = tasks.filter((task) => task.status === "Overdue").length
|
|
210
|
+
const draftCount = tasks.filter((task) => task.status === "Draft").length
|
|
211
|
+
const upcomingCount = tasks.filter(
|
|
212
|
+
(task) => task.status === "Upcoming",
|
|
213
|
+
).length
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<section className="mt-8 space-y-6">
|
|
217
|
+
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
|
218
|
+
<OverviewCard
|
|
219
|
+
title="Active tasks"
|
|
220
|
+
value={tasks
|
|
221
|
+
.filter((task) => task.status === "Active")
|
|
222
|
+
.length.toString()}
|
|
223
|
+
subtext="Due within 24 hours: 2"
|
|
224
|
+
accent="bg-sky-500"
|
|
225
|
+
/>
|
|
226
|
+
<OverviewCard
|
|
227
|
+
title="Overdue"
|
|
228
|
+
value={overdueCount.toString()}
|
|
229
|
+
subtext="Escalations triggered today"
|
|
230
|
+
accent="bg-rose-500"
|
|
231
|
+
/>
|
|
232
|
+
<OverviewCard
|
|
233
|
+
title="Drafts"
|
|
234
|
+
value={draftCount.toString()}
|
|
235
|
+
subtext="Autosave enabled every 30s"
|
|
236
|
+
accent="bg-indigo-500"
|
|
237
|
+
/>
|
|
238
|
+
<OverviewCard
|
|
239
|
+
title="Upcoming"
|
|
240
|
+
value={upcomingCount.toString()}
|
|
241
|
+
subtext="Forecast across next 7 days"
|
|
242
|
+
accent="bg-amber-500"
|
|
243
|
+
/>
|
|
244
|
+
</div>
|
|
245
|
+
<div className="flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/60">
|
|
246
|
+
<div className="flex flex-wrap gap-2">
|
|
247
|
+
{taskSavedViews.map((view) => {
|
|
248
|
+
const isActive = selectedView === view.id
|
|
249
|
+
return (
|
|
250
|
+
<button
|
|
251
|
+
key={view.id}
|
|
252
|
+
type="button"
|
|
253
|
+
onClick={() => handleSelectView(view.id)}
|
|
254
|
+
className={cn(
|
|
255
|
+
"rounded-full border px-4 py-1.5 text-sm font-medium transition",
|
|
256
|
+
isActive
|
|
257
|
+
? "border-blue-500 bg-blue-500 text-white shadow-sm"
|
|
258
|
+
: "border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-slate-100 dark:border-slate-700 dark:text-slate-300 dark:hover:border-slate-600 dark:hover:bg-slate-800",
|
|
259
|
+
)}
|
|
260
|
+
>
|
|
261
|
+
{view.name}
|
|
262
|
+
</button>
|
|
263
|
+
)
|
|
264
|
+
})}
|
|
265
|
+
{selectedView === "custom" && (
|
|
266
|
+
<span className="rounded-full border border-dashed border-blue-300 px-4 py-1.5 text-sm font-medium text-blue-500">
|
|
267
|
+
Custom view
|
|
268
|
+
</span>
|
|
269
|
+
)}
|
|
270
|
+
</div>
|
|
271
|
+
<div className="flex items-center gap-2">
|
|
272
|
+
<button
|
|
273
|
+
type="button"
|
|
274
|
+
onClick={() => setDensity("comfortable")}
|
|
275
|
+
className={cn(
|
|
276
|
+
"rounded-full border px-3 py-1.5 text-sm",
|
|
277
|
+
density === "comfortable"
|
|
278
|
+
? "border-blue-500 text-blue-600 dark:text-blue-300"
|
|
279
|
+
: "border-slate-200 text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200",
|
|
280
|
+
)}
|
|
281
|
+
>
|
|
282
|
+
Comfortable
|
|
283
|
+
</button>
|
|
284
|
+
<button
|
|
285
|
+
type="button"
|
|
286
|
+
onClick={() => setDensity("compact")}
|
|
287
|
+
className={cn(
|
|
288
|
+
"rounded-full border px-3 py-1.5 text-sm",
|
|
289
|
+
density === "compact"
|
|
290
|
+
? "border-blue-500 text-blue-600 dark:text-blue-300"
|
|
291
|
+
: "border-slate-200 text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200",
|
|
292
|
+
)}
|
|
293
|
+
>
|
|
294
|
+
Compact
|
|
295
|
+
</button>
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
<div className="flex flex-col gap-4 rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/60">
|
|
299
|
+
<div className="flex flex-wrap gap-3">
|
|
300
|
+
<FilterGroup
|
|
301
|
+
label="Status"
|
|
302
|
+
onClear={statusFilter.length > 0 ? clearStatusOnly : undefined}
|
|
303
|
+
>
|
|
304
|
+
{statusOptions.map((status) => (
|
|
305
|
+
<Chip
|
|
306
|
+
key={status}
|
|
307
|
+
label={status}
|
|
308
|
+
active={statusFilter.includes(status)}
|
|
309
|
+
onClick={() => toggleStatusFilter(status)}
|
|
310
|
+
/>
|
|
311
|
+
))}
|
|
312
|
+
</FilterGroup>
|
|
313
|
+
<FilterGroup
|
|
314
|
+
label="Priority"
|
|
315
|
+
onClear={priorityFilter.length > 0 ? clearPriorityOnly : undefined}
|
|
316
|
+
>
|
|
317
|
+
{priorityOptions.map((priority) => (
|
|
318
|
+
<Chip
|
|
319
|
+
key={priority}
|
|
320
|
+
label={priority}
|
|
321
|
+
active={priorityFilter.includes(priority)}
|
|
322
|
+
icon={
|
|
323
|
+
<span
|
|
324
|
+
className={cn(
|
|
325
|
+
"h-2.5 w-2.5 rounded-full",
|
|
326
|
+
priorityTheme[priority],
|
|
327
|
+
)}
|
|
328
|
+
/>
|
|
329
|
+
}
|
|
330
|
+
onClick={() => togglePriorityFilter(priority)}
|
|
331
|
+
/>
|
|
332
|
+
))}
|
|
333
|
+
</FilterGroup>
|
|
334
|
+
<div className="ml-auto flex flex-wrap items-center gap-3">
|
|
335
|
+
<div className="flex items-center gap-2 rounded-full border border-slate-200 bg-white px-3 py-1.5 text-sm text-slate-500 dark:border-slate-700 dark:bg-slate-900">
|
|
336
|
+
<label
|
|
337
|
+
htmlFor="mock-sort-select"
|
|
338
|
+
className="text-xs tracking-wide text-slate-400 uppercase"
|
|
339
|
+
>
|
|
340
|
+
Sort
|
|
341
|
+
</label>
|
|
342
|
+
<select
|
|
343
|
+
id="mock-sort-select"
|
|
344
|
+
value={sortKey}
|
|
345
|
+
onChange={(event) =>
|
|
346
|
+
setSortKey(event.target.value as TaskSortKey)
|
|
347
|
+
}
|
|
348
|
+
className="bg-transparent text-sm font-medium text-slate-700 outline-none dark:text-slate-200"
|
|
349
|
+
>
|
|
350
|
+
{sortOptions.map((option) => (
|
|
351
|
+
<option key={option} value={option}>
|
|
352
|
+
{option}
|
|
353
|
+
</option>
|
|
354
|
+
))}
|
|
355
|
+
</select>
|
|
356
|
+
</div>
|
|
357
|
+
{(statusFilter.length > 0 || priorityFilter.length > 0) && (
|
|
358
|
+
<button
|
|
359
|
+
type="button"
|
|
360
|
+
onClick={clearTaskFilters}
|
|
361
|
+
className="rounded-full border border-slate-200 px-3 py-1.5 text-sm text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200"
|
|
362
|
+
>
|
|
363
|
+
Clear filters
|
|
364
|
+
</button>
|
|
365
|
+
)}
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
<div
|
|
369
|
+
className={cn(
|
|
370
|
+
"grid gap-4",
|
|
371
|
+
density === "compact"
|
|
372
|
+
? "md:grid-cols-2 xl:grid-cols-3"
|
|
373
|
+
: "md:grid-cols-2 xl:grid-cols-2",
|
|
374
|
+
)}
|
|
375
|
+
>
|
|
376
|
+
{sortedTasks.length === 0 ? (
|
|
377
|
+
<EmptyState
|
|
378
|
+
title="No tasks match these filters"
|
|
379
|
+
description="Try expanding your filters or check the Processes catalog to kick off new work."
|
|
380
|
+
/>
|
|
381
|
+
) : (
|
|
382
|
+
sortedTasks.map((task) => (
|
|
383
|
+
<MockTodoCard key={task.id} task={task} density={density} />
|
|
384
|
+
))
|
|
385
|
+
)}
|
|
386
|
+
</div>
|
|
387
|
+
</div>
|
|
388
|
+
</section>
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function OverviewCard({
|
|
393
|
+
title,
|
|
394
|
+
value,
|
|
395
|
+
subtext,
|
|
396
|
+
accent,
|
|
397
|
+
}: {
|
|
398
|
+
title: string
|
|
399
|
+
value: string
|
|
400
|
+
subtext: string
|
|
401
|
+
accent: string
|
|
402
|
+
}) {
|
|
403
|
+
return (
|
|
404
|
+
<div className="overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm transition hover:shadow-md dark:border-slate-800 dark:bg-slate-900/70">
|
|
405
|
+
<div className="flex items-center justify-between px-5 pt-5">
|
|
406
|
+
<p className="text-sm font-semibold text-slate-500 dark:text-slate-400">
|
|
407
|
+
{title}
|
|
408
|
+
</p>
|
|
409
|
+
<span className={cn("h-2 w-12 rounded-full", accent)} />
|
|
410
|
+
</div>
|
|
411
|
+
<div className="px-5 pb-5">
|
|
412
|
+
<p className="text-3xl font-semibold text-slate-900 dark:text-slate-50">
|
|
413
|
+
{value}
|
|
414
|
+
</p>
|
|
415
|
+
<p className="text-sm text-slate-500 dark:text-slate-400">{subtext}</p>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
)
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function FilterGroup({
|
|
422
|
+
label,
|
|
423
|
+
children,
|
|
424
|
+
onClear,
|
|
425
|
+
}: {
|
|
426
|
+
label: string
|
|
427
|
+
children: ReactNode
|
|
428
|
+
onClear?: (() => void) | undefined
|
|
429
|
+
}) {
|
|
430
|
+
return (
|
|
431
|
+
<div className="flex flex-wrap items-center gap-2 rounded-full border border-slate-200 bg-white px-3 py-1.5 text-sm text-slate-500 shadow-sm dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400">
|
|
432
|
+
<span className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
|
|
433
|
+
{label}
|
|
434
|
+
</span>
|
|
435
|
+
{children}
|
|
436
|
+
{onClear && (
|
|
437
|
+
<button
|
|
438
|
+
type="button"
|
|
439
|
+
onClick={onClear}
|
|
440
|
+
className="text-xs font-semibold text-blue-500 hover:text-blue-600"
|
|
441
|
+
>
|
|
442
|
+
Clear
|
|
443
|
+
</button>
|
|
444
|
+
)}
|
|
445
|
+
</div>
|
|
446
|
+
)
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function Chip({
|
|
450
|
+
label,
|
|
451
|
+
active,
|
|
452
|
+
onClick,
|
|
453
|
+
icon,
|
|
454
|
+
}: {
|
|
455
|
+
label: string
|
|
456
|
+
active: boolean
|
|
457
|
+
onClick: () => void
|
|
458
|
+
icon?: ReactNode
|
|
459
|
+
}) {
|
|
460
|
+
return (
|
|
461
|
+
<button
|
|
462
|
+
type="button"
|
|
463
|
+
onClick={onClick}
|
|
464
|
+
className={cn(
|
|
465
|
+
"inline-flex items-center gap-2 rounded-full border px-3 py-1 text-sm transition",
|
|
466
|
+
active
|
|
467
|
+
? "border-blue-500 bg-blue-500/10 text-blue-600 dark:border-blue-400 dark:bg-blue-500/10 dark:text-blue-200"
|
|
468
|
+
: "border-transparent text-slate-600 hover:border-slate-200 hover:bg-slate-100 dark:text-slate-300 dark:hover:border-slate-700 dark:hover:bg-slate-800",
|
|
469
|
+
)}
|
|
470
|
+
>
|
|
471
|
+
{icon}
|
|
472
|
+
{label}
|
|
473
|
+
</button>
|
|
474
|
+
)
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* @deprecated This component will be deleted in the near future.
|
|
479
|
+
* Use RealTodoCard instead.
|
|
480
|
+
*/
|
|
481
|
+
function MockTodoCard({
|
|
482
|
+
task,
|
|
483
|
+
density,
|
|
484
|
+
}: {
|
|
485
|
+
task: Task
|
|
486
|
+
density: "comfortable" | "compact"
|
|
487
|
+
}) {
|
|
488
|
+
return (
|
|
489
|
+
<article
|
|
490
|
+
className={cn(
|
|
491
|
+
"flex flex-col gap-3 rounded-2xl border bg-white p-4 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md dark:bg-slate-900/70",
|
|
492
|
+
statusTheme[task.status].card,
|
|
493
|
+
density === "compact" ? "sm:p-3" : "sm:p-5",
|
|
494
|
+
)}
|
|
495
|
+
>
|
|
496
|
+
<header className="flex items-start justify-between gap-3">
|
|
497
|
+
<div className="space-y-1">
|
|
498
|
+
<div className="inline-flex items-center gap-2">
|
|
499
|
+
<span className="text-xs font-semibold tracking-wide text-slate-400 uppercase dark:text-slate-500">
|
|
500
|
+
{task.processName}
|
|
501
|
+
</span>
|
|
502
|
+
<span
|
|
503
|
+
className={cn(
|
|
504
|
+
"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",
|
|
505
|
+
statusTheme[task.status].badge,
|
|
506
|
+
)}
|
|
507
|
+
>
|
|
508
|
+
{task.status}
|
|
509
|
+
</span>
|
|
510
|
+
<span className="inline-flex items-center gap-1 rounded-full border border-slate-200 px-2 py-0.5 text-xs font-semibold text-slate-500 dark:border-slate-700 dark:text-slate-300">
|
|
511
|
+
<span
|
|
512
|
+
className={cn(
|
|
513
|
+
"h-2 w-2 rounded-full",
|
|
514
|
+
priorityTheme[task.priority],
|
|
515
|
+
)}
|
|
516
|
+
/>
|
|
517
|
+
{task.priority}
|
|
518
|
+
</span>
|
|
519
|
+
<span className="inline-flex items-center gap-1 rounded-full bg-slate-100 px-2 py-0.5 text-xs font-semibold text-slate-600 dark:bg-slate-700/60 dark:text-slate-300">
|
|
520
|
+
{task.role}
|
|
521
|
+
</span>
|
|
522
|
+
</div>
|
|
523
|
+
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
|
|
524
|
+
{task.stepName}
|
|
525
|
+
</h3>
|
|
526
|
+
<p className="text-sm text-slate-500 dark:text-slate-400">
|
|
527
|
+
{task.description}
|
|
528
|
+
</p>
|
|
529
|
+
</div>
|
|
530
|
+
<button
|
|
531
|
+
type="button"
|
|
532
|
+
className="rounded-full border border-slate-200 px-3 py-1 text-xs font-semibold text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200"
|
|
533
|
+
>
|
|
534
|
+
View details
|
|
535
|
+
</button>
|
|
536
|
+
</header>
|
|
537
|
+
<div className="flex flex-wrap items-center gap-2 text-xs text-slate-500 dark:text-slate-400">
|
|
538
|
+
{task.dueDate && (
|
|
539
|
+
<span className="inline-flex items-center gap-1 rounded-full bg-slate-100 px-2 py-1 dark:bg-slate-800">
|
|
540
|
+
⏰ {task.dueDate}
|
|
541
|
+
</span>
|
|
542
|
+
)}
|
|
543
|
+
{task.upcomingIn && (
|
|
544
|
+
<span className="inline-flex items-center gap-1 rounded-full border border-dashed border-slate-200 px-2 py-1 text-slate-500 dark:border-slate-700 dark:text-slate-300">
|
|
545
|
+
⏳ {task.upcomingIn}
|
|
546
|
+
</span>
|
|
547
|
+
)}
|
|
548
|
+
{task.overdueBy && (
|
|
549
|
+
<span className="inline-flex items-center gap-1 rounded-full bg-rose-100 px-2 py-1 text-rose-700 dark:bg-rose-500/10 dark:text-rose-300">
|
|
550
|
+
⚠️ {task.overdueBy}
|
|
551
|
+
</span>
|
|
552
|
+
)}
|
|
553
|
+
{task.draftSavedAt && (
|
|
554
|
+
<span className="inline-flex items-center gap-1 rounded-full bg-indigo-100 px-2 py-1 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-300">
|
|
555
|
+
💾 {task.draftSavedAt}
|
|
556
|
+
</span>
|
|
557
|
+
)}
|
|
558
|
+
<span className="inline-flex items-center gap-1 rounded-full border border-slate-200 px-2 py-1 text-slate-500 dark:border-slate-700 dark:text-slate-300">
|
|
559
|
+
🧭 Assigned {task.assignedDate}
|
|
560
|
+
</span>
|
|
561
|
+
<span className="inline-flex items-center gap-1 rounded-full border border-slate-200 px-2 py-1 text-slate-500 dark:border-slate-700 dark:text-slate-300">
|
|
562
|
+
📝 {task.formComplexity} form
|
|
563
|
+
</span>
|
|
564
|
+
</div>
|
|
565
|
+
<footer className="mt-auto flex flex-wrap items-center justify-between gap-2">
|
|
566
|
+
<div className="flex items-center gap-2">
|
|
567
|
+
<Button className="min-w-20 rounded-full">
|
|
568
|
+
{task.status === "Draft"
|
|
569
|
+
? "Continue"
|
|
570
|
+
: task.status === "Upcoming"
|
|
571
|
+
? "Preview"
|
|
572
|
+
: "Do"}
|
|
573
|
+
</Button>
|
|
574
|
+
<Button variant="outline" className="rounded-full">
|
|
575
|
+
Delegate
|
|
576
|
+
</Button>
|
|
577
|
+
</div>
|
|
578
|
+
<button
|
|
579
|
+
type="button"
|
|
580
|
+
className="text-xs font-semibold text-blue-500 hover:text-blue-600"
|
|
581
|
+
>
|
|
582
|
+
Open form preview →
|
|
583
|
+
</button>
|
|
584
|
+
</footer>
|
|
585
|
+
</article>
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function EmptyState({
|
|
590
|
+
title,
|
|
591
|
+
description,
|
|
592
|
+
action,
|
|
593
|
+
}: {
|
|
594
|
+
title: string
|
|
595
|
+
description: string
|
|
596
|
+
action?: { label: string; href: string }
|
|
597
|
+
}) {
|
|
598
|
+
return (
|
|
599
|
+
<div className="col-span-full flex flex-col items-center justify-center rounded-3xl border border-dashed border-slate-300 bg-white/60 p-12 text-center dark:border-slate-700 dark:bg-slate-900/40">
|
|
600
|
+
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
|
|
601
|
+
{title}
|
|
602
|
+
</h3>
|
|
603
|
+
<p className="mt-2 max-w-md text-sm text-slate-500 dark:text-slate-400">
|
|
604
|
+
{description}
|
|
605
|
+
</p>
|
|
606
|
+
{action && (
|
|
607
|
+
<Link
|
|
608
|
+
href={action.href}
|
|
609
|
+
className="mt-5 rounded-full bg-blue-600 px-5 py-2 text-sm font-semibold text-white shadow hover:bg-blue-500"
|
|
610
|
+
>
|
|
611
|
+
{action.label}
|
|
612
|
+
</Link>
|
|
613
|
+
)}
|
|
614
|
+
</div>
|
|
615
|
+
)
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// ============================================================================
|
|
619
|
+
// Real Todos Section (using RxDB collection)
|
|
620
|
+
// ============================================================================
|
|
621
|
+
|
|
622
|
+
function RealTodosLoadingState() {
|
|
623
|
+
return (
|
|
624
|
+
<section aria-label="Loading to-dos" className="space-y-6">
|
|
625
|
+
<div className="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900/60">
|
|
626
|
+
<div className="flex items-center gap-3">
|
|
627
|
+
<div className="h-5 w-5 animate-spin rounded-full border-2 border-blue-500 border-t-transparent" />
|
|
628
|
+
<span className="text-sm text-slate-500 dark:text-slate-400">
|
|
629
|
+
Loading todos...
|
|
630
|
+
</span>
|
|
631
|
+
</div>
|
|
632
|
+
</div>
|
|
633
|
+
</section>
|
|
634
|
+
)
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function RealTodosSectionInner({
|
|
638
|
+
collectionPromise,
|
|
639
|
+
}: {
|
|
640
|
+
collectionPromise: Promise<Collection<TodoDocType, string>>
|
|
641
|
+
}) {
|
|
642
|
+
"use memo"
|
|
643
|
+
|
|
644
|
+
const todosCollection = use(collectionPromise)
|
|
645
|
+
|
|
646
|
+
const { initialSync, retryInitialSync } = useTodoCollection()
|
|
647
|
+
const todosQuery = useLiveQuery({
|
|
648
|
+
query: (q) => q.from({ todo: todosCollection }),
|
|
649
|
+
})
|
|
650
|
+
const todos = todosQuery.data ?? []
|
|
651
|
+
// As in Processes, provider completion covers adapter commits, while the
|
|
652
|
+
// consumer must also wait for its live query to incorporate those commits.
|
|
653
|
+
const queryIsCurrent =
|
|
654
|
+
todosQuery.isReady &&
|
|
655
|
+
todos.length === todosCollection.size &&
|
|
656
|
+
todos.every((todo) => deepEqual(todo, todosCollection.get(todo.id)))
|
|
657
|
+
const canShowEmpty = initialSync.status === "complete" && queryIsCurrent
|
|
658
|
+
|
|
659
|
+
const [density, setDensity] = useState<"comfortable" | "compact">(
|
|
660
|
+
"comfortable",
|
|
661
|
+
)
|
|
662
|
+
const [selectedView, setSelectedView] = useState<SavedView["id"]>(
|
|
663
|
+
taskSavedViews[0]?.id ?? "all",
|
|
664
|
+
)
|
|
665
|
+
const [statusFilter, setStatusFilter] = useState<TaskStatus[]>(
|
|
666
|
+
taskSavedViews[0]?.statuses ?? [],
|
|
667
|
+
)
|
|
668
|
+
const [priorityFilter, setPriorityFilter] = useState<TaskPriority[]>(
|
|
669
|
+
taskSavedViews[0]?.priorities ?? [],
|
|
670
|
+
)
|
|
671
|
+
const [sortKey, setSortKey] = useState<TaskSortKey>("Due date")
|
|
672
|
+
|
|
673
|
+
// Single pass: compute status counts, due-within-24h count, filter todos, and collect dueTimes
|
|
674
|
+
const counts: Record<TaskStatus, number> = {
|
|
675
|
+
Active: 0,
|
|
676
|
+
Completed: 0,
|
|
677
|
+
"Correction Required": 0,
|
|
678
|
+
Overdue: 0,
|
|
679
|
+
Draft: 0,
|
|
680
|
+
Upcoming: 0,
|
|
681
|
+
}
|
|
682
|
+
let dueWithin24HoursCount = 0
|
|
683
|
+
const filteredTodos: typeof todos = []
|
|
684
|
+
const dueTimes: (string | null | undefined)[] = []
|
|
685
|
+
|
|
686
|
+
for (const todo of todos) {
|
|
687
|
+
const status = computeTodoStatus(todo.dueAt, todo.status)
|
|
688
|
+
counts[status]++
|
|
689
|
+
dueTimes.push(todo.dueAt)
|
|
690
|
+
|
|
691
|
+
if (status === "Active" && isDueWithin24Hours(todo.dueAt)) {
|
|
692
|
+
dueWithin24HoursCount++
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
const statusMatch =
|
|
696
|
+
statusFilter.length === 0 || statusFilter.includes(status)
|
|
697
|
+
const priorityMatch =
|
|
698
|
+
priorityFilter.length === 0 || priorityFilter.includes(todo.priority)
|
|
699
|
+
|
|
700
|
+
if (statusMatch && priorityMatch) {
|
|
701
|
+
filteredTodos.push(todo)
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
useOverdueRefresh(dueTimes)
|
|
706
|
+
|
|
707
|
+
const sortedTodos = [...filteredTodos]
|
|
708
|
+
if (sortKey === "Priority") {
|
|
709
|
+
const rank: Record<TaskPriority, number> = { High: 0, Medium: 1, Low: 2 }
|
|
710
|
+
sortedTodos.sort((a, b) => rank[a.priority] - rank[b.priority])
|
|
711
|
+
} else if (sortKey === "Alphabetical") {
|
|
712
|
+
sortedTodos.sort((a, b) => a.stepName.localeCompare(b.stepName))
|
|
713
|
+
} else if (sortKey === "Due date") {
|
|
714
|
+
sortedTodos.sort(
|
|
715
|
+
(a, b) =>
|
|
716
|
+
todoStatusSortOrder[computeTodoStatus(a.dueAt, a.status)] -
|
|
717
|
+
todoStatusSortOrder[computeTodoStatus(b.dueAt, b.status)],
|
|
718
|
+
)
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// Mobile intentionally skips the desktop control bars in this first pass.
|
|
722
|
+
// Known gap: mobile also ignores the desktop saved-view/filter/sort state.
|
|
723
|
+
const mobileTodoList = createMobileTodoList(todos)
|
|
724
|
+
|
|
725
|
+
function handleSelectView(viewId: SavedView["id"]) {
|
|
726
|
+
setSelectedView(viewId)
|
|
727
|
+
const view = taskSavedViews.find((item) => item.id === viewId)
|
|
728
|
+
if (view) {
|
|
729
|
+
setStatusFilter(view.statuses)
|
|
730
|
+
setPriorityFilter(view.priorities)
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
function toggleStatusFilter(status: TaskStatus) {
|
|
735
|
+
setStatusFilter((previous) =>
|
|
736
|
+
previous.includes(status)
|
|
737
|
+
? previous.filter((item) => item !== status)
|
|
738
|
+
: [...previous, status],
|
|
739
|
+
)
|
|
740
|
+
setSelectedView("custom")
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function togglePriorityFilter(priority: TaskPriority) {
|
|
744
|
+
setPriorityFilter((previous) =>
|
|
745
|
+
previous.includes(priority)
|
|
746
|
+
? previous.filter((item) => item !== priority)
|
|
747
|
+
: [...previous, priority],
|
|
748
|
+
)
|
|
749
|
+
setSelectedView("custom")
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
function clearStatusOnly() {
|
|
753
|
+
setStatusFilter([])
|
|
754
|
+
setSelectedView("custom")
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
function clearPriorityOnly() {
|
|
758
|
+
setPriorityFilter([])
|
|
759
|
+
setSelectedView("custom")
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function clearAllFilters() {
|
|
763
|
+
clearStatusOnly()
|
|
764
|
+
clearPriorityOnly()
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
const syncError =
|
|
768
|
+
initialSync.status === "error" ? (
|
|
769
|
+
<div role="alert" className="rounded-2xl border border-amber-300 p-4">
|
|
770
|
+
<p>To-dos could not finish loading. Check your connection and retry.</p>
|
|
771
|
+
<Button onClick={retryInitialSync} className="mt-2">
|
|
772
|
+
Retry loading to-dos
|
|
773
|
+
</Button>
|
|
774
|
+
</div>
|
|
775
|
+
) : null
|
|
776
|
+
|
|
777
|
+
if (todos.length === 0 && syncError) return syncError
|
|
778
|
+
if (todos.length === 0 && !canShowEmpty) return <RealTodosLoadingState />
|
|
779
|
+
|
|
780
|
+
const noWork = (
|
|
781
|
+
<EmptyState
|
|
782
|
+
title="No to-dos yet"
|
|
783
|
+
description="Check back here when new work reaches your queue."
|
|
784
|
+
action={{ label: "Browse processes", href: "/processes" }}
|
|
785
|
+
/>
|
|
786
|
+
)
|
|
787
|
+
|
|
788
|
+
const {
|
|
789
|
+
Active: activeCount,
|
|
790
|
+
"Correction Required": correctionRequiredCount,
|
|
791
|
+
Overdue: overdueCount,
|
|
792
|
+
Draft: draftCount,
|
|
793
|
+
Upcoming: upcomingCount,
|
|
794
|
+
} = counts
|
|
795
|
+
|
|
796
|
+
return (
|
|
797
|
+
<section className="space-y-6">
|
|
798
|
+
{syncError}
|
|
799
|
+
{!syncError && !canShowEmpty && (
|
|
800
|
+
<p role="status" className="text-sm text-slate-500">
|
|
801
|
+
Loading todos...
|
|
802
|
+
</p>
|
|
803
|
+
)}
|
|
804
|
+
{/* Overview cards */}
|
|
805
|
+
<div className="hidden gap-4 md:grid md:grid-cols-2 xl:grid-cols-5">
|
|
806
|
+
<OverviewCard
|
|
807
|
+
title="Active tasks"
|
|
808
|
+
value={activeCount.toString()}
|
|
809
|
+
subtext={`Due within 24 hours: ${dueWithin24HoursCount}`}
|
|
810
|
+
accent="bg-sky-500"
|
|
811
|
+
/>
|
|
812
|
+
<OverviewCard
|
|
813
|
+
title="Corrections"
|
|
814
|
+
value={correctionRequiredCount.toString()}
|
|
815
|
+
subtext="Recipient update needed"
|
|
816
|
+
accent="bg-amber-500"
|
|
817
|
+
/>
|
|
818
|
+
<OverviewCard
|
|
819
|
+
title="Overdue"
|
|
820
|
+
value={overdueCount.toString()}
|
|
821
|
+
subtext="Requires attention"
|
|
822
|
+
accent="bg-rose-500"
|
|
823
|
+
/>
|
|
824
|
+
<OverviewCard
|
|
825
|
+
title="Drafts"
|
|
826
|
+
value={draftCount.toString()}
|
|
827
|
+
subtext="In progress"
|
|
828
|
+
accent="bg-indigo-500"
|
|
829
|
+
/>
|
|
830
|
+
<OverviewCard
|
|
831
|
+
title="Upcoming"
|
|
832
|
+
value={upcomingCount.toString()}
|
|
833
|
+
subtext="Scheduled tasks"
|
|
834
|
+
accent="bg-amber-500"
|
|
835
|
+
/>
|
|
836
|
+
</div>
|
|
837
|
+
|
|
838
|
+
{/* Filter bar with saved views and density toggle */}
|
|
839
|
+
<div className="hidden flex-wrap items-center justify-between gap-4 rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/60 md:flex">
|
|
840
|
+
<div className="flex flex-wrap gap-2">
|
|
841
|
+
{taskSavedViews.map((view) => {
|
|
842
|
+
const isActive = selectedView === view.id
|
|
843
|
+
return (
|
|
844
|
+
<button
|
|
845
|
+
key={view.id}
|
|
846
|
+
type="button"
|
|
847
|
+
onClick={() => handleSelectView(view.id)}
|
|
848
|
+
className={cn(
|
|
849
|
+
"rounded-full border px-4 py-1.5 text-sm font-medium transition",
|
|
850
|
+
isActive
|
|
851
|
+
? "border-blue-500 bg-blue-500 text-white shadow-sm"
|
|
852
|
+
: "border-slate-200 text-slate-600 hover:border-slate-300 hover:bg-slate-100 dark:border-slate-700 dark:text-slate-300 dark:hover:border-slate-600 dark:hover:bg-slate-800",
|
|
853
|
+
)}
|
|
854
|
+
>
|
|
855
|
+
{view.name}
|
|
856
|
+
</button>
|
|
857
|
+
)
|
|
858
|
+
})}
|
|
859
|
+
{selectedView === "custom" && (
|
|
860
|
+
<span className="rounded-full border border-dashed border-blue-300 px-4 py-1.5 text-sm font-medium text-blue-500">
|
|
861
|
+
Custom view
|
|
862
|
+
</span>
|
|
863
|
+
)}
|
|
864
|
+
</div>
|
|
865
|
+
<div className="flex items-center gap-2">
|
|
866
|
+
<button
|
|
867
|
+
type="button"
|
|
868
|
+
onClick={() => setDensity("comfortable")}
|
|
869
|
+
className={cn(
|
|
870
|
+
"rounded-full border px-3 py-1.5 text-sm",
|
|
871
|
+
density === "comfortable"
|
|
872
|
+
? "border-blue-500 text-blue-600 dark:text-blue-300"
|
|
873
|
+
: "border-slate-200 text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200",
|
|
874
|
+
)}
|
|
875
|
+
>
|
|
876
|
+
Comfortable
|
|
877
|
+
</button>
|
|
878
|
+
<button
|
|
879
|
+
type="button"
|
|
880
|
+
onClick={() => setDensity("compact")}
|
|
881
|
+
className={cn(
|
|
882
|
+
"rounded-full border px-3 py-1.5 text-sm",
|
|
883
|
+
density === "compact"
|
|
884
|
+
? "border-blue-500 text-blue-600 dark:text-blue-300"
|
|
885
|
+
: "border-slate-200 text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200",
|
|
886
|
+
)}
|
|
887
|
+
>
|
|
888
|
+
Compact
|
|
889
|
+
</button>
|
|
890
|
+
</div>
|
|
891
|
+
</div>
|
|
892
|
+
|
|
893
|
+
<div className="space-y-4 md:hidden">
|
|
894
|
+
{mobileTodoList.length === 0
|
|
895
|
+
? canShowEmpty
|
|
896
|
+
? noWork
|
|
897
|
+
: null
|
|
898
|
+
: mobileTodoList.map((todo) => (
|
|
899
|
+
<MobileTodoRow key={todo.id} todo={todo} />
|
|
900
|
+
))}
|
|
901
|
+
</div>
|
|
902
|
+
|
|
903
|
+
{/* Filter row and todo cards */}
|
|
904
|
+
<div className="hidden flex-col gap-4 rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/60 md:flex">
|
|
905
|
+
<div className="flex flex-wrap gap-3">
|
|
906
|
+
<FilterGroup
|
|
907
|
+
label="Status"
|
|
908
|
+
onClear={statusFilter.length > 0 ? clearStatusOnly : undefined}
|
|
909
|
+
>
|
|
910
|
+
{statusOptions.map((status) => (
|
|
911
|
+
<Chip
|
|
912
|
+
key={status}
|
|
913
|
+
label={status}
|
|
914
|
+
active={statusFilter.includes(status)}
|
|
915
|
+
onClick={() => toggleStatusFilter(status)}
|
|
916
|
+
/>
|
|
917
|
+
))}
|
|
918
|
+
</FilterGroup>
|
|
919
|
+
<FilterGroup
|
|
920
|
+
label="Priority"
|
|
921
|
+
onClear={priorityFilter.length > 0 ? clearPriorityOnly : undefined}
|
|
922
|
+
>
|
|
923
|
+
{priorityOptions.map((priority) => (
|
|
924
|
+
<Chip
|
|
925
|
+
key={priority}
|
|
926
|
+
label={priority}
|
|
927
|
+
active={priorityFilter.includes(priority)}
|
|
928
|
+
icon={
|
|
929
|
+
<span
|
|
930
|
+
className={cn(
|
|
931
|
+
"h-2.5 w-2.5 rounded-full",
|
|
932
|
+
priorityTheme[priority],
|
|
933
|
+
)}
|
|
934
|
+
/>
|
|
935
|
+
}
|
|
936
|
+
onClick={() => togglePriorityFilter(priority)}
|
|
937
|
+
/>
|
|
938
|
+
))}
|
|
939
|
+
</FilterGroup>
|
|
940
|
+
<div className="ml-auto flex flex-wrap items-center gap-3">
|
|
941
|
+
<div className="flex items-center gap-2 rounded-full border border-slate-200 bg-white px-3 py-1.5 text-sm text-slate-500 dark:border-slate-700 dark:bg-slate-900">
|
|
942
|
+
<label
|
|
943
|
+
htmlFor="real-sort-select"
|
|
944
|
+
className="text-xs tracking-wide text-slate-400 uppercase"
|
|
945
|
+
>
|
|
946
|
+
Sort
|
|
947
|
+
</label>
|
|
948
|
+
<select
|
|
949
|
+
id="real-sort-select"
|
|
950
|
+
value={sortKey}
|
|
951
|
+
onChange={(event) =>
|
|
952
|
+
setSortKey(event.target.value as TaskSortKey)
|
|
953
|
+
}
|
|
954
|
+
className="bg-transparent text-sm font-medium text-slate-700 outline-none dark:text-slate-200"
|
|
955
|
+
>
|
|
956
|
+
{sortOptions.map((option) => (
|
|
957
|
+
<option key={option} value={option}>
|
|
958
|
+
{option}
|
|
959
|
+
</option>
|
|
960
|
+
))}
|
|
961
|
+
</select>
|
|
962
|
+
</div>
|
|
963
|
+
{(statusFilter.length > 0 || priorityFilter.length > 0) && (
|
|
964
|
+
<button
|
|
965
|
+
type="button"
|
|
966
|
+
onClick={clearAllFilters}
|
|
967
|
+
className="rounded-full border border-slate-200 px-3 py-1.5 text-sm text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200"
|
|
968
|
+
>
|
|
969
|
+
Clear filters
|
|
970
|
+
</button>
|
|
971
|
+
)}
|
|
972
|
+
</div>
|
|
973
|
+
</div>
|
|
974
|
+
|
|
975
|
+
{/* Todo cards grid */}
|
|
976
|
+
<div
|
|
977
|
+
className={cn(
|
|
978
|
+
"grid gap-4",
|
|
979
|
+
density === "compact"
|
|
980
|
+
? "md:grid-cols-2 xl:grid-cols-3"
|
|
981
|
+
: "md:grid-cols-2 xl:grid-cols-2",
|
|
982
|
+
)}
|
|
983
|
+
>
|
|
984
|
+
{sortedTodos.length === 0 ? (
|
|
985
|
+
canShowEmpty ? (
|
|
986
|
+
todos.length === 0 ? (
|
|
987
|
+
noWork
|
|
988
|
+
) : (
|
|
989
|
+
<EmptyState
|
|
990
|
+
title="No todos match these filters"
|
|
991
|
+
description="Try expanding your filters or check the Processes catalog to kick off new work."
|
|
992
|
+
/>
|
|
993
|
+
)
|
|
994
|
+
) : null
|
|
995
|
+
) : (
|
|
996
|
+
sortedTodos.map((todo) => (
|
|
997
|
+
<TodoCard key={todo.id} todo={todo} density={density} />
|
|
998
|
+
))
|
|
999
|
+
)}
|
|
1000
|
+
</div>
|
|
1001
|
+
</div>
|
|
1002
|
+
</section>
|
|
1003
|
+
)
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
function RealTodosSection() {
|
|
1007
|
+
const { collectionPromise } = useTodoCollection()
|
|
1008
|
+
|
|
1009
|
+
return (
|
|
1010
|
+
<Suspense fallback={<RealTodosLoadingState />}>
|
|
1011
|
+
<RealTodosSectionInner collectionPromise={collectionPromise} />
|
|
1012
|
+
</Suspense>
|
|
1013
|
+
)
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
function MobileTodoRow({ todo }: { todo: MobileTodoListItem }) {
|
|
1017
|
+
return (
|
|
1018
|
+
<article
|
|
1019
|
+
className={cn(
|
|
1020
|
+
"relative overflow-hidden rounded-2xl border bg-white p-4 shadow-sm dark:bg-slate-900/70",
|
|
1021
|
+
statusTheme[todo.status]?.card ??
|
|
1022
|
+
"border-slate-200 dark:border-slate-700",
|
|
1023
|
+
)}
|
|
1024
|
+
>
|
|
1025
|
+
{todo.href && (
|
|
1026
|
+
<Link
|
|
1027
|
+
href={todo.href}
|
|
1028
|
+
prefetch={false}
|
|
1029
|
+
aria-hidden="true"
|
|
1030
|
+
tabIndex={-1}
|
|
1031
|
+
data-testid={`mobile-todo-row-link-${todo.id}`}
|
|
1032
|
+
className="absolute inset-0 rounded-2xl"
|
|
1033
|
+
/>
|
|
1034
|
+
)}
|
|
1035
|
+
<div className="relative z-10 space-y-3">
|
|
1036
|
+
<div className="space-y-1">
|
|
1037
|
+
<p className="text-xs font-semibold tracking-wide text-slate-400 uppercase dark:text-slate-500">
|
|
1038
|
+
{todo.processName}
|
|
1039
|
+
</p>
|
|
1040
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
1041
|
+
<span className="text-xs text-slate-500 dark:text-slate-300">
|
|
1042
|
+
Assigned{" "}
|
|
1043
|
+
<DateTimeDisplay kind="timestamp" value={todo.assignedAt} />
|
|
1044
|
+
</span>
|
|
1045
|
+
{todo.dueAt && (
|
|
1046
|
+
<span
|
|
1047
|
+
className={cn(
|
|
1048
|
+
"inline-flex w-fit items-center rounded-full px-2 py-0.5 text-xs font-medium",
|
|
1049
|
+
todo.status === "Overdue"
|
|
1050
|
+
? "bg-rose-100 text-rose-700 dark:bg-rose-500/20 dark:text-rose-300"
|
|
1051
|
+
: "bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-300",
|
|
1052
|
+
)}
|
|
1053
|
+
>
|
|
1054
|
+
{todo.status === "Overdue" ? "Overdue" : "Due"}{" "}
|
|
1055
|
+
<DateTimeDisplay
|
|
1056
|
+
kind="timestamp"
|
|
1057
|
+
value={todo.dueAt}
|
|
1058
|
+
initialMode="browser-local"
|
|
1059
|
+
/>
|
|
1060
|
+
</span>
|
|
1061
|
+
)}
|
|
1062
|
+
</div>
|
|
1063
|
+
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
|
|
1064
|
+
{todo.title}
|
|
1065
|
+
</h3>
|
|
1066
|
+
{!todo.dueAt && (
|
|
1067
|
+
<p className="text-sm text-slate-500 dark:text-slate-400">
|
|
1068
|
+
{todo.cue}
|
|
1069
|
+
</p>
|
|
1070
|
+
)}
|
|
1071
|
+
</div>
|
|
1072
|
+
{todo.summary.length > 0 && (
|
|
1073
|
+
<div className="flex flex-wrap gap-x-3 gap-y-1 border-t border-slate-100 pt-3 text-sm dark:border-slate-800">
|
|
1074
|
+
{todo.summary.map((item) => (
|
|
1075
|
+
<div
|
|
1076
|
+
key={`${item.label}-${item.value}`}
|
|
1077
|
+
className="flex min-w-0 max-w-full flex-wrap items-center gap-x-1.5"
|
|
1078
|
+
>
|
|
1079
|
+
<span className="shrink-0 text-slate-400">{item.label}:</span>
|
|
1080
|
+
<span
|
|
1081
|
+
className="min-w-0 break-words text-slate-700 dark:text-slate-300"
|
|
1082
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: sanitized with DOMPurify
|
|
1083
|
+
dangerouslySetInnerHTML={{
|
|
1084
|
+
__html: DOMPurify.sanitize(item.value),
|
|
1085
|
+
}}
|
|
1086
|
+
/>
|
|
1087
|
+
</div>
|
|
1088
|
+
))}
|
|
1089
|
+
</div>
|
|
1090
|
+
)}
|
|
1091
|
+
<div className="flex justify-end">
|
|
1092
|
+
{todo.href ? (
|
|
1093
|
+
<Link
|
|
1094
|
+
href={todo.href}
|
|
1095
|
+
prefetch={false}
|
|
1096
|
+
aria-label={`${todo.actionLabel} ${todo.title}`}
|
|
1097
|
+
className="rounded-full bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-blue-500"
|
|
1098
|
+
>
|
|
1099
|
+
{todo.actionLabel}
|
|
1100
|
+
</Link>
|
|
1101
|
+
) : (
|
|
1102
|
+
<div className="flex flex-col items-end gap-1">
|
|
1103
|
+
<button
|
|
1104
|
+
type="button"
|
|
1105
|
+
disabled
|
|
1106
|
+
className="rounded-full bg-slate-200 px-4 py-2 text-sm font-semibold text-slate-500 dark:bg-slate-800 dark:text-slate-400"
|
|
1107
|
+
>
|
|
1108
|
+
{todo.actionLabel}
|
|
1109
|
+
</button>
|
|
1110
|
+
{todo.status === "Correction Required" && (
|
|
1111
|
+
<p className="max-w-48 text-right text-xs text-amber-700 dark:text-amber-300">
|
|
1112
|
+
{correctionHelp}
|
|
1113
|
+
</p>
|
|
1114
|
+
)}
|
|
1115
|
+
</div>
|
|
1116
|
+
)}
|
|
1117
|
+
</div>
|
|
1118
|
+
</div>
|
|
1119
|
+
</article>
|
|
1120
|
+
)
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
function TodoCard({
|
|
1124
|
+
todo,
|
|
1125
|
+
density = "comfortable",
|
|
1126
|
+
}: {
|
|
1127
|
+
todo: TodoDocType
|
|
1128
|
+
density?: "comfortable" | "compact"
|
|
1129
|
+
}) {
|
|
1130
|
+
const effectiveStatus = computeTodoStatus(todo.dueAt, todo.status)
|
|
1131
|
+
const priority = todo.priority
|
|
1132
|
+
// Active is implicit, and Overdue is conveyed by the due badge.
|
|
1133
|
+
const showStatusBadge =
|
|
1134
|
+
effectiveStatus !== "Active" && effectiveStatus !== "Overdue"
|
|
1135
|
+
const correctionHelpId = `${todo.id}-correction-pending-help`
|
|
1136
|
+
|
|
1137
|
+
return (
|
|
1138
|
+
<article
|
|
1139
|
+
className={cn(
|
|
1140
|
+
"flex flex-col gap-1 rounded-2xl border bg-white shadow-sm transition hover:-translate-y-0.5 hover:shadow-md dark:bg-slate-900/70",
|
|
1141
|
+
statusTheme[effectiveStatus]?.card ??
|
|
1142
|
+
"border-slate-200 dark:border-slate-700",
|
|
1143
|
+
density === "compact" ? "p-3 sm:p-3" : "p-5 sm:p-5",
|
|
1144
|
+
)}
|
|
1145
|
+
>
|
|
1146
|
+
<header className="flex items-start justify-between gap-3">
|
|
1147
|
+
<div className="space-y-2">
|
|
1148
|
+
<p className="text-xs font-semibold tracking-wide text-slate-400 uppercase dark:text-slate-500">
|
|
1149
|
+
{todo.processName}
|
|
1150
|
+
</p>
|
|
1151
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
1152
|
+
<span className="inline-flex items-center gap-1 rounded-full border border-slate-200 px-2 py-0.5 text-xs font-semibold text-slate-500 dark:border-slate-700 dark:text-slate-300">
|
|
1153
|
+
<span
|
|
1154
|
+
className={cn(
|
|
1155
|
+
"h-2 w-2 rounded-full",
|
|
1156
|
+
priorityTheme[priority] ?? "bg-slate-400",
|
|
1157
|
+
)}
|
|
1158
|
+
/>
|
|
1159
|
+
{todo.priority}
|
|
1160
|
+
</span>
|
|
1161
|
+
<span className="text-xs text-slate-500 dark:text-slate-300">
|
|
1162
|
+
Assigned{" "}
|
|
1163
|
+
<DateTimeDisplay kind="timestamp" value={todo.assignedAt} />
|
|
1164
|
+
</span>
|
|
1165
|
+
{todo.dueAt && (
|
|
1166
|
+
<span
|
|
1167
|
+
className={cn(
|
|
1168
|
+
"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",
|
|
1169
|
+
effectiveStatus === "Overdue"
|
|
1170
|
+
? "bg-rose-100 text-rose-700 dark:bg-rose-500/20 dark:text-rose-300"
|
|
1171
|
+
: "bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-300",
|
|
1172
|
+
)}
|
|
1173
|
+
>
|
|
1174
|
+
{effectiveStatus === "Overdue" ? "Overdue" : "Due"}{" "}
|
|
1175
|
+
<DateTimeDisplay
|
|
1176
|
+
kind="timestamp"
|
|
1177
|
+
value={todo.dueAt}
|
|
1178
|
+
initialMode="browser-local"
|
|
1179
|
+
/>
|
|
1180
|
+
</span>
|
|
1181
|
+
)}
|
|
1182
|
+
{showStatusBadge && (
|
|
1183
|
+
<span
|
|
1184
|
+
className={cn(
|
|
1185
|
+
"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",
|
|
1186
|
+
statusTheme[effectiveStatus]?.badge ??
|
|
1187
|
+
"bg-slate-100 text-slate-600",
|
|
1188
|
+
)}
|
|
1189
|
+
>
|
|
1190
|
+
{effectiveStatus}
|
|
1191
|
+
</span>
|
|
1192
|
+
)}
|
|
1193
|
+
</div>
|
|
1194
|
+
<div className="space-y-1">
|
|
1195
|
+
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
|
|
1196
|
+
{todo.stepName}
|
|
1197
|
+
</h3>
|
|
1198
|
+
<p className="text-sm text-slate-500 dark:text-slate-400">
|
|
1199
|
+
{todo.description}
|
|
1200
|
+
</p>
|
|
1201
|
+
</div>
|
|
1202
|
+
</div>
|
|
1203
|
+
<span className="shrink-0 rounded-full bg-slate-100 px-3 py-1 text-xs font-semibold text-slate-600 dark:bg-slate-700/60 dark:text-slate-300">
|
|
1204
|
+
{todo.role}
|
|
1205
|
+
</span>
|
|
1206
|
+
</header>
|
|
1207
|
+
|
|
1208
|
+
{todo.summary && todo.summary.length > 0 && (
|
|
1209
|
+
<div className="flex flex-wrap gap-x-4 gap-y-1 border-t border-slate-100 pt-2 text-sm dark:border-slate-800">
|
|
1210
|
+
{todo.summary.map((item) => (
|
|
1211
|
+
<div
|
|
1212
|
+
key={`${item.label}-${item.value}`}
|
|
1213
|
+
className="flex items-center gap-1.5"
|
|
1214
|
+
>
|
|
1215
|
+
<span className="text-slate-400">{item.label}:</span>
|
|
1216
|
+
<span
|
|
1217
|
+
className="text-slate-700 dark:text-slate-300"
|
|
1218
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: sanitized with DOMPurify
|
|
1219
|
+
dangerouslySetInnerHTML={{
|
|
1220
|
+
__html: DOMPurify.sanitize(item.value),
|
|
1221
|
+
}}
|
|
1222
|
+
/>
|
|
1223
|
+
</div>
|
|
1224
|
+
))}
|
|
1225
|
+
</div>
|
|
1226
|
+
)}
|
|
1227
|
+
|
|
1228
|
+
<footer className="mt-auto flex flex-wrap items-center justify-between gap-2 pt-4">
|
|
1229
|
+
<div className="flex items-center gap-2">
|
|
1230
|
+
{effectiveStatus === "Completed" ? (
|
|
1231
|
+
<Button className="min-w-20 rounded-full" disabled>
|
|
1232
|
+
Done
|
|
1233
|
+
</Button>
|
|
1234
|
+
) : effectiveStatus === "Correction Required" ? (
|
|
1235
|
+
<Button
|
|
1236
|
+
asChild
|
|
1237
|
+
className="min-w-20 rounded-full"
|
|
1238
|
+
aria-describedby={correctionHelpId}
|
|
1239
|
+
>
|
|
1240
|
+
<Link
|
|
1241
|
+
href={`/to-dos/correct/${toUrlPath(todo.stepPath)}?todoId=${encodeURIComponent(todo.id)}`}
|
|
1242
|
+
prefetch={false}
|
|
1243
|
+
>
|
|
1244
|
+
Correct email
|
|
1245
|
+
</Link>
|
|
1246
|
+
</Button>
|
|
1247
|
+
) : (
|
|
1248
|
+
<Button asChild className="min-w-20 rounded-full">
|
|
1249
|
+
<Link
|
|
1250
|
+
href={`/to-dos/complete/${toUrlPath(todo.stepPath)}?todoId=${encodeURIComponent(todo.id)}`}
|
|
1251
|
+
prefetch={false}
|
|
1252
|
+
>
|
|
1253
|
+
{effectiveStatus === "Draft"
|
|
1254
|
+
? "Continue"
|
|
1255
|
+
: effectiveStatus === "Upcoming"
|
|
1256
|
+
? "Preview"
|
|
1257
|
+
: "Do"}
|
|
1258
|
+
</Link>
|
|
1259
|
+
</Button>
|
|
1260
|
+
)}
|
|
1261
|
+
<Button variant="outline" className="rounded-full" disabled>
|
|
1262
|
+
Delegate
|
|
1263
|
+
</Button>
|
|
1264
|
+
</div>
|
|
1265
|
+
{effectiveStatus === "Correction Required" && (
|
|
1266
|
+
<p
|
|
1267
|
+
id={correctionHelpId}
|
|
1268
|
+
className="basis-full text-xs text-amber-700 dark:text-amber-300"
|
|
1269
|
+
>
|
|
1270
|
+
{correctionHelp}
|
|
1271
|
+
</p>
|
|
1272
|
+
)}
|
|
1273
|
+
<button
|
|
1274
|
+
type="button"
|
|
1275
|
+
className="text-xs font-semibold text-blue-500 hover:text-blue-600"
|
|
1276
|
+
>
|
|
1277
|
+
Open form preview
|
|
1278
|
+
</button>
|
|
1279
|
+
</footer>
|
|
1280
|
+
</article>
|
|
1281
|
+
)
|
|
1282
|
+
}
|