@prenta/admin 2.16.7 → 2.17.2

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 (275) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/AdminRoot.d.ts.map +1 -1
  3. package/dist/AdminRoot.js +31 -3
  4. package/dist/AdminRoot.js.map +1 -1
  5. package/dist/__tests__/components/attribution-rows.test.js +12 -3
  6. package/dist/__tests__/components/attribution-rows.test.js.map +1 -1
  7. package/dist/__tests__/components/command-palette-links.render.test.d.ts +2 -0
  8. package/dist/__tests__/components/command-palette-links.render.test.d.ts.map +1 -0
  9. package/dist/__tests__/components/command-palette-links.render.test.js +73 -0
  10. package/dist/__tests__/components/command-palette-links.render.test.js.map +1 -0
  11. package/dist/__tests__/components/live-preview-pane.render.test.d.ts +2 -0
  12. package/dist/__tests__/components/live-preview-pane.render.test.d.ts.map +1 -0
  13. package/dist/__tests__/components/live-preview-pane.render.test.js +45 -0
  14. package/dist/__tests__/components/live-preview-pane.render.test.js.map +1 -0
  15. package/dist/__tests__/components/schedule-publish-dialog.render.test.d.ts +2 -0
  16. package/dist/__tests__/components/schedule-publish-dialog.render.test.d.ts.map +1 -0
  17. package/dist/__tests__/components/schedule-publish-dialog.render.test.js +78 -0
  18. package/dist/__tests__/components/schedule-publish-dialog.render.test.js.map +1 -0
  19. package/dist/__tests__/fields/field-renderer-null.render.test.js +7 -0
  20. package/dist/__tests__/fields/field-renderer-null.render.test.js.map +1 -1
  21. package/dist/__tests__/layout/layout-command-palette.render.test.d.ts +2 -0
  22. package/dist/__tests__/layout/layout-command-palette.render.test.d.ts.map +1 -0
  23. package/dist/__tests__/layout/layout-command-palette.render.test.js +54 -0
  24. package/dist/__tests__/layout/layout-command-palette.render.test.js.map +1 -0
  25. package/dist/__tests__/layout/shell-nav.render.test.js +106 -27
  26. package/dist/__tests__/layout/shell-nav.render.test.js.map +1 -1
  27. package/dist/__tests__/lib/api-error.test.d.ts +2 -0
  28. package/dist/__tests__/lib/api-error.test.d.ts.map +1 -0
  29. package/dist/__tests__/lib/api-error.test.js +32 -0
  30. package/dist/__tests__/lib/api-error.test.js.map +1 -0
  31. package/dist/__tests__/lib/api.test.js +29 -0
  32. package/dist/__tests__/lib/api.test.js.map +1 -1
  33. package/dist/__tests__/lib/collection-routes.test.js +19 -1
  34. package/dist/__tests__/lib/collection-routes.test.js.map +1 -1
  35. package/dist/__tests__/lib/document-editor-path.test.d.ts +2 -0
  36. package/dist/__tests__/lib/document-editor-path.test.d.ts.map +1 -0
  37. package/dist/__tests__/lib/document-editor-path.test.js +42 -0
  38. package/dist/__tests__/lib/document-editor-path.test.js.map +1 -0
  39. package/dist/__tests__/lib/fetch-all-pages.test.js +11 -1
  40. package/dist/__tests__/lib/fetch-all-pages.test.js.map +1 -1
  41. package/dist/__tests__/lib/forms-service-rate-limit.test.d.ts +2 -0
  42. package/dist/__tests__/lib/forms-service-rate-limit.test.d.ts.map +1 -0
  43. package/dist/__tests__/lib/forms-service-rate-limit.test.js +19 -0
  44. package/dist/__tests__/lib/forms-service-rate-limit.test.js.map +1 -0
  45. package/dist/__tests__/lib/useApiData.test.js +20 -0
  46. package/dist/__tests__/lib/useApiData.test.js.map +1 -1
  47. package/dist/__tests__/test-env-storage.test.d.ts +2 -0
  48. package/dist/__tests__/test-env-storage.test.d.ts.map +1 -0
  49. package/dist/__tests__/test-env-storage.test.js +28 -0
  50. package/dist/__tests__/test-env-storage.test.js.map +1 -0
  51. package/dist/__tests__/views/account-setup-gate.render.test.d.ts +2 -0
  52. package/dist/__tests__/views/account-setup-gate.render.test.d.ts.map +1 -0
  53. package/dist/__tests__/views/account-setup-gate.render.test.js +103 -0
  54. package/dist/__tests__/views/account-setup-gate.render.test.js.map +1 -0
  55. package/dist/__tests__/views/collection-editor-redirect.render.test.d.ts +2 -0
  56. package/dist/__tests__/views/collection-editor-redirect.render.test.d.ts.map +1 -0
  57. package/dist/__tests__/views/collection-editor-redirect.render.test.js +168 -0
  58. package/dist/__tests__/views/collection-editor-redirect.render.test.js.map +1 -0
  59. package/dist/__tests__/views/collection-list-nav.render.test.js +33 -0
  60. package/dist/__tests__/views/collection-list-nav.render.test.js.map +1 -1
  61. package/dist/__tests__/views/dashboard.test.js +50 -0
  62. package/dist/__tests__/views/dashboard.test.js.map +1 -1
  63. package/dist/__tests__/views/form-entries.render.test.js +7 -0
  64. package/dist/__tests__/views/form-entries.render.test.js.map +1 -1
  65. package/dist/__tests__/views/forms-list.render.test.js +12 -0
  66. package/dist/__tests__/views/forms-list.render.test.js.map +1 -1
  67. package/dist/__tests__/views/login-mfa.render.test.js +33 -0
  68. package/dist/__tests__/views/login-mfa.render.test.js.map +1 -1
  69. package/dist/__tests__/views/posts-list-view.render.test.js +31 -0
  70. package/dist/__tests__/views/posts-list-view.render.test.js.map +1 -1
  71. package/dist/__tests__/views/rate-limited-views.render.test.d.ts +2 -0
  72. package/dist/__tests__/views/rate-limited-views.render.test.d.ts.map +1 -0
  73. package/dist/__tests__/views/rate-limited-views.render.test.js +148 -0
  74. package/dist/__tests__/views/rate-limited-views.render.test.js.map +1 -0
  75. package/dist/__tests__/views/script-tags.render.test.js +42 -0
  76. package/dist/__tests__/views/script-tags.render.test.js.map +1 -1
  77. package/dist/__tests__/views/trash.render.test.js +40 -1
  78. package/dist/__tests__/views/trash.render.test.js.map +1 -1
  79. package/dist/components/CommandPalette.d.ts +9 -1
  80. package/dist/components/CommandPalette.d.ts.map +1 -1
  81. package/dist/components/CommandPalette.js +21 -7
  82. package/dist/components/CommandPalette.js.map +1 -1
  83. package/dist/components/LivePreview.d.ts.map +1 -1
  84. package/dist/components/LivePreview.js +10 -2
  85. package/dist/components/LivePreview.js.map +1 -1
  86. package/dist/components/MediaPickerModal.d.ts.map +1 -1
  87. package/dist/components/MediaPickerModal.js +2 -2
  88. package/dist/components/MediaPickerModal.js.map +1 -1
  89. package/dist/components/SchedulePublishDialog.d.ts +7 -1
  90. package/dist/components/SchedulePublishDialog.d.ts.map +1 -1
  91. package/dist/components/SchedulePublishDialog.js +6 -5
  92. package/dist/components/SchedulePublishDialog.js.map +1 -1
  93. package/dist/fields/FieldRenderer.d.ts.map +1 -1
  94. package/dist/fields/FieldRenderer.js +2 -0
  95. package/dist/fields/FieldRenderer.js.map +1 -1
  96. package/dist/fields/JsonField.d.ts +12 -0
  97. package/dist/fields/JsonField.d.ts.map +1 -0
  98. package/dist/fields/JsonField.js +11 -0
  99. package/dist/fields/JsonField.js.map +1 -0
  100. package/dist/layout/Header.d.ts +7 -1
  101. package/dist/layout/Header.d.ts.map +1 -1
  102. package/dist/layout/Header.js +2 -2
  103. package/dist/layout/Header.js.map +1 -1
  104. package/dist/layout/Layout.d.ts.map +1 -1
  105. package/dist/layout/Layout.js +1 -1
  106. package/dist/layout/Layout.js.map +1 -1
  107. package/dist/layout/MobileTabBar.d.ts +7 -4
  108. package/dist/layout/MobileTabBar.d.ts.map +1 -1
  109. package/dist/layout/MobileTabBar.js +41 -17
  110. package/dist/layout/MobileTabBar.js.map +1 -1
  111. package/dist/lib/api-error.d.ts +23 -0
  112. package/dist/lib/api-error.d.ts.map +1 -0
  113. package/dist/lib/api-error.js +42 -0
  114. package/dist/lib/api-error.js.map +1 -0
  115. package/dist/lib/api.d.ts +6 -0
  116. package/dist/lib/api.d.ts.map +1 -1
  117. package/dist/lib/api.js +10 -0
  118. package/dist/lib/api.js.map +1 -1
  119. package/dist/lib/collection-routes.d.ts +8 -0
  120. package/dist/lib/collection-routes.d.ts.map +1 -1
  121. package/dist/lib/collection-routes.js +12 -0
  122. package/dist/lib/collection-routes.js.map +1 -1
  123. package/dist/lib/document-editor-path.d.ts +32 -0
  124. package/dist/lib/document-editor-path.d.ts.map +1 -0
  125. package/dist/lib/document-editor-path.js +75 -0
  126. package/dist/lib/document-editor-path.js.map +1 -0
  127. package/dist/lib/entry-attribution.d.ts.map +1 -1
  128. package/dist/lib/entry-attribution.js +6 -4
  129. package/dist/lib/entry-attribution.js.map +1 -1
  130. package/dist/lib/fetch-all-pages.d.ts.map +1 -1
  131. package/dist/lib/fetch-all-pages.js +4 -2
  132. package/dist/lib/fetch-all-pages.js.map +1 -1
  133. package/dist/lib/forms-service.d.ts.map +1 -1
  134. package/dist/lib/forms-service.js +3 -1
  135. package/dist/lib/forms-service.js.map +1 -1
  136. package/dist/lib/jobs-service.d.ts.map +1 -1
  137. package/dist/lib/jobs-service.js +4 -11
  138. package/dist/lib/jobs-service.js.map +1 -1
  139. package/dist/lib/posts-service.d.ts.map +1 -1
  140. package/dist/lib/posts-service.js +3 -1
  141. package/dist/lib/posts-service.js.map +1 -1
  142. package/dist/lib/useApiData.d.ts.map +1 -1
  143. package/dist/lib/useApiData.js +8 -4
  144. package/dist/lib/useApiData.js.map +1 -1
  145. package/dist/prenta-admin.css +1 -1
  146. package/dist/router/index.d.ts +5 -1
  147. package/dist/router/index.d.ts.map +1 -1
  148. package/dist/router/index.js +13 -3
  149. package/dist/router/index.js.map +1 -1
  150. package/dist/views/AccountSetupGate.d.ts +17 -0
  151. package/dist/views/AccountSetupGate.d.ts.map +1 -0
  152. package/dist/views/AccountSetupGate.js +69 -0
  153. package/dist/views/AccountSetupGate.js.map +1 -0
  154. package/dist/views/ApiKeys.js +1 -1
  155. package/dist/views/ApiKeys.js.map +1 -1
  156. package/dist/views/CollectionList.d.ts.map +1 -1
  157. package/dist/views/CollectionList.js +2 -2
  158. package/dist/views/CollectionList.js.map +1 -1
  159. package/dist/views/Dashboard.d.ts.map +1 -1
  160. package/dist/views/Dashboard.js +5 -3
  161. package/dist/views/Dashboard.js.map +1 -1
  162. package/dist/views/DocumentEdit.d.ts.map +1 -1
  163. package/dist/views/DocumentEdit.js +1 -1
  164. package/dist/views/DocumentEdit.js.map +1 -1
  165. package/dist/views/Forms.d.ts.map +1 -1
  166. package/dist/views/Forms.js +4 -1
  167. package/dist/views/Forms.js.map +1 -1
  168. package/dist/views/Login.d.ts.map +1 -1
  169. package/dist/views/Login.js +50 -2
  170. package/dist/views/Login.js.map +1 -1
  171. package/dist/views/MediaBrowser.d.ts.map +1 -1
  172. package/dist/views/MediaBrowser.js +2 -2
  173. package/dist/views/MediaBrowser.js.map +1 -1
  174. package/dist/views/Pages/PagesListView.d.ts.map +1 -1
  175. package/dist/views/Pages/PagesListView.js +10 -8
  176. package/dist/views/Pages/PagesListView.js.map +1 -1
  177. package/dist/views/Pages.d.ts.map +1 -1
  178. package/dist/views/Pages.js +1 -1
  179. package/dist/views/Pages.js.map +1 -1
  180. package/dist/views/Posts/PostsListView.d.ts.map +1 -1
  181. package/dist/views/Posts/PostsListView.js +7 -6
  182. package/dist/views/Posts/PostsListView.js.map +1 -1
  183. package/dist/views/Redirects.d.ts.map +1 -1
  184. package/dist/views/Redirects.js +1 -1
  185. package/dist/views/Redirects.js.map +1 -1
  186. package/dist/views/ScriptTags.d.ts.map +1 -1
  187. package/dist/views/ScriptTags.js +3 -1
  188. package/dist/views/ScriptTags.js.map +1 -1
  189. package/dist/views/Trash.d.ts +10 -11
  190. package/dist/views/Trash.d.ts.map +1 -1
  191. package/dist/views/Trash.js +17 -16
  192. package/dist/views/Trash.js.map +1 -1
  193. package/dist/views/Users.d.ts.map +1 -1
  194. package/dist/views/Users.js +1 -1
  195. package/dist/views/Users.js.map +1 -1
  196. package/dist/views/entries/EntriesInbox.d.ts.map +1 -1
  197. package/dist/views/entries/EntriesInbox.js +1 -1
  198. package/dist/views/entries/EntriesInbox.js.map +1 -1
  199. package/dist/views/page-editor/PageSectionEditor.d.ts.map +1 -1
  200. package/dist/views/page-editor/PageSectionEditor.js +1 -1
  201. package/dist/views/page-editor/PageSectionEditor.js.map +1 -1
  202. package/dist/views/post-editor/PostSectionEditor.d.ts.map +1 -1
  203. package/dist/views/post-editor/PostSectionEditor.js +1 -1
  204. package/dist/views/post-editor/PostSectionEditor.js.map +1 -1
  205. package/dist/views/profile/AccountSecurity.d.ts +5 -1
  206. package/dist/views/profile/AccountSecurity.d.ts.map +1 -1
  207. package/dist/views/profile/AccountSecurity.js +2 -1
  208. package/dist/views/profile/AccountSecurity.js.map +1 -1
  209. package/package.json +6 -6
  210. package/src/AdminRoot.tsx +53 -6
  211. package/src/__tests__/components/attribution-rows.test.ts +13 -3
  212. package/src/__tests__/components/command-palette-links.render.test.tsx +89 -0
  213. package/src/__tests__/components/live-preview-pane.render.test.tsx +62 -0
  214. package/src/__tests__/components/schedule-publish-dialog.render.test.tsx +100 -0
  215. package/src/__tests__/fields/field-renderer-null.render.test.tsx +16 -0
  216. package/src/__tests__/layout/layout-command-palette.render.test.tsx +69 -0
  217. package/src/__tests__/layout/shell-nav.render.test.tsx +181 -29
  218. package/src/__tests__/lib/api-error.test.ts +45 -0
  219. package/src/__tests__/lib/api.test.ts +47 -0
  220. package/src/__tests__/lib/collection-routes.test.ts +22 -0
  221. package/src/__tests__/lib/document-editor-path.test.ts +67 -0
  222. package/src/__tests__/lib/fetch-all-pages.test.ts +14 -1
  223. package/src/__tests__/lib/forms-service-rate-limit.test.ts +25 -0
  224. package/src/__tests__/lib/useApiData.test.ts +24 -0
  225. package/src/__tests__/test-env-storage.test.ts +28 -0
  226. package/src/__tests__/views/account-setup-gate.render.test.tsx +122 -0
  227. package/src/__tests__/views/collection-editor-redirect.render.test.tsx +197 -0
  228. package/src/__tests__/views/collection-list-nav.render.test.tsx +36 -0
  229. package/src/__tests__/views/dashboard.test.tsx +67 -0
  230. package/src/__tests__/views/form-entries.render.test.tsx +10 -0
  231. package/src/__tests__/views/forms-list.render.test.tsx +15 -0
  232. package/src/__tests__/views/login-mfa.render.test.tsx +42 -0
  233. package/src/__tests__/views/posts-list-view.render.test.tsx +33 -0
  234. package/src/__tests__/views/rate-limited-views.render.test.tsx +163 -0
  235. package/src/__tests__/views/script-tags.render.test.tsx +43 -0
  236. package/src/__tests__/views/trash.render.test.tsx +42 -1
  237. package/src/components/CommandPalette.tsx +32 -5
  238. package/src/components/LivePreview.tsx +13 -2
  239. package/src/components/MediaPickerModal.tsx +18 -1
  240. package/src/components/SchedulePublishDialog.tsx +15 -4
  241. package/src/fields/FieldRenderer.tsx +2 -0
  242. package/src/fields/JsonField.tsx +34 -0
  243. package/src/layout/Header.tsx +8 -1
  244. package/src/layout/Layout.tsx +6 -1
  245. package/src/layout/MobileTabBar.tsx +57 -28
  246. package/src/lib/api-error.ts +47 -0
  247. package/src/lib/api.ts +17 -0
  248. package/src/lib/collection-routes.ts +15 -0
  249. package/src/lib/document-editor-path.ts +97 -0
  250. package/src/lib/entry-attribution.ts +6 -4
  251. package/src/lib/fetch-all-pages.ts +4 -1
  252. package/src/lib/forms-service.ts +4 -2
  253. package/src/lib/jobs-service.ts +4 -10
  254. package/src/lib/posts-service.ts +3 -1
  255. package/src/lib/useApiData.ts +10 -4
  256. package/src/router/index.ts +25 -7
  257. package/src/views/AccountSetupGate.tsx +198 -0
  258. package/src/views/ApiKeys.tsx +1 -1
  259. package/src/views/CollectionList.tsx +7 -4
  260. package/src/views/Dashboard.tsx +5 -3
  261. package/src/views/DocumentEdit.tsx +1 -0
  262. package/src/views/Forms.tsx +27 -22
  263. package/src/views/Login.tsx +54 -2
  264. package/src/views/MediaBrowser.tsx +12 -8
  265. package/src/views/Pages/PagesListView.tsx +16 -11
  266. package/src/views/Pages.tsx +6 -3
  267. package/src/views/Posts/PostsListView.tsx +28 -19
  268. package/src/views/Redirects.tsx +7 -4
  269. package/src/views/ScriptTags.tsx +7 -3
  270. package/src/views/Trash.tsx +29 -16
  271. package/src/views/Users.tsx +7 -4
  272. package/src/views/entries/EntriesInbox.tsx +10 -7
  273. package/src/views/page-editor/PageSectionEditor.tsx +1 -0
  274. package/src/views/post-editor/PostSectionEditor.tsx +1 -0
  275. package/src/views/profile/AccountSecurity.tsx +7 -1
