canopycms 0.0.68-int.113 → 0.0.68-int.114

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 (170) hide show
  1. package/dist/ai/generate.d.ts +4 -4
  2. package/dist/ai/generate.js +75 -14
  3. package/dist/ai/types.d.ts +12 -0
  4. package/dist/api/branch.js +13 -13
  5. package/dist/auth/cache.d.ts +1 -1
  6. package/dist/auth/cache.js +1 -1
  7. package/dist/auth/file-based-auth-cache.d.ts +8 -0
  8. package/dist/auth/file-based-auth-cache.js +11 -0
  9. package/dist/authorization/branch.d.ts +1 -1
  10. package/dist/authorization/branch.js +2 -1
  11. package/dist/cli/cli.js +160 -28
  12. package/dist/cli/generate-ai-content.js +156 -24
  13. package/dist/content-reader.js +2 -1
  14. package/dist/context.js +2 -1
  15. package/dist/editor/BranchManager.js +13 -17
  16. package/dist/editor/CommentsPanel.js +7 -6
  17. package/dist/editor/Editor.js +152 -30
  18. package/dist/editor/EditorAuthGate.js +2 -2
  19. package/dist/editor/EditorPanes.d.ts +10 -0
  20. package/dist/editor/EditorPanes.js +32 -8
  21. package/dist/editor/FormRenderer.d.ts +10 -0
  22. package/dist/editor/FormRenderer.js +92 -73
  23. package/dist/editor/PreviewFrame.d.ts +3 -1
  24. package/dist/editor/PreviewFrame.js +72 -9
  25. package/dist/editor/admin/SystemHealthPanel.js +27 -24
  26. package/dist/editor/branch-status.d.ts +16 -0
  27. package/dist/editor/branch-status.js +28 -0
  28. package/dist/editor/comments/BranchComments.js +1 -1
  29. package/dist/editor/comments/EntryComments.d.ts +3 -0
  30. package/dist/editor/comments/EntryComments.js +3 -3
  31. package/dist/editor/comments/FieldWrapper.d.ts +3 -0
  32. package/dist/editor/comments/FieldWrapper.js +2 -2
  33. package/dist/editor/comments/InlineCommentThread.js +2 -1
  34. package/dist/editor/comments/ThreadCarousel.js +2 -2
  35. package/dist/editor/components/ConfirmDeleteModal.js +1 -1
  36. package/dist/editor/components/EditorCrashScreen.js +1 -1
  37. package/dist/editor/components/EditorHeader.d.ts +2 -0
  38. package/dist/editor/components/EditorHeader.js +15 -36
  39. package/dist/editor/components/EditorSidebar.d.ts +5 -6
  40. package/dist/editor/components/EditorSidebar.js +2 -2
  41. package/dist/editor/components/EntryCreateModal.js +1 -1
  42. package/dist/editor/components/NoEditPermissionNotice.d.ts +3 -2
  43. package/dist/editor/components/NoEditPermissionNotice.js +3 -2
  44. package/dist/editor/components/ReadOnlyDraftNotice.d.ts +11 -0
  45. package/dist/editor/components/ReadOnlyDraftNotice.js +12 -0
  46. package/dist/editor/components/RenameEntryModal.js +1 -1
  47. package/dist/editor/components/StagedChangesDrawer.js +3 -3
  48. package/dist/editor/components/UndoToastMessage.d.ts +14 -0
  49. package/dist/editor/components/UndoToastMessage.js +9 -0
  50. package/dist/editor/components/UserBadge.js +9 -5
  51. package/dist/editor/copy.d.ts +14 -0
  52. package/dist/editor/copy.js +14 -0
  53. package/dist/editor/fields/BlockField.d.ts +5 -0
  54. package/dist/editor/fields/BlockField.js +38 -32
  55. package/dist/editor/fields/CodeField.d.ts +2 -0
  56. package/dist/editor/fields/CodeField.js +5 -2
  57. package/dist/editor/fields/DateTimeField.d.ts +2 -0
  58. package/dist/editor/fields/DateTimeField.js +5 -2
  59. package/dist/editor/fields/FieldCrashFallback.d.ts +3 -3
  60. package/dist/editor/fields/FieldCrashFallback.js +4 -4
  61. package/dist/editor/fields/FieldLabel.d.ts +24 -0
  62. package/dist/editor/fields/FieldLabel.js +9 -0
  63. package/dist/editor/fields/ImageField.d.ts +4 -0
  64. package/dist/editor/fields/ImageField.js +17 -8
  65. package/dist/editor/fields/InlineGroupField.js +4 -3
  66. package/dist/editor/fields/MarkdownField.d.ts +6 -0
  67. package/dist/editor/fields/MarkdownField.js +41 -11
  68. package/dist/editor/fields/MdxImageDialog.js +1 -1
  69. package/dist/editor/fields/NumberField.d.ts +2 -0
  70. package/dist/editor/fields/NumberField.js +4 -2
  71. package/dist/editor/fields/NumberListField.d.ts +2 -0
  72. package/dist/editor/fields/NumberListField.js +4 -2
  73. package/dist/editor/fields/ObjectField.d.ts +1 -0
  74. package/dist/editor/fields/ObjectField.js +5 -4
  75. package/dist/editor/fields/ReferenceField.d.ts +2 -0
  76. package/dist/editor/fields/ReferenceField.js +9 -3
  77. package/dist/editor/fields/SelectField.d.ts +2 -0
  78. package/dist/editor/fields/SelectField.js +8 -2
  79. package/dist/editor/fields/StringListField.d.ts +2 -0
  80. package/dist/editor/fields/StringListField.js +5 -2
  81. package/dist/editor/fields/TextField.d.ts +2 -0
  82. package/dist/editor/fields/TextField.js +5 -2
  83. package/dist/editor/fields/ToggleField.d.ts +2 -0
  84. package/dist/editor/fields/ToggleField.js +6 -3
  85. package/dist/editor/fields/entry-link/InsertEntryLink.js +1 -1
  86. package/dist/editor/fields/list-item-keys.d.ts +8 -0
  87. package/dist/editor/fields/list-item-keys.js +50 -0
  88. package/dist/editor/group-manager/GroupCard.js +1 -1
  89. package/dist/editor/group-manager/GroupForm.js +1 -1
  90. package/dist/editor/group-manager/InternalGroupsTab.js +1 -1
  91. package/dist/editor/group-manager/MemberList.js +1 -1
  92. package/dist/editor/group-manager/hooks/useGroupState.d.ts +1 -0
  93. package/dist/editor/group-manager/hooks/useGroupState.js +1 -1
  94. package/dist/editor/group-manager/index.js +26 -2
  95. package/dist/editor/hooks/useBranchActions.js +2 -2
  96. package/dist/editor/hooks/useBranchManager.js +36 -22
  97. package/dist/editor/hooks/useDraftManager.d.ts +8 -0
  98. package/dist/editor/hooks/useDraftManager.js +27 -5
  99. package/dist/editor/hooks/useEditorLayout.d.ts +45 -3
  100. package/dist/editor/hooks/useEditorLayout.js +97 -7
  101. package/dist/editor/hooks/useUserMetadata.js +12 -1
  102. package/dist/editor/media/AssetCard.js +1 -1
  103. package/dist/editor/media/CropStep.js +6 -1
  104. package/dist/editor/media/MediaLibraryBody.js +3 -3
  105. package/dist/editor/permission-manager/PermissionEditor.js +3 -3
  106. package/dist/editor/permission-manager/index.js +1 -1
  107. package/dist/editor/preview-bridge.js +2 -2
  108. package/dist/editor/schema-editor/CollectionEditor.js +1 -1
  109. package/dist/editor/schema-editor/EntryTypeEditor.js +1 -1
  110. package/dist/editor/theme.d.ts +1 -1
  111. package/dist/editor/theme.js +11 -11
  112. package/dist/editor/undo-removal.d.ts +44 -0
  113. package/dist/editor/undo-removal.js +129 -0
  114. package/dist/editor/user-display.d.ts +4 -0
  115. package/dist/editor/user-display.js +5 -0
  116. package/dist/editor/utils/confirm-modal.d.ts +8 -0
  117. package/dist/editor/utils/confirm-modal.js +12 -0
  118. package/dist/entry-link-resolver.d.ts +11 -1
  119. package/dist/entry-link-resolver.js +65 -5
  120. package/dist/git-manager.d.ts +6 -6
  121. package/dist/git-manager.js +16 -15
  122. package/dist/github-service.d.ts +25 -1
  123. package/dist/github-service.js +65 -6
  124. package/dist/http/handler.js +2 -1
  125. package/dist/static/seo.d.ts +5 -5
  126. package/dist/static/seo.js +5 -5
  127. package/dist/system-users.d.ts +12 -0
  128. package/dist/system-users.js +12 -0
  129. package/dist/types.d.ts +9 -1
  130. package/dist/utils/error.js +4 -3
  131. package/dist/utils/escape-text.d.ts +7 -0
  132. package/dist/utils/escape-text.js +27 -0
  133. package/dist/version.d.ts +1 -1
  134. package/dist/version.js +1 -1
  135. package/dist/worker/branch-policy.d.ts +124 -0
  136. package/dist/worker/branch-policy.js +243 -0
  137. package/dist/worker/bundle-header.d.ts +117 -0
  138. package/dist/worker/bundle-header.js +253 -0
  139. package/dist/worker/cms-worker.d.ts +68 -17
  140. package/dist/worker/cms-worker.js +116 -33
  141. package/dist/worker/gateway-egress.d.ts +43 -0
  142. package/dist/worker/gateway-egress.js +209 -0
  143. package/dist/worker/gateway-instance.d.ts +42 -0
  144. package/dist/worker/gateway-instance.js +129 -0
  145. package/dist/worker/git-process.d.ts +81 -0
  146. package/dist/worker/git-process.js +234 -0
  147. package/dist/worker/git-sync.d.ts +8 -7
  148. package/dist/worker/git-sync.js +184 -74
  149. package/dist/worker/github-gateway-http.d.ts +62 -0
  150. package/dist/worker/github-gateway-http.js +977 -0
  151. package/dist/worker/github-gateway-wire.d.ts +589 -0
  152. package/dist/worker/github-gateway-wire.js +484 -0
  153. package/dist/worker/github-gateway.d.ts +152 -58
  154. package/dist/worker/github-gateway.js +485 -129
  155. package/dist/worker/github-mirror-upkeep.d.ts +75 -0
  156. package/dist/worker/github-mirror-upkeep.js +266 -0
  157. package/dist/worker/github-mirror.d.ts +271 -71
  158. package/dist/worker/github-mirror.js +755 -238
  159. package/dist/worker/github-transfer.d.ts +56 -0
  160. package/dist/worker/github-transfer.js +444 -0
  161. package/dist/worker/self-checks.d.ts +107 -0
  162. package/dist/worker/self-checks.js +358 -0
  163. package/dist/worker/shared-repo-git.d.ts +20 -7
  164. package/dist/worker/shared-repo-git.js +51 -22
  165. package/dist/worker/stale-mirror.d.ts +82 -0
  166. package/dist/worker/stale-mirror.js +130 -0
  167. package/dist/worker/task-runner.d.ts +2 -0
  168. package/dist/worker/task-runner.js +49 -20
  169. package/dist/worker/worker-context.d.ts +6 -0
  170. package/package.json +1 -1
@@ -11,8 +11,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
11
  */
12
12
  import { Alert, Badge, Button, Code, Group, Loader, Modal, Paper, SegmentedControl, SimpleGrid, Spoiler, Stack, Table, Tabs, Text, ThemeIcon, Tooltip, } from '@mantine/core';
13
13
  import { IconAlertCircle, IconAlertTriangle } from '@tabler/icons-react';
14
- import { modals } from '@mantine/modals';
14
+ import { openConfirm } from '../utils/confirm-modal.js';
15
15
  import { useSystemHealth, } from './useSystemHealth.js';
16
+ import { escapeForLog } from '../../utils/escape-text.js';
17
+ import { branchStatusPresentation } from '../branch-status.js';
16
18
  // ============================================================================
17
19
  // Small pure helpers
18
20
  // ============================================================================
@@ -97,6 +99,14 @@ function BaseHoldAlert({ hold }) {
97
99
  ? 'The worker updated the base branch anyway; content types using them are unavailable until an editor image defining them is deployed.'
98
100
  : 'The worker keeps the base branch at its current version until an editor image defining them handles a request.'] }), _jsxs(Text, { size: "xs", c: "dimmed", mt: 4, children: ["Held since ", hold.since, " \u00B7 ", hold.files.join(', '), hold.fileCount > hold.files.length && ` and ${hold.fileCount - hold.files.length} more`] })] }));
99
101
  }
