@processfocus/runtime-local 0.1.0-next.1 → 0.1.0-next.3

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.
Files changed (326) hide show
  1. package/README.md +48 -253
  2. package/dist/authentication-server.mjs +52 -84
  3. package/dist/{chunk-fn7b5pxw.js → chunk-04r0t2mb.js} +19364 -34104
  4. package/dist/chunk-727y6qkb.js +156 -0
  5. package/dist/chunk-bg5r4wpv.js +4755 -0
  6. package/dist/chunk-cbd36jq1.js +512 -0
  7. package/dist/chunk-d4ctj079.js +241 -0
  8. package/dist/{chunk-cq9xscgb.js → chunk-r5s2v669.js} +49079 -33564
  9. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +12 -12
  10. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +31 -21
  11. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +3 -0
  12. package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +1 -12
  13. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
  14. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
  15. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -0
  16. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
  17. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +3 -1
  18. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
  19. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
  20. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
  21. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
  22. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
  23. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
  24. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
  25. package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
  26. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
  27. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -0
  28. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
  29. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +153 -16
  30. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +10 -2
  31. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +29 -13
  32. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
  33. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
  34. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
  35. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
  36. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
  37. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
  38. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
  39. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
  40. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
  41. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
  42. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
  43. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
  44. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
  45. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
  46. package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
  47. package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
  48. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
  49. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
  50. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
  51. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
  52. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
  53. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
  54. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
  55. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
  56. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
  57. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
  58. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
  59. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
  60. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
  61. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
  62. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
  63. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
  64. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
  65. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
  66. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
  67. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
  68. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
  69. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
  70. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
  71. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
  72. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
  73. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
  74. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
  75. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
  76. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
  77. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
  78. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
  79. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
  80. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
  81. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
  82. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
  83. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
  84. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
  85. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
  86. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
  87. package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
  88. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
  89. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
  90. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
  91. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +2 -4
  92. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
  93. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
  94. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
  95. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
  96. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
  97. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
  98. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
  99. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
  100. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
  101. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
  102. package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
  103. package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
  104. package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
  105. package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
  106. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
  107. package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
  108. package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
  109. package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
  110. package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
  111. package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
  112. package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
  113. package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
  114. package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
  115. package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +11 -4
  116. package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
  117. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
  118. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
  119. package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
  120. package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
  121. package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
  122. package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +47 -0
  123. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
  124. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
  125. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
  126. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
  127. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
  128. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
  129. package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
  130. package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
  131. package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
  132. package/dist/dashboard-source/apps/frontend/components/Header.tsx +4 -8
  133. package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
  134. package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
  135. package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
  136. package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
  137. package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
  138. package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
  139. package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
  140. package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
  141. package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
  142. package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
  143. package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
  144. package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
  145. package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
  146. package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
  147. package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
  148. package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
  149. package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
  150. package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
  151. package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
  152. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
  153. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
  154. package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
  155. package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
  156. package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
  157. package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
  158. package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
  159. package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
  160. package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
  161. package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
  162. package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
  163. package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
  164. package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
  165. package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
  166. package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
  167. package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
  168. package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +112 -21
  169. package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
  170. package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
  171. package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
  172. package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
  173. package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
  174. package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
  175. package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
  176. package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
  177. package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
  178. package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
  179. package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
  180. package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
  181. package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
  182. package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
  183. package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
  184. package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
  185. package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
  186. package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
  187. package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
  188. package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
  189. package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
  190. package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
  191. package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +169 -30
  192. package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
  193. package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
  194. package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
  195. package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +38 -29
  196. package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
  197. package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
  198. package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
  199. package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
  200. package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
  201. package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
  202. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
  203. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
  204. package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
  205. package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
  206. package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
  207. package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
  208. package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +900 -0
  209. package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +42 -0
  210. package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
  211. package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
  212. package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
  213. package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
  214. package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +193 -0
  215. package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +237 -0
  216. package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
  217. package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
  218. package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
  219. package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
  220. package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
  221. package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
  222. package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
  223. package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
  224. package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
  225. package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
  226. package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
  227. package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
  228. package/dist/dashboard-source/apps/frontend/package.json +48 -47
  229. package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
  230. package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
  231. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
  232. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
  233. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
  234. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
  235. package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
  236. package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
  237. package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
  238. package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
  239. package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
  240. package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
  241. package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
  242. package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
  243. package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
  244. package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
  245. package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
  246. package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
  247. package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
  248. package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
  249. package/dist/dashboard-source/modules/form/src/index.ts +1 -10
  250. package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
  251. package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
  252. package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
  253. package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
  254. package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
  255. package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
  256. package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
  257. package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
  258. package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
  259. package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
  260. package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
  261. package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
  262. package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
  263. package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
  264. package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
  265. package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
  266. package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
  267. package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
  268. package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
  269. package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
  270. package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
  271. package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
  272. package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
  273. package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
  274. package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
  275. package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
  276. package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
  277. package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
  278. package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
  279. package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
  280. package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
  281. package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
  282. package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
  283. package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
  284. package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
  285. package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
  286. package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
  287. package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
  288. package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
  289. package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
  290. package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
  291. package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
  292. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
  293. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
  294. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +272 -0
  295. package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
  296. package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
  297. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
  298. package/dist/dashboard-source.json +48 -47
  299. package/dist/graphql-server.mjs +245 -200
  300. package/dist/job-worker-supervisor.mjs +262 -0
  301. package/dist/job-worker.mjs +234 -133
  302. package/dist/main.mjs +23 -4
  303. package/dist/prepare-dashboard.mjs +8 -8
  304. package/dist/resources/cedar/policies.cedar +80 -38
  305. package/dist/resources/cedar/schema.cedarschema +39 -21
  306. package/dist/resources/graphql-schema/rxdb.graphql +2 -0
  307. package/dist/resources/graphql-schema/system.graphql +204 -51
  308. package/package.json +64 -62
  309. package/dist/chunk-6b6t8tyq.js +0 -85
  310. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
  311. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
  312. package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
  313. package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
  314. package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
  315. package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
  316. package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
  317. package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
  318. package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
  319. package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
  320. package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
  321. package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
  322. package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
  323. package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
  324. package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
  325. package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
  326. package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