@@ -376,3 +376,70 @@ describe('Dashboard KPI grid', () => {
376
376
  expect(screen.queryByRole('button', { name: /Conversion rate/ })).toBeNull()
377
377
  })
378
378
  })
379
+
380
+ // Issue 1206: the canvas editors' own routes, never a route that redirects.
381
+ describe('Dashboard editor links (#1206)', () => {
382
+ const fieldsNamed = (...names: string[]) => names.map((name) => ({ name, type: 'text' }))
383
+ const postFields = fieldsNamed(
384
+ 'title',
385
+ 'sections',
386
+ 'excerpt',
387
+ 'featuredImage',
388
+ 'body',
389
+ 'category',
390
+ 'tags',
391
+ 'publishDate',
392
+ 'metaTitle',
393
+ 'metaDescription',
394
+ )
395
+ const pageFields = fieldsNamed('title', 'sections', 'path', 'metaTitle', 'metaDescription')
396
+
397
+ it.each([
398
+ ['with the canvas fields', postFields, pageFields, '/posts/articles/new', '/pages/new'],
399
+ [
400
+ 'missing the canvas fields',
401
+ fieldsNamed('title'),
402
+ fieldsNamed('title'),
403
+ '/articles/new',
404
+ '/pages/new',
405
+ ],
406
+ ])(
407
+ 'sends New Post and New Page to their create routes %s',
408
+ (_kind, articleFields, pagesFields, postTo, pageTo) => {
409
+ const onNavigate = vi.fn()
410
+ const config = {
411
+ collections: [
412
+ { slug: 'articles', type: 'post', fields: articleFields },
413
+ { slug: 'pages', type: 'page', fields: pagesFields },
414
+ ],
415
+ }
416
+ render(<Dashboard config={config} session={{}} onNavigate={onNavigate} />)
417
+ fireEvent.click(screen.getByRole('button', { name: 'New Post' }))
418
+ expect(onNavigate).toHaveBeenLastCalledWith(postTo)
419
+ fireEvent.click(screen.getByRole('button', { name: 'New Page' }))
420
+ expect(onNavigate).toHaveBeenLastCalledWith(pageTo)
421
+ },
422
+ )
423
+
424
+ it('opens a recent document of a Posts-group collection missing the post fields in the generic editor', () => {
425
+ const onNavigate = vi.fn()
426
+ responses['/stats'] = statsResult({
427
+ recentDocuments: [
428
+ {
429
+ id: 'n1',
430
+ title: 'A note',
431
+ status: 'DRAFT',
432
+ collection: 'notes',
433
+ updatedAt: new Date().toISOString(),
434
+ author: 'Sam',
435
+ },
436
+ ],
437
+ })
438
+ const config = {
439
+ collections: [{ slug: 'notes', admin: { group: 'Posts' }, fields: fieldsNamed('title') }],
440
+ }
441
+ render(<Dashboard config={config} session={{}} onNavigate={onNavigate} />)
442
+ fireEvent.click(screen.getByRole('button', { name: /A note/ }))
443
+ expect(onNavigate).toHaveBeenCalledWith('/notes/n1')
444
+ })
445
+ })
@@ -457,3 +457,13 @@ it('keeps a surname visible when the contact header only displays the first name
457
457
  expect(within(submission).getByText('jordan@example.com')).toBeTruthy()
458
458
  expect(within(submission).queryByRole('button', { name: /Show all fields/ })).toBeNull()
459
459
  })