102
+ /**
103
+ * Branches the worker left diverged from GitHub because this deployment's copy holds editor work
104
+ * (worker/git-sync.ts's `reconcileTrackedBranches`). A copy holding none is moved to GitHub's tip
105
+ * and never listed. Names come from GitHub and are attacker-chosen, so each is shown escaped.
106
+ */
107
+ function DivergedBranchesAlert({ names }) {
108
+ return (_jsx(Alert, { color: "orange", icon: _jsx(IconAlertTriangle, { size: 16 }), title: `${plural(names.length, 'branch')} diverged from GitHub`, "data-testid": "diverged-branches-alert", children: _jsxs(Stack, { gap: 4, children: [_jsx(Text, { size: "sm", children: "This deployment's copy of each branch below holds editor work that conflicts with the branch on GitHub, usually because the GitHub branch was rebased or force-pushed, or because another CanopyCMS deployment sharing this repository uses the same branch name. Neither copy has been changed, and publishing the branch fails until they agree." }), _jsx(Text, { size: "sm", children: "A developer decides which version to keep. To keep GitHub's, first push it to a new branch name on GitHub, because Delete Branch in the editor also deletes a published branch on GitHub; then delete this branch in the editor (Withdraw Branch first if it is in review). The editor's changes cannot be copied to another branch: to keep them, leave this branch as it is, or re-enter them by hand in a new branch. For the base branch or a settings branch, ask a developer to check what changed on GitHub." }), _jsx(Group, { gap: 4, children: names.map((name) => (_jsx(Code, { children: escapeForLog(name) }, name))) })] }) }));
109
+ }
100
110
  /**
101
111
  * Why the base branch needs an operator, or null when its last refresh needs
102
112
  * nothing. Shared by the overview and the base row's warning tooltip.
@@ -116,13 +126,6 @@ function baseRefreshWarning(report) {
116
126
  }
117
127
  return lines.length > 0 ? lines.join('\n') : null;
118
128
  }
119
- // Mirrors BranchManager.tsx's statusColorMap -- kept local (not exported
120
- // there) rather than shared, same tiny lookup either way.
121
- const branchStatusColorMap = {
122
- editing: 'brand',
123
- submitted: 'green',
124
- approved: 'teal',
125
- };
126
129
  const TASK_STATUS_OPTIONS = [
127
130
  { label: 'Pending', value: 'pending' },
128
131
  { label: 'Processing', value: 'processing' },
@@ -209,7 +212,7 @@ function OverviewTab({ health }) {
209
212
  return (_jsxs(Group, { justify: "center", py: "xl", children: [_jsx(Loader, { size: "md" }), _jsx(Text, { size: "sm", c: "dimmed", children: "Loading status..." })] }));
210
213
  }
211
214
  if (!status) {
212
- return (_jsxs(Stack, { align: "center", py: "xl", gap: "sm", children: [_jsx(Text, { size: "sm", c: "dimmed", children: "No status available." }), _jsx(Button, { size: "xs", variant: "light", onClick: () => refresh(), children: "Refresh" })] }));
215
+ return (_jsxs(Stack, { align: "center", py: "xl", gap: "sm", children: [_jsx(Text, { size: "sm", c: "dimmed", children: "No status available." }), _jsx(Button, { variant: "light", onClick: () => refresh(), children: "Refresh" })] }));
213
216
  }
214
217
  const liveness = workerLivenessBadge(status.worker, status.mode);
215
218
  const lastFatalError = status.workerStatus?.lastFatalError;
@@ -225,14 +228,14 @@ function OverviewTab({ health }) {
225
228
  workerVersion !== build.canopycmsVersion;
226
229
  return (_jsxs(Stack, { gap: "md", children: [error && (_jsx(Alert, { color: "red", icon: _jsx(IconAlertCircle, { size: 16 }), variant: "light", children: error })), _jsxs(Group, { gap: "sm", children: [_jsx(Badge, { color: liveness.color, variant: "light", size: "lg", children: liveness.label }), status.mode === 'dev' && (_jsx(Text, { size: "xs", c: "dimmed", children: "No worker runs in dev mode" }))] }), isRecentFatalError && lastFatalError && (_jsxs(Alert, { color: "red", icon: _jsx(IconAlertCircle, { size: 16 }), title: lastFatalError.phase === 'startup'
227
230
  ? 'The worker failed to start'
228
- : 'The worker stopped while running', children: [_jsx(Text, { size: "sm", children: lastFatalError.message }), _jsxs(Text, { size: "xs", c: "dimmed", mt: 4, children: ["at ", lastFatalError.at] })] })), status.settingsWorkspaceError && (_jsx(Alert, { color: "red", icon: _jsx(IconAlertCircle, { size: 16 }), title: "Settings workspace unavailable: groups and path rules are not loading", children: _jsx(Text, { size: "sm", children: status.settingsWorkspaceError }) })), status.schemaIssues && status.schemaIssues.length > 0 && (_jsx(Alert, { color: "yellow", icon: _jsx(IconAlertTriangle, { size: 16 }), title: "Content types this editor version doesn't know", "data-testid": "schema-issues-alert", children: _jsx(Stack, { gap: 4, children: status.schemaIssues.map((issue) => (_jsx(Text, { size: "sm", children: issue.kind === 'unknown-schema' ? (_jsxs(_Fragment, { children: [_jsx(Code, { children: issue.metaFile }), " names ", _jsx(Code, { children: issue.schemaRef }), ", so entry type ", _jsx(Code, { children: issue.entryType }), " is unavailable"] })) : (issue.message) }, `${issue.kind}:${issue.message}`))) }) })), status.workerStatus?.baseHold && _jsx(BaseHoldAlert, { hold: status.workerStatus.baseHold }), status.statusReadError && (_jsxs(Text, { size: "xs", c: "orange", children: ["Warning: could not read worker status (", status.statusReadError, ")"] })), status.workerStatus?.lastGitSyncError && (_jsxs(Alert, { color: "orange", icon: _jsx(IconAlertCircle, { size: 16 }), title: "Last git sync failed", children: [_jsx(Text, { size: "sm", children: status.workerStatus.lastGitSyncError.message }), _jsxs(Text, { size: "xs", c: "dimmed", mt: 4, children: ["at ", status.workerStatus.lastGitSyncError.at] })] })), versionSkew && (_jsx(Alert, { color: "orange", icon: _jsx(IconAlertCircle, { size: 16 }), title: "API and worker versions differ", "data-testid": "version-skew-warning", children: _jsxs(Text, { size: "sm", children: ["The API runs canopycms ", build.canopycmsVersion, " but the worker runs canopycms", ' ', workerVersion, ". They were deployed from different builds."] }) })), _jsxs(Paper, { withBorder: true, p: "sm", radius: "md", children: [_jsx(Text, { size: "sm", fw: 600, children: "Build" }), _jsxs(Text, { size: "xs", c: "dimmed", "data-testid": "build-api-version", children: ["API: canopycms ", build.canopycmsVersion] }), _jsxs(Text, { size: "xs", c: "dimmed", "data-testid": "build-source-revision", children: ["Source revision:", ' ', build.sourceRevision ? (_jsx(Tooltip, { label: build.sourceRevision, children: _jsx(Code, { children: build.sourceRevision.slice(0, 12) }) })) : ('not set (pass the CANOPY_SOURCE_SHA build arg to the image build)')] }), _jsxs(Text, { size: "xs", c: "dimmed", "data-testid": "build-worker-version", children: ["Worker version: ", workerVersion ? `canopycms ${workerVersion}` : 'unknown'] }), lastShutdown && (_jsxs(Text, { size: "xs", c: lastShutdown.outcome === 'drained' ? 'dimmed' : 'orange', "data-testid": "build-last-shutdown", children: ["Last worker shutdown: ", lastShutdown.reason, " at ", lastShutdown.at, lastShutdown.outcome === 'deadline' &&
231
+ : 'The worker stopped while running', children: [_jsx(Text, { size: "sm", children: lastFatalError.message }), _jsxs(Text, { size: "xs", c: "dimmed", mt: 4, children: ["at ", lastFatalError.at] })] })), status.settingsWorkspaceError && (_jsx(Alert, { color: "red", icon: _jsx(IconAlertCircle, { size: 16 }), title: "Settings workspace unavailable: groups and path rules are not loading", children: _jsx(Text, { size: "sm", children: status.settingsWorkspaceError }) })), status.schemaIssues && status.schemaIssues.length > 0 && (_jsx(Alert, { color: "yellow", icon: _jsx(IconAlertTriangle, { size: 16 }), title: "Content types this editor version doesn't know", "data-testid": "schema-issues-alert", children: _jsx(Stack, { gap: 4, children: status.schemaIssues.map((issue) => (_jsx(Text, { size: "sm", children: issue.kind === 'unknown-schema' ? (_jsxs(_Fragment, { children: [_jsx(Code, { children: issue.metaFile }), " names ", _jsx(Code, { children: issue.schemaRef }), ", so entry type ", _jsx(Code, { children: issue.entryType }), " is unavailable"] })) : (issue.message) }, `${issue.kind}:${issue.message}`))) }) })), status.workerStatus?.baseHold && _jsx(BaseHoldAlert, { hold: status.workerStatus.baseHold }), status.statusReadError && (_jsxs(Text, { size: "xs", c: "orange", children: ["Warning: could not read worker status (", status.statusReadError, ")"] })), lastGitSync?.tracked && lastGitSync.tracked.diverged.length > 0 && (_jsx(DivergedBranchesAlert, { names: lastGitSync.tracked.diverged })), status.workerStatus?.lastGitSyncError && (_jsxs(Alert, { color: "orange", icon: _jsx(IconAlertCircle, { size: 16 }), title: "Last git sync failed", children: [_jsx(Text, { size: "sm", children: status.workerStatus.lastGitSyncError.message }), _jsxs(Text, { size: "xs", c: "dimmed", mt: 4, children: ["at ", status.workerStatus.lastGitSyncError.at] })] })), versionSkew && (_jsx(Alert, { color: "orange", icon: _jsx(IconAlertCircle, { size: 16 }), title: "API and worker versions differ", "data-testid": "version-skew-warning", children: _jsxs(Text, { size: "sm", children: ["The API runs canopycms ", build.canopycmsVersion, " but the worker runs canopycms", ' ', workerVersion, ". They were deployed from different builds."] }) })), _jsxs(Paper, { withBorder: true, p: "sm", children: [_jsx(Text, { size: "sm", fw: 600, children: "Build" }), _jsxs(Text, { size: "xs", c: "dimmed", "data-testid": "build-api-version", children: ["API: canopycms ", build.canopycmsVersion] }), _jsxs(Text, { size: "xs", c: "dimmed", "data-testid": "build-source-revision", children: ["Source revision:", ' ', build.sourceRevision ? (_jsx(Tooltip, { label: build.sourceRevision, children: _jsx(Code, { children: build.sourceRevision.slice(0, 12) }) })) : ('not set (pass the CANOPY_SOURCE_SHA build arg to the image build)')] }), _jsxs(Text, { size: "xs", c: "dimmed", "data-testid": "build-worker-version", children: ["Worker version: ", workerVersion ? `canopycms ${workerVersion}` : 'unknown'] }), lastShutdown && (_jsxs(Text, { size: "xs", c: lastShutdown.outcome === 'drained' ? 'dimmed' : 'orange', "data-testid": "build-last-shutdown", children: ["Last worker shutdown: ", lastShutdown.reason, " at ", lastShutdown.at, lastShutdown.outcome === 'deadline' &&
229
232
  ` · drain deadline hit, aborted ${lastShutdown.abandoned?.join(', ') ?? 'in-flight work'}`, lastShutdown.outcome === 'drained' &&
230
233
  lastShutdown.drainMs !== undefined &&
231
234
  ` · drained in ${(lastShutdown.drainMs / 1000).toFixed(1)}s`, lastShutdown.outcome === 'not-drained' && ' (a crash or a forced stop)'] })), lastFatalError?.phase === 'startup' && (_jsxs(Text, { size: "xs", c: "orange", "data-testid": "build-failed-start", children: ["Last start failed at ", lastFatalError.at] })), _jsxs(Text, { size: "xs", c: "dimmed", "data-testid": "build-media", children: ["Media storage:", ' ', status.assetStore.configured ? 'configured' : 'not configured — uploads are disabled'] }), _jsxs(Text, { size: "xs", c: status.imageProcessing.available ? 'dimmed' : 'orange', "data-testid": "build-image-processing", children: ["Image processing:", ' ', status.imageProcessing.available
232
235
  ? 'available'
233
- : `unavailable — new editor image sizes and crops fail, and uploads skip decode validation${status.imageProcessing.error ? ` (${status.imageProcessing.error})` : ''}`] })] }), lastGitSync && (_jsxs(Paper, { withBorder: true, p: "sm", radius: "md", children: [_jsx(Text, { size: "sm", fw: 600, children: "Last git sync" }), _jsxs(Text, { size: "xs", c: "dimmed", children: [status.workerStatus?.lastGitSyncAt ?? 'unknown time', " \u00B7 ", lastGitSync.durationMs, "ms \u00B7", ' ', lastGitSync.rebased.length, " rebased \u00B7 ", lastGitSync.skippedDirty.length, " skipped (dirty)", lastGitSync.skippedLocked && lastGitSync.skippedLocked.length > 0
236
+ : `unavailable — new editor image sizes and crops fail, and uploads skip decode validation${status.imageProcessing.error ? ` (${status.imageProcessing.error})` : ''}`] })] }), lastGitSync && (_jsxs(Paper, { withBorder: true, p: "sm", children: [_jsx(Text, { size: "sm", fw: 600, children: "Last git sync" }), _jsxs(Text, { size: "xs", c: "dimmed", children: [status.workerStatus?.lastGitSyncAt ?? 'unknown time', " \u00B7 ", lastGitSync.durationMs, "ms \u00B7", ' ', lastGitSync.rebased.length, " rebased \u00B7 ", lastGitSync.skippedDirty.length, " skipped (dirty)", lastGitSync.skippedLocked && lastGitSync.skippedLocked.length > 0
234
237
  ? ` · ${lastGitSync.skippedLocked.length} skipped (busy: a content write, provisioning or purge)`
235
- : ''] }), lastGitSync.baseRefresh && (_jsxs(Text, { size: "xs", c: "dimmed", "data-testid": "base-refresh-outcome", children: ["Base branch: ", BASE_REFRESH_LABELS[lastGitSync.baseRefresh.outcome]] })), baseWarning && (_jsx(Text, { size: "xs", c: "orange", style: { whiteSpace: 'pre-line' }, "data-testid": "base-refresh-warning", children: baseWarning })), lastGitSync.failed.length > 0 && (_jsx(Spoiler, { maxHeight: 0, showLabel: `${lastGitSync.failed.length} failed — show details`, hideLabel: "Hide", children: _jsx(Stack, { gap: 4, mt: 4, children: lastGitSync.failed.map((f) => (_jsxs(Text, { size: "xs", c: "red", children: [f.branch, ": ", f.error] }, f.branch))) }) }))] })), _jsx(SimpleGrid, { cols: 5, spacing: "xs", children: ['pending', 'processing', 'completed', 'failed', 'corrupt'].map((key) => (_jsxs(Paper, { withBorder: true, p: "xs", radius: "md", ta: "center", children: [_jsx(Text, { size: "xs", c: "dimmed", tt: "capitalize", children: key }), _jsx(Text, { size: "lg", fw: 700, c: (key === 'failed' || key === 'corrupt') && status.queue[key] > 0 ? 'red' : undefined, children: status.queue[key] })] }, key))) }), status.queue.oldestPendingAgeMs !== undefined && (_jsxs(Text, { size: "xs", c: "dimmed", children: ["Oldest pending task: ", formatAgeMs(status.queue.oldestPendingAgeMs), " old"] })), _jsxs(Group, { justify: "space-between", align: "center", children: [_jsxs(Text, { size: "xs", c: "dimmed", children: ["Generated at ", status.generatedAt] }), _jsx(Button, { size: "xs", variant: "light", onClick: () => refresh(), loading: statusLoading, children: "Refresh" })] }), _jsx(Text, { size: "xs", c: "dimmed", children: "Data may lag up to ~60s (shared-filesystem caching)" })] }));
238
+ : ''] }), lastGitSync.baseRefresh && (_jsxs(Text, { size: "xs", c: "dimmed", "data-testid": "base-refresh-outcome", children: ["Base branch: ", BASE_REFRESH_LABELS[lastGitSync.baseRefresh.outcome]] })), baseWarning && (_jsx(Text, { size: "xs", c: "orange", style: { whiteSpace: 'pre-line' }, "data-testid": "base-refresh-warning", children: baseWarning })), lastGitSync.failed.length > 0 && (_jsx(Spoiler, { maxHeight: 0, showLabel: `${lastGitSync.failed.length} failed — show details`, hideLabel: "Hide", children: _jsx(Stack, { gap: 4, mt: 4, children: lastGitSync.failed.map((f) => (_jsxs(Text, { size: "xs", c: "red", children: [f.branch, ": ", f.error] }, f.branch))) }) }))] })), _jsx(SimpleGrid, { cols: 5, spacing: "xs", children: ['pending', 'processing', 'completed', 'failed', 'corrupt'].map((key) => (_jsxs(Paper, { withBorder: true, p: "xs", ta: "center", children: [_jsx(Text, { size: "xs", c: "dimmed", tt: "capitalize", children: key }), _jsx(Text, { size: "lg", fw: 700, c: (key === 'failed' || key === 'corrupt') && status.queue[key] > 0 ? 'red' : undefined, children: status.queue[key] })] }, key))) }), status.queue.oldestPendingAgeMs !== undefined && (_jsxs(Text, { size: "xs", c: "dimmed", children: ["Oldest pending task: ", formatAgeMs(status.queue.oldestPendingAgeMs), " old"] })), _jsxs(Group, { justify: "space-between", align: "center", children: [_jsxs(Text, { size: "xs", c: "dimmed", children: ["Generated at ", status.generatedAt] }), _jsx(Button, { variant: "light", onClick: () => refresh(), loading: statusLoading, children: "Refresh" })] }), _jsx(Text, { size: "xs", c: "dimmed", children: "Data may lag up to ~60s (shared-filesystem caching)" })] }));
236
239
  }
237
240
  function TasksTab({ health }) {
238
241
  const { taskStatus, setTaskStatus, tasks, tasksLoading } = health;
@@ -242,7 +245,7 @@ function TasksTab({ health }) {
242
245
  const isEmpty = isCorrupt ? corruptRows.length === 0 : taskRows.length === 0;
243
246
  const canDelete = taskStatus === 'pending' || taskStatus === 'failed' || taskStatus === 'corrupt';
244
247
  const handleRetryClick = (task) => {
245
- modals.openConfirmModal({
248
+ openConfirm({
246
249
  title: 'Retry task',
247
250
  children: _jsx(Text, { size: "sm", children: RETRY_CONFIRM_TEXT }),
248
251
  labels: { confirm: 'Retry', cancel: 'Cancel' },
@@ -251,7 +254,7 @@ function TasksTab({ health }) {
251
254
  });
252
255
  };
253
256
  const handleDeleteClick = (status, fileName) => {
254
- modals.openConfirmModal({
257
+ openConfirm({
255
258
  title: 'Delete task file',
256
259
  children: _jsx(Text, { size: "sm", children: deleteConfirmText(status) }),
257
260
  labels: { confirm: 'Delete', cancel: 'Cancel' },
@@ -263,15 +266,15 @@ function TasksTab({ health }) {
263
266
  if (isAdminTaskStatus(value))
264
267
  setTaskStatus(value);
265
268
  } }), tasksLoading && taskRows.length === 0 && corruptRows.length === 0 ? (_jsxs(Group, { justify: "center", py: "xl", children: [_jsx(Loader, { size: "sm" }), _jsx(Text, { size: "sm", c: "dimmed", children: "Loading tasks..." })] })) : isEmpty ? (_jsxs(Text, { size: "sm", c: "dimmed", py: "md", children: ["No ", taskStatus, " tasks."] })) : (_jsx(Table.ScrollContainer, { minWidth: 600, children: _jsxs(Table, { children: [_jsx(Table.Thead, { children: _jsx(Table.Tr, { children: isCorrupt ? (_jsxs(_Fragment, { children: [_jsx(Table.Th, { children: "File" }), _jsx(Table.Th, { children: "Size" }), _jsx(Table.Th, { children: "Modified" }), _jsx(Table.Th, { children: "Raw snippet" }), _jsx(Table.Th, { children: "Actions" })] })) : (_jsxs(_Fragment, { children: [_jsx(Table.Th, { children: "ID" }), _jsx(Table.Th, { children: "Action" }), _jsx(Table.Th, { children: "Created" }), _jsx(Table.Th, { children: "Retries" }), _jsx(Table.Th, { children: "Error" }), _jsx(Table.Th, { children: "Actions" })] })) }) }), _jsx(Table.Tbody, { children: isCorrupt
266
- ? corruptRows.map((file) => (_jsxs(Table.Tr, { children: [_jsx(Table.Td, { children: _jsx("span", { title: file.fileName, children: truncate(file.fileName, 30) }) }), _jsxs(Table.Td, { children: [file.size, " bytes"] }), _jsx(Table.Td, { children: file.mtime }), _jsx(Table.Td, { children: _jsx(Code, { block: true, style: { maxWidth: 320, whiteSpace: 'pre-wrap' }, children: file.rawSnippet }) }), _jsx(Table.Td, { children: _jsx(Button, { size: "xs", variant: "light", color: "red", "data-testid": `delete-task-${file.fileName}`, onClick: () => handleDeleteClick('corrupt', file.fileName), children: "Delete" }) })] }, file.fileName)))
267
- : taskRows.map((task) => (_jsxs(Table.Tr, { children: [_jsx(Table.Td, { children: _jsx("span", { title: task.id, children: truncate(task.id, 12) }) }), _jsx(Table.Td, { children: task.action }), _jsx(Table.Td, { children: task.createdAt }), _jsx(Table.Td, { children: task.retryCount ?? 0 }), _jsx(Table.Td, { children: task.error ? (_jsx(Tooltip, { label: task.error, multiline: true, maw: 400, children: _jsx(Text, { size: "xs", style: { cursor: 'help' }, children: truncate(task.error, 50) }) })) : (_jsx(Text, { size: "xs", c: "dimmed", children: "\u2014" })) }), _jsx(Table.Td, { children: _jsxs(Group, { gap: "xs", children: [taskStatus === 'failed' && (_jsx(Button, { size: "xs", variant: "light", "data-testid": `retry-task-${task.id}`, onClick: () => handleRetryClick(task), children: "Retry" })), canDelete && (_jsx(Button, { size: "xs", variant: "light", color: "red", "data-testid": `delete-task-${task.id}`, onClick: () => handleDeleteClick(taskStatus, `${task.id}.json`), children: "Delete" }))] }) })] }, task.id))) })] }) }))] }));
269
+ ? corruptRows.map((file) => (_jsxs(Table.Tr, { children: [_jsx(Table.Td, { children: _jsx("span", { title: file.fileName, children: truncate(file.fileName, 30) }) }), _jsxs(Table.Td, { children: [file.size, " bytes"] }), _jsx(Table.Td, { children: file.mtime }), _jsx(Table.Td, { children: _jsx(Code, { block: true, style: { maxWidth: 320, whiteSpace: 'pre-wrap' }, children: file.rawSnippet }) }), _jsx(Table.Td, { children: _jsx(Button, { variant: "light", color: "red", "data-testid": `delete-task-${file.fileName}`, onClick: () => handleDeleteClick('corrupt', file.fileName), children: "Delete" }) })] }, file.fileName)))
270
+ : taskRows.map((task) => (_jsxs(Table.Tr, { children: [_jsx(Table.Td, { children: _jsx("span", { title: task.id, children: truncate(task.id, 12) }) }), _jsx(Table.Td, { children: task.action }), _jsx(Table.Td, { children: task.createdAt }), _jsx(Table.Td, { children: task.retryCount ?? 0 }), _jsx(Table.Td, { children: task.error ? (_jsx(Tooltip, { label: task.error, multiline: true, maw: 400, children: _jsx(Text, { size: "xs", style: { cursor: 'help' }, children: truncate(task.error, 50) }) })) : (_jsx(Text, { size: "xs", c: "dimmed", children: "\u2014" })) }), _jsx(Table.Td, { children: _jsxs(Group, { gap: "xs", children: [taskStatus === 'failed' && (_jsx(Button, { variant: "light", "data-testid": `retry-task-${task.id}`, onClick: () => handleRetryClick(task), children: "Retry" })), canDelete && (_jsx(Button, { variant: "light", color: "red", "data-testid": `delete-task-${task.id}`, onClick: () => handleDeleteClick(taskStatus, `${task.id}.json`), children: "Delete" }))] }) })] }, task.id))) })] }) }))] }));
268
271
  }
269
272
  function BranchesTab({ health }) {
270
273
  const { branchHealth, branchHealthLoading } = health;
271
274
  const entries = branchHealth?.entries ?? [];
272
275
  const baseWarning = baseRefreshWarning(health.status?.workerStatus?.lastGitSync?.baseRefresh);
273
276
  const handleMarkMergedClick = (branchName) => {
274
- modals.openConfirmModal({
277
+ openConfirm({
275
278
  title: 'Mark branch as merged',
276
279
  children: _jsx(Text, { size: "sm", children: MARK_MERGED_CONFIRM_TEXT }),
277
280
  labels: { confirm: 'Mark merged', cancel: 'Cancel' },
@@ -280,7 +283,7 @@ function BranchesTab({ health }) {
280
283
  });
281
284
  };
282
285
  const handleRepairClick = (dirName) => {
283
- modals.openConfirmModal({
286
+ openConfirm({
284
287
  title: 'Repair metadata',
285
288
  children: _jsx(Text, { size: "sm", children: REPAIR_CONFIRM_TEXT }),
286
289
  labels: { confirm: 'Repair', cancel: 'Cancel' },
@@ -289,7 +292,7 @@ function BranchesTab({ health }) {
289
292
  });
290
293
  };
291
294
  const handlePurgeClick = (dirName) => {
292
- modals.openConfirmModal({
295
+ openConfirm({
293
296
  title: 'Purge directory',
294
297
  children: _jsx(Text, { size: "sm", children: PURGE_CONFIRM_TEXT }),
295
298
  labels: { confirm: 'Purge', cancel: 'Cancel' },
@@ -301,7 +304,7 @@ function BranchesTab({ health }) {
301
304
  // calls only the duplicate repair: Purge sits on neighbouring rows and
302
305
  // trashes a whole branch directory.
303
306
  const handleDuplicateIdsClick = (dirName, duplicates) => {
304
- modals.openConfirmModal({
307
+ openConfirm({
305
308
  title: 'Fix duplicate content IDs',
306
309
  children: _jsx(DuplicateRepairDetails, { dirName: dirName, duplicates: duplicates }),
307
310
  labels: { confirm: 'Archive duplicates', cancel: 'Cancel' },
@@ -334,17 +337,17 @@ function BranchHealthRow({ entry, baseWarning, duplicateIdScan, onMarkMerged, on
334
337
  // default instead of silently hiding them.
335
338
  const showRebaseFailure = !['submitted', 'approved', 'archived'].includes(b.status) && !!b.rebaseFailure;
336
339
  const canMarkMerged = (b.status === 'submitted' || b.status === 'approved') && !!b.pullRequestNumber;
337
- return (_jsxs(Table.Tr, { children: [_jsx(Table.Td, { children: _jsxs(Group, { gap: 4, wrap: "nowrap", children: [_jsx(Text, { size: "sm", children: entry.dirName }), entry.isBaseBranch && (_jsx(Badge, { size: "xs", color: "gray", variant: "outline", children: "base" }))] }) }), _jsx(Table.Td, { children: _jsx(Badge, { color: branchStatusColorMap[b.status] ?? 'neutral', variant: "light", children: b.status }) }), _jsx(Table.Td, { children: b.pullRequestNumber ? (_jsxs(Text, { size: "xs", c: "blue", component: "a", href: b.pullRequestUrl, target: "_blank", rel: "noopener noreferrer", style: { textDecoration: 'underline' }, children: ["PR #", b.pullRequestNumber, b.pullRequestState ? ` (${b.pullRequestState})` : ''] })) : (_jsx(Text, { size: "xs", c: "dimmed", children: "\u2014" })) }), _jsx(Table.Td, { children: b.syncStatus === 'sync-failed' ? (_jsx(Tooltip, { label: b.syncFailureReason
340
+ return (_jsxs(Table.Tr, { children: [_jsx(Table.Td, { children: _jsxs(Group, { gap: 4, wrap: "nowrap", children: [_jsx(Text, { size: "sm", children: entry.dirName }), entry.isBaseBranch && (_jsx(Badge, { size: "xs", color: "gray", variant: "outline", children: "base" }))] }) }), _jsx(Table.Td, { children: _jsx(Badge, { color: branchStatusPresentation(b.status)?.color ?? 'neutral', variant: "light", children: b.status }) }), _jsx(Table.Td, { children: b.pullRequestNumber ? (_jsxs(Text, { size: "xs", c: "blue", component: "a", href: b.pullRequestUrl, target: "_blank", rel: "noopener noreferrer", style: { textDecoration: 'underline' }, children: ["PR #", b.pullRequestNumber, b.pullRequestState ? ` (${b.pullRequestState})` : ''] })) : (_jsx(Text, { size: "xs", c: "dimmed", children: "\u2014" })) }), _jsx(Table.Td, { children: b.syncStatus === 'sync-failed' ? (_jsx(Tooltip, { label: b.syncFailureReason
338
341
  ? `${b.syncFailureReason} — retry from the Tasks tab`
339
342
  : 'GitHub sync failed — retry from the Tasks tab', multiline: true, maw: 320, children: _jsx(Badge, { color: "red", variant: "light", children: "sync-failed" }) })) : b.syncStatus === 'pending-sync' ? (_jsx(Badge, { color: "gray", variant: "light", children: "pending-sync" })) : null }), _jsx(Table.Td, { children: _jsxs(Group, { gap: 6, wrap: "nowrap", children: [!!b.conflictFiles?.length && (_jsxs(Badge, { color: "orange", variant: "light", children: [b.conflictFiles.length, " conflict", b.conflictFiles.length === 1 ? '' : 's'] })), showRebaseFailure && b.rebaseFailure && (_jsx(Tooltip, { label: `${b.rebaseFailure.message} (failing since ${b.rebaseFailure.firstAt})`, multiline: true, maw: 320, children: _jsx(ThemeIcon, { color: "yellow", variant: "light", size: "sm", radius: "xl", "data-testid": `rebase-failure-${entry.dirName}`, children: _jsx(IconAlertTriangle, { size: 12 }) }) })), baseWarning && (_jsx(Tooltip, { label: baseWarning, multiline: true, maw: 420, style: { whiteSpace: 'pre-line' }, children: _jsx(ThemeIcon, { color: "yellow", variant: "light", size: "sm", radius: "xl", "data-testid": `base-refresh-warning-${entry.dirName}`, children: _jsx(IconAlertTriangle, { size: 12 }) }) })), duplicateIdScan?.state === 'found' && (_jsx(Tooltip, { label: "Review and fix", children: _jsx(Badge, { component: "button", type: "button", color: "orange", variant: "light", style: { cursor: 'pointer' }, "data-testid": `duplicate-content-ids-${entry.dirName}`, onClick: () => onDuplicateIds(entry.dirName, duplicateIdScan.duplicates), children: plural(duplicateIdScan.duplicates.length, 'duplicate ID') }) })), duplicateIdScan !== undefined &&
340
343
  duplicateIdScan?.state !== 'found' &&
341
- duplicateIdScan?.state !== 'none' && (_jsx(Tooltip, { label: duplicateUncheckedReason(duplicateIdScan), multiline: true, maw: 320, children: _jsx(Badge, { color: "gray", variant: "outline", "data-testid": `duplicate-ids-unchecked-${entry.dirName}`, children: "IDs not checked" }) }))] }) }), _jsx(Table.Td, { children: _jsx(Text, { size: "xs", c: "dimmed", children: b.updatedAt }) }), _jsx(Table.Td, { children: canMarkMerged && (_jsx(Button, { size: "xs", variant: "light", "data-testid": `mark-merged-${b.name}`, onClick: () => onMarkMerged(b.name), children: "Mark merged" })) })] }));
344
+ duplicateIdScan?.state !== 'none' && (_jsx(Tooltip, { label: duplicateUncheckedReason(duplicateIdScan), multiline: true, maw: 320, children: _jsx(Badge, { color: "gray", variant: "outline", "data-testid": `duplicate-ids-unchecked-${entry.dirName}`, children: "IDs not checked" }) }))] }) }), _jsx(Table.Td, { children: _jsx(Text, { size: "xs", c: "dimmed", children: b.updatedAt }) }), _jsx(Table.Td, { children: canMarkMerged && (_jsx(Button, { variant: "light", "data-testid": `mark-merged-${b.name}`, onClick: () => onMarkMerged(b.name), children: "Mark merged" })) })] }));
342
345
  }
343
346
  if (entry.kind === 'corrupt-metadata') {
344
347
  const purgeGate = purgeGateFor(entry);
345
- return (_jsxs(Table.Tr, { style: { backgroundColor: 'var(--mantine-color-red-light)' }, children: [_jsx(Table.Td, { children: entry.dirName }), _jsx(Table.Td, { children: _jsx(Badge, { color: "red", variant: "light", children: "corrupt metadata" }) }), _jsx(Table.Td, { colSpan: 3, children: _jsx(Tooltip, { label: entry.parseError, multiline: true, maw: 400, children: _jsx(Text, { size: "xs", c: "red", children: truncate(entry.parseError ?? 'Unknown parse error', 60) }) }) }), _jsx(Table.Td, { children: _jsx(Text, { size: "xs", c: "dimmed", children: entry.metaMtime ?? '—' }) }), _jsx(Table.Td, { children: _jsxs(Group, { gap: "xs", wrap: "nowrap", children: [_jsx(Button, { size: "xs", variant: "light", "data-testid": `repair-dir-${entry.dirName}`, onClick: () => onRepair(entry.dirName), children: "Repair" }), _jsx(Tooltip, { label: purgeGate.tooltip, disabled: !purgeGate.disabled, children: _jsx("span", { children: _jsx(Button, { size: "xs", variant: "light", color: "red", disabled: purgeGate.disabled, "data-testid": `purge-dir-${entry.dirName}`, onClick: () => onPurge(entry.dirName), children: "Purge" }) }) })] }) })] }));
348
+ return (_jsxs(Table.Tr, { style: { backgroundColor: 'var(--mantine-color-red-light)' }, children: [_jsx(Table.Td, { children: entry.dirName }), _jsx(Table.Td, { children: _jsx(Badge, { color: "red", variant: "light", children: "corrupt metadata" }) }), _jsx(Table.Td, { colSpan: 3, children: _jsx(Tooltip, { label: entry.parseError, multiline: true, maw: 400, children: _jsx(Text, { size: "xs", c: "red", children: truncate(entry.parseError ?? 'Unknown parse error', 60) }) }) }), _jsx(Table.Td, { children: _jsx(Text, { size: "xs", c: "dimmed", children: entry.metaMtime ?? '—' }) }), _jsx(Table.Td, { children: _jsxs(Group, { gap: "xs", wrap: "nowrap", children: [_jsx(Button, { variant: "light", "data-testid": `repair-dir-${entry.dirName}`, onClick: () => onRepair(entry.dirName), children: "Repair" }), _jsx(Tooltip, { label: purgeGate.tooltip, disabled: !purgeGate.disabled, children: _jsx("span", { children: _jsx(Button, { variant: "light", color: "red", disabled: purgeGate.disabled, "data-testid": `purge-dir-${entry.dirName}`, onClick: () => onPurge(entry.dirName), children: "Purge" }) }) })] }) })] }));
346
349
  }
347
350
  // orphan
348
351
  const purgeGate = purgeGateFor(entry);
349
- return (_jsxs(Table.Tr, { style: { opacity: 0.65 }, children: [_jsx(Table.Td, { children: entry.dirName }), _jsx(Table.Td, { children: _jsx(Badge, { color: "gray", variant: "outline", children: "orphan" }) }), _jsx(Table.Td, { colSpan: 3, children: _jsxs(Text, { size: "xs", c: "dimmed", children: [entry.ageMs !== undefined ? `${formatAgeMs(entry.ageMs)} old` : 'unknown age', " \u00B7", ' ', entry.hasGitDir ? 'has .git' : 'no .git'] }) }), _jsx(Table.Td, { children: _jsx(Text, { size: "xs", c: "dimmed", children: entry.dirMtime ?? '—' }) }), _jsx(Table.Td, { children: _jsx(Tooltip, { label: purgeGate.tooltip, disabled: !purgeGate.disabled, children: _jsx("span", { children: _jsx(Button, { size: "xs", variant: "light", color: "red", disabled: purgeGate.disabled, "data-testid": `purge-dir-${entry.dirName}`, onClick: () => onPurge(entry.dirName), children: "Purge" }) }) }) })] }));
352
+ return (_jsxs(Table.Tr, { style: { opacity: 0.65 }, children: [_jsx(Table.Td, { children: entry.dirName }), _jsx(Table.Td, { children: _jsx(Badge, { color: "gray", variant: "outline", children: "orphan" }) }), _jsx(Table.Td, { colSpan: 3, children: _jsxs(Text, { size: "xs", c: "dimmed", children: [entry.ageMs !== undefined ? `${formatAgeMs(entry.ageMs)} old` : 'unknown age', " \u00B7", ' ', entry.hasGitDir ? 'has .git' : 'no .git'] }) }), _jsx(Table.Td, { children: _jsx(Text, { size: "xs", c: "dimmed", children: entry.dirMtime ?? '—' }) }), _jsx(Table.Td, { children: _jsx(Tooltip, { label: purgeGate.tooltip, disabled: !purgeGate.disabled, children: _jsx("span", { children: _jsx(Button, { variant: "light", color: "red", disabled: purgeGate.disabled, "data-testid": `purge-dir-${entry.dirName}`, onClick: () => onPurge(entry.dirName), children: "Purge" }) }) }) })] }));
350
353
  }
@@ -0,0 +1,16 @@
1
+ import type { BranchStatus } from '../types.js';
2
+ export interface BranchStatusPresentation {
3
+ label: string;
4
+ color: string;
5
+ variant: 'light' | 'outline';
6
+ }
7
+ export declare const PROTECTED_BRANCH_PRESENTATION: BranchStatusPresentation;
8
+ /** @internal Exported for tests. */
9
+ export declare const BRANCH_STATUS_PRESENTATION: Record<BranchStatus, BranchStatusPresentation>;
10
+ /**
11
+ * The badge for a branch: the protected base branch reads "Protected" whatever its workflow
12
+ * status, so a base branch never advertises a state it cannot act on. `status` is a string
13
+ * because server data is untyped at runtime; an unrecognised one shows as itself, neutrally.
14
+ * Returns undefined when there is nothing to show.
15
+ */
16
+ export declare function branchStatusPresentation(status: string | undefined, isProtected?: boolean): BranchStatusPresentation | undefined;
@@ -0,0 +1,28 @@
1
+ export const PROTECTED_BRANCH_PRESENTATION = {
2
+ label: 'Protected',
3
+ color: 'neutral',
4
+ variant: 'outline',
5
+ };
6
+ /** @internal Exported for tests. */
7
+ export const BRANCH_STATUS_PRESENTATION = {
8
+ editing: { label: 'Editing', color: 'brand', variant: 'light' },
9
+ submitted: { label: 'In review', color: 'green', variant: 'light' },
10
+ approved: { label: 'Approved', color: 'teal', variant: 'light' },
11
+ archived: { label: 'Archived', color: 'gray', variant: 'light' },
12
+ };
13
+ const isKnownStatus = (status) => Object.prototype.hasOwnProperty.call(BRANCH_STATUS_PRESENTATION, status);
14
+ /**
15
+ * The badge for a branch: the protected base branch reads "Protected" whatever its workflow
16
+ * status, so a base branch never advertises a state it cannot act on. `status` is a string
17
+ * because server data is untyped at runtime; an unrecognised one shows as itself, neutrally.
18
+ * Returns undefined when there is nothing to show.
19
+ */
20
+ export function branchStatusPresentation(status, isProtected = false) {
21
+ if (isProtected)
22
+ return PROTECTED_BRANCH_PRESENTATION;
23
+ if (!status)
24
+ return undefined;
25
+ if (isKnownStatus(status))
26
+ return BRANCH_STATUS_PRESENTATION[status];
27
+ return { label: status, color: 'gray', variant: 'light' };
28
+ }
@@ -15,7 +15,7 @@ export const BranchComments = ({ comments, currentUserId, canResolve, onAddComme
15
15
  await onAddComment(text, 'branch', undefined, undefined, threadId);
16
16
  };
17
17
  if (!shouldShowCarousel) {
18
- return (_jsx(Box, { children: _jsx(Button, { size: "xs", variant: "subtle", color: "gray", onClick: () => setShowCarousel(true), style: { fontSize: '0.75rem', height: '1.5rem' }, children: "New branch comment" }) }));
18
+ return (_jsx(Box, { children: _jsx(Button, { variant: "subtle", color: "gray", onClick: () => setShowCarousel(true), style: { fontSize: '0.75rem', height: '1.5rem' }, children: "New branch comment" }) }));
19
19
  }
20
20
  return (_jsx(ThreadCarousel, { threads: branchThreads, label: "Branch Discussion", contextType: "branch", currentUserId: currentUserId, canResolve: canResolve, onAddComment: handleAddComment, onResolveThread: onResolveThread, autoFocus: autoFocus, autoOpenNewThread: showCarousel && branchThreads.length === 0, highlightThreadId: highlightThreadId, onGetUserMetadata: onGetUserMetadata }));
21
21
  };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { CommentThread } from '../../comment-store.js';