@@ -0,0 +1,1637 @@
1
+ "use client"
2
+ import type { Collection } from "@tanstack/db"
3
+ import { useLiveQuery } from "@tanstack/react-db"
4
+ import { ChevronLeft } from "lucide-react"
5
+ import Image from "next/image"
6
+ import Link from "next/link"
7
+ import { useRouter, useSearchParams } from "next/navigation"
8
+ import { Suspense, use, useMemo, useRef, useState } from "react"
9
+ import { deepEqual } from "rxdb/plugins/utils"
10
+ import { DateTimeDisplay } from "../../../../../modules/shadcn-components/src/lib/date-time-display.tsx"
11
+ import { ExecutionCardMenu } from "./execution-card-menu.tsx"
12
+ import { useMocks } from "@/components/mocks-provider"
13
+ import { ProcessWorkflowLink } from "@/components/process-workflow-link"
14
+ import { TabPill } from "@/components/ui/tab-pill"
15
+ import { WithoutWaitingBadge } from "@/components/without-waiting-badge"
16
+ import { useIsMobile } from "@/hooks/use-mobile"
17
+ import {
18
+ type ExecutionDocType,
19
+ useExecutionCollection,
20
+ } from "@/lib/collections/execution-collection-provider"
21
+ import { type Execution, executions as mockExecutions } from "@/lib/mock-data"
22
+ import { cn } from "@/lib/utils"
23
+
24
+ type ExecutionStatus =
25
+ | "Running"
26
+ | "Completed"
27
+ | "Failed"
28
+ | "Abandoned"
29
+ | "Not started"
30
+ type ExecutionTabKey =
31
+ | "in-progress"
32
+ | "completed"
33
+ | "failed"
34
+ | "not-started"
35
+ | "all"
36
+ type MockExecutionView = "timeline" | "kanban"
37
+ type MockExecutionTabKey = "in-progress" | "completed" | "failed" | "all"
38
+
39
+ const executionStatusTheme: Record<ExecutionStatus, string> = {
40
+ "Not started":
41
+ "bg-amber-100 text-amber-800 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-300 dark:border-amber-500/30",
42
+ Running:
43
+ "bg-sky-100 text-sky-700 border border-sky-200 dark:bg-sky-500/10 dark:text-sky-300 dark:border-sky-500/30",
44
+ Completed:
45
+ "bg-emerald-100 text-emerald-700 border border-emerald-200 dark:bg-emerald-500/10 dark:text-emerald-300 dark:border-emerald-500/30",
46
+ Failed:
47
+ "bg-rose-100 text-rose-700 border border-rose-200 dark:bg-rose-500/10 dark:text-rose-300 dark:border-rose-500/30",
48
+ Abandoned:
49
+ "bg-slate-100 text-slate-600 border border-slate-200 dark:bg-slate-500/10 dark:text-slate-400 dark:border-slate-500/30",
50
+ }
51
+
52
+ const mockExecutionStatusTheme = {
53
+ Running:
54
+ "bg-sky-100 text-sky-700 border border-sky-200 dark:bg-sky-500/10 dark:text-sky-300 dark:border-sky-500/30",
55
+ Paused:
56
+ "bg-amber-100 text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-300 dark:border-amber-500/30",
57
+ Completed:
58
+ "bg-emerald-100 text-emerald-700 border border-emerald-200 dark:bg-emerald-500/10 dark:text-emerald-300 dark:border-emerald-500/30",
59
+ Failed:
60
+ "bg-rose-100 text-rose-700 border border-rose-200 dark:bg-rose-500/10 dark:text-rose-300 dark:border-rose-500/30",
61
+ }
62
+
63
+ const mockExecutionTabFilters: Record<
64
+ MockExecutionTabKey,
65
+ Execution["status"][]
66
+ > = {
67
+ "in-progress": ["Running", "Paused"],
68
+ completed: ["Completed"],
69
+ failed: ["Failed"],
70
+ all: ["Running", "Paused", "Completed", "Failed"],
71
+ }
72
+
73
+ const executionTabKeys = [
74
+ "not-started",
75
+ "in-progress",
76
+ "completed",
77
+ "failed",
78
+ "all",
79
+ ] as const satisfies readonly ExecutionTabKey[]
80
+
81
+ function parseExecutionTabKey(value: string | null): ExecutionTabKey | null {
82
+ return executionTabKeys.find((key) => key === value) ?? null
83
+ }
84
+
85
+ function ExecutionsSkeleton() {
86
+ return (
87
+ <div className="flex-1 overflow-y-auto">
88
+ <section className="space-y-6">
89
+ <div className="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900/60">
90
+ <div className="flex items-center justify-center py-12">
91
+ <div className="text-center">
92
+ <output
93
+ className="inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-blue-600 border-r-transparent motion-reduce:animate-[spin_1.5s_linear_infinite]"
94
+ aria-label="Loading executions"
95
+ />
96
+ <p className="mt-4 text-sm text-slate-500 dark:text-slate-400">
97
+ Loading executions...
98
+ </p>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ </section>
103
+ </div>
104
+ )
105
+ }
106
+
107
+ // =============================================================================
108
+ // LIVE IMPLEMENTATION (using RxDB data)
109
+ // =============================================================================
110
+
111
+ function ExecutionsPageInner({
112
+ collectionPromise,
113
+ initialSelectedExecutionId = null,
114
+ onMobileBack,
115
+ }: {
116
+ collectionPromise: Promise<Collection<ExecutionDocType, string>>
117
+ initialSelectedExecutionId?: string | null
118
+ onMobileBack?: () => void
119
+ }) {
120
+ "use memo"
121
+
122
+ const executionCollection = use(collectionPromise)
123
+ const { initialSync, retryInitialSync } = useExecutionCollection()
124
+ const router = useRouter()
125
+ const searchParams = useSearchParams()
126
+ const isMobile = useIsMobile()
127
+ const defaultTab = initialSelectedExecutionId ? "all" : "in-progress"
128
+ const tab = parseExecutionTabKey(searchParams.get("filter")) ?? defaultTab
129
+ const currentQueryString = searchParams.toString()
130
+ const currentQuerySuffix = currentQueryString ? `?${currentQueryString}` : ""
131
+ const [selectedExecutionId, setSelectedExecutionId] = useState<string | null>(
132
+ null,
133
+ )
134
+
135
+ const executionsQuery = useLiveQuery({
136
+ query: (q) =>
137
+ q
138
+ .from({ execution: executionCollection })
139
+ .orderBy(({ execution }) => execution.startedAt, "desc"),
140
+ })
141
+
142
+ // Initial replication includes persistence and adapter commits. Wait for the
143
+ // live query to incorporate that snapshot before declaring a result empty.
144
+ const queryCaughtUp =
145
+ executionsQuery.isReady &&
146
+ executionsQuery.data.length === executionCollection.size &&
147
+ executionsQuery.data.every((execution) =>
148
+ deepEqual(execution, executionCollection.get(execution.id)),
149
+ )
150
+ const resultsComplete = initialSync.status === "complete" && queryCaughtUp
151
+ const executions = (executionsQuery.data ?? []).map((execution) => ({
152
+ id: execution.id,
153
+ updatedAt: execution.updatedAt,
154
+ processStateId: execution.processStateId,
155
+ processName: execution.processName,
156
+ withoutWaiting: execution.withoutWaiting ?? false,
157
+ processPath: execution.processPath,
158
+ canAbandonExecution: execution.canAbandonExecution ?? false,
159
+ canRestartExecution: execution.canRestartExecution ?? false,
160
+ status: execution.status,
161
+ failureReason: execution.failureReason,
162
+ notStartedReason: execution.notStartedReason,
163
+ abandonedReason: execution.abandonedReason,
164
+ startedAt: execution.startedAt,
165
+ finishedAt: execution.finishedAt,
166
+ completedSteps: execution.completedSteps,
167
+ totalSteps: execution.totalSteps,
168
+ durationMs: execution.durationMs,
169
+ estimatedCompletionAt: execution.estimatedCompletionAt,
170
+ slaTargetAt: execution.slaTargetAt,
171
+ steps: execution.steps,
172
+ }))
173
+
174
+ const routeSelectedExecution = initialSelectedExecutionId
175
+ ? executions.find(
176
+ (execution) => execution.id === initialSelectedExecutionId,
177
+ )
178
+ : null
179
+
180
+ const runningCount = executions.filter((e) => e.status === "Running").length
181
+ const completedCount = executions.filter(
182
+ (e) => e.status === "Completed",
183
+ ).length
184
+ const failedCount = executions.filter(
185
+ (e) => e.status === "Failed" || e.status === "Abandoned",
186
+ ).length
187
+
188
+ const filtered = (() => {
189
+ switch (tab) {
190
+ case "not-started":
191
+ return executions.filter((e) => e.status === "Not started")
192
+ case "in-progress":
193
+ return executions.filter((e) => e.status === "Running")
194
+ case "completed":
195
+ return executions.filter((e) => e.status === "Completed")
196
+ case "failed":
197
+ return executions.filter(
198
+ (e) => e.status === "Failed" || e.status === "Abandoned",
199
+ )
200
+ default:
201
+ return executions
202
+ }
203
+ })()
204
+
205
+ const selectedExecution = (() => {
206
+ if (filtered.length === 0) return null
207
+
208
+ if (selectedExecutionId) {
209
+ const found = filtered.find((e) => e.id === selectedExecutionId)
210
+ if (found) return found
211
+ }
212
+
213
+ if (initialSelectedExecutionId) {
214
+ if (!routeSelectedExecution) return null
215
+
216
+ const routeSelection = filtered.find(
217
+ (execution) => execution.id === initialSelectedExecutionId,
218
+ )
219
+
220
+ if (routeSelection) return routeSelection
221
+ return isMobile ? routeSelectedExecution : (filtered[0] ?? null)
222
+ }
223
+
224
+ return filtered[0] ?? null
225
+ })()
226
+
227
+ const handleSelectExecution = (executionId: string) => {
228
+ setSelectedExecutionId(executionId)
229
+
230
+ const executionPath = `/executions/${encodeURIComponent(executionId)}${currentQuerySuffix}`
231
+
232
+ if (isMobile) {
233
+ router.push(executionPath, { scroll: false })
234
+ return
235
+ }
236
+
237
+ router.replace(executionPath, { scroll: false })
238
+ }
239
+
240
+ const handleSelectTab = (nextTab: ExecutionTabKey) => {
241
+ const nextSearchParams = new URLSearchParams(searchParams)
242
+
243
+ if (nextTab === defaultTab) {
244
+ nextSearchParams.delete("filter")
245
+ } else {
246
+ nextSearchParams.set("filter", nextTab)
247
+ }
248
+
249
+ const nextQueryString = nextSearchParams.toString()
250
+ router.replace(
251
+ nextQueryString ? `/executions?${nextQueryString}` : "/executions",
252
+ { scroll: false },
253
+ )
254
+ }
255
+
256
+ const handleCloseMobileDetail = () => {
257
+ if (onMobileBack) {
258
+ onMobileBack()
259
+ return
260
+ }
261
+
262
+ router.push(`/executions${currentQuerySuffix}`, { scroll: false })
263
+ }
264
+
265
+ const isMobileDetailRoute = isMobile && initialSelectedExecutionId !== null
266
+ const isRouteExecutionMissing =
267
+ initialSelectedExecutionId !== null && routeSelectedExecution === null
268
+
269
+ const syncError =
270
+ initialSync.status === "error" ? (
271
+ <div role="alert" className="rounded-2xl border border-amber-300 p-6">
272
+ <p>
273
+ Executions could not finish loading. Check your connection and retry.
274
+ </p>
275
+ <button
276
+ type="button"
277
+ onClick={retryInitialSync}
278
+ className="mt-2 font-semibold text-blue-600"
279
+ >
280
+ Retry loading executions
281
+ </button>
282
+ </div>
283
+ ) : null
284
+
285
+ if (executions.length === 0 && !resultsComplete) {
286
+ return syncError ?? <ExecutionsSkeleton />
287
+ }
288
+
289
+ return (
290
+ <section className="space-y-6">
291
+ {syncError}
292
+ {!resultsComplete && !syncError && (
293
+ <p role="status" className="text-sm text-slate-500">
294
+ Loading executions…
295
+ </p>
296
+ )}
297
+ {!isMobileDetailRoute && (
298
+ <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">
299
+ <div className="flex flex-wrap items-center gap-2">
300
+ <TabPill
301
+ label="In Progress"
302
+ count={runningCount}
303
+ active={tab === "in-progress"}
304
+ onClick={() => handleSelectTab("in-progress")}
305
+ />
306
+ <TabPill
307
+ label="Completed"
308
+ count={completedCount}
309
+ active={tab === "completed"}
310
+ onClick={() => handleSelectTab("completed")}
311
+ />
312
+ <TabPill
313
+ label="Failed"
314
+ count={failedCount}
315
+ active={tab === "failed"}
316
+ onClick={() => handleSelectTab("failed")}
317
+ />
318
+ <TabPill
319
+ label="All"
320
+ count={executions.length}
321
+ active={tab === "all"}
322
+ onClick={() => handleSelectTab("all")}
323
+ />
324
+ <TabPill
325
+ label="Not started"
326
+ count={
327
+ executions.filter((e) => e.status === "Not started").length
328
+ }
329
+ active={tab === "not-started"}
330
+ onClick={() => handleSelectTab("not-started")}
331
+ />
332
+ </div>
333
+ </div>
334
+ )}
335
+
336
+ {isMobileDetailRoute ? (
337
+ selectedExecution ? (
338
+ <MobileExecutionDetail
339
+ execution={selectedExecution}
340
+ onBack={handleCloseMobileDetail}
341
+ />
342
+ ) : !resultsComplete ? null : (
343
+ <EmptyState
344
+ title="Execution not found"
345
+ description="This execution is no longer available or you no longer have access to it."
346
+ />
347
+ )
348
+ ) : filtered.length === 0 ? (
349
+ resultsComplete ? (
350
+ <EmptyState
351
+ title={
352
+ executions.length === 0
353
+ ? "No executions in this view"
354
+ : "No matching executions"
355
+ }
356
+ description={
357
+ executions.length === 0
358
+ ? "Start a process from the catalog to see live executions."
359
+ : "There are no executions matching the selected filter. Choose another filter to see executions."
360
+ }
361
+ />
362
+ ) : null
363
+ ) : isMobile ? (
364
+ <div className="space-y-3">
365
+ {filtered.map((exec) => (
366
+ <ExecutionListCard
367
+ key={exec.id}
368
+ execution={exec}
369
+ isSelected={false}
370
+ onSelect={() => handleSelectExecution(exec.id)}
371
+ />
372
+ ))}
373
+ </div>
374
+ ) : (
375
+ <div className="mt-4 grid gap-6 lg:grid-cols-[380px_1fr]">
376
+ <div className="space-y-3">
377
+ {filtered.map((exec) => (
378
+ <ExecutionListCard
379
+ key={exec.id}
380
+ execution={exec}
381
+ isSelected={exec.id === selectedExecution?.id}
382
+ onSelect={() => handleSelectExecution(exec.id)}
383
+ />
384
+ ))}
385
+ </div>
386
+ {selectedExecution ? (
387
+ <LiveExecutionDetail execution={selectedExecution} />
388
+ ) : isRouteExecutionMissing && resultsComplete ? (
389
+ <EmptyState
390
+ title="Execution not found"
391
+ description="This execution is no longer available or you no longer have access to it."
392
+ />
393
+ ) : null}
394
+ </div>
395
+ )}
396
+ </section>
397
+ )
398
+ }
399
+
400
+ function ExecutionListCard({
401
+ execution,
402
+ isSelected,
403
+ onSelect,
404
+ }: {
405
+ execution: ExecutionData
406
+ isSelected: boolean
407
+ onSelect: () => void
408
+ }) {
409
+ "use memo"
410
+
411
+ const waitingStep = execution.steps.find(
412
+ (step) =>
413
+ step.status === "Correction Required" || step.status === "Waiting",
414
+ )
415
+
416
+ return (
417
+ <article
418
+ className={cn(
419
+ "relative flex w-full flex-col gap-3 rounded-2xl border bg-white p-4 text-left shadow-sm transition hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800 dark:bg-slate-900/70",
420
+ isSelected
421
+ ? "border-blue-500 dark:border-blue-400 dark:bg-blue-500/10"
422
+ : "border-slate-200",
423
+ )}
424
+ >
425
+ <div className="flex items-center justify-between">
426
+ <h4 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
427
+ <button
428
+ type="button"
429
+ onClick={onSelect}
430
+ className="cursor-pointer text-left after:absolute after:inset-0 after:rounded-2xl hover:underline focus-visible:outline-2 focus-visible:outline-blue-500"
431
+ >
432
+ {execution.processName}
433
+ </button>
434
+ {execution.withoutWaiting && (
435
+ <span className="relative z-10">
436
+ <WithoutWaitingBadge />
437
+ </span>
438
+ )}
439
+ </h4>
440
+ <div className="relative z-10 flex items-center gap-2">
441
+ <ExecutionCardMenu
442
+ executionId={execution.id}
443
+ status={execution.status}
444
+ processPath={execution.processPath}
445
+ canAbandonExecution={execution.canAbandonExecution}
446
+ canRestartExecution={execution.canRestartExecution}
447
+ />
448
+ <span
449
+ className={cn(
450
+ "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold",
451
+ executionStatusTheme[execution.status as ExecutionStatus] ||
452
+ executionStatusTheme.Running,
453
+ )}
454
+ >
455
+ {execution.status}
456
+ </span>
457
+ </div>
458
+ </div>
459
+ <p className="text-sm text-slate-500 dark:text-slate-400">
460
+ {execution.status === "Completed"
461
+ ? "Finished"
462
+ : `Step ${execution.completedSteps} of ${execution.totalSteps}`}
463
+ </p>
464
+ <div className="relative z-10 flex flex-wrap items-center justify-between gap-2 text-xs text-slate-500 dark:text-slate-400">
465
+ <span>
466
+ Started{" "}
467
+ <DateTimeDisplay kind="timestamp" value={execution.startedAt} />
468
+ </span>
469
+ <span>
470
+ {execution.status === "Completed" && execution.finishedAt ? (
471
+ <>
472
+ Completed{" "}
473
+ <DateTimeDisplay kind="timestamp" value={execution.finishedAt} />
474
+ </>
475
+ ) : (
476
+ <>
477
+ Last activity{" "}
478
+ <DateTimeDisplay kind="timestamp" value={execution.updatedAt} />
479
+ </>
480
+ )}
481
+ </span>
482
+ </div>
483
+ {waitingStep && (
484
+ <div className="flex items-center gap-2">
485
+ <span
486
+ className={cn(
487
+ "rounded-full px-2 py-0.5 text-xs font-semibold",
488
+ waitingStep.status === "Correction Required"
489
+ ? "bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-200"
490
+ : "bg-slate-200 text-slate-600 dark:bg-slate-800 dark:text-slate-300",
491
+ )}
492
+ >
493
+ {waitingStep.status === "Correction Required"
494
+ ? `Correction required: ${waitingStep.name}`
495
+ : waitingStep.name}
496
+ </span>
497
+ </div>
498
+ )}
499
+ <StepParticipants steps={execution.steps} />
500
+ </article>
501
+ )
502
+ }
503
+
504
+ interface ExecutionStep {
505
+ readonly deadlineActivity?: string | undefined
506
+ readonly id: string
507
+ readonly name: string
508
+ readonly path: string
509
+ readonly status:
510
+ | "Completed"
511
+ | "Waiting"
512
+ | "Potential"
513
+ | "Failed"
514
+ | "Correction Required"
515
+ | "Not started"
516
+ | "Interrupted"
517
+ readonly failureReason?: string | undefined
518
+ readonly notStartedReason?: string | undefined
519
+ readonly role?:
520
+ | {
521
+ readonly id: string
522
+ readonly name: string
523
+ }
524
+ | undefined
525
+ readonly submittedViaEmbeddedForm?: boolean | undefined
526
+ readonly externalSubmitterEmail?: string | undefined
527
+ readonly assignedProviderUserEmail?: string | undefined
528
+ readonly providerUser?:
529
+ | {
530
+ readonly id: string
531
+ readonly firstName: string
532
+ readonly lastName: string
533
+ readonly picture: string
534
+ readonly orgUnit: string
535
+ }
536
+ | undefined
537
+ readonly startedAt?: string | undefined // ISO date string
538
+ readonly completedAt?: string | undefined // ISO date string
539
+ }
540
+
541
+ interface ExecutionData {
542
+ withoutWaiting: boolean
543
+ id: string
544
+ updatedAt: number
545
+ processStateId: string
546
+ processName: string
547
+ processPath: string
548
+ canAbandonExecution: boolean
549
+ canRestartExecution: boolean
550
+ status: ExecutionStatus
551
+ failureReason?: string | undefined
552
+ notStartedReason?: string | undefined
553
+ abandonedReason?: string | undefined
554
+ startedAt: string // ISO date string
555
+ finishedAt: string | undefined // ISO date string
556
+ completedSteps: number
557
+ totalSteps: number
558
+ durationMs: number | undefined
559
+ estimatedCompletionAt: string | undefined // ISO date string
560
+ slaTargetAt: string | undefined // ISO date string
561
+ steps: readonly ExecutionStep[]
562
+ }
563
+
564
+ const SWIPE_CLOSE_MIN_PX = 72
565
+ const SWIPE_CLOSE_HORIZONTAL_RATIO = 1.25
566
+
567
+ /**
568
+ * Extract unique participants from execution steps
569
+ */
570
+ function getParticipants(steps: readonly ExecutionStep[]) {
571
+ const completedWithProviderUser = steps.filter(
572
+ (
573
+ s,
574
+ ): s is typeof s & {
575
+ providerUser: NonNullable<typeof s.providerUser>
576
+ } => s.status === "Completed" && s.providerUser != null,
577
+ )
578
+ const waitingWithRole = steps.filter(
579
+ (s): s is typeof s & { role: NonNullable<typeof s.role> } =>
580
+ (s.status === "Waiting" || s.status === "Correction Required") &&
581
+ s.role != null,
582
+ )
583
+
584
+ // Dedupe provider users by id
585
+ const seenProviderUsers = new Set<string>()
586
+ const uniqueProviderUsers = completedWithProviderUser.filter((step) => {
587
+ const key = step.providerUser.id
588
+ if (seenProviderUsers.has(key)) return false
589
+ seenProviderUsers.add(key)
590
+ return true
591
+ })
592
+
593
+ return { providerUsers: uniqueProviderUsers, waitingRoles: waitingWithRole }
594
+ }
595
+
596
+ function LiveExecutionDetail({ execution }: { execution: ExecutionData }) {
597
+ "use memo"
598
+
599
+ // Find current waiting step for display
600
+ const currentWaitingStep = execution.steps.find(
601
+ (s) => s.status === "Waiting" || s.status === "Correction Required",
602
+ )
603
+ const failedStep = execution.steps.find((s) => s.status === "Failed")
604
+ const { providerUsers, waitingRoles } = getParticipants(execution.steps)
605
+
606
+ return (
607
+ <div className="flex flex-col gap-4 rounded-2xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900/70">
608
+ <div className="flex flex-wrap items-start justify-between gap-3">
609
+ <div>
610
+ <h3 className="text-2xl font-semibold text-slate-900 dark:text-slate-100">
611
+ {execution.processName}
612
+ {execution.withoutWaiting && <WithoutWaitingBadge />}
613
+ </h3>
614
+ <p className="text-sm text-slate-500 dark:text-slate-400">
615
+ Started{" "}
616
+ <DateTimeDisplay kind="timestamp" value={execution.startedAt} />.
617
+ {currentWaitingStep?.status === "Correction Required"
618
+ ? ` Correction required on ${currentWaitingStep.name}.`
619
+ : currentWaitingStep?.providerUser
620
+ ? ` Current assignee: ${currentWaitingStep.providerUser.firstName} ${currentWaitingStep.providerUser.lastName}`
621
+ : ""}
622
+ </p>
623
+ </div>
624
+ <div className="flex items-center gap-2">
625
+ <span
626
+ className={cn(
627
+ "inline-flex items-center rounded-full px-3 py-1 text-sm font-semibold",
628
+ executionStatusTheme[execution.status as ExecutionStatus] ||
629
+ executionStatusTheme.Running,
630
+ )}
631
+ >
632
+ {execution.status}
633
+ </span>
634
+ <ProcessWorkflowLink
635
+ processName={execution.processName}
636
+ processPath={execution.processPath}
637
+ />
638
+ </div>
639
+ </div>
640
+
641
+ {/* Progress */}
642
+ {execution.status === "Not started" && (
643
+ <div className="rounded-2xl border border-amber-200 bg-amber-50 p-4 text-amber-800 dark:border-amber-900/40 dark:bg-amber-950/20 dark:text-amber-200">
644
+ <h4 className="text-sm font-semibold">Not started</h4>
645
+ <p className="mt-2 text-sm">{execution.notStartedReason}</p>
646
+ </div>
647
+ )}
648
+ {execution.status === "Failed" &&
649
+ (execution.failureReason || failedStep) && (
650
+ <div className="rounded-2xl border border-rose-200 bg-rose-50 p-4 text-rose-800 dark:border-rose-900/40 dark:bg-rose-950/20 dark:text-rose-200">
651
+ <h4 className="text-sm font-semibold tracking-wide uppercase">
652
+ Failure
653
+ </h4>
654
+ <p className="mt-2 text-sm leading-relaxed">
655
+ {execution.failureReason ??
656
+ failedStep?.failureReason ??
657
+ "A system step failed."}
658
+ </p>
659
+ </div>
660
+ )}
661
+
662
+ {execution.status === "Abandoned" && (
663
+ <div className="rounded-2xl border border-slate-300 bg-slate-100 p-4 text-slate-700 dark:border-slate-600 dark:bg-slate-800/40 dark:text-slate-300">
664
+ <h4 className="text-sm font-semibold tracking-wide uppercase">
665
+ Abandoned
666
+ </h4>
667
+ <p className="mt-2 text-sm leading-relaxed">
668
+ {execution.abandonedReason || "This execution was abandoned."}
669
+ </p>
670
+ </div>
671
+ )}
672
+
673
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
674
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
675
+ Progress
676
+ </h4>
677
+ <div className="mt-4 space-y-3">
678
+ <div className="flex items-center justify-between text-sm">
679
+ <span className="text-slate-600 dark:text-slate-300">
680
+ Steps completed
681
+ </span>
682
+ <span className="font-semibold text-slate-900 dark:text-slate-100">
683
+ {execution.completedSteps} / {execution.totalSteps}
684
+ </span>
685
+ </div>
686
+ <div className="h-2 w-full rounded-full bg-slate-200 dark:bg-slate-700">
687
+ <div
688
+ className="h-2 rounded-full bg-blue-500"
689
+ style={{
690
+ width: `${execution.totalSteps > 0 ? (execution.completedSteps / execution.totalSteps) * 100 : 0}%`,
691
+ }}
692
+ />
693
+ </div>
694
+ </div>
695
+ </div>
696
+
697
+ {/* Timeline */}
698
+ {execution.steps.length > 0 && (
699
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
700
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
701
+ Timeline
702
+ </h4>
703
+ <ul className="mt-4 space-y-4">
704
+ {execution.steps.map((step) => {
705
+ const isEmbeddedSubmission =
706
+ step.submittedViaEmbeddedForm === true
707
+ const hasExternalSubmitterEmail =
708
+ step.externalSubmitterEmail != null &&
709
+ step.externalSubmitterEmail.length > 0
710
+ const showExternalSubmissionInfo =
711
+ step.status !== "Interrupted" &&
712
+ step.status !== "Correction Required" &&
713
+ (isEmbeddedSubmission || hasExternalSubmitterEmail)
714
+
715
+ return (
716
+ <li key={step.id} className="relative pl-8">
717
+ <span
718
+ className={cn(
719
+ "absolute left-0 top-1.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-xs font-semibold",
720
+ step.status === "Completed"
721
+ ? "border-emerald-500 bg-emerald-500 text-white"
722
+ : step.status === "Failed"
723
+ ? "border-rose-500 bg-rose-500 text-white"
724
+ : step.status === "Correction Required"
725
+ ? "border-amber-500 bg-amber-500 text-white"
726
+ : step.status === "Waiting"
727
+ ? "border-blue-500 bg-blue-500 text-white"
728
+ : "border-slate-300 bg-white text-slate-400 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-500",
729
+ )}
730
+ >
731
+ {step.status === "Completed"
732
+ ? "\u2713"
733
+ : step.status === "Failed"
734
+ ? "!"
735
+ : step.status === "Correction Required"
736
+ ? "?"
737
+ : step.status === "Waiting"
738
+ ? "\u2022"
739
+ : ""}
740
+ </span>
741
+ <div className="flex flex-wrap items-center gap-2">
742
+ <p className="text-sm font-semibold text-slate-900 dark:text-slate-100">
743
+ {step.name}
744
+ </p>
745
+ {/* External submissions can have internal roles but external submitters. */}
746
+ {showExternalSubmissionInfo ? (
747
+ <span className="rounded-full bg-cyan-500/10 px-2 py-0.5 text-[11px] font-semibold text-cyan-700 dark:text-cyan-300">
748
+ External Participant
749
+ </span>
750
+ ) : step.assignedProviderUserEmail ? (
751
+ <span className="rounded-full bg-blue-500/10 px-2 py-0.5 text-[11px] font-semibold text-blue-700 dark:text-blue-300">
752
+ {step.assignedProviderUserEmail}
753
+ </span>
754
+ ) : step.role ? (
755
+ <span className="rounded-full bg-slate-200 px-2 py-0.5 text-[11px] font-semibold text-slate-600 dark:bg-slate-800/60 dark:text-slate-300">
756
+ {step.role.name}
757
+ </span>
758
+ ) : null}
759
+ </div>
760
+ {showExternalSubmissionInfo && hasExternalSubmitterEmail ? (
761
+ <p className="mt-1 text-[11px] text-slate-500 dark:text-slate-400">
762
+ {step.status === "Waiting"
763
+ ? "Waiting for"
764
+ : isEmbeddedSubmission
765
+ ? "Submitted via embedded form by"
766
+ : "Submitted by"}{" "}
767
+ {step.externalSubmitterEmail}
768
+ </p>
769
+ ) : isEmbeddedSubmission &&
770
+ step.status !== "Interrupted" &&
771
+ step.status !== "Waiting" &&
772
+ step.status !== "Correction Required" ? (
773
+ <p className="mt-1 text-[11px] text-slate-500 dark:text-slate-400">
774
+ Submitted via embedded form (no email recorded)
775
+ </p>
776
+ ) : !showExternalSubmissionInfo && step.providerUser ? (
777
+ <p className="mt-1 text-[11px] text-slate-500 dark:text-slate-400">
778
+ {step.status === "Completed"
779
+ ? "Completed by"
780
+ : step.status === "Failed"
781
+ ? "Failed at"
782
+ : step.status === "Correction Required"
783
+ ? "Correction assigned to"
784
+ : "Assigned to"}{" "}
785
+ {step.providerUser.firstName} {step.providerUser.lastName}
786
+ </p>
787
+ ) : step.status === "Correction Required" && step.role ? (
788
+ <p className="mt-1 text-[11px] text-slate-500 dark:text-slate-400">
789
+ Correction assigned to {step.role.name}
790
+ </p>
791
+ ) : null}
792
+ {step.deadlineActivity && (
793
+ <p className="mt-1 whitespace-pre-line text-sm text-amber-700 dark:text-amber-400">
794
+ {step.deadlineActivity}
795
+ </p>
796
+ )}
797
+ {step.status === "Failed" && step.failureReason && (
798
+ <p className="mt-1 text-xs text-rose-700 dark:text-rose-300">
799
+ {step.failureReason}
800
+ </p>
801
+ )}
802
+ {step.status === "Not started" && (
803
+ <p className="mt-1 text-xs text-amber-700 dark:text-amber-300">
804
+ Not started: {step.notStartedReason}
805
+ </p>
806
+ )}
807
+ {step.status === "Interrupted" && (
808
+ <p className="mt-1 text-xs text-slate-500 dark:text-slate-400">
809
+ Interrupted
810
+ </p>
811
+ )}
812
+ {step.status === "Correction Required" &&
813
+ step.failureReason && (
814
+ <p className="mt-1 text-xs text-amber-700 dark:text-amber-300">
815
+ {step.failureReason}
816
+ </p>
817
+ )}
818
+ <div className="mt-1 flex flex-wrap items-center gap-3 text-xs text-slate-500 dark:text-slate-400">
819
+ {step.startedAt && step.status !== "Not started" && (
820
+ <span>
821
+ Started{" "}
822
+ <DateTimeDisplay
823
+ kind="timestamp"
824
+ value={step.startedAt}
825
+ />
826
+ </span>
827
+ )}
828
+ {step.completedAt && (
829
+ <span>
830
+ {step.status === "Not started"
831
+ ? "Not started"
832
+ : step.status === "Failed"
833
+ ? "Failed"
834
+ : "Completed"}{" "}
835
+ <DateTimeDisplay
836
+ kind="timestamp"
837
+ value={step.completedAt}
838
+ />
839
+ </span>
840
+ )}
841
+ </div>
842
+ </li>
843
+ )
844
+ })}
845
+ </ul>
846
+ </div>
847
+ )}
848
+
849
+ {/* Participants and State Snapshot cards */}
850
+ <div className="grid gap-4 md:grid-cols-2">
851
+ {/* Participants */}
852
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
853
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
854
+ Participants
855
+ </h4>
856
+ <div className="mt-3 space-y-2">
857
+ {providerUsers.map((step) => (
858
+ <div
859
+ key={step.id}
860
+ className="flex items-center justify-between rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-slate-600 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300"
861
+ >
862
+ <span>
863
+ {step.providerUser.firstName} {step.providerUser.lastName}
864
+ </span>
865
+ <span className="text-xs text-slate-500 dark:text-slate-400">
866
+ {step.providerUser.orgUnit}
867
+ </span>
868
+ </div>
869
+ ))}
870
+ {waitingRoles.map((step) => (
871
+ <div
872
+ key={step.id}
873
+ className="flex items-center justify-between rounded-xl border border-dashed border-slate-300 bg-white px-3 py-2 text-sm text-slate-500 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-400"
874
+ >
875
+ <span className="italic">
876
+ Waiting for{" "}
877
+ {step.externalSubmitterEmail ??
878
+ step.assignedProviderUserEmail ??
879
+ step.role.name}
880
+ </span>
881
+ </div>
882
+ ))}
883
+ {providerUsers.length === 0 && waitingRoles.length === 0 && (
884
+ <p className="text-sm text-slate-500 dark:text-slate-400">
885
+ No participants yet
886
+ </p>
887
+ )}
888
+ </div>
889
+ </div>
890
+
891
+ {/* State Snapshot */}
892
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
893
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
894
+ State snapshot
895
+ </h4>
896
+ <dl className="mt-3 grid grid-cols-2 gap-3 text-sm text-slate-600 dark:text-slate-300">
897
+ <div>
898
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
899
+ {execution.status === "Abandoned"
900
+ ? "Abandoned"
901
+ : execution.status === "Not started"
902
+ ? "Not started"
903
+ : execution.finishedAt
904
+ ? "Completed"
905
+ : "Estimated completion"}
906
+ </dt>
907
+ <dd>
908
+ {execution.finishedAt ? (
909
+ <DateTimeDisplay
910
+ kind="timestamp"
911
+ value={execution.finishedAt}
912
+ />
913
+ ) : execution.estimatedCompletionAt ? (
914
+ <DateTimeDisplay
915
+ kind="timestamp"
916
+ value={execution.estimatedCompletionAt}
917
+ initialMode="browser-local"
918
+ />
919
+ ) : (
920
+ "N/A"
921
+ )}
922
+ </dd>
923
+ </div>
924
+ <div>
925
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
926
+ SLA target
927
+ </dt>
928
+ <dd>
929
+ {execution.slaTargetAt ? (
930
+ <DateTimeDisplay
931
+ kind="timestamp"
932
+ value={execution.slaTargetAt}
933
+ initialMode="browser-local"
934
+ />
935
+ ) : (
936
+ "Not set"
937
+ )}
938
+ </dd>
939
+ </div>
940
+ </dl>
941
+ </div>
942
+ </div>
943
+ </div>
944
+ )
945
+ }
946
+
947
+ function MobileExecutionDetail({
948
+ execution,
949
+ onBack,
950
+ }: {
951
+ execution: ExecutionData
952
+ onBack: () => void
953
+ }) {
954
+ "use memo"
955
+
956
+ const touchStartX = useRef<number | null>(null)
957
+ const touchStartY = useRef<number | null>(null)
958
+ const touchCurrentX = useRef<number | null>(null)
959
+ const touchCurrentY = useRef<number | null>(null)
960
+
961
+ const resetSwipe = () => {
962
+ touchStartX.current = null
963
+ touchStartY.current = null
964
+ touchCurrentX.current = null
965
+ touchCurrentY.current = null
966
+ }
967
+
968
+ return (
969
+ <div
970
+ className="space-y-4"
971
+ onTouchStart={(event) => {
972
+ const touch = event.touches[0]
973
+ if (!touch) return
974
+
975
+ touchStartX.current = touch.clientX
976
+ touchStartY.current = touch.clientY
977
+ touchCurrentX.current = touch.clientX
978
+ touchCurrentY.current = touch.clientY
979
+ }}
980
+ onTouchMove={(event) => {
981
+ const touch = event.touches[0]
982
+ if (!touch) return
983
+
984
+ touchCurrentX.current = touch.clientX
985
+ touchCurrentY.current = touch.clientY
986
+ }}
987
+ onTouchEnd={() => {
988
+ if (
989
+ touchStartX.current === null ||
990
+ touchStartY.current === null ||
991
+ touchCurrentX.current === null ||
992
+ touchCurrentY.current === null
993
+ ) {
994
+ resetSwipe()
995
+ return
996
+ }
997
+
998
+ const deltaX = touchCurrentX.current - touchStartX.current
999
+ const deltaY = Math.abs(touchCurrentY.current - touchStartY.current)
1000
+
1001
+ resetSwipe()
1002
+
1003
+ if (
1004
+ deltaX > SWIPE_CLOSE_MIN_PX &&
1005
+ deltaX > deltaY * SWIPE_CLOSE_HORIZONTAL_RATIO
1006
+ ) {
1007
+ onBack()
1008
+ }
1009
+ }}
1010
+ onTouchCancel={resetSwipe}
1011
+ >
1012
+ <div className="flex items-center gap-3 rounded-2xl border border-slate-200 bg-white px-3 py-2.5 shadow-sm dark:border-slate-800 dark:bg-slate-900/70">
1013
+ <button
1014
+ type="button"
1015
+ onClick={onBack}
1016
+ className="inline-flex items-center gap-1 rounded-full px-2 py-1 text-sm font-medium text-slate-600 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-slate-800 dark:hover:text-slate-50"
1017
+ >
1018
+ <ChevronLeft className="h-4 w-4" />
1019
+ Back
1020
+ </button>
1021
+ <div className="min-w-0">
1022
+ <p className="text-[11px] font-semibold tracking-[0.18em] text-slate-400 uppercase dark:text-slate-500">
1023
+ Execution detail
1024
+ </p>
1025
+ <p className="truncate text-sm font-semibold text-slate-900 dark:text-slate-100">
1026
+ {execution.processName}
1027
+ {execution.withoutWaiting && <WithoutWaitingBadge />}
1028
+ </p>
1029
+ </div>
1030
+ </div>
1031
+
1032
+ <div className="animate-in slide-in-from-right-4 duration-200">
1033
+ <LiveExecutionDetail execution={execution} />
1034
+ </div>
1035
+ </div>
1036
+ )
1037
+ }
1038
+
1039
+ // =============================================================================
1040
+ // MOCK IMPLEMENTATION (for reference)
1041
+ // =============================================================================
1042
+
1043
+ function MockExecutionsSection() {
1044
+ const [tab, setTab] = useState<MockExecutionTabKey>("in-progress")
1045
+ const [view, setView] = useState<MockExecutionView>("timeline")
1046
+ const [selectedExecutionId, setSelectedExecutionId] = useState<string | null>(
1047
+ mockExecutions[0]?.id ?? null,
1048
+ )
1049
+
1050
+ const filtered = useMemo(() => {
1051
+ const statuses = mockExecutionTabFilters[tab]
1052
+ return mockExecutions.filter((exec) => statuses.includes(exec.status))
1053
+ }, [tab])
1054
+
1055
+ const selectedExecution = useMemo(() => {
1056
+ if (filtered.length === 0) return null
1057
+ const selected = filtered.find((exec) => exec.id === selectedExecutionId)
1058
+ return selected ?? filtered[0] ?? null
1059
+ }, [filtered, selectedExecutionId])
1060
+
1061
+ return (
1062
+ <section className="space-y-6">
1063
+ <div className="rounded-2xl border-2 border-amber-500 bg-amber-50 p-2 dark:border-amber-400 dark:bg-amber-900/20">
1064
+ <h2 className="mb-4 text-lg font-bold text-amber-700 dark:text-amber-300">
1065
+ MOCK DATA (for reference)
1066
+ </h2>
1067
+ <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">
1068
+ <div className="flex flex-wrap items-center gap-2">
1069
+ <TabPill
1070
+ label="In Progress"
1071
+ count={
1072
+ mockExecutions.filter(
1073
+ (exec) =>
1074
+ exec.status === "Running" || exec.status === "Paused",
1075
+ ).length
1076
+ }
1077
+ active={tab === "in-progress"}
1078
+ onClick={() => setTab("in-progress")}
1079
+ />
1080
+ <TabPill
1081
+ label="Completed"
1082
+ count={
1083
+ mockExecutions.filter((exec) => exec.status === "Completed")
1084
+ .length
1085
+ }
1086
+ active={tab === "completed"}
1087
+ onClick={() => setTab("completed")}
1088
+ />
1089
+ <TabPill
1090
+ label="Failed / Cancelled"
1091
+ count={
1092
+ mockExecutions.filter((exec) => exec.status === "Failed").length
1093
+ }
1094
+ active={tab === "failed"}
1095
+ onClick={() => setTab("failed")}
1096
+ />
1097
+ <TabPill
1098
+ label="All"
1099
+ count={mockExecutions.length}
1100
+ active={tab === "all"}
1101
+ onClick={() => setTab("all")}
1102
+ />
1103
+ </div>
1104
+ <div className="flex items-center gap-2">
1105
+ <button
1106
+ type="button"
1107
+ onClick={() => setView("timeline")}
1108
+ className={cn(
1109
+ "rounded-full border px-3 py-1.5 text-sm font-medium",
1110
+ view === "timeline"
1111
+ ? "border-blue-500 text-blue-600 dark:text-blue-300"
1112
+ : "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",
1113
+ )}
1114
+ >
1115
+ Timeline
1116
+ </button>
1117
+ <button
1118
+ type="button"
1119
+ onClick={() => setView("kanban")}
1120
+ className={cn(
1121
+ "rounded-full border px-3 py-1.5 text-sm font-medium",
1122
+ view === "kanban"
1123
+ ? "border-blue-500 text-blue-600 dark:text-blue-300"
1124
+ : "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",
1125
+ )}
1126
+ >
1127
+ Kanban
1128
+ </button>
1129
+ <button
1130
+ type="button"
1131
+ 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"
1132
+ >
1133
+ Export CSV
1134
+ </button>
1135
+ </div>
1136
+ </div>
1137
+
1138
+ {filtered.length === 0 ? (
1139
+ <EmptyState
1140
+ title="No executions in this view"
1141
+ description="Adjust filters or start a process from the catalog to see live executions."
1142
+ />
1143
+ ) : view === "kanban" ? (
1144
+ <div className="mt-4">
1145
+ <MockExecutionKanban executions={filtered} />
1146
+ </div>
1147
+ ) : (
1148
+ <div className="mt-4 grid gap-6 lg:grid-cols-[380px_1fr]">
1149
+ <div className="space-y-3">
1150
+ {filtered.map((exec) => (
1151
+ <button
1152
+ key={exec.id}
1153
+ type="button"
1154
+ onClick={() => setSelectedExecutionId(exec.id)}
1155
+ className={cn(
1156
+ "flex w-full flex-col gap-3 rounded-2xl border bg-white p-4 text-left shadow-sm transition hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800 dark:bg-slate-900/70",
1157
+ exec.id === selectedExecution?.id
1158
+ ? "border-blue-500 dark:border-blue-400 dark:bg-blue-500/10"
1159
+ : "border-slate-200",
1160
+ )}
1161
+ >
1162
+ <div className="flex items-center justify-between">
1163
+ <h4 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
1164
+ {exec.processName} {exec.executionId}
1165
+ </h4>
1166
+ <span
1167
+ className={cn(
1168
+ "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold",
1169
+ mockExecutionStatusTheme[exec.status],
1170
+ )}
1171
+ >
1172
+ {exec.status}
1173
+ </span>
1174
+ </div>
1175
+ <p className="text-sm text-slate-500 dark:text-slate-400">
1176
+ {exec.progress}
1177
+ </p>
1178
+ <div className="flex items-center justify-between text-xs text-slate-500 dark:text-slate-400">
1179
+ <span>Started {exec.startDate}</span>
1180
+ <span>Last activity {exec.lastActivity}</span>
1181
+ </div>
1182
+ <div className="flex items-center gap-2">
1183
+ {exec.participants.map((participant) => (
1184
+ <MockAvatar
1185
+ key={participant.id}
1186
+ name={participant.name}
1187
+ title={participant.role}
1188
+ />
1189
+ ))}
1190
+ </div>
1191
+ </button>
1192
+ ))}
1193
+ </div>
1194
+ {selectedExecution && (
1195
+ <MockExecutionDetail execution={selectedExecution} />
1196
+ )}
1197
+ </div>
1198
+ )}
1199
+ </div>
1200
+ </section>
1201
+ )
1202
+ }
1203
+
1204
+ function StepParticipants({ steps }: { steps: readonly ExecutionStep[] }) {
1205
+ "use memo"
1206
+
1207
+ const firstParticipant = steps.find(
1208
+ (step) =>
1209
+ isExternalParticipantStep(step) ||
1210
+ (step.status === "Completed" && step.providerUser != null) ||
1211
+ ((step.status === "Waiting" || step.status === "Correction Required") &&
1212
+ step.role != null),
1213
+ )
1214
+
1215
+ if (!firstParticipant) {
1216
+ return null
1217
+ }
1218
+
1219
+ const isExternalParticipant = isExternalParticipantStep(firstParticipant)
1220
+
1221
+ return (
1222
+ <div className="flex flex-wrap items-center gap-2">
1223
+ {isExternalParticipant ? (
1224
+ <ExternalParticipantChip
1225
+ email={firstParticipant.externalSubmitterEmail}
1226
+ />
1227
+ ) : firstParticipant.providerUser ? (
1228
+ <CompletedProviderUserChip
1229
+ firstName={firstParticipant.providerUser.firstName}
1230
+ lastName={firstParticipant.providerUser.lastName}
1231
+ orgUnit={firstParticipant.providerUser.orgUnit}
1232
+ picture={firstParticipant.providerUser.picture}
1233
+ />
1234
+ ) : firstParticipant.role ? (
1235
+ <PendingRoleChip roleName={firstParticipant.role.name} />
1236
+ ) : null}
1237
+ </div>
1238
+ )
1239
+ }
1240
+
1241
+ function isExternalParticipantStep(step: ExecutionStep) {
1242
+ if (step.status === "Correction Required") return false
1243
+
1244
+ return (
1245
+ step.submittedViaEmbeddedForm === true ||
1246
+ (step.externalSubmitterEmail != null &&
1247
+ step.externalSubmitterEmail.length > 0)
1248
+ )
1249
+ }
1250
+
1251
+ function ExternalParticipantChip({ email }: { email: string | undefined }) {
1252
+ "use memo"
1253
+
1254
+ return (
1255
+ <div className="flex items-center gap-2 rounded-full border border-cyan-400/50 bg-cyan-400/10 py-1 pl-2 pr-3 text-xs text-cyan-700 dark:border-cyan-400/30 dark:bg-cyan-400/10 dark:text-cyan-200">
1256
+ <span className="flex h-7 w-7 items-center justify-center rounded-full bg-cyan-500 text-[10px] font-bold tracking-wide text-slate-950">
1257
+ EXT
1258
+ </span>
1259
+ <div>
1260
+ <p className="font-semibold">External Participant</p>
1261
+ <p className="text-[11px] text-cyan-800/80 dark:text-cyan-200/80">
1262
+ {email ?? "Embedded form"}
1263
+ </p>
1264
+ </div>
1265
+ </div>
1266
+ )
1267
+ }
1268
+
1269
+ function CompletedProviderUserChip({
1270
+ firstName,
1271
+ lastName,
1272
+ orgUnit,
1273
+ picture,
1274
+ }: {
1275
+ firstName: string
1276
+ lastName: string
1277
+ orgUnit: string
1278
+ picture?: string
1279
+ }) {
1280
+ "use memo"
1281
+
1282
+ const initials = `${firstName.charAt(0)}${lastName.charAt(0)}`.toUpperCase()
1283
+ return (
1284
+ <div className="flex items-center gap-2 rounded-full border border-slate-200 bg-slate-50 py-1 pl-2 pr-3 text-xs dark:border-slate-700 dark:bg-slate-800/60">
1285
+ {picture ? (
1286
+ <Image
1287
+ src={picture}
1288
+ alt={`${firstName} ${lastName}`}
1289
+ width={28}
1290
+ height={28}
1291
+ className="h-7 w-7 rounded-full"
1292
+ />
1293
+ ) : (
1294
+ <span className="flex h-7 w-7 items-center justify-center rounded-full bg-emerald-600 text-[11px] font-semibold text-white">
1295
+ {initials}
1296
+ </span>
1297
+ )}
1298
+ <div>
1299
+ <p className="font-semibold text-slate-700 dark:text-slate-200">
1300
+ {firstName}
1301
+ <br />
1302
+ {lastName}
1303
+ </p>
1304
+ <p className="text-[11px] text-slate-500 dark:text-slate-400">
1305
+ {orgUnit}
1306
+ </p>
1307
+ </div>
1308
+ </div>
1309
+ )
1310
+ }
1311
+
1312
+ function PendingRoleChip({ roleName }: { roleName: string }) {
1313
+ "use memo"
1314
+
1315
+ return (
1316
+ <div className="flex items-center gap-2 rounded-full border border-slate-200 bg-slate-50 py-1 pl-2 pr-3 text-xs dark:border-slate-700 dark:bg-slate-800/60">
1317
+ <span className="flex h-7 w-7 items-center justify-center rounded-full border-2 border-blue-500 text-[11px] font-semibold text-blue-500">
1318
+ ?
1319
+ </span>
1320
+ <div>
1321
+ <p className="font-semibold text-slate-700 dark:text-slate-200">
1322
+ {roleName}
1323
+ </p>
1324
+ </div>
1325
+ </div>
1326
+ )
1327
+ }
1328
+
1329
+ function MockAvatar({ name, title }: { name: string; title: string }) {
1330
+ const initials = name
1331
+ .split(" ")
1332
+ .map((part) => part[0])
1333
+ .join("")
1334
+ .slice(0, 2)
1335
+ .toUpperCase()
1336
+ return (
1337
+ <div className="flex items-center gap-2 rounded-full border border-slate-200 bg-slate-50 px-2 py-1 text-xs dark:border-slate-700 dark:bg-slate-800/60">
1338
+ <span className="flex h-7 w-7 items-center justify-center rounded-full bg-blue-600 text-[11px] font-semibold text-white">
1339
+ {initials}
1340
+ </span>
1341
+ <div>
1342
+ <p className="font-semibold text-slate-700 dark:text-slate-200">
1343
+ {name}
1344
+ </p>
1345
+ <p className="text-[11px] text-slate-500 dark:text-slate-400">
1346
+ {title}
1347
+ </p>
1348
+ </div>
1349
+ </div>
1350
+ )
1351
+ }
1352
+
1353
+ function MockExecutionDetail({ execution }: { execution: Execution }) {
1354
+ return (
1355
+ <div className="flex flex-col gap-4 rounded-2xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900/70">
1356
+ <div className="flex flex-wrap items-start justify-between gap-3">
1357
+ <div>
1358
+ <h3 className="text-2xl font-semibold text-slate-900 dark:text-slate-100">
1359
+ {execution.processName} {execution.executionId}
1360
+ </h3>
1361
+ <p className="text-sm text-slate-500 dark:text-slate-400">
1362
+ Started {execution.startDate}. Current assignee{" "}
1363
+ {execution.currentRole ? `${execution.currentRole}` : "N/A"}.
1364
+ </p>
1365
+ </div>
1366
+ <div className="flex items-center gap-2">
1367
+ <span
1368
+ className={cn(
1369
+ "inline-flex items-center rounded-full px-3 py-1 text-sm font-semibold",
1370
+ mockExecutionStatusTheme[execution.status],
1371
+ )}
1372
+ >
1373
+ {execution.status}
1374
+ </span>
1375
+ <button
1376
+ type="button"
1377
+ 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-300 dark:hover:border-slate-600 dark:hover:text-slate-200"
1378
+ >
1379
+ Share
1380
+ </button>
1381
+ <button
1382
+ type="button"
1383
+ className="rounded-full bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-blue-500"
1384
+ >
1385
+ View audit log
1386
+ </button>
1387
+ </div>
1388
+ </div>
1389
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
1390
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
1391
+ Timeline
1392
+ </h4>
1393
+ <ul className="mt-4 space-y-4">
1394
+ {execution.steps.map((step) => (
1395
+ <li key={step.id} className="relative pl-8">
1396
+ <span
1397
+ className={cn(
1398
+ "absolute left-0 top-1.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-xs font-semibold",
1399
+ step.status === "Complete"
1400
+ ? "border-emerald-500 bg-emerald-500 text-white"
1401
+ : step.status === "Current"
1402
+ ? "border-blue-500 bg-blue-500 text-white"
1403
+ : step.status === "Upcoming"
1404
+ ? "border-slate-300 bg-white text-slate-400 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-500"
1405
+ : "border-slate-300 bg-slate-100 text-slate-400",
1406
+ )}
1407
+ >
1408
+ {step.status === "Complete"
1409
+ ? "✓"
1410
+ : step.status === "Current"
1411
+ ? "•"
1412
+ : ""}
1413
+ </span>
1414
+ <div className="flex flex-wrap items-center gap-2">
1415
+ <p className="text-sm font-semibold text-slate-900 dark:text-slate-100">
1416
+ {step.name}
1417
+ </p>
1418
+ <span className="rounded-full bg-slate-200 px-2 py-0.5 text-[11px] font-semibold text-slate-600 dark:bg-slate-800/60 dark:text-slate-300">
1419
+ {step.role}
1420
+ </span>
1421
+ {step.assignee && (
1422
+ <span className="text-[11px] text-slate-500 dark:text-slate-400">
1423
+ Assigned to {step.assignee}
1424
+ </span>
1425
+ )}
1426
+ </div>
1427
+ <div className="mt-1 flex flex-wrap items-center gap-3 text-xs text-slate-500 dark:text-slate-400">
1428
+ {step.startedAt && <span>Started {step.startedAt}</span>}
1429
+ {step.completedAt && <span>Completed {step.completedAt}</span>}
1430
+ {step.notes && (
1431
+ <span className="rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-amber-600 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200">
1432
+ {step.notes}
1433
+ </span>
1434
+ )}
1435
+ </div>
1436
+ </li>
1437
+ ))}
1438
+ </ul>
1439
+ </div>
1440
+ {execution.failureReason && (
1441
+ <div className="rounded-2xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700 dark:border-rose-500/40 dark:bg-rose-900/20 dark:text-rose-200">
1442
+ <p className="font-semibold">Failure reason</p>
1443
+ <p>{execution.failureReason}</p>
1444
+ </div>
1445
+ )}
1446
+ {execution.abandonedReason && (
1447
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 text-sm text-slate-700 dark:border-slate-700 dark:bg-slate-900/60 dark:text-slate-200">
1448
+ <p className="font-semibold">Abandoned reason</p>
1449
+ <p>{execution.abandonedReason}</p>
1450
+ </div>
1451
+ )}
1452
+ <div className="grid gap-4 md:grid-cols-2">
1453
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
1454
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
1455
+ Participants
1456
+ </h4>
1457
+ <div className="mt-3 space-y-2">
1458
+ {execution.participants.map((participant) => (
1459
+ <div
1460
+ key={participant.id}
1461
+ className="flex items-center justify-between rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-slate-600 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300"
1462
+ >
1463
+ <span>{participant.name}</span>
1464
+ <span className="text-xs text-slate-500 dark:text-slate-400">
1465
+ {participant.role}
1466
+ </span>
1467
+ </div>
1468
+ ))}
1469
+ </div>
1470
+ </div>
1471
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
1472
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
1473
+ State snapshot
1474
+ </h4>
1475
+ <dl className="mt-3 grid grid-cols-2 gap-3 text-sm text-slate-600 dark:text-slate-300">
1476
+ <div>
1477
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
1478
+ Estimated completion
1479
+ </dt>
1480
+ <dd>In 2 days</dd>
1481
+ </div>
1482
+ <div>
1483
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
1484
+ SLA target
1485
+ </dt>
1486
+ <dd>Oct 16, 18:00</dd>
1487
+ </div>
1488
+ <div>
1489
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
1490
+ Current form
1491
+ </dt>
1492
+ <dd>IT account setup</dd>
1493
+ </div>
1494
+ <div>
1495
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
1496
+ Pending approvals
1497
+ </dt>
1498
+ <dd>1 manager</dd>
1499
+ </div>
1500
+ </dl>
1501
+ </div>
1502
+ </div>
1503
+ </div>
1504
+ )
1505
+ }
1506
+
1507
+ function MockExecutionKanban({ executions }: { executions: Execution[] }) {
1508
+ const columns: { title: string; statuses: Execution["status"][] }[] = [
1509
+ { title: "Running", statuses: ["Running", "Paused"] },
1510
+ { title: "Completed", statuses: ["Completed"] },
1511
+ { title: "Failed", statuses: ["Failed"] },
1512
+ ]
1513
+
1514
+ return (
1515
+ <div className="grid gap-4 md:grid-cols-2 xl:grid-cols-3">
1516
+ {columns.map((column) => (
1517
+ <div
1518
+ key={column.title}
1519
+ className="rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/70"
1520
+ >
1521
+ <div className="flex items-center justify-between">
1522
+ <h4 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
1523
+ {column.title}
1524
+ </h4>
1525
+ <span className="rounded-full bg-slate-200 px-2 py-0.5 text-xs font-semibold text-slate-600 dark:bg-slate-800 dark:text-slate-300">
1526
+ {
1527
+ executions.filter((exec) =>
1528
+ column.statuses.includes(exec.status),
1529
+ ).length
1530
+ }
1531
+ </span>
1532
+ </div>
1533
+ <div className="mt-3 space-y-3">
1534
+ {executions
1535
+ .filter((exec) => column.statuses.includes(exec.status))
1536
+ .map((exec) => (
1537
+ <div
1538
+ key={exec.id}
1539
+ className="rounded-2xl border border-slate-200 bg-slate-50/60 p-3 text-sm text-slate-600 shadow-sm dark:border-slate-700 dark:bg-slate-900/60 dark:text-slate-300"
1540
+ >
1541
+ <div className="flex items-center justify-between">
1542
+ <p className="font-semibold text-slate-900 dark:text-slate-100">
1543
+ {exec.processName} {exec.executionId}
1544
+ </p>
1545
+ <span
1546
+ className={cn(
1547
+ "inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold",
1548
+ mockExecutionStatusTheme[exec.status],
1549
+ )}
1550
+ >
1551
+ {exec.status}
1552
+ </span>
1553
+ </div>
1554
+ <p className="text-xs text-slate-500 dark:text-slate-400">
1555
+ {exec.progress}
1556
+ </p>
1557
+ <div className="mt-2 flex items-center justify-between text-[11px] text-slate-500 dark:text-slate-400">
1558
+ <span>{exec.startDate}</span>
1559
+ <span>{exec.lastActivity}</span>
1560
+ </div>
1561
+ </div>
1562
+ ))}
1563
+ {executions.filter((exec) => column.statuses.includes(exec.status))
1564
+ .length === 0 && (
1565
+ <div className="rounded-xl border border-dashed border-slate-300 p-4 text-center text-sm text-slate-500 dark:border-slate-700 dark:text-slate-400">
1566
+ No executions here yet
1567
+ </div>
1568
+ )}
1569
+ </div>
1570
+ </div>
1571
+ ))}
1572
+ </div>
1573
+ )
1574
+ }
1575
+
1576
+ // =============================================================================
1577
+ // SHARED COMPONENTS
1578
+ // =============================================================================
1579
+
1580
+ export function ExecutionsPageContent({
1581
+ initialSelectedExecutionId = null,
1582
+ onMobileBack,
1583
+ }: {
1584
+ initialSelectedExecutionId?: string | null
1585
+ onMobileBack?: () => void
1586
+ }) {
1587
+ "use memo"
1588
+
1589
+ const { collectionPromise } = useExecutionCollection()
1590
+ const { showMocks } = useMocks()
1591
+ const isMobile = useIsMobile()
1592
+ const showMocksSection = !isMobile || initialSelectedExecutionId === null
1593
+
1594
+ return (
1595
+ <div className="flex-1 space-y-8 overflow-y-auto">
1596
+ <Suspense fallback={<ExecutionsSkeleton />}>
1597
+ <ExecutionsPageInner
1598
+ collectionPromise={collectionPromise}
1599
+ initialSelectedExecutionId={initialSelectedExecutionId}
1600
+ {...(onMobileBack ? { onMobileBack } : {})}
1601
+ />
1602
+ </Suspense>
1603
+ {showMocks && showMocksSection && <MockExecutionsSection />}
1604
+ </div>
1605
+ )
1606
+ }
1607
+
1608
+ export default function ExecutionsPage() {
1609
+ return <ExecutionsPageContent />
1610
+ }
1611
+
1612
+ function EmptyState({
1613
+ title,
1614
+ description,
1615
+ }: {
1616
+ title: string
1617
+ description: string
1618
+ }) {
1619
+ "use memo"
1620
+
1621
+ return (
1622
+ <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">
1623
+ <h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
1624
+ {title}
1625
+ </h3>
1626
+ <p className="mt-2 max-w-md text-sm text-slate-500 dark:text-slate-400">
1627
+ {description}
1628
+ </p>
1629
+ <Link
1630
+ href="/processes"
1631
+ className="mt-5 rounded-full bg-blue-600 px-5 py-2 text-sm font-semibold text-white shadow hover:bg-blue-500"
1632
+ >
1633
+ Browse processes
1634
+ </Link>
1635
+ </div>
1636
+ )
1637
+ }