460
+
461
+ /** Issue 1209: a rate-limited first load says when to retry and shows no "Showing 0 of 0". */
462
+ it('shows the busy message and no entry count when the first load is rate limited', async () => {
463
+ fetchEntries.mockRejectedValueOnce(
464
+ new Error('Too many requests right now. Try again in 30 seconds.'),
465
+ )
466
+ render(<FormEntries onNavigate={() => {}} />)
467
+ expect((await screen.findByRole('alert')).textContent).toContain('Try again in 30 seconds')
468
+ expect(screen.queryByText(/Showing/)).toBeNull()
469
+ })
@@ -322,3 +322,18 @@ describe('Forms header chips', () => {
322
322
  await waitFor(() => expect(onNavigate).toHaveBeenCalledWith('/forms'))
323
323
  })
324
324
  })
325
+
326
+ /** Issue 1209: a rate-limited load must not read as zero forms and zero entries. */
327
+ describe('Forms rate-limited load', () => {
328
+ it('shows the error and no count chips or segment counts', async () => {
329
+ fetchForms.mockRejectedValueOnce(
330
+ new Error('Too many requests right now. Try again in 30 seconds.'),
331
+ )
332
+ render(<Forms onNavigate={() => {}} />)
333
+ expect((await screen.findByRole('alert')).textContent).toContain('Try again in 30 seconds')
334
+ expect(screen.queryByText('total entries')).toBeNull()
335
+ expect(screen.queryByText('unread')).toBeNull()
336
+ expect(screen.queryByRole('tab', { name: 'All 0' })).toBeNull()
337
+ expect(screen.getByRole('tab', { name: 'All' })).toBeTruthy()
338
+ })
339
+ })
@@ -93,3 +93,45 @@ describe('Login — MFA challenge', () => {
93
93
  expect(screen.queryByText('Two-factor authentication')).toBeNull()
94
94
  })