3
+ import type { UserSearchResult } from '../../auth/types.js';
3
4
  export interface EntryCommentsProps {
4
5
  /** All comments (will be filtered for entry-level) */
5
6
  comments: CommentThread[];
@@ -17,6 +18,8 @@ export interface EntryCommentsProps {
17
18
  autoFocus?: boolean;
18
19
  /** Thread ID to highlight and scroll to */
19
20
  highlightThreadId?: string;
21
+ /** Resolves author ids to names; without it authors show as ids. */
22
+ onGetUserMetadata?: (userId: string) => Promise<UserSearchResult | null>;
20
23
  }
21
24
  /**
22
25
  * Entry-level comments section displayed at the top of the form.
@@ -7,7 +7,7 @@ import { ThreadCarousel } from './ThreadCarousel.js';
7
7
  * Entry-level comments section displayed at the top of the form.
8
8
  * Uses ThreadCarousel for navigation.
9
9
  */
10
- export const EntryComments = ({ comments, entryPath, currentUserId, canResolve, onAddComment, onResolveThread, autoFocus, highlightThreadId, }) => {
10
+ export const EntryComments = ({ comments, entryPath, currentUserId, canResolve, onAddComment, onResolveThread, autoFocus, highlightThreadId, onGetUserMetadata, }) => {
11
11
  const [showCarousel, setShowCarousel] = useState(false);
12
12
  const entryThreads = useMemo(() => comments.filter((t) => t.type === 'entry' && t.entryPath === entryPath), [comments, entryPath]);
13
13
  const shouldShowCarousel = entryThreads.length > 0 || showCarousel || autoFocus;
@@ -15,7 +15,7 @@ export const EntryComments = ({ comments, entryPath, currentUserId, canResolve,
15
15
  await onAddComment(text, 'entry', entryPath, undefined, threadId);
16
16
  };
17
17
  if (!shouldShowCarousel) {
18
- return (_jsx(Box, { children: _jsx(Button, { size: "xs", variant: "subtle", color: "gray", onClick: () => setShowCarousel(true), style: { fontSize: '0.75rem', height: '1.5rem' }, children: "New file comment" }) }));
18
+ return (_jsx(Box, { children: _jsx(Button, { variant: "subtle", color: "gray", onClick: () => setShowCarousel(true), style: { fontSize: '0.75rem', height: '1.5rem' }, children: "New file comment" }) }));
19
19
  }
20
- return (_jsx(ThreadCarousel, { threads: entryThreads, label: "Entry Comments", contextType: "entry", currentUserId: currentUserId, canResolve: canResolve, onAddComment: handleAddComment, onResolveThread: onResolveThread, autoFocus: autoFocus, autoOpenNewThread: showCarousel && entryThreads.length === 0, highlightThreadId: highlightThreadId }));
20
+ return (_jsx(ThreadCarousel, { threads: entryThreads, label: "Entry Comments", contextType: "entry", currentUserId: currentUserId, canResolve: canResolve, onAddComment: handleAddComment, onResolveThread: onResolveThread, autoFocus: autoFocus, autoOpenNewThread: showCarousel && entryThreads.length === 0, highlightThreadId: highlightThreadId, onGetUserMetadata: onGetUserMetadata }));
21
21
  };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { CommentThread } from '../../comment-store.js';
3
+ import type { UserSearchResult } from '../../auth/types.js';
3
4
  export interface FieldWrapperProps {
4
5
  /** Child form field element */
5
6
  children: React.ReactNode;
@@ -23,6 +24,8 @@ export interface FieldWrapperProps {
23
24
  fieldLabel?: string;
24
25
  /** Thread ID to highlight and scroll to */
25
26
  highlightThreadId?: string;
27
+ /** Resolves author ids to names; without it authors show as ids. */
28
+ onGetUserMetadata?: (userId: string) => Promise<UserSearchResult | null>;
26
29
  }
27
30
  /**
28
31
  * Wraps a form field with inline comment functionality.
@@ -7,7 +7,7 @@ import { ThreadCarousel } from './ThreadCarousel.js';
7
7
  * Wraps a form field with inline comment functionality.
8
8
  * Shows ThreadCarousel when comments exist or when user clicks "New comment".
9
9
  */
10
- export const FieldWrapper = ({ children, canopyPath, entryPath, threads, autoFocus, currentUserId, canResolve, onAddComment, onResolveThread, highlightThreadId, }) => {
10
+ export const FieldWrapper = ({ children, canopyPath, entryPath, threads, autoFocus, currentUserId, canResolve, onAddComment, onResolveThread, highlightThreadId, onGetUserMetadata, }) => {
11
11
  const wrapperRef = useRef(null);
12
12
  const [showCarousel, setShowCarousel] = useState(false);
13
13
  const shouldShowCarousel = threads.length > 0 || showCarousel;
@@ -32,5 +32,5 @@ export const FieldWrapper = ({ children, canopyPath, entryPath, threads, autoFoc
32
32
  top: 4,
33
33
  right: 8,
34
34
  zIndex: 1,
35
- }, children: _jsx(Button, { size: "xs", variant: "subtle", color: "gray", onClick: () => setShowCarousel(true), style: { fontSize: '0.75rem', height: '1.5rem' }, "data-testid": `field-new-comment-${canopyPath}`, children: "New comment" }) })), shouldShowCarousel && (_jsx(ThreadCarousel, { threads: threads, contextType: "field", currentUserId: currentUserId, canResolve: canResolve, onAddComment: handleAddComment, onResolveThread: onResolveThread, autoFocus: autoFocus, autoOpenNewThread: showCarousel && threads.length === 0, highlightThreadId: highlightThreadId, onCancelNewThread: () => setShowCarousel(false) }))] }));
35
+ }, children: _jsx(Button, { variant: "subtle", color: "gray", onClick: () => setShowCarousel(true), style: { fontSize: '0.75rem', height: '1.5rem' }, "data-testid": `field-new-comment-${canopyPath}`, children: "New comment" }) })), shouldShowCarousel && (_jsx(ThreadCarousel, { threads: threads, contextType: "field", currentUserId: currentUserId, canResolve: canResolve, onAddComment: handleAddComment, onResolveThread: onResolveThread, autoFocus: autoFocus, autoOpenNewThread: showCarousel && threads.length === 0, highlightThreadId: highlightThreadId, onGetUserMetadata: onGetUserMetadata, onCancelNewThread: () => setShowCarousel(false) }))] }));
36
36
  };
@@ -4,6 +4,7 @@ import { useState } from 'react';
4
4
  import { Alert, Badge, Button, Group, Paper, Stack, Text, Textarea } from '@mantine/core';
5
5
  import { IconAlertCircle } from '@tabler/icons-react';
6
6
  import { UserBadge } from '../components/UserBadge.js';
7
+ import { userIdLabel } from '../user-display.js';
7
8
  import { formatRelativeTime } from '../relative-time.js';
8
9
  /**
9
10
  * Individual comment thread display within the carousel.
@@ -56,5 +57,5 @@ export const InlineCommentThread = ({ thread, onAddReply, onResolve, currentUser
56
57
  borderTop: '1px solid var(--mantine-color-gray-3)',
57
58
  marginTop: 8,
58
59
  marginBottom: 8,
59
- } })), _jsxs(Stack, { gap: 4, children: [_jsxs(Group, { gap: "xs", justify: "space-between", children: [onGetUserMetadata ? (_jsx(UserBadge, { userId: comment.userId, getUserMetadata: onGetUserMetadata, variant: "avatar-name", size: "xs", showEmailTooltip: true, showBadge: true, badgeVariant: "light", color: "gray" })) : (_jsx(Text, { size: "xs", fw: 600, children: comment.userId })), _jsx(Text, { size: "xs", c: "dimmed", children: formatRelativeTime(comment.timestamp) })] }), _jsx(Text, { size: "sm", style: { whiteSpace: 'pre-wrap' }, children: comment.text })] })] }, comment.id))) }), error && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "red", variant: "light", onClose: () => setError(null), withCloseButton: true, children: error })), !thread.resolved && (_jsxs(Stack, { gap: "xs", children: [_jsx(Textarea, { placeholder: "Write a reply...", value: replyText, onChange: (e) => setReplyText(e.target.value), minRows: 2, disabled: isSubmitting }), _jsxs(Group, { gap: "xs", children: [_jsx(Button, { size: "xs", onClick: handleReply, loading: isSubmitting, disabled: !replyText.trim(), children: "Reply" }), canUserResolve() && (_jsx(Button, { size: "xs", variant: "light", color: "green", onClick: handleResolve, loading: isSubmitting, "data-testid": "resolve-thread-button", children: "Resolve" }))] })] })), thread.resolved && thread.resolvedBy && (_jsxs(Group, { gap: 4, children: [_jsx(Text, { size: "xs", c: "dimmed", fs: "italic", children: "Resolved by" }), onGetUserMetadata ? (_jsx(UserBadge, { userId: thread.resolvedBy, getUserMetadata: onGetUserMetadata, variant: "avatar-name", size: "xs", showEmailTooltip: true, showBadge: true, badgeVariant: "light", color: "gray" })) : (_jsx(Text, { size: "xs", c: "dimmed", fs: "italic", children: thread.resolvedBy })), thread.resolvedAt && (_jsx(Text, { size: "xs", c: "dimmed", fs: "italic", children: formatRelativeTime(thread.resolvedAt) }))] }))] }) }));
60
+ } })), _jsxs(Stack, { gap: 4, children: [_jsxs(Group, { gap: "xs", justify: "space-between", children: [onGetUserMetadata ? (_jsx(UserBadge, { userId: comment.userId, getUserMetadata: onGetUserMetadata, variant: "avatar-name", size: "xs", showEmailTooltip: true, showBadge: true, badgeVariant: "light", color: "gray" })) : (_jsx(Text, { size: "xs", fw: 600, children: userIdLabel(comment.userId) })), _jsx(Text, { size: "xs", c: "dimmed", children: formatRelativeTime(comment.timestamp) })] }), _jsx(Text, { size: "sm", style: { whiteSpace: 'pre-wrap' }, children: comment.text })] })] }, comment.id))) }), error && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "red", variant: "light", onClose: () => setError(null), withCloseButton: true, children: error })), !thread.resolved && (_jsxs(Stack, { gap: "xs", children: [_jsx(Textarea, { placeholder: "Write a reply...", value: replyText, onChange: (e) => setReplyText(e.target.value), minRows: 2, disabled: isSubmitting }), _jsxs(Group, { gap: "xs", children: [_jsx(Button, { onClick: handleReply, loading: isSubmitting, disabled: !replyText.trim(), children: "Reply" }), canUserResolve() && (_jsx(Button, { variant: "light", color: "green", onClick: handleResolve, loading: isSubmitting, "data-testid": "resolve-thread-button", children: "Resolve" }))] })] })), thread.resolved && thread.resolvedBy && (_jsxs(Group, { gap: 4, children: [_jsx(Text, { size: "xs", c: "dimmed", fs: "italic", children: "Resolved by" }), onGetUserMetadata ? (_jsx(UserBadge, { userId: thread.resolvedBy, getUserMetadata: onGetUserMetadata, variant: "avatar-name", size: "xs", showEmailTooltip: true, showBadge: true, badgeVariant: "light", color: "gray" })) : (_jsx(Text, { size: "xs", c: "dimmed", fs: "italic", children: userIdLabel(thread.resolvedBy) })), thread.resolvedAt && (_jsx(Text, { size: "xs", c: "dimmed", fs: "italic", children: formatRelativeTime(thread.resolvedAt) }))] }))] }) }));
60
61
  };
@@ -140,11 +140,11 @@ export const ThreadCarousel = ({ threads, label = 'Comments', contextType: _, cu
140
140
  }
141
141
  };
142
142
  const unresolvedCount = sortedThreads.filter((t) => !t.resolved).length;
143
- return (_jsx(Paper, { p: "sm", bg: "gray.0", style: { marginTop: 8 }, children: _jsxs(Stack, { gap: "xs", children: [_jsxs(Group, { justify: "space-between", align: "center", children: [_jsxs(Group, { gap: "xs", children: [_jsxs(Text, { size: "sm", fw: 600, children: [label, sortedThreads.length > 0 && ` (${sortedThreads.length})`] }), unresolvedCount > 0 && (_jsxs(Text, { size: "xs", c: "orange", fw: 600, children: [unresolvedCount, " unresolved"] }))] }), _jsxs(Group, { gap: "xs", children: [sortedThreads.length > 1 && (_jsxs(_Fragment, { children: [_jsx(ActionIcon, { size: "sm", variant: "subtle", onClick: handlePrevious, disabled: currentIndex === 0, children: _jsx(IconChevronLeft, { size: 16 }) }), _jsxs(Text, { size: "xs", fw: 500, children: [currentIndex + 1, "/", sortedThreads.length] }), _jsx(ActionIcon, { size: "sm", variant: "subtle", onClick: handleNext, disabled: currentIndex === sortedThreads.length - 1, children: _jsx(IconChevronRight, { size: 16 }) }), _jsx("div", { style: {
143
+ return (_jsx(Paper, { p: "sm", bg: "gray.0", style: { marginTop: 8 }, children: _jsxs(Stack, { gap: "xs", children: [_jsxs(Group, { justify: "space-between", align: "center", children: [_jsxs(Group, { gap: "xs", children: [_jsxs(Text, { size: "sm", fw: 600, children: [label, sortedThreads.length > 0 && ` (${sortedThreads.length})`] }), unresolvedCount > 0 && (_jsxs(Text, { size: "xs", c: "orange", fw: 600, children: [unresolvedCount, " unresolved"] }))] }), _jsxs(Group, { gap: "xs", children: [sortedThreads.length > 1 && (_jsxs(_Fragment, { children: [_jsx(ActionIcon, { variant: "subtle", onClick: handlePrevious, disabled: currentIndex === 0, children: _jsx(IconChevronLeft, { size: 16 }) }), _jsxs(Text, { size: "xs", fw: 500, children: [currentIndex + 1, "/", sortedThreads.length] }), _jsx(ActionIcon, { variant: "subtle", onClick: handleNext, disabled: currentIndex === sortedThreads.length - 1, children: _jsx(IconChevronRight, { size: 16 }) }), _jsx("div", { style: {
144
144
  width: 1,
145
145
  height: 16,
146
146
  background: 'var(--mantine-color-gray-4)',
147
- } })] })), _jsx(Button, { size: "xs", variant: "light", onClick: () => setShowNewThreadBox(!showNewThreadBox), children: "+ New" })] })] }), error && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "red", variant: "light", onClose: () => setError(null), withCloseButton: true, children: error })), showNewThreadBox && (_jsx(Paper, { withBorder: true, p: "sm", bg: "white", children: _jsxs(Stack, { gap: "xs", children: [_jsx(Textarea, { placeholder: "Start a new thread...", value: newThreadText, onChange: (e) => setNewThreadText(e.target.value), minRows: 2, disabled: isSubmitting, autoFocus: true, "data-testid": "new-thread-textarea" }), _jsxs(Group, { gap: "xs", children: [_jsx(Button, { size: "xs", onClick: handleCreateNewThread, loading: isSubmitting, disabled: !newThreadText.trim(), "data-testid": "create-thread-button", children: "Create Thread" }), _jsx(Button, { size: "xs", variant: "subtle", onClick: () => {
147
+ } })] })), _jsx(Button, { variant: "light", onClick: () => setShowNewThreadBox(!showNewThreadBox), children: "+ New" })] })] }), error && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "red", variant: "light", onClose: () => setError(null), withCloseButton: true, children: error })), showNewThreadBox && (_jsx(Paper, { withBorder: true, p: "sm", bg: "white", children: _jsxs(Stack, { gap: "xs", children: [_jsx(Textarea, { placeholder: "Start a new thread...", value: newThreadText, onChange: (e) => setNewThreadText(e.target.value), minRows: 2, disabled: isSubmitting, autoFocus: true, "data-testid": "new-thread-textarea" }), _jsxs(Group, { gap: "xs", children: [_jsx(Button, { onClick: handleCreateNewThread, loading: isSubmitting, disabled: !newThreadText.trim(), "data-testid": "create-thread-button", children: "Create Thread" }), _jsx(Button, { variant: "subtle", onClick: () => {
148
148
  setShowNewThreadBox(false);
149
149
  onCancelNewThread?.();
150
150
  }, children: "Cancel" })] })] }) })), sortedThreads.length > 0 && (_jsxs("div", { style: {
@@ -6,5 +6,5 @@ import { Modal, Button, Text, Group, Stack } from '@mantine/core';
6
6
  * Provides a clear warning UI with red/danger theme.
7
7
  */