95
95
  })
96
+
97
+ describe('Login — arriving from an OAuth callback (#1251)', () => {
98
+ it('opens the code step on ?mfa=totp and verifies with the cookie-held token', async () => {
99
+ window.history.replaceState(null, '', '/admin?mfa=totp')
100
+ const onLogin = vi.fn()
101
+ const onVerifyTotp = vi.fn(async () => ({ success: true }))
102
+
103
+ render(<Login onLogin={onLogin} onVerifyTotp={onVerifyTotp} />)
104
+
105
+ await screen.findByText('Two-factor authentication')
106
+ expect(window.location.search).toBe('')
107
+
108
+ fireEvent.change(screen.getByLabelText('Authentication code'), { target: { value: '123456' } })
109
+ fireEvent.click(screen.getByRole('button', { name: 'Verify' }))
110
+
111
+ // Empty token: the server reads the HttpOnly prenta_mfa_pending cookie.
112
+ await waitFor(() => expect(onVerifyTotp).toHaveBeenCalledWith('', '123456'))
113
+ expect(onLogin).not.toHaveBeenCalled()
114
+ })
115
+
116
+ it('shows a known account-state error from ?error=', async () => {
117
+ window.history.replaceState(null, '', '/admin?error=Account%20is%20suspended')
118
+ render(<Login onLogin={vi.fn()} />)
119
+ await screen.findByText('Account is suspended')
120
+ expect(window.location.search).toBe('')
121
+ })
122
+
123
+ it('shows the fixed "no account" instruction from the callback', async () => {
124
+ const msg =
125
+ 'No account found for this email. Ask an administrator to invite you before signing in with OAuth.'
126
+ window.history.replaceState(null, '', `/admin?error=${encodeURIComponent(msg)}`)
127
+ render(<Login onLogin={vi.fn()} />)
128
+ await screen.findByText(msg)
129
+ })
130
+
131
+ it('replaces any other ?error= text with a generic line', async () => {
132
+ window.history.replaceState(null, '', '/admin?error=Call%20555-0100%20to%20unlock')
133
+ render(<Login onLogin={vi.fn()} />)
134
+ await screen.findByText('Sign-in with that provider did not complete. Try again.')
135
+ expect(screen.queryByText(/555-0100/)).toBeNull()
136
+ })
137
+ })
@@ -94,3 +94,36 @@ describe('PostsListView — page-scoped selection', () => {
94
94
  expect(ids).toHaveLength(2)
95
95
  })