8
8
  export function ConfirmDeleteModal({ isOpen, title, message, confirmLabel = 'Delete', onConfirm, onClose, loading = false, children, }) {
9
- return (_jsx(Modal, { opened: isOpen, onClose: onClose, title: title, centered: true, size: "md", children: _jsxs(Stack, { gap: "md", "data-testid": "confirm-delete-modal", children: [_jsx(Text, { size: "sm", children: message }), children, _jsxs(Group, { justify: "flex-end", gap: "sm", children: [_jsx(Button, { variant: "default", onClick: onClose, disabled: loading, children: "Cancel" }), _jsx(Button, { color: "red", onClick: onConfirm, loading: loading, "data-testid": "confirm-delete-submit", children: confirmLabel })] })] }) }));
9
+ return (_jsx(Modal, { opened: isOpen, onClose: onClose, title: title, centered: true, size: "md", children: _jsxs(Stack, { gap: "md", "data-testid": "confirm-delete-modal", children: [_jsx(Text, { size: "sm", children: message }), children, _jsxs(Group, { justify: "flex-end", gap: "sm", children: [_jsx(Button, { size: "sm", variant: "default", onClick: onClose, disabled: loading, children: "Cancel" }), _jsx(Button, { size: "sm", color: "red", onClick: onConfirm, loading: loading, "data-testid": "confirm-delete-submit", children: confirmLabel })] })] }) }));
10
10
  }