96
96
  })
97
+
98
+ /**
99
+ * Issue 1206: with one post type the CTA linked to its top-level `/<slug>/new`,
100
+ * which now redirects to the post editor. It links to the post editor itself,
101
+ * so a click never lands on a redirect; a post type missing the post editor's
102
+ * fields keeps the generic create route.
103
+ */
104
+ describe('PostsListView — New Post CTA', () => {
105
+ const postFields = [
106
+ 'title',
107
+ 'sections',
108
+ 'excerpt',
109
+ 'featuredImage',
110
+ 'body',
111
+ 'category',
112
+ 'tags',
113
+ 'publishDate',
114
+ 'metaTitle',
115
+ 'metaDescription',
116
+ ].map((name) => ({ name, type: 'text' }))
117
+
118
+ it.each([
119
+ ['a post type with the post fields', postFields, '/posts/articles/new'],
120
+ ['a post type missing the post fields', [{ name: 'title', type: 'text' }], '/articles/new'],
121
+ ])('opens the create route for %s directly', async (_kind, fields, to) => {
122
+ const onNavigate = vi.fn()
123
+ const config = { collections: { articles: { slug: 'articles', type: 'post', fields } } }
124
+ render(<PostsListView onNavigate={onNavigate} config={config} />)
125
+ await screen.findByLabelText('Select "Alpha"')
126
+ fireEvent.click(screen.getAllByRole('button', { name: /New Post/ })[0]!)
127
+ expect(onNavigate).toHaveBeenCalledWith(to)
128
+ })
129
+ })
@@ -0,0 +1,163 @@
1
+ // @vitest-environment happy-dom
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest'
3
+ import { fireEvent, render, screen, waitFor } from '@testing-library/react'
4
+
5
+ /**
6
+ * Issue 1209: every list view that loads through `useApiData` must read a
7
+ * rate-limited (429) load as a busy state that says when to retry, never as
8
+ * an empty list or a zero count. The real `useApiData` and `fetchAllPages`
9
+ * run; only `cmsApi` is mocked, and it answers every request with a 429.
10
+ */
11
+
12
+ const LIMITED = { error: 'Too many requests', status: 429, retryAfterMs: 30_000 }
13
+ const BUSY = 'Try again in 30 seconds'
14
+
15
+ const cmsApi = vi.hoisted(() => vi.fn())
16
+ vi.mock('../../lib/api.js', () => ({
17
+ cmsApi,
18
+ getApiBase: () => '/api/cms',
19
+ ensureCsrfToken: vi.fn(async () => {}),
20
+ }))
21
+
22
+ vi.mock('sonner', () => ({
23
+ toast: Object.assign(vi.fn(), { error: vi.fn(), success: vi.fn(), info: vi.fn() }),
24
+ }))
25
+
26
+ const { __clearApiDataCache } = await import('../../lib/useApiData.js')
27
+ const { ApiKeys } = await import('../../views/ApiKeys.js')
28
+ const { CollectionList } = await import('../../views/CollectionList.js')
29
+ const { MediaBrowser } = await import('../../views/MediaBrowser.js')
30
+ const { Pages } = await import('../../views/Pages.js')
31
+ const { Redirects } = await import('../../views/Redirects.js')
32
+ const { Users } = await import('../../views/Users.js')
33
+ const { MediaPickerModal } = await import('../../components/MediaPickerModal.js')
34
+ const { PagesListView } = await import('../../views/Pages/PagesListView.js')
35
+ const { PostsListView } = await import('../../views/Posts/PostsListView.js')
36
+
37
+ /** The routed list views persist UI choices; give them a working storage. */
38
+ function stubStorage() {
39
+ const store = new Map<string, string>()
40
+ vi.stubGlobal('localStorage', {
41
+ getItem: (k: string) => store.get(k) ?? null,
42
+ setItem: (k: string, v: string) => void store.set(k, String(v)),
43
+ removeItem: (k: string) => void store.delete(k),
44
+ clear: () => store.clear(),
45
+ })
46
+ }
47
+
48
+ beforeEach(() => {
49
+ __clearApiDataCache()
50
+ cmsApi.mockReset()
51
+ cmsApi.mockResolvedValue(LIMITED)
52
+ })
53
+
54
+ /** Waits for the busy message, which is only shown once the load has settled. */
55
+ async function expectBusy() {
56
+ await waitFor(() => expect(screen.queryAllByText(new RegExp(BUSY)).length).toBeGreaterThan(0))
57
+ }
58
+
59
+ describe('rate-limited list views', () => {
60
+ it('CollectionList shows no "0 total" and no empty state', async () => {
61
+ const config = {
62
+ collections: {
63
+ posts: {
64
+ slug: 'posts',
65
+ labels: { singular: 'Post', plural: 'Posts' },
66
+ fields: { title: { type: 'text', label: 'Title' } },
67
+ },
68
+ },
69
+ }
70
+ render(<CollectionList collectionSlug="posts" config={config} onNavigate={() => {}} />)
71
+ await expectBusy()
72
+ expect(screen.queryByText(/\b0 total\b/)).toBeNull()
73
+ expect(screen.queryByText('No posts found')).toBeNull()
74
+ })
75
+
76
+ it('MediaBrowser shows no count chips and no empty state', async () => {
77
+ render(<MediaBrowser />)
78
+ await expectBusy()
79
+ expect(screen.queryByText('Total Files')).toBeNull()
80
+ expect(screen.queryByText('Storage used')).toBeNull()
81
+ expect(screen.queryByText('No media yet')).toBeNull()
82
+ })
83
+
84
+ it('ApiKeys shows no "No API keys yet" empty state', async () => {
85
+ render(<ApiKeys />)
86
+ await expectBusy()
87
+ expect(screen.queryByText('No API keys yet')).toBeNull()
88
+ })
89
+
90
+ it('Pages shows no "0 pages" count', async () => {
91
+ render(<Pages />)
92
+ await expectBusy()
93
+ expect(screen.queryByText(/\b0 pages\b/)).toBeNull()
94
+ })
95
+
96
+ it('Redirects shows no "0 total redirects" and no empty state', async () => {
97
+ render(<Redirects />)
98
+ await expectBusy()
99
+ expect(screen.queryByText(/total redirects/)).toBeNull()
100
+ expect(screen.queryByText('No redirects yet')).toBeNull()
101
+ })
102
+
103
+ it('Users shows no "0 people have access" line', async () => {
104
+ render(<Users />)
105
+ await expectBusy()
106
+ expect(screen.queryByText(/people have access/)).toBeNull()
107
+ })
108
+
109
+ it('MediaPickerModal shows the busy message with Retry, not "No images found"', async () => {
110
+ render(<MediaPickerModal open onClose={() => {}} onSelect={() => {}} />)
111
+ await expectBusy()
112
+ expect(screen.getByRole('alert').textContent).toContain(BUSY)
113
+ expect(screen.getByRole('button', { name: 'Retry' })).toBeTruthy()
114
+ expect(screen.queryByText(/No images found/)).toBeNull()
115
+ })
116
+
117
+ it('MediaPickerModal keeps Retry visible when a later search is rate limited', async () => {
118
+ // The first load succeeds; the search after it is refused.
119
+ cmsApi.mockResolvedValueOnce({
120
+ data: {
121
+ docs: [{ id: 'm1', filename: 'hero.png', mimeType: 'image/png', url: '/hero.png' }],
122
+ },
123
+ status: 200,
124
+ })
125
+ render(<MediaPickerModal open onClose={() => {}} onSelect={() => {}} />)
126
+ expect(await screen.findByTitle('hero.png')).toBeTruthy()
127
+
128
+ fireEvent.change(screen.getByLabelText('Search images'), { target: { value: 'logo' } })
129
+ await expectBusy()
130
+ // The last images stay, but the failure and Retry are not hidden behind them.
131
+ expect(screen.getByTitle('hero.png')).toBeTruthy()
132
+ expect(screen.getByRole('alert').textContent).toContain(BUSY)
133
+ expect(screen.getByRole('button', { name: 'Retry' })).toBeTruthy()
134
+ })
135
+
136
+ // The routed /pages and /posts screens load through their own services, not
137
+ // useApiData; a failed first load must not read as zero pages or posts.
138
+ it('PagesListView (the routed /pages screen) shows no zero counts', async () => {
139
+ stubStorage()
140
+ try {
141
+ render(<PagesListView onNavigate={() => {}} />)
142
+ await expectBusy()
143
+ expect(screen.queryByText(/\b0 pages?\b/)).toBeNull()
144
+ expect(screen.queryByText(/\b0 of 0\b/)).toBeNull()
145
+ expect(screen.queryByRole('navigation', { name: 'Pages pagination' })).toBeNull()
146
+ } finally {
147
+ vi.unstubAllGlobals()
148
+ }
149
+ })
150
+
151
+ it('PostsListView (the routed /posts screen) shows no zero counts', async () => {
152
+ stubStorage()
153
+ try {
154
+ render(<PostsListView onNavigate={() => {}} />)
155
+ await expectBusy()
156
+ expect(screen.queryByText(/\b0 total posts?\b/)).toBeNull()
157
+ expect(screen.queryByText(/\b0 results?\b/)).toBeNull()
158
+ expect(screen.queryByRole('navigation', { name: 'Posts pagination' })).toBeNull()
159
+ } finally {
160
+ vi.unstubAllGlobals()
161
+ }
162
+ })
163
+ })
@@ -216,3 +216,46 @@ describe('ScriptTags empty state', () => {
216
216
  ).toBeTruthy()
217
217
  })
218
218
  })
219
+
220
+ /** Issue 1209: a rate-limited load is a busy state, not an empty or filtered list. */
221
+ describe('ScriptTags rate-limited load', () => {
222
+ it('says when to retry and shows no empty or no-match state', async () => {
223
+ // The shared mock is typed by its success replies; this one is a 429.
224
+ const limited = { error: 'Too many requests', status: 429, retryAfterMs: 30_000 }
225
+ cmsApi.mockImplementationOnce((async () => limited) as unknown as typeof cmsApi)
226
+ render(<ScriptTags />)
227
+ const alert = await screen.findByRole('alert')
228
+ expect(alert.textContent).toContain('Try again in 30 seconds')
229
+ expect(screen.queryByText('No scripts match your filters')).toBeNull()
230
+ expect(screen.queryByText('No script tags yet')).toBeNull()
231
+ // A 429 is not retried on a timer: one request, then the busy state.
232
+ expect(cmsApi).toHaveBeenCalledTimes(1)
233
+ })
234
+
235
+ it('shows no "no match" state when a refresh is refused while a filter matches nothing', async () => {
236
+ const limited = { error: 'Too many requests', status: 429, retryAfterMs: 30_000 }
237
+ const original = cmsApi.getMockImplementation()!
238
+ let gets = 0
239
+ // The first list load succeeds; the refresh after a duplicate is refused.
240
+ cmsApi.mockImplementation((async (endpoint: string, init?: RequestInit) => {
241
+ if (!init?.method) return ++gets === 1 ? { data: TAGS } : limited
242
+ return original(endpoint, init)
243
+ }) as unknown as typeof original)
244
+ try {
245
+ render(<ScriptTags />)
246
+ await screen.findByText('Google Analytics 4')
247
+ fireEvent.click(screen.getByRole('button', { name: 'Duplicate Google Analytics 4' }))
248
+ expect((await screen.findByRole('alert')).textContent).toContain('Try again in 30 seconds')
249
+
250
+ // The last list is still in memory; a search that matches none of it is
251
+ // not "no scripts match" while the CMS could not be read.
252
+ fireEvent.change(screen.getByPlaceholderText('Search scripts…'), {
253
+ target: { value: 'zzz-no-match' },
254
+ })
255
+ await waitFor(() => expect(screen.queryByText('Google Analytics 4')).toBeNull())
256
+ expect(screen.queryByText('No scripts match your filters')).toBeNull()
257
+ } finally {
258
+ cmsApi.mockImplementation(original)
259
+ }
260
+ })
261
+ })
@@ -55,7 +55,48 @@ describe('Trash', () => {
55
55
 
56
56
  fireEvent.click(screen.getByRole('button', { name: 'Restore About' }))
57
57
  await waitFor(() => {
58
- expect(onNavigate).toHaveBeenCalledWith('/pages/p1')
58
+ expect(onNavigate).toHaveBeenCalledWith('/pages/p1/edit')
59
+ })
60
+ })
61
+
62
+ // Issue 1206: only the pages and posts slugs used to reach a canvas
63
+ // editor; any other post type fell through to the generic editor.
64
+ it.each([
65
+ ['a post type', 'articles', '/posts/articles/a1/edit'],
66
+ ['a post type defined by its Posts group', 'notes', '/posts/notes/a1/edit'],
67
+ // The post editor refuses a post type that lacks its fields; the generic
68
+ // editor is the only one left that can edit it.
69
+ ['a post type missing the post fields', 'drafts', '/collections/drafts/a1'],
70
+ ['a plain collection', 'faqs', '/collections/faqs/a1'],
71
+ ])('opens a restored document of %s in its own editor', async (_kind, slug, path) => {
72
+ cmsApi.mockImplementation(async (endpoint: string, options?: { method?: string }) => {
73
+ if (options?.method === 'POST' && String(endpoint).includes('/restore')) {
74
+ return { data: { document: { id: 'a1' }, slugConflict: false }, status: 200 }
75
+ }
76
+ if (String(endpoint).startsWith(`/collections/${slug}?`)) {
77
+ return {
78
+ data: {
79
+ docs: [{ id: 'a1', title: 'Launch notes', deletedAt: '2026-08-01T00:00:00.000Z' }],
80
+ },
81
+ status: 200,
82
+ }
83
+ }
84
+ return { data: { docs: [] }, status: 200 }
85
+ })
86
+ const config = {
87
+ collections: {
88
+ articles: { slug: 'articles', type: 'post' },
89
+ notes: { slug: 'notes', admin: { group: 'posts' } },
90
+ drafts: { slug: 'drafts', type: 'post', fields: [{ name: 'title', type: 'text' }] },
91
+ faqs: { slug: 'faqs' },
92
+ },
93
+ }
94
+
95
+ const onNavigate = vi.fn()
96
+ render(<Trash onNavigate={onNavigate} config={config} />)
97
+ fireEvent.click(await screen.findByRole('button', { name: 'Restore Launch notes' }))
98
+ await waitFor(() => {
99
+ expect(onNavigate).toHaveBeenCalledWith(path)
59
100
  })
60
101
  })