@@ -19,4 +19,4 @@ export const entriesUrl = (href) => {
19
19
  * provider, the editor's having gone with the crash. Edits made before the crash are in the
20
20
  * browser's draft store, so a reload offers them; the edit whose render crashed is not.
21
21
  */
22
- export const EditorCrashBoundary = ({ themeOptions, children }) => (_jsx(EditorErrorBoundary, { context: { boundary: 'editor' }, fallback: (caught) => (_jsx(CanopyCMSProvider, { ...themeOptions, withNotifications: false, children: _jsx(Center, { mih: "100vh", p: "md", "data-testid": "editor-crash-screen", children: _jsx(Paper, { withBorder: true, radius: "md", p: "xl", maw: 560, children: _jsxs(Stack, { gap: "md", children: [_jsxs(Group, { gap: "sm", children: [_jsx(IconAlertTriangle, { size: 24, color: "var(--mantine-color-red-6)" }), _jsx(Title, { order: 3, children: "The editor stopped working" })] }), _jsx(Text, { size: "sm", children: "Something went wrong while showing this page. Unsaved changes made before the error are kept in this browser and come back when the editor opens again." }), _jsx(Text, { size: "sm", children: "Reload to try again. If it happens again on the same entry, go back to the list of entries and copy the error details for whoever looks after the site." }), _jsxs(Group, { gap: "sm", children: [_jsx(Button, { leftSection: _jsx(IconRefresh, { size: 16 }), onClick: () => window.location.reload(), children: "Reload" }), _jsx(Button, { variant: "default", leftSection: _jsx(IconArrowLeft, { size: 16 }), onClick: () => window.location.assign(entriesUrl(window.location.href)), children: "Back to entries" }), _jsx(CopyErrorDetailsButton, { caught: caught, size: "sm" })] })] }) }) }) })), children: children }));
22
+ export const EditorCrashBoundary = ({ themeOptions, children }) => (_jsx(EditorErrorBoundary, { context: { boundary: 'editor' }, fallback: (caught) => (_jsx(CanopyCMSProvider, { ...themeOptions, withNotifications: false, children: _jsx(Center, { mih: "100vh", p: "md", "data-testid": "editor-crash-screen", children: _jsx(Paper, { withBorder: true, p: "xl", maw: 560, children: _jsxs(Stack, { gap: "md", children: [_jsxs(Group, { gap: "sm", children: [_jsx(IconAlertTriangle, { size: 24, color: "var(--mantine-color-red-6)" }), _jsx(Title, { order: 3, children: "The editor stopped working" })] }), _jsx(Text, { size: "sm", children: "Something went wrong while showing this page. Unsaved changes made before the error are kept in this browser and come back when the editor opens again." }), _jsx(Text, { size: "sm", children: "Reload to try again. If it happens again on the same entry, go back to the list of entries and copy the error details for whoever looks after the site." }), _jsxs(Group, { gap: "sm", children: [_jsx(Button, { size: "sm", leftSection: _jsx(IconRefresh, { size: 16 }), onClick: () => window.location.reload(), children: "Reload" }), _jsx(Button, { size: "sm", variant: "default", leftSection: _jsx(IconArrowLeft, { size: 16 }), onClick: () => window.location.assign(entriesUrl(window.location.href)), children: "Back to entries" }), _jsx(CopyErrorDetailsButton, { caught: caught, size: "sm" })] })] }) }) }) })), children: children }));
@@ -100,6 +100,8 @@ export interface EditorHeaderProps {
100
100
  * Whether the current entry has unsaved changes.
101
101
  */
102
102
  hasUnsavedChanges: boolean;
103
+ /** Writing drafts to localStorage failed, so they live only in this tab. */
104
+ draftStorageFailed?: boolean;
103
105
  /**
104
106
  * Current branch status (undefined if unknown).
105
107
  */
@@ -1,27 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
- import { Alert, Badge, Box, Button, Group, Menu, Paper, Stack, Text, Title, Tooltip, } from '@mantine/core';
3
+ import { Alert, Badge, Box, Button, Group, Indicator, Menu, Paper, Stack, Text, Title, Tooltip, VisuallyHidden, } from '@mantine/core';
4
4
  import { IconFolderOpen, IconChevronDown, IconGitBranch, IconLock } from '@tabler/icons-react';
5
5
  import { clientOperatingStrategy } from '../../operating-mode/client.js';
6
6
  import { isAdmin, isReviewer } from '../../authorization/helpers.js';
7
- /**
8
- * Status color map matching BranchManager.tsx pattern.
9
- * Returns the Mantine color string for a given branch status.
10
- */
11
- const getStatusColor = (status) => {
12
- const statusColorMap = {
13
- editing: 'brand',
14
- submitted: 'green',
15
- approved: 'teal',
16
- archived: 'gray',
17
- };
18
- return statusColorMap[status] ?? 'gray';
19
- };
7
+ import { branchStatusPresentation } from '../branch-status.js';
8
+ import { SYSTEM_USER_ID } from '../../system-users.js';
20
9
  /**
21
10
  * Header component for the Editor.
22
11
  * Contains site info, file navigation, breadcrumbs, branch selector, comments button, and action buttons.
23
12
  */
24
- export const EditorHeader = forwardRef(function EditorHeader({ siteTitle, siteSubtitle, headerTitle, currentEntry, branchName, operatingMode, busy, breadcrumbSegments, editedFiles, modifiedCount, unresolvedCommentCount: _, comments, onNavigatorOpen, onFileReload, onFileDiscardDraft, onEntrySelect, onBranchReloadData, onBranchDiscardDrafts, onBranchManagerOpen, onCommentsPanelOpen, onSave, onSubmit, hasUnsavedChanges, branchStatus, onWithdraw, userContext, branchCreatedBy, branchAccess, branchIsProtected = false, branchReadOnly = false, branchWriteBlocked = false, }, ref) {
13
+ export const EditorHeader = forwardRef(function EditorHeader({ siteTitle, siteSubtitle, headerTitle, currentEntry, branchName, operatingMode, busy, breadcrumbSegments, editedFiles, modifiedCount, unresolvedCommentCount: _, comments, onNavigatorOpen, onFileReload, onFileDiscardDraft, onEntrySelect, onBranchReloadData, onBranchDiscardDrafts, onBranchManagerOpen, onCommentsPanelOpen, onSave, onSubmit, hasUnsavedChanges, draftStorageFailed = false, branchStatus, onWithdraw, userContext, branchCreatedBy, branchAccess, branchIsProtected = false, branchReadOnly = false, branchWriteBlocked = false, }, ref) {
25
14
  // `branchWriteBlocked` is the server's own answer (getBranchProtection), so
26
15
  // Save is never enabled for a write the API would reject; a client-side
27
16
  // derivation could drift from it. `branchReadOnly` only picks which banner
@@ -35,36 +24,26 @@ export const EditorHeader = forwardRef(function EditorHeader({ siteTitle, siteSu
35
24
  // status: 'editing', which would otherwise assert a lock the status
36
25
  // contradicts). In both cases the banner says data is unavailable instead.
37
26
  const branchDataUnavailable = statusLocked && (branchStatus === undefined || branchStatus === 'editing');
27
+ const statusPresentation = branchStatusPresentation(branchStatus, branchIsProtected);
28
+ const unresolvedCount = comments.filter((t) => !t.resolved).length;
38
29
  return (_jsx(Paper, { ref: ref, shadow: "md", withBorder: true, radius: 0, px: 0, py: 0, style: {
39
30
  position: 'fixed',
40
31
  top: 0,
41
32
  left: 0,
42
33
  right: 0,
43
34
  zIndex: 70,
44
- }, children: _jsxs(Box, { px: "md", py: "sm", children: [_jsxs(Group, { justify: "space-between", align: "center", wrap: "nowrap", children: [_jsxs(Stack, { gap: 2, style: { minWidth: 0 }, children: [_jsx(Title, { order: 5, style: { lineHeight: 1.1 }, children: siteTitle }), siteSubtitle && (_jsx(Text, { size: "xs", c: "dimmed", children: siteSubtitle }))] }), _jsxs(Stack, { gap: 6, style: { minWidth: 0, flex: 1, alignItems: 'center' }, children: [_jsx(Title, { order: 4, style: { lineHeight: 1.1 }, children: headerTitle }), _jsxs(Group, { gap: "sm", wrap: "wrap", align: "center", style: { minWidth: 0, justifyContent: 'center' }, children: [_jsxs(Menu, { withinPortal: true, shadow: "sm", children: [_jsx(Menu.Target, { children: _jsx(Button, { "data-testid": "file-dropdown-button", variant: "outline", color: "gray", size: "xs", leftSection: _jsx(IconFolderOpen, { size: 16 }), rightSection: _jsx(IconChevronDown, { size: 14 }), children: currentEntry?.label ?? 'No file selected' }) }), _jsxs(Menu.Dropdown, { children: [_jsx(Menu.Item, { onClick: onFileReload, disabled: !branchName || !currentEntry, children: "Reload File" }), _jsx(Menu.Item, { "data-testid": "discard-file-draft-menu-item", onClick: onFileDiscardDraft, disabled: !currentEntry, children: "Discard File Draft" }), _jsx(Menu.Divider, {}), _jsx(Menu.Item, { "data-testid": "all-files-menu-item", onClick: onNavigatorOpen, children: "All Files" }), _jsx(Menu.Divider, {}), _jsx(Menu.Label, { children: "Recently modified" }), editedFiles.slice(0, 3).length === 0 ? (_jsx(Menu.Item, { disabled: true, children: "<none>" })) : (editedFiles.slice(0, 3).map((file) => (_jsx(Menu.Item, { onClick: () => {
35
+ }, children: _jsxs(Box, { px: "md", py: "sm", children: [_jsxs(Group, { justify: "space-between", align: "center", wrap: "nowrap", children: [_jsxs(Stack, { gap: 2, style: { minWidth: 0 }, children: [_jsx(Title, { order: 5, style: { lineHeight: 1.1 }, children: siteTitle }), siteSubtitle && (_jsx(Text, { size: "xs", c: "dimmed", children: siteSubtitle }))] }), _jsxs(Stack, { gap: 6, style: { minWidth: 0, flex: 1, alignItems: 'center' }, children: [_jsx(Title, { order: 4, style: { lineHeight: 1.1 }, children: headerTitle }), _jsxs(Group, { gap: "sm", wrap: "wrap", align: "center", style: { minWidth: 0, justifyContent: 'center' }, children: [_jsxs(Menu, { withinPortal: true, shadow: "sm", children: [_jsx(Menu.Target, { children: _jsx(Button, { "data-testid": "file-dropdown-button", variant: "outline", color: "gray", leftSection: _jsx(IconFolderOpen, { size: 16 }), rightSection: _jsx(IconChevronDown, { size: 14 }), children: currentEntry?.label ?? 'No file selected' }) }), _jsxs(Menu.Dropdown, { children: [_jsx(Menu.Item, { onClick: onFileReload, disabled: !branchName || !currentEntry, children: "Reload File" }), _jsx(Menu.Item, { "data-testid": "discard-file-draft-menu-item", onClick: onFileDiscardDraft, disabled: !currentEntry, children: "Discard File Draft" }), _jsx(Menu.Divider, {}), _jsx(Menu.Item, { "data-testid": "all-files-menu-item", onClick: onNavigatorOpen, children: "All Files" }), _jsx(Menu.Divider, {}), _jsx(Menu.Label, { children: "Recently modified" }), editedFiles.slice(0, 3).length === 0 ? (_jsx(Menu.Item, { disabled: true, children: "<none>" })) : (editedFiles.slice(0, 3).map((file) => (_jsx(Menu.Item, { onClick: () => {
45
36
  onEntrySelect(file.path);
46
37
  onNavigatorOpen();
47
- }, children: file.label }, file.path))))] })] }), _jsx(Group, { gap: 4, wrap: "wrap", align: "center", style: { minWidth: 0 }, children: breadcrumbSegments.map((segment, idx) => (_jsxs(Group, { gap: 4, align: "center", wrap: "nowrap", children: [idx > 0 && (_jsx(Text, { size: "xs", c: "dimmed", children: "/" })), _jsx(Button, { variant: "subtle", size: "xs", px: "xs", onClick: onNavigatorOpen, children: segment })] }, `${segment}-${idx}`))) }), _jsxs(Menu, { withinPortal: true, shadow: "sm", children: [_jsx(Menu.Target, { children: _jsx(Button, { variant: "outline", color: "gray", size: "xs", leftSection: _jsx(IconGitBranch, { size: 16 }), rightSection: _jsx(IconChevronDown, { size: 14 }), loading: !branchName && busy, "data-testid": "branch-dropdown-button", children: branchName || (busy ? 'Loading branches…' : 'No branch selected') }) }), _jsxs(Menu.Dropdown, { "data-testid": "branch-menu", children: [_jsx(Menu.Item, { onClick: onBranchReloadData, disabled: !branchName, children: "Reload All Files" }), _jsx(Menu.Item, { onClick: onBranchDiscardDrafts, disabled: !branchName, children: "Discard All File Drafts" }), _jsx(Menu.Divider, {}), _jsx(Menu.Item, { onClick: onBranchManagerOpen, "data-testid": "manage-branches-menu-item", children: "Change / Manage Branches" }), _jsx(Menu.Divider, {}), _jsx(Menu.Label, { children: `${modifiedCount} file${modifiedCount === 1 ? '' : 's'} modified` }), editedFiles.length === 0 ? (_jsx(Menu.Item, { disabled: true, children: "No edited files yet" })) : (editedFiles.map((file) => (_jsx(Menu.Item, { onClick: () => {
38
+ }, children: file.label }, file.path))))] })] }), _jsx(Group, { gap: 4, wrap: "wrap", align: "center", style: { minWidth: 0 }, children: breadcrumbSegments.map((segment, idx) => (_jsxs(Group, { gap: 4, align: "center", wrap: "nowrap", children: [idx > 0 && (_jsx(Text, { size: "xs", c: "dimmed", children: "/" })), _jsx(Button, { variant: "subtle", px: "xs", onClick: onNavigatorOpen, children: segment })] }, `${segment}-${idx}`))) }), _jsxs(Menu, { withinPortal: true, shadow: "sm", children: [_jsx(Menu.Target, { children: _jsx(Button, { variant: "outline", color: "gray", leftSection: _jsx(IconGitBranch, { size: 16 }), rightSection: _jsx(IconChevronDown, { size: 14 }), loading: !branchName && busy, "data-testid": "branch-dropdown-button", children: branchName || (busy ? 'Loading branches…' : 'No branch selected') }) }), _jsxs(Menu.Dropdown, { "data-testid": "branch-menu", children: [_jsx(Menu.Item, { onClick: onBranchReloadData, disabled: !branchName, children: "Reload All Files" }), _jsx(Menu.Item, { "data-testid": "discard-all-drafts-menu-item", onClick: onBranchDiscardDrafts, disabled: !branchName, children: "Discard All File Drafts" }), _jsx(Menu.Divider, {}), _jsx(Menu.Item, { onClick: onBranchManagerOpen, "data-testid": "manage-branches-menu-item", children: "Change / Manage Branches" }), _jsx(Menu.Divider, {}), _jsx(Menu.Label, { children: `${modifiedCount} file${modifiedCount === 1 ? '' : 's'} modified` }), editedFiles.length === 0 ? (_jsx(Menu.Item, { disabled: true, children: "No edited files yet" })) : (editedFiles.map((file) => (_jsx(Menu.Item, { onClick: () => {
48
39
  onEntrySelect(file.path);
49
40
  onNavigatorOpen();
50
41
  }, children: file.label }, `branch-mod-${file.path}`))))] })] }), clientOperatingStrategy(operatingMode ?? 'prod').supportsStatusBadge() &&
51
42
  branchName &&
52
- branchStatus && (_jsx(Badge, { color: getStatusColor(branchStatus), variant: "light", size: "sm", "data-testid": `header-status-badge-${branchStatus}`, children: branchStatus })), clientOperatingStrategy(operatingMode ?? 'prod').supportsComments() &&
53
- branchName && (_jsxs(Button, { variant: "outline", color: "gray", size: "xs", onClick: onCommentsPanelOpen, style: { position: 'relative' }, "data-testid": "comments-button", children: ["Comments", comments.filter((t) => !t.resolved).length > 0 && (_jsx("span", { style: {
54
- position: 'absolute',
55
- top: -6,
56
- right: -6,
57
- background: 'var(--mantine-color-grape-6)',
58
- color: 'white',
59
- borderRadius: '50%',
60
- width: 18,
61
- height: 18,
62
- fontSize: 10,
63
- display: 'flex',
64
- alignItems: 'center',
65
- justifyContent: 'center',
66
- fontWeight: 600,
67
- }, children: comments.filter((t) => !t.resolved).length }))] }))] })] }), _jsxs(Group, { gap: "xs", wrap: "nowrap", children: [_jsx(Tooltip, { label: branchReadOnly
43
+ statusPresentation && (_jsx(Badge, { color: statusPresentation.color, variant: statusPresentation.variant, size: "sm", "data-testid": `header-status-badge-${branchIsProtected ? 'protected' : branchStatus}`, "data-status": branchIsProtected ? 'protected' : branchStatus, children: statusPresentation.label })), clientOperatingStrategy(operatingMode ?? 'prod').supportsComments() &&
44
+ branchName && (_jsx(Indicator, { label: _jsx("span", { "data-testid": "comments-unresolved-count", children: unresolvedCount }), size: 18, color: "brand", disabled: unresolvedCount === 0, styles: { indicator: { pointerEvents: 'none' } }, children: _jsx(Button, { variant: "outline", color: "gray", onClick: onCommentsPanelOpen, "data-testid": "comments-button", "aria-label": unresolvedCount > 0 ? `Comments, ${unresolvedCount} unresolved` : undefined, children: "Comments" }) }))] })] }), _jsxs(Group, { gap: "xs", wrap: "nowrap", children: [_jsx(Box, { role: "status", w: 112, ta: "right", children: hasUnsavedChanges && (_jsx(Tooltip, { label: "Your browser couldn't store these changes. Save before you leave or reload, or they'll be lost.", disabled: !draftStorageFailed, multiline: true, w: 260, children: _jsxs(Text, { size: "xs", lh: 1.2, c: draftStorageFailed ? 'red.9' : 'gray.7', "data-testid": "unsaved-indicator", children: [draftStorageFailed
45
+ ? 'Unsaved · not kept on this device'
46
+ : 'Unsaved · kept on this device', draftStorageFailed && (_jsx(VisuallyHidden, { component: "span", children: ". Save before you leave or reload, or they'll be lost." }))] }) })) }), _jsx(Tooltip, { label: branchReadOnly
68
47
  ? 'The base branch is read-only'
69
48
  : branchDataUnavailable
70
49
  ? 'Branch details are still loading — saving is disabled until they arrive'
@@ -100,7 +79,7 @@ export const EditorHeader = forwardRef(function EditorHeader({ siteTitle, siteSu
100
79
  // server's canPerformWorkflowAction (BranchManager.tsx), which is the
101
80
  // actual enforcer; this only decides whether to show the control disabled.
102
81
  const userIsCreator = userContext?.userId === branchCreatedBy;
103
- const isSystemBranch = branchCreatedBy === 'canopycms-system' && !branchIsProtected;
82
+ const isSystemBranch = branchCreatedBy === SYSTEM_USER_ID && !branchIsProtected;
104
83
  const userInACL = userContext &&
105
84
  branchAccess &&
106
85
  (branchAccess.allowedUsers?.includes(userContext.userId) ||
@@ -126,9 +105,9 @@ export const EditorHeader = forwardRef(function EditorHeader({ siteTitle, siteSu
126
105
  : !userHasPermission
127
106
  ? 'You do not have permission to submit or withdraw this branch'
128
107
  : '', disabled: canPerformAction, children: _jsx(Button, { size: "sm", color: isWithdrawable ? 'orange' : 'brand', onClick: isWithdrawable ? onWithdraw : onSubmit, disabled: !branchName || busy || !canPerformAction, "data-testid": isWithdrawable ? 'withdraw-button' : 'submit-button', children: isWithdrawable ? 'Withdraw Branch...' : 'Submit Branch...' }) }));
129
- })()] })] }), branchReadOnly && (_jsx(Alert, { icon: _jsx(IconLock, { size: 16 }), color: "yellow", variant: "light", mt: "sm", "data-testid": "protected-branch-banner", children: _jsxs(Group, { justify: "space-between", align: "center", gap: "sm", wrap: "wrap", children: [_jsx(Text, { size: "sm", children: `You are viewing the protected base branch "${branchName}". Content is read-only — create a branch to make changes.` }), _jsx(Button, { size: "xs", variant: "light", color: "yellow", onClick: onBranchManagerOpen, children: "Create a branch" })] }) })), statusLocked && (_jsx(Alert, { icon: _jsx(IconLock, { size: 16 }), color: "yellow", variant: "light", mt: "sm", "data-testid": "status-locked-banner", children: _jsxs(Group, { justify: "space-between", align: "center", gap: "sm", wrap: "wrap", children: [_jsx(Text, { size: "sm", children: branchDataUnavailable
108
+ })()] })] }), branchReadOnly && (_jsx(Alert, { icon: _jsx(IconLock, { size: 16 }), color: "yellow", variant: "light", mt: "sm", "data-testid": "protected-branch-banner", children: _jsxs(Group, { justify: "space-between", align: "center", gap: "sm", wrap: "wrap", children: [_jsx(Text, { size: "sm", children: `You are viewing the protected base branch "${branchName}". Content is read-only — create a branch to make changes.` }), _jsx(Button, { variant: "default", onClick: onBranchManagerOpen, children: "Create a branch" })] }) })), statusLocked && (_jsx(Alert, { icon: _jsx(IconLock, { size: 16 }), color: "yellow", variant: "light", mt: "sm", "data-testid": "status-locked-banner", children: _jsxs(Group, { justify: "space-between", align: "center", gap: "sm", wrap: "wrap", children: [_jsx(Text, { size: "sm", children: branchDataUnavailable
130
109
  ? `Branch details for "${branchName}" could not be loaded, so content is locked until they arrive. Use Manage Branches to retry.`
131
110
  : branchStatus === 'submitted'
132
111
  ? `Branch "${branchName}" is submitted for review and locked for edits. Use Withdraw Branch above to resume editing.`
133
- : `Branch "${branchName}" is ${branchStatus} — content is read-only.` }), _jsx(Button, { size: "xs", variant: "light", color: "yellow", onClick: onBranchManagerOpen, children: "Manage Branches" })] }) }))] }) }));
112
+ : `Branch "${branchName}" is ${branchStatus} — content is read-only.` }), _jsx(Button, { variant: "default", onClick: onBranchManagerOpen, children: "Manage Branches" })] }) }))] }) }));
134
113
  });
@@ -34,13 +34,12 @@ export interface EditorSidebarProps {
34
34
  */
35
35
  onHighlightToggle: () => void;
36
36
  /**
37
- * Callback when permission manager should be opened.
37
+ * Opens the permission manager. Admin-only like `onSystemHealthOpen`: the menu item renders
38
+ * only when this is provided.
38
39
  */
39
- onPermissionManagerOpen: () => void;
40
- /**
41
- * Callback when group manager should be opened.
42
- */
43
- onGroupManagerOpen: () => void;
40
+ onPermissionManagerOpen?: () => void;
41
+ /** Opens the group manager. Admin-only; the menu item renders only when this is provided. */
42
+ onGroupManagerOpen?: () => void;
44
43
  /**
45
44
  * Callback when the media library should be opened.
46
45
  */
@@ -32,7 +32,7 @@ export function EditorSidebar({ layout, highlightEnabled, previewMarksNothing =
32
32
  ? true
33
33
  : previewInexactMarks.length > 0
34
34
  ? undefined
35
- : false, position: "left", multiline: true, w: 240, withArrow: true, children: _jsx(Indicator, { label: previewInexactMarks.length, size: 16, color: "orange", disabled: !highlightEnabled || previewInexactMarks.length === 0, children: _jsx(ActionIcon, { variant: highlightEnabled ? 'filled' : 'subtle', color: highlightEnabled ? 'brand' : 'gray', size: "lg", radius: "md", "aria-pressed": highlightEnabled, "aria-label": "Toggle highlights", "aria-description": highlightEnabled && previewInexactMarks.length > 0
35
+ : false, position: "left", multiline: true, w: 240, withArrow: true, children: _jsx(Indicator, { label: previewInexactMarks.length, size: 16, color: "orange", disabled: !highlightEnabled || previewInexactMarks.length === 0, children: _jsx(ActionIcon, { variant: highlightEnabled ? 'filled' : 'subtle', color: highlightEnabled ? 'brand' : 'gray', size: "lg", radius: "md", "aria-pressed": highlightEnabled, "aria-label": "Toggle highlights", "data-testid": "toggle-highlights-button", "aria-description": highlightEnabled && previewInexactMarks.length > 0
36
36
  ? inexactMarksNote(previewInexactMarks)
37
- : undefined, onClick: onHighlightToggle, children: _jsx(IconMarquee, { size: 18 }) }) }) })] }), _jsxs(Stack, { gap: "xs", align: "center", children: [_jsxs(Menu, { shadow: "md", width: 200, position: "left", children: [_jsx(Menu.Target, { children: _jsx(ActionIcon, { variant: "subtle", size: "lg", radius: "md", "aria-label": "Settings", children: _jsx(IconSettings, { size: 18 }) }) }), _jsxs(Menu.Dropdown, { children: [_jsx(Menu.Label, { children: "Settings" }), _jsx(Menu.Item, { onClick: onPermissionManagerOpen, children: "Manage Permissions" }), _jsx(Menu.Item, { onClick: onGroupManagerOpen, children: "Manage Groups" }), _jsx(Menu.Item, { leftSection: _jsx(IconPhoto, { size: 14 }), onClick: onMediaLibraryOpen, children: "Media library" }), onSystemHealthOpen && (_jsx(Menu.Item, { leftSection: _jsx(IconActivity, { size: 14 }), onClick: onSystemHealthOpen, children: "System health" }))] })] }), AccountComponent ? (_jsx(AccountComponent, {})) : (_jsxs(_Fragment, { children: [onAccountClick && (_jsx(ActionIcon, { variant: "subtle", size: "lg", radius: "md", "aria-label": "Account", onClick: onAccountClick, children: _jsx(IconUserCircle, { size: 18 }) })), onLogoutClick && (_jsx(ActionIcon, { variant: "subtle", size: "lg", radius: "md", "aria-label": "Sign out", onClick: onLogoutClick, children: _jsx(IconLogout, { size: 18 }) }))] }))] })] }));
37
+ : undefined, onClick: onHighlightToggle, children: _jsx(IconMarquee, { size: 18 }) }) }) })] }), _jsxs(Stack, { gap: "xs", align: "center", children: [_jsxs(Menu, { shadow: "md", width: 200, position: "left", children: [_jsx(Menu.Target, { children: _jsx(ActionIcon, { variant: "subtle", size: "lg", radius: "md", "aria-label": "Settings", "data-testid": "settings-button", children: _jsx(IconSettings, { size: 18 }) }) }), _jsxs(Menu.Dropdown, { "data-testid": "settings-menu", children: [_jsx(Menu.Label, { children: "Settings" }), onPermissionManagerOpen && (_jsx(Menu.Item, { "data-testid": "settings-menu-permissions", onClick: onPermissionManagerOpen, children: "Manage Permissions" })), onGroupManagerOpen && (_jsx(Menu.Item, { "data-testid": "settings-menu-groups", onClick: onGroupManagerOpen, children: "Manage Groups" })), _jsx(Menu.Item, { "data-testid": "settings-menu-media-library", leftSection: _jsx(IconPhoto, { size: 14 }), onClick: onMediaLibraryOpen, children: "Media library" }), onSystemHealthOpen && (_jsx(Menu.Item, { "data-testid": "settings-menu-system-health", leftSection: _jsx(IconActivity, { size: 14 }), onClick: onSystemHealthOpen, children: "System health" }))] })] }), AccountComponent ? (_jsx(AccountComponent, {})) : (_jsxs(_Fragment, { children: [onAccountClick && (_jsx(ActionIcon, { variant: "subtle", size: "lg", radius: "md", "aria-label": "Account", onClick: onAccountClick, children: _jsx(IconUserCircle, { size: 18 }) })), onLogoutClick && (_jsx(ActionIcon, { variant: "subtle", size: "lg", radius: "md", "aria-label": "Sign out", onClick: onLogoutClick, children: _jsx(IconLogout, { size: 18 }) }))] }))] })] }));
38
38
  }