61
102
 
@@ -44,6 +44,8 @@ import {
44
44
  parseAiSlashCommand,
45
45
  } from '../lib/slash-command.js'
46
46
  import { getActiveEditor } from '../lib/active-editor.js'
47
+ import type { CollectionRouteMeta } from '../lib/collection-routes.js'
48
+ import { documentEditorPath } from '../lib/document-editor-path.js'
47
49
  import { CoauthorResultPopover } from './CoauthorResultPopover.js'
48
50
  import type { Editor } from '@tiptap/react'
49
51
 
@@ -190,9 +192,33 @@ export interface CommandPaletteProps {
190
192
  open: boolean
191
193
  onOpenChange: (open: boolean) => void
192
194
  onNavigate: (path: string) => void
195
+ /**
196
+ * The config's collections (keyed as in the config). A document result opens
197
+ * in its collection's editor: pages and post types in their canvas editors.
198
+ */
199
+ collections?: Record<string, CollectionRouteMeta & { slug?: string }>
193
200
  }
194
201
 
195
- export function CommandPalette({ open, onOpenChange, onNavigate }: CommandPaletteProps) {
202
+ /** Where a document search result opens, by its collection's type. */
203
+ function documentPath(
204
+ collections: CommandPaletteProps['collections'],
205
+ doc: SearchResultDocument,
206
+ ): string {
207
+ const meta = collections
208
+ ? (Object.values(collections).find((c) => c?.slug === doc.collection) ??
209
+ collections[doc.collection])
210
+ : undefined
211
+ // A plain collection keeps the `/collections/` route, which resolves even
212
+ // for a slug that a built-in route reserves at the top level.
213
+ return documentEditorPath({ collections }, meta, doc.collection, doc.id)
214
+ }
215
+
216
+ export function CommandPalette({
217
+ open,
218
+ onOpenChange,
219
+ onNavigate,
220
+ collections,
221
+ }: CommandPaletteProps) {
196
222
  const [search, setSearch] = useState('')
197
223
  const [documents, setDocuments] = useState<SearchResultDocument[]>([])
198
224
  const [media, setMedia] = useState<SearchResultMedia[]>([])
@@ -496,14 +522,15 @@ export function CommandPalette({ open, onOpenChange, onNavigate }: CommandPalett
496
522
  <Command.Item
497
523
  key={`doc-${doc.id}`}
498
524
  value={doc.title ?? doc.slug ?? doc.id}
499
- onSelect={() =>
500
- handleSelect(`/collections/${doc.collection}/${doc.id}`, {
525
+ onSelect={() => {
526
+ const path = documentPath(collections, doc)
527
+ handleSelect(path, {
501
528
  id: `doc-${doc.id}`,
502
529
  label: doc.title ?? doc.slug ?? doc.id,
503
- path: `/collections/${doc.collection}/${doc.id}`,
530
+ path,
504
531
  type: 'document',
505
532
  })
506
- }
533
+ }}
507
534
  className="hover:bg-accent data-[selected=true]:bg-muted flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2"
508
535
  >
509
536
  <FileText className="text-muted-foreground h-4 w-4" />
@@ -47,6 +47,15 @@ function postToIframe(
47
47
  iframe.contentWindow.postMessage({ type: 'prenta-preview-update', data }, targetOrigin)
48
48
  }
49
49
 
50
+ /**
51
+ * The pane fills its container (`h-full`, as it always has), but never grows
52
+ * past the visible viewport (`max-h-dvh`) and sticks to the top of the scroll
53
+ * area. Beside a form thousands of pixels tall it therefore stays in view and
54
+ * its empty-state hint is centred where it can be seen, not halfway down the
55
+ * form; in a container shorter than the viewport it is unchanged.
56
+ */
57
+ const PANE = 'sticky top-0 self-start h-full max-h-dvh'
58
+
50
59
  export function LivePreview({
51
60
  collection,
52
61
  documentId,
@@ -157,7 +166,9 @@ export function LivePreview({
157
166
 
158
167
  if (!previewSrc) {
159
168
  return (
160
- <div className="border-border bg-muted flex h-full flex-col items-center justify-center rounded-lg border border-dashed p-8">
169
+ <div
170
+ className={`border-border bg-muted flex flex-col items-center justify-center rounded-lg border border-dashed p-8 ${PANE}`}
171
+ >
161
172
  <p className="text-muted-foreground text-center text-sm">
162
173
  {!documentId
163
174
  ? 'Save the document first to enable preview'
@@ -174,7 +185,7 @@ export function LivePreview({
174
185
  }
175
186
 
176
187
  return (
177
- <div className="border-border bg-card flex h-full flex-col border-l">
188
+ <div className={`border-border bg-card flex flex-col border-l ${PANE}`}>
178
189
  <div className="border-border bg-muted flex items-center justify-between border-b px-3 py-2">
179
190
  <div className="flex items-center gap-1">
180
191
  {(
@@ -66,7 +66,7 @@ export function MediaPickerModal({
66
66
  const fileInputRef = useRef<HTMLInputElement>(null)
67
67
  const searchId = useId()
68
68
 
69
- const { data, loading, refetch } = useApiData<{ docs?: MediaItem[] }>(
69
+ const { data, loading, error, refetch } = useApiData<{ docs?: MediaItem[] }>(
70
70
  open ? `/media?pageSize=50${search ? `&search=${encodeURIComponent(search)}` : ''}` : null,
71
71
  )
72
72
 
@@ -203,10 +203,27 @@ export function MediaPickerModal({
203
203
  />
204
204
  </div>
205
205
 
206
+ {/* A failed refresh keeps the last images on screen: say so,
207
+ with Retry, since a 429 is not retried on its own. */}
208
+ {error && imageItems.length > 0 && !loading ? (
209
+ <div className="text-destructive mb-3 text-sm" role="alert">
210
+ {error}{' '}
211
+ <button type="button" className="underline" onClick={refetch}>
212
+ Retry
213
+ </button>
214
+ </div>
215
+ ) : null}
206
216
  {loading ? (
207
217
  <div className="flex items-center justify-center py-12">
208
218
  <Loader2 className="text-muted-foreground h-6 w-6 animate-spin" aria-hidden />
209
219
  </div>
220
+ ) : error && imageItems.length === 0 ? (
221
+ <div className="text-destructive py-12 text-center text-sm" role="alert">
222
+ {error}{' '}
223
+ <button type="button" className="underline" onClick={refetch}>
224
+ Retry
225
+ </button>
226
+ </div>
210
227
  ) : imageItems.length === 0 ? (
211
228
  <div className="text-muted-foreground py-12 text-center text-sm">
212
229
  No images found. Try uploading one.
@@ -10,6 +10,12 @@ import { adminPortalContainer } from '../lib/portal-container.js'
10
10
  export interface SchedulePublishDialogProps {
11
11
  collectionSlug: string
12
12
  documentId: string
13
+ /**
14
+ * The document's current status. A live (PUBLISHED) document has nothing
15
+ * to publish, and the server refuses a publish time for it, so the dialog
16
+ * leaves the publish time empty and disabled and ticks the unpublish option.
17
+ */
18
+ status?: string
13
19
  /** Existing scheduled publish time, if any. */
14
20
  scheduledAt?: string | null
15
21
  /** Existing scheduled unpublish time, if any. */
@@ -47,6 +53,7 @@ function defaultScheduleTime(): string {
47
53
  export function SchedulePublishDialog({
48
54
  collectionSlug,
49
55
  documentId,
56
+ status,
50
57
  scheduledAt,
51
58
  scheduledUnpublishAt,
52
59
  open,
@@ -62,13 +69,16 @@ export function SchedulePublishDialog({
62
69
  const unpublishAtId = useId()
63
70
 
64
71
  const hasExistingSchedule = Boolean(scheduledAt || scheduledUnpublishAt)
72
+ const live = status === 'PUBLISHED'
65
73
 
66
74
  useEffect(() => {
67
75
  if (!open) return
68
- setPublishAt(scheduledAt ? toLocalDateTimeInput(scheduledAt) : defaultScheduleTime())
76
+ setPublishAt(
77
+ live ? '' : scheduledAt ? toLocalDateTimeInput(scheduledAt) : defaultScheduleTime(),
78
+ )
69
79
  setUnpublishAt(scheduledUnpublishAt ? toLocalDateTimeInput(scheduledUnpublishAt) : '')
70
- setIncludeUnpublish(Boolean(scheduledUnpublishAt))
71
- }, [open, scheduledAt, scheduledUnpublishAt])
80
+ setIncludeUnpublish(live || Boolean(scheduledUnpublishAt))
81
+ }, [open, live, scheduledAt, scheduledUnpublishAt])
72
82
 
73
83
  async function handleSave() {
74
84
  if (!publishAt && !(includeUnpublish && unpublishAt)) {
@@ -174,9 +184,10 @@ export function SchedulePublishDialog({
174
184
  id={publishAtId}
175
185
  type="datetime-local"
176
186
  value={publishAt}
187
+ disabled={live}
177
188
  onChange={(e) => setPublishAt(e.target.value)}
178
189
  min={toLocalDateTimeInput(new Date(Date.now() + 60 * 1000))}
179
- className="border-input bg-background text-foreground focus:border-ring focus:ring-ring w-full rounded-md border py-2 pr-3 pl-9 text-sm focus:ring-1 focus:outline-none"
190
+ className="border-input bg-background text-foreground focus:border-ring focus:ring-ring w-full rounded-md border py-2 pr-3 pl-9 text-sm focus:ring-1 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
180
191
  />
181
192
  </div>
182
193
  <p className="text-muted-foreground text-xs">
@@ -14,6 +14,7 @@ import { GroupField } from './GroupField.js'
14
14
  import { NavBuilderField } from './NavBuilderField.js'
15
15
  import { NumberField } from './NumberField.js'
16
16
  import { ComponentBlockField } from './ComponentBlockField.js'
17
+ import { JsonField } from './JsonField.js'
17
18
 
18
19
  interface FieldDefinition {
19
20
  name: string
@@ -58,6 +59,7 @@ const FIELD_MAP: Record<string, React.ComponentType<any>> = {
58
59
  nav: NavBuilderField,
59
60
  number: NumberField,
60
61
  componentBlock: ComponentBlockField,
62
+ json: JsonField,
61
63
  }
62
64
 
63
65
  export function FieldRenderer({ field, value, onChange }: FieldRendererProps) {