@conloca/cms-spa 0.2.1 → 0.2.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.
- package/dist/spa/main.css +17 -3
- package/dist/ts/App.d.ts +5 -1
- package/dist/ts/App.d.ts.map +1 -1
- package/dist/ts/App.js +7 -2
- package/dist/ts/App.js.map +1 -1
- package/dist/ts/components/CMSDashboard.d.ts.map +1 -1
- package/dist/ts/components/CMSDashboard.js +6 -2
- package/dist/ts/components/CMSDashboard.js.map +1 -1
- package/dist/ts/components/RouteErrorPage.d.ts +11 -0
- package/dist/ts/components/RouteErrorPage.d.ts.map +1 -0
- package/dist/ts/components/RouteErrorPage.js +44 -0
- package/dist/ts/components/RouteErrorPage.js.map +1 -0
- package/dist/ts/components/cards/DataEntryCard.d.ts +1 -1
- package/dist/ts/components/cards/DataEntryCard.d.ts.map +1 -1
- package/dist/ts/components/cards/SectionCard.d.ts +1 -1
- package/dist/ts/components/cards/SectionCard.d.ts.map +1 -1
- package/dist/ts/components/dashboard/RecentActivity.d.ts.map +1 -1
- package/dist/ts/components/dashboard/RecentActivity.js +2 -8
- package/dist/ts/components/dashboard/RecentActivity.js.map +1 -1
- package/dist/ts/components/dialogs/CreateDataDialog.js +2 -2
- package/dist/ts/components/dialogs/CreateDataDialog.js.map +1 -1
- package/dist/ts/components/dialogs/CreateFolderDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/CreateFolderDialog.js +2 -1
- package/dist/ts/components/dialogs/CreateFolderDialog.js.map +1 -1
- package/dist/ts/components/dialogs/CreatePageFlow.d.ts +13 -0
- package/dist/ts/components/dialogs/CreatePageFlow.d.ts.map +1 -0
- package/dist/ts/components/dialogs/CreatePageFlow.js +100 -0
- package/dist/ts/components/dialogs/CreatePageFlow.js.map +1 -0
- package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts +1 -1
- package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/DataPropertiesDialog.js +2 -2
- package/dist/ts/components/dialogs/DataPropertiesDialog.js.map +1 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts +1 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +2 -2
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.js +2 -2
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.js.map +1 -1
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts +1 -1
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/PageMetadataDialog.d.ts +2 -12
- package/dist/ts/components/dialogs/PageMetadataDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/PageMetadataDialog.js +3 -21
- package/dist/ts/components/dialogs/PageMetadataDialog.js.map +1 -1
- package/dist/ts/components/editor/DrawerItemOverride.d.ts +2 -0
- package/dist/ts/components/editor/DrawerItemOverride.d.ts.map +1 -1
- package/dist/ts/components/editor/DrawerItemOverride.js +4 -3
- package/dist/ts/components/editor/DrawerItemOverride.js.map +1 -1
- package/dist/ts/components/editor/LocaleSelector.d.ts +1 -1
- package/dist/ts/components/editor/LocaleSelector.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditor.d.ts +7 -8
- package/dist/ts/components/editor/PageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditor.js +78 -17
- package/dist/ts/components/editor/PageEditor.js.map +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.js +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.js.map +1 -1
- package/dist/ts/components/editor/PageEditorWrapper.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditorWrapper.js +17 -7
- package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -1
- package/dist/ts/components/editor/draft-media-config.d.ts +4 -0
- package/dist/ts/components/editor/draft-media-config.d.ts.map +1 -0
- package/dist/ts/components/editor/draft-media-config.js +95 -0
- package/dist/ts/components/editor/draft-media-config.js.map +1 -0
- package/dist/ts/components/editor/page-setting-targets.d.ts +1 -1
- package/dist/ts/components/editor/page-setting-targets.d.ts.map +1 -1
- package/dist/ts/components/editors/DataEditor.d.ts +3 -3
- package/dist/ts/components/editors/DataEditor.d.ts.map +1 -1
- package/dist/ts/components/forms/HintForm.js +8 -5
- package/dist/ts/components/forms/HintForm.js.map +1 -1
- package/dist/ts/components/forms/SchemaForm.d.ts +17 -5
- package/dist/ts/components/forms/SchemaForm.d.ts.map +1 -1
- package/dist/ts/components/forms/SchemaForm.js +16 -9
- package/dist/ts/components/forms/SchemaForm.js.map +1 -1
- package/dist/ts/components/media/AssetCard.d.ts +1 -1
- package/dist/ts/components/media/AssetCard.d.ts.map +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.d.ts +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.d.ts.map +1 -1
- package/dist/ts/components/media/FolderTreeSidebar.d.ts.map +1 -1
- package/dist/ts/components/media/FolderTreeSidebar.js +4 -1
- package/dist/ts/components/media/FolderTreeSidebar.js.map +1 -1
- package/dist/ts/components/media/MediaLibrary.d.ts +1 -1
- package/dist/ts/components/media/MediaLibrary.d.ts.map +1 -1
- package/dist/ts/components/media/MediaToolbar.d.ts +1 -1
- package/dist/ts/components/media/MediaToolbar.d.ts.map +1 -1
- package/dist/ts/components/pages/PageList.d.ts.map +1 -1
- package/dist/ts/components/pages/PageList.js +4 -96
- package/dist/ts/components/pages/PageList.js.map +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.d.ts +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.d.ts.map +1 -1
- package/dist/ts/components/ui/IconButton.d.ts +1 -1
- package/dist/ts/components/ui/IconButton.d.ts.map +1 -1
- package/dist/ts/content-form-fields.d.ts +41 -0
- package/dist/ts/content-form-fields.d.ts.map +1 -0
- package/dist/ts/content-form-fields.js +70 -0
- package/dist/ts/content-form-fields.js.map +1 -0
- package/dist/ts/data-schemas.d.ts +4 -3
- package/dist/ts/data-schemas.d.ts.map +1 -1
- package/dist/ts/data-schemas.js.map +1 -1
- package/dist/ts/host-discovery.d.ts.map +1 -1
- package/dist/ts/host-schema.d.ts +73 -0
- package/dist/ts/host-schema.d.ts.map +1 -0
- package/dist/ts/host-schema.js +66 -0
- package/dist/ts/host-schema.js.map +1 -0
- package/dist/ts/host-style-probe.d.ts.map +1 -1
- package/dist/ts/host-style-probe.js +16 -0
- package/dist/ts/host-style-probe.js.map +1 -1
- package/dist/ts/page-schema-define.d.ts +14 -12
- package/dist/ts/page-schema-define.d.ts.map +1 -1
- package/dist/ts/page-schema-define.js +8 -5
- package/dist/ts/page-schema-define.js.map +1 -1
- package/dist/ts/page-schemas.d.ts.map +1 -1
- package/dist/ts/puck-config.d.ts.map +1 -1
- package/dist/ts/selected-block.d.ts.map +1 -1
- package/dist/ts/site-styles.d.ts.map +1 -1
- package/dist/ts/ui-config.d.ts +2 -0
- package/dist/ts/ui-config.d.ts.map +1 -1
- package/dist/ts/ui-config.js.map +1 -1
- package/dist/ts/utils/asset-url.d.ts +2 -0
- package/dist/ts/utils/asset-url.d.ts.map +1 -1
- package/dist/ts/utils/asset-url.js +7 -0
- package/dist/ts/utils/asset-url.js.map +1 -1
- package/dist/ts/utils/pageMetadata.d.ts.map +1 -1
- package/dist/ts/utils/pageMetadata.js +27 -10
- package/dist/ts/utils/pageMetadata.js.map +1 -1
- package/dist/ts/utils/schema-fields.d.ts +23 -0
- package/dist/ts/utils/schema-fields.d.ts.map +1 -0
- package/dist/ts/utils/schema-fields.js +82 -0
- package/dist/ts/utils/schema-fields.js.map +1 -0
- package/package.json +41 -13
- package/src/App.tsx +13 -4
- package/src/components/CMSDashboard.tsx +12 -4
- package/src/components/RouteErrorPage.tsx +75 -0
- package/src/components/dashboard/RecentActivity.tsx +3 -7
- package/src/components/dialogs/CreateDataDialog.tsx +2 -2
- package/src/components/dialogs/CreateFolderDialog.tsx +2 -1
- package/src/components/dialogs/CreatePageFlow.tsx +117 -0
- package/src/components/dialogs/DataPropertiesDialog.tsx +3 -2
- package/src/components/dialogs/FragmentPropertiesDialog.tsx +3 -2
- package/src/components/dialogs/PageMetadataDialog.tsx +5 -28
- package/src/components/editor/DrawerItemOverride.tsx +14 -8
- package/src/components/editor/PageEditor.tsx +90 -19
- package/src/components/editor/PageEditorHeaderActions.tsx +1 -1
- package/src/components/editor/PageEditorWrapper.tsx +17 -7
- package/src/components/editor/draft-media-config.ts +95 -0
- package/src/components/editors/DataEditor.tsx +2 -2
- package/src/components/forms/HintForm.tsx +7 -5
- package/src/components/forms/SchemaForm.tsx +41 -12
- package/src/components/media/FolderTreeSidebar.tsx +3 -1
- package/src/components/pages/PageList.tsx +6 -116
- package/src/content-form-fields.ts +79 -0
- package/src/data-schemas.ts +4 -3
- package/src/host-schema.ts +122 -0
- package/src/host-style-probe.ts +16 -0
- package/src/main.css +10 -7
- package/src/page-schema-define.ts +29 -17
- package/src/ui-config.ts +2 -0
- package/src/utils/asset-url.ts +8 -0
- package/src/utils/pageMetadata.ts +27 -10
- package/src/utils/schema-fields.ts +106 -0
- package/dist/ts/utils/zodIntrospect.d.ts +0 -19
- package/dist/ts/utils/zodIntrospect.d.ts.map +0 -1
- package/dist/ts/utils/zodIntrospect.js +0 -95
- package/dist/ts/utils/zodIntrospect.js.map +0 -1
- package/src/utils/zodIntrospect.ts +0 -136
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-fields.js","sourceRoot":"","sources":["../../../src/utils/schema-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,qBAAqB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAmBlH,6FAA6F;AAC7F,SAAS,aAAa,CACpB,QAA4B,EA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AAC;AACH,CAAC;AAED,4EAA4E;AAC5E,oEAAoE;AACpE,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAkC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAA4B;IAC3D,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;QAClE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;IACvF,CAAC;IACD,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,kBAAkB,CAAC,MAAkB;IACnD,OAAO,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conloca/cms-spa",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -124,8 +124,8 @@
|
|
|
124
124
|
"test": "nx run cms-spa:test --outputStyle=stream"
|
|
125
125
|
},
|
|
126
126
|
"dependencies": {
|
|
127
|
-
"@conloca/content-api-client": "0.2.
|
|
128
|
-
"@conloca/mdx": "0.2.
|
|
127
|
+
"@conloca/content-api-client": "0.2.2",
|
|
128
|
+
"@conloca/mdx": "0.2.2",
|
|
129
129
|
"@lexical/react": "^0.48.0",
|
|
130
130
|
"@mdxeditor/editor": "^4.2.3",
|
|
131
131
|
"@puckeditor/core": "^0.23.0",
|
|
@@ -135,8 +135,9 @@
|
|
|
135
135
|
"@tanstack/react-query": "^5.102.8",
|
|
136
136
|
"@tanstack/react-query-devtools": "^5.102.8",
|
|
137
137
|
"@types/mdast": "^4.0.4",
|
|
138
|
+
"@typia/interface": "^14.0.5",
|
|
138
139
|
"clsx": "^2.1.1",
|
|
139
|
-
"dompurify": "^3.4.
|
|
140
|
+
"dompurify": "^3.4.17",
|
|
140
141
|
"lexical": "^0.48.0",
|
|
141
142
|
"lucide-react": "^0.564.0",
|
|
142
143
|
"mdast-util-from-markdown": "^2.0.3",
|
|
@@ -144,33 +145,36 @@
|
|
|
144
145
|
"react-router-dom": "^7.18.3",
|
|
145
146
|
"sonner": "^2.0.8",
|
|
146
147
|
"tailwind-merge": "^3.6.0",
|
|
147
|
-
"tslib": "^2.8.1"
|
|
148
|
-
"zod": "^4.5.4"
|
|
148
|
+
"tslib": "^2.8.1"
|
|
149
149
|
},
|
|
150
150
|
"peerDependencies": {
|
|
151
151
|
"react": "^19.0.0",
|
|
152
152
|
"react-dom": "^19.0.0"
|
|
153
153
|
},
|
|
154
154
|
"devDependencies": {
|
|
155
|
-
"@happy-dom/global-registrator": "
|
|
156
|
-
"@storybook/addon-vitest": "^10.6.
|
|
157
|
-
"@storybook/react-vite": "^10.6.
|
|
155
|
+
"@happy-dom/global-registrator": "21.0.4",
|
|
156
|
+
"@storybook/addon-vitest": "^10.6.2",
|
|
157
|
+
"@storybook/react-vite": "^10.6.2",
|
|
158
158
|
"@tailwindcss/cli": "4.3.3",
|
|
159
159
|
"@tailwindcss/typography": "^0.5.20",
|
|
160
160
|
"@tailwindcss/vite": "^4.3.3",
|
|
161
161
|
"@testing-library/jest-dom": "^7.0.1",
|
|
162
162
|
"@testing-library/react": "^16.3.3",
|
|
163
|
+
"@ttsc/unplugin": "^0.30.4",
|
|
163
164
|
"@vitejs/plugin-react": "^5.2.0",
|
|
164
165
|
"@vitest/browser-playwright": "^4.1.11",
|
|
165
166
|
"bun-tailwindcss": "^0.0.9",
|
|
167
|
+
"fast-check": "^4.9.0",
|
|
166
168
|
"hono": "^4.13.5",
|
|
167
169
|
"playwright": "^1.62.1",
|
|
168
170
|
"react": "19.2.8",
|
|
169
171
|
"react-dom": "19.2.8",
|
|
170
172
|
"react-refresh-typescript": "^2.0.12",
|
|
171
|
-
"storybook": "^10.6.
|
|
173
|
+
"storybook": "^10.6.2",
|
|
172
174
|
"tailwindcss": "^4.3.3",
|
|
175
|
+
"ttsc": "0.30.4",
|
|
173
176
|
"typescript": "^6.0.3",
|
|
177
|
+
"typia": "^14.0.4",
|
|
174
178
|
"vite": "^7.3.6",
|
|
175
179
|
"vitest": "^4.1.11"
|
|
176
180
|
},
|
|
@@ -218,9 +222,32 @@
|
|
|
218
222
|
"test-packed"
|
|
219
223
|
],
|
|
220
224
|
"options": {
|
|
221
|
-
"command": "bun --conditions=production
|
|
225
|
+
"command": "bun test --timeout=0 --conditions=production",
|
|
222
226
|
"cwd": "{projectRoot}",
|
|
223
|
-
"
|
|
227
|
+
"idleTimeoutMs": 180000,
|
|
228
|
+
"killAfterMs": 10000
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"build-storybook": {
|
|
232
|
+
"executor": "@smoothbricks/nx-plugin:bounded-exec",
|
|
233
|
+
"cache": true,
|
|
234
|
+
"dependsOn": [
|
|
235
|
+
"^build",
|
|
236
|
+
"bun-web"
|
|
237
|
+
],
|
|
238
|
+
"inputs": [
|
|
239
|
+
"default",
|
|
240
|
+
"^production",
|
|
241
|
+
"{workspaceRoot}/package.json",
|
|
242
|
+
"{workspaceRoot}/bun.lock"
|
|
243
|
+
],
|
|
244
|
+
"outputs": [
|
|
245
|
+
"{workspaceRoot}/dist/storybook/cms-spa"
|
|
246
|
+
],
|
|
247
|
+
"options": {
|
|
248
|
+
"command": "bunx --no-install storybook build --config-dir .storybook --output-dir ../../dist/storybook/cms-spa --disable-telemetry",
|
|
249
|
+
"cwd": "{projectRoot}",
|
|
250
|
+
"timeoutMs": 300000,
|
|
224
251
|
"killAfterMs": 10000
|
|
225
252
|
}
|
|
226
253
|
},
|
|
@@ -233,7 +260,8 @@
|
|
|
233
260
|
"^production"
|
|
234
261
|
],
|
|
235
262
|
"dependsOn": [
|
|
236
|
-
"^build"
|
|
263
|
+
"^build",
|
|
264
|
+
"build-storybook"
|
|
237
265
|
],
|
|
238
266
|
"options": {
|
|
239
267
|
"command": "smoo playwright ensure chromium && vitest run --config .storybook/vitest.config.ts",
|
package/src/App.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { DataList } from './components/pages/DataList.js';
|
|
|
9
9
|
import { FragmentList } from './components/pages/FragmentList.js';
|
|
10
10
|
import { MediaPage } from './components/pages/MediaPage.js';
|
|
11
11
|
import { PageList } from './components/pages/PageList.js';
|
|
12
|
+
import { RouteErrorPage } from './components/RouteErrorPage.js';
|
|
12
13
|
import { type DataSchemas, useDataSchemas } from './data-schemas.js';
|
|
13
14
|
import { usePuckConfig } from './puck-config.js';
|
|
14
15
|
|
|
@@ -24,7 +25,11 @@ export interface RouteDeps {
|
|
|
24
25
|
*
|
|
25
26
|
* `/pages/:id` and `/fragments/:id` sit OUTSIDE the CMSLayout shell so the
|
|
26
27
|
* editors occupy the full viewport — the page-route equivalent of "modal
|
|
27
|
-
* takes over the screen".
|
|
28
|
+
* takes over the screen". Each of the three top-level routes carries the
|
|
29
|
+
* `RouteErrorPage` `errorElement`, so a failing screen never falls through to
|
|
30
|
+
* react-router's developer screen. An address that matches no route is answered
|
|
31
|
+
* by the FIRST route's `errorElement` (react-router's choice), so the layout
|
|
32
|
+
* route must stay first and keep its `errorElement`.
|
|
28
33
|
*
|
|
29
34
|
* Exported so tests that need `useBlocker` (the unsaved-changes guard hooks
|
|
30
35
|
* inside the page/fragment editors) can plug the same routes into
|
|
@@ -34,15 +39,19 @@ export interface RouteDeps {
|
|
|
34
39
|
export function routeElements({ puckConfig, dataSchemas }: RouteDeps) {
|
|
35
40
|
return (
|
|
36
41
|
<>
|
|
37
|
-
<Route path="/" element={<CMSLayout />}>
|
|
42
|
+
<Route path="/" element={<CMSLayout />} errorElement={<RouteErrorPage />}>
|
|
38
43
|
<Route index element={<CMSDashboard />} />
|
|
39
44
|
<Route path="pages" element={<PageList />} />
|
|
40
45
|
<Route path="fragments" element={<FragmentList />} />
|
|
41
46
|
<Route path="data" element={<DataList dataSchemas={dataSchemas} />} />
|
|
42
47
|
<Route path="media" element={<MediaPage />} />
|
|
43
48
|
</Route>
|
|
44
|
-
<Route
|
|
45
|
-
|
|
49
|
+
<Route
|
|
50
|
+
path="/pages/:id"
|
|
51
|
+
element={<PageEditorWrapper puckConfig={puckConfig} />}
|
|
52
|
+
errorElement={<RouteErrorPage />}
|
|
53
|
+
/>
|
|
54
|
+
<Route path="/fragments/:id" element={<FragmentEditor />} errorElement={<RouteErrorPage />} />
|
|
46
55
|
</>
|
|
47
56
|
);
|
|
48
57
|
}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { FolderTreeNode } from '@conloca/content-api-client';
|
|
2
2
|
import { useData, useFolderTree, useFragments, useSitePages } from '@conloca/content-api-client';
|
|
3
3
|
import { Database, FileText, Image, Package, Plus, Upload } from 'lucide-react';
|
|
4
|
+
import { useState } from 'react';
|
|
4
5
|
import { Link } from 'react-router-dom';
|
|
5
6
|
import { SectionCard } from './cards/SectionCard.js';
|
|
6
7
|
import { RecentActivity } from './dashboard/RecentActivity.js';
|
|
8
|
+
import { CreatePageFlow } from './dialogs/CreatePageFlow.js';
|
|
9
|
+
|
|
10
|
+
const DASHBOARD_SITE = 'default';
|
|
7
11
|
|
|
8
12
|
function countAllAssets(nodes: FolderTreeNode[]): number {
|
|
9
13
|
return nodes.reduce((sum, node) => sum + node.assetCount + countAllAssets(node.children), 0);
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
export function CMSDashboard() {
|
|
13
|
-
const
|
|
17
|
+
const [showCreateDialog, setShowCreateDialog] = useState(false);
|
|
18
|
+
const { data: sitePages, isLoading: pagesLoading } = useSitePages(DASHBOARD_SITE);
|
|
14
19
|
const { data: fragments, isLoading: fragmentsLoading } = useFragments();
|
|
15
20
|
const { data: dataEntries, isLoading: dataLoading } = useData();
|
|
16
21
|
const { data: folderTree, isLoading: mediaLoading } = useFolderTree();
|
|
@@ -31,13 +36,14 @@ export function CMSDashboard() {
|
|
|
31
36
|
<p className="text-grey-04 dark:text-grey-07 mt-1">Overview of your content and recent activity.</p>
|
|
32
37
|
</div>
|
|
33
38
|
<div className="flex items-center gap-2">
|
|
34
|
-
<
|
|
35
|
-
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
onClick={() => setShowCreateDialog(true)}
|
|
36
42
|
className="flex items-center gap-2 px-3 py-2 rounded-md text-sm font-medium whitespace-nowrap bg-grey-01 text-grey-12 hover:bg-azure-04 hover:text-white dark:bg-grey-12 dark:text-grey-01 dark:hover:bg-azure-06 dark:hover:text-white transition-colors"
|
|
37
43
|
>
|
|
38
44
|
<Plus className="h-4 w-4" />
|
|
39
45
|
New Page
|
|
40
|
-
</
|
|
46
|
+
</button>
|
|
41
47
|
<Link
|
|
42
48
|
to="/media"
|
|
43
49
|
className="flex items-center gap-2 px-3 py-2 border border-grey-09 dark:border-grey-03 rounded-md text-sm font-medium whitespace-nowrap text-grey-01 dark:text-grey-12 hover:bg-grey-11 dark:hover:bg-grey-03 transition-colors"
|
|
@@ -113,6 +119,8 @@ export function CMSDashboard() {
|
|
|
113
119
|
</div>
|
|
114
120
|
<RecentActivity />
|
|
115
121
|
</div>
|
|
122
|
+
|
|
123
|
+
<CreatePageFlow open={showCreateDialog} onOpenChange={setShowCreateDialog} site={DASHBOARD_SITE} />
|
|
116
124
|
</div>
|
|
117
125
|
);
|
|
118
126
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { AlertCircle } from 'lucide-react';
|
|
2
|
+
import { isRouteErrorResponse, Link, useRouteError } from 'react-router-dom';
|
|
3
|
+
import { cn } from '../utils/cn.js';
|
|
4
|
+
import { Button } from './ui/Button.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A short, copyable cause for the details block. A thrown non-Error value is
|
|
8
|
+
* stringified, and a value that cannot be stringified (a null-prototype object,
|
|
9
|
+
* a throwing `toString`) falls back to its type tag: this page is the last
|
|
10
|
+
* boundary, so a second throw here would blank the whole screen.
|
|
11
|
+
*
|
|
12
|
+
* The router hands over whatever was thrown, so this is the parsing boundary
|
|
13
|
+
* for that value.
|
|
14
|
+
*/
|
|
15
|
+
// oxlint-disable-next-line anti-slop/no-unknown-parameters -- the router types a route error as unknown; this function narrows it.
|
|
16
|
+
function describeRouteError(error: unknown): string {
|
|
17
|
+
if (error instanceof Error) return error.message;
|
|
18
|
+
if (isRouteErrorResponse(error)) return `${error.status} ${error.statusText}`.trim();
|
|
19
|
+
try {
|
|
20
|
+
return String(error);
|
|
21
|
+
} catch {
|
|
22
|
+
return Object.prototype.toString.call(error);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The `errorElement` for every CMS route: replaces react-router's developer
|
|
28
|
+
* screen ("Unexpected Application Error!") with a plain-language message and a
|
|
29
|
+
* way out. The router already logs a render error to the console, so this page
|
|
30
|
+
* does not log it a second time.
|
|
31
|
+
*
|
|
32
|
+
* An address that matches no route arrives here as a 404 route response and
|
|
33
|
+
* gets its own wording; there is nothing to reload in that case.
|
|
34
|
+
*/
|
|
35
|
+
export function RouteErrorPage() {
|
|
36
|
+
const error = useRouteError();
|
|
37
|
+
const notFound = isRouteErrorResponse(error) && error.status === 404;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div className="flex h-full min-h-[400px] items-center justify-center bg-page p-6">
|
|
41
|
+
<div className="max-w-md text-center">
|
|
42
|
+
<AlertCircle className="mx-auto mb-4 h-12 w-12 text-red-04 dark:text-red-08" />
|
|
43
|
+
<h1 className="mb-2 text-xl font-semibold text-grey-01 dark:text-grey-12">
|
|
44
|
+
{notFound ? 'Page not found' : 'Something went wrong'}
|
|
45
|
+
</h1>
|
|
46
|
+
<p className="mb-4 text-grey-04 dark:text-grey-07">
|
|
47
|
+
{notFound
|
|
48
|
+
? 'This address does not match any screen in the CMS.'
|
|
49
|
+
: 'The CMS could not show this screen. Reloading usually fixes it; changes you had not saved on this screen may be lost.'}
|
|
50
|
+
</p>
|
|
51
|
+
{!notFound && (
|
|
52
|
+
<details className="mb-4 text-left text-sm text-grey-04 dark:text-grey-07">
|
|
53
|
+
<summary className="cursor-pointer text-center">Error details</summary>
|
|
54
|
+
<pre className="mt-2 overflow-auto whitespace-pre-wrap break-words rounded-md border border-line bg-panel p-3 text-xs">
|
|
55
|
+
{describeRouteError(error)}
|
|
56
|
+
</pre>
|
|
57
|
+
</details>
|
|
58
|
+
)}
|
|
59
|
+
<div className="flex items-center justify-center gap-2">
|
|
60
|
+
{!notFound && <Button onClick={() => window.location.reload()}>Reload</Button>}
|
|
61
|
+
<Link
|
|
62
|
+
to="/"
|
|
63
|
+
className={cn(
|
|
64
|
+
'inline-flex items-center justify-center rounded-md px-4 py-2 transition-colors',
|
|
65
|
+
'border border-line bg-panel text-grey-04 hover:bg-hover hover:text-grey-01',
|
|
66
|
+
'dark:text-grey-07 dark:hover:text-grey-12',
|
|
67
|
+
)}
|
|
68
|
+
>
|
|
69
|
+
Back to dashboard
|
|
70
|
+
</Link>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { localesOf, type PageStatus, pageStatusOf, useSitePages } from '@conloca/content-api-client';
|
|
2
2
|
import { AlertCircle, Clock, FileText, Loader2 } from 'lucide-react';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { Link } from 'react-router-dom';
|
|
@@ -10,7 +10,7 @@ interface RecentPage {
|
|
|
10
10
|
title: string;
|
|
11
11
|
path: string;
|
|
12
12
|
modified: Date;
|
|
13
|
-
status:
|
|
13
|
+
status: PageStatus;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function RecentActivity() {
|
|
@@ -32,11 +32,7 @@ export function RecentActivity() {
|
|
|
32
32
|
if (d > latestModified) latestModified = d;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
const now = new Date();
|
|
37
|
-
const publishAt = firstLocale.publishAt ? new Date(firstLocale.publishAt) : null;
|
|
38
|
-
if (publishAt && publishAt > now) status = 'scheduled';
|
|
39
|
-
else if (!isContentPublished(firstLocale, now)) status = 'draft';
|
|
35
|
+
const status = pageStatusOf(entry);
|
|
40
36
|
|
|
41
37
|
pages.push({
|
|
42
38
|
id: entry.id,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { dataEditableSchema } from '@conloca/content-api-client';
|
|
2
1
|
import { useState } from 'react';
|
|
2
|
+
import { dataEditableFields } from '../../content-form-fields.js';
|
|
3
3
|
import { SchemaForm } from '../forms/SchemaForm.js';
|
|
4
4
|
import { Button, Select } from '../ui/index.js';
|
|
5
5
|
|
|
@@ -49,7 +49,7 @@ export function CreateDataDialog({ collections, isPending, onClose, onCreate }:
|
|
|
49
49
|
</Select>
|
|
50
50
|
</div>
|
|
51
51
|
<div className="mb-4">
|
|
52
|
-
<SchemaForm
|
|
52
|
+
<SchemaForm fields={dataEditableFields} values={formValues} onChange={setFormValues} />
|
|
53
53
|
</div>
|
|
54
54
|
<div className="flex justify-end gap-3">
|
|
55
55
|
<Button variant="outline" onClick={onClose}>
|
|
@@ -28,7 +28,8 @@ export function CreateFolderDialog({ open, isPending, error, onClose, onCreate }
|
|
|
28
28
|
|
|
29
29
|
const handleCreate = () => {
|
|
30
30
|
const name = folderName.trim();
|
|
31
|
-
|
|
31
|
+
// Enter bypasses the disabled button; a second request would detach the first one's callbacks.
|
|
32
|
+
if (!name || isPending) return;
|
|
32
33
|
setSubmittedName(name);
|
|
33
34
|
onCreate(name);
|
|
34
35
|
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { APIClientError, useCreateContent } from '@conloca/content-api-client';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import { useErrorModal } from '../../hooks/index.js';
|
|
4
|
+
import type { CreatePageData } from '../../types.js';
|
|
5
|
+
import { getUIConfig } from '../../ui-config.js';
|
|
6
|
+
import { contentFailureMessage } from '../../utils/content-failure.js';
|
|
7
|
+
import { CreatePageDialog } from './CreatePageDialog.js';
|
|
8
|
+
import { ErrorModal } from './ErrorModal.js';
|
|
9
|
+
|
|
10
|
+
interface CreatePageFlowProps {
|
|
11
|
+
open: boolean;
|
|
12
|
+
onOpenChange: (open: boolean) => void;
|
|
13
|
+
site: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const createTemplateContent = (componentName: string) => [
|
|
17
|
+
{
|
|
18
|
+
type: componentName,
|
|
19
|
+
props: {
|
|
20
|
+
id: `${componentName}-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The create-page dialog together with what happens after Create: the page is created, its editor opens, and a
|
|
27
|
+
* refusal is shown in an error modal. Shared by the Dashboard and the Pages list, so both New Page buttons
|
|
28
|
+
* behave the same.
|
|
29
|
+
*/
|
|
30
|
+
export function CreatePageFlow({ open, onOpenChange, site }: CreatePageFlowProps) {
|
|
31
|
+
const { showError, errorModalProps } = useErrorModal();
|
|
32
|
+
const navigate = useNavigate();
|
|
33
|
+
const createContent = useCreateContent();
|
|
34
|
+
|
|
35
|
+
const handleCreatePage = async (data: CreatePageData) => {
|
|
36
|
+
try {
|
|
37
|
+
const config = getUIConfig();
|
|
38
|
+
const templateConfig = config.templates?.[data.template];
|
|
39
|
+
|
|
40
|
+
// Shared metadata. Description is only added when MDX picked it
|
|
41
|
+
// up — Puck pages don't render it today, so the manifest stays
|
|
42
|
+
// clean for them.
|
|
43
|
+
const meta =
|
|
44
|
+
data.format === 'mdx' && data.description
|
|
45
|
+
? { title: data.title, description: data.description }
|
|
46
|
+
: { title: data.title };
|
|
47
|
+
|
|
48
|
+
// Build a type-specific content payload. MDX pages send an empty
|
|
49
|
+
// body — the editor opens to a blank canvas. Puck pages keep the
|
|
50
|
+
// existing template-driven payload.
|
|
51
|
+
const templateContent =
|
|
52
|
+
data.format !== 'mdx' && templateConfig?.component ? createTemplateContent(templateConfig.component) : [];
|
|
53
|
+
const result = await (data.format === 'mdx'
|
|
54
|
+
? createContent.mutateAsync({
|
|
55
|
+
kind: 'page',
|
|
56
|
+
site,
|
|
57
|
+
collection: 'pages',
|
|
58
|
+
type: 'mdx',
|
|
59
|
+
meta,
|
|
60
|
+
locales: {
|
|
61
|
+
[data.locale]: {
|
|
62
|
+
meta,
|
|
63
|
+
pathname: data.path,
|
|
64
|
+
// Empty body — backend stamps id/created/modified into
|
|
65
|
+
// frontmatter automatically (see
|
|
66
|
+
// filesystem-content-api.ts createContent, type === 'mdx'
|
|
67
|
+
// branch).
|
|
68
|
+
content: { mdx: '' },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
: createContent.mutateAsync({
|
|
73
|
+
kind: 'page',
|
|
74
|
+
site,
|
|
75
|
+
collection: 'pages',
|
|
76
|
+
type: 'puck',
|
|
77
|
+
meta,
|
|
78
|
+
locales: {
|
|
79
|
+
[data.locale]: {
|
|
80
|
+
meta,
|
|
81
|
+
pathname: data.path,
|
|
82
|
+
content: {
|
|
83
|
+
puckData: {
|
|
84
|
+
root: {},
|
|
85
|
+
content: templateContent,
|
|
86
|
+
zones: {},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
if (result.success && result.id) {
|
|
94
|
+
// Navigate to the new page editor with the actual ID.
|
|
95
|
+
// PageEditorWrapper dispatches by content.type so MDX pages
|
|
96
|
+
// land on MdxPageEditor and Puck pages on the Puck canvas.
|
|
97
|
+
void navigate(`/pages/${result.id}`);
|
|
98
|
+
} else {
|
|
99
|
+
// The dialog has already closed, so this is the author's only answer:
|
|
100
|
+
// say why (a path taken since the check), not just "try again".
|
|
101
|
+
showError(contentFailureMessage(result, 'Failed to create page. Please try again.'), result.error);
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error('Failed to create page:', error);
|
|
105
|
+
// The content-API router answers a refusal, such as a path another page took since the check,
|
|
106
|
+
// with an error status, which the client throws: say why, as for a refusal the result carries.
|
|
107
|
+
showError(error instanceof APIClientError ? error.message : 'Failed to create page. Please try again.', error);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<>
|
|
113
|
+
<CreatePageDialog open={open} onOpenChange={onOpenChange} onCreatePage={handleCreatePage} site={site} />
|
|
114
|
+
<ErrorModal {...errorModalProps} />
|
|
115
|
+
</>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DataEditable } from '@conloca/content-api-client';
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { dataEditableFields } from '../../content-form-fields.js';
|
|
3
4
|
import { SchemaForm } from '../forms/SchemaForm.js';
|
|
4
5
|
import { Button } from '../ui/index.js';
|
|
5
6
|
|
|
@@ -62,7 +63,7 @@ export function DataPropertiesDialog({ initialMeta, isPending, onClose, onSave }
|
|
|
62
63
|
<h2 className="text-xl font-semibold text-grey-01 dark:text-grey-12 mb-4">Edit Data Properties</h2>
|
|
63
64
|
|
|
64
65
|
<div className="mb-4">
|
|
65
|
-
<SchemaForm
|
|
66
|
+
<SchemaForm fields={dataEditableFields} values={formValues} onChange={setFormValues} />
|
|
66
67
|
</div>
|
|
67
68
|
|
|
68
69
|
<div className="flex justify-end gap-3">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FragmentEditable } from '@conloca/content-api-client';
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { fragmentEditableFields } from '../../content-form-fields.js';
|
|
3
4
|
import { SchemaForm } from '../forms/SchemaForm.js';
|
|
4
5
|
import { Button } from '../ui/index.js';
|
|
5
6
|
|
|
@@ -75,7 +76,7 @@ export function FragmentPropertiesDialog({
|
|
|
75
76
|
<h2 className="text-xl font-semibold text-grey-01 dark:text-grey-12 mb-4">Edit Fragment Properties</h2>
|
|
76
77
|
|
|
77
78
|
<div className="mb-4">
|
|
78
|
-
<SchemaForm
|
|
79
|
+
<SchemaForm fields={fragmentEditableFields} values={formValues} onChange={setFormValues} />
|
|
79
80
|
</div>
|
|
80
81
|
|
|
81
82
|
<div className="flex justify-end gap-3">
|
|
@@ -4,7 +4,7 @@ import { X } from 'lucide-react';
|
|
|
4
4
|
import type React from 'react';
|
|
5
5
|
/* oxlint-disable anti-slop/no-unsafe-dictionary-type -- Form state intentionally mirrors SchemaForm/HintForm's validated Record<string, unknown> contract until schema parsing materializes PageMetadata. */
|
|
6
6
|
import { useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { pathnameOnlyFields, publishWindowFields, seoPublishingFields } from '../../content-form-fields.js';
|
|
8
8
|
import { type PageSchemaDescriptor, resolvePageSchemaEntry, usePageSchemas } from '../../page-schemas.js';
|
|
9
9
|
import type { CorePageSettingName } from '../../page-setting-attributes.js';
|
|
10
10
|
import type { PageMetadata } from '../../types.js';
|
|
@@ -18,31 +18,8 @@ import { HintForm } from '../forms/HintForm.js';
|
|
|
18
18
|
import { SchemaForm } from '../forms/SchemaForm.js';
|
|
19
19
|
import { Button, FieldError, IconButton, Input } from '../ui/index.js';
|
|
20
20
|
|
|
21
|
-
const pathnameOnlySchema = z.object({
|
|
22
|
-
pathname: z.string().describe('URL path (e.g., /about)'),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const publishWindowSchema = z.object({
|
|
26
|
-
publishAt: z.coerce
|
|
27
|
-
.date()
|
|
28
|
-
.nullable()
|
|
29
|
-
.optional()
|
|
30
|
-
.describe(
|
|
31
|
-
'When the page goes live. Page lists that sort by date use this date, or the date the page was created when it is empty.',
|
|
32
|
-
),
|
|
33
|
-
unpublishAt: z.coerce.date().nullable().optional().describe('Schedule unpublish date/time'),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const seoPublishingSchema = z
|
|
37
|
-
.object({
|
|
38
|
-
description: z.string().optional().describe('Meta description for search engines'),
|
|
39
|
-
robots: z.string().optional().describe('Robots meta tag (e.g., index, follow)'),
|
|
40
|
-
canonical: z.string().url().optional().describe('Canonical URL for duplicate content'),
|
|
41
|
-
})
|
|
42
|
-
.extend(publishWindowSchema.shape);
|
|
43
|
-
|
|
44
21
|
type Assert<T extends true> = T;
|
|
45
|
-
type DialogCoreField = 'title' | keyof
|
|
22
|
+
type DialogCoreField = 'title' | keyof typeof pathnameOnlyFields | keyof typeof seoPublishingFields;
|
|
46
23
|
/** A block can name exactly the core fields this dialog renders (CorePageSettingName): renaming a field here breaks the typecheck. */
|
|
47
24
|
export type CoreFieldNamesProof = Assert<
|
|
48
25
|
[DialogCoreField] extends [CorePageSettingName]
|
|
@@ -264,7 +241,7 @@ function PageMetadataForm({ formRef, page, descriptor, onSave, onSaved }: PageMe
|
|
|
264
241
|
)}
|
|
265
242
|
<SchemaForm
|
|
266
243
|
className={cn({ 'mt-6': mode === 'full' })}
|
|
267
|
-
|
|
244
|
+
fields={pathnameOnlyFields}
|
|
268
245
|
values={coreValues}
|
|
269
246
|
onChange={changeCoreValues}
|
|
270
247
|
/>
|
|
@@ -283,10 +260,10 @@ function PageMetadataForm({ formRef, page, descriptor, onSave, onSaved }: PageMe
|
|
|
283
260
|
))}
|
|
284
261
|
|
|
285
262
|
{mode === 'full' && (
|
|
286
|
-
<SchemaForm className="mt-6"
|
|
263
|
+
<SchemaForm className="mt-6" fields={seoPublishingFields} values={coreValues} onChange={changeCoreValues} />
|
|
287
264
|
)}
|
|
288
265
|
{mode === 'minimal' && (
|
|
289
|
-
<SchemaForm className="mt-6"
|
|
266
|
+
<SchemaForm className="mt-6" fields={publishWindowFields} values={coreValues} onChange={changeCoreValues} />
|
|
290
267
|
)}
|
|
291
268
|
|
|
292
269
|
{titleMissing && mode !== 'full' && <FieldError className="mt-6">Enter a page title before saving.</FieldError>}
|
|
@@ -6,6 +6,9 @@ interface DrawerItemOverrideProps {
|
|
|
6
6
|
name: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
/** Puck's root drop zone, which Puck does not export as a constant. */
|
|
10
|
+
export const PUCK_ROOT_DROP_ZONE = 'root:default-zone';
|
|
11
|
+
|
|
9
12
|
function generateId(componentType: string): string {
|
|
10
13
|
return `${componentType}-${crypto.randomUUID()}`;
|
|
11
14
|
}
|
|
@@ -24,8 +27,7 @@ export function DrawerItemOverride({ children, name }: DrawerItemOverrideProps)
|
|
|
24
27
|
type: 'insert',
|
|
25
28
|
componentType: name,
|
|
26
29
|
destinationIndex: puck.appState.data.content.length,
|
|
27
|
-
|
|
28
|
-
destinationZone: 'root:default-zone',
|
|
30
|
+
destinationZone: PUCK_ROOT_DROP_ZONE,
|
|
29
31
|
id,
|
|
30
32
|
recordHistory: true,
|
|
31
33
|
});
|
|
@@ -42,21 +44,25 @@ export function DrawerItemOverride({ children, name }: DrawerItemOverrideProps)
|
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
return (
|
|
47
|
+
// Not a real <button>: Puck's drag sensor refuses to start a drag from a press on an interactive element
|
|
48
|
+
// (button, link, input) inside a drawer item, so a <button> here made every block in the list undraggable.
|
|
45
49
|
// `block w-full`: this wrapper sits between Puck's drawer-item container
|
|
46
|
-
// and the row it lays out, so a default inline-block
|
|
50
|
+
// and the row it lays out, so a default inline-block wrapper would size to
|
|
47
51
|
// its content instead of the container. A drawer item's label is as wide
|
|
48
52
|
// as its text — a fragment is named after its content, so those names run
|
|
49
53
|
// past the sidebar — and the label's own `text-overflow: ellipsis` can
|
|
50
54
|
// only take effect while something above it is still bounded by the
|
|
51
|
-
// sidebar's width.
|
|
52
|
-
<button
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
// sidebar's width. `select-none` keeps a double-click from selecting the label's text, as it never did on a button.
|
|
56
|
+
// biome-ignore lint/a11y/useSemanticElements: a <button> here would stop Puck from dragging the block (see above)
|
|
57
|
+
<div
|
|
58
|
+
role="button"
|
|
59
|
+
tabIndex={0}
|
|
60
|
+
className="block w-full select-none"
|
|
55
61
|
onDoubleClick={handleDoubleClick}
|
|
56
62
|
onKeyDown={handleKeyDown}
|
|
57
63
|
data-testid={`drawer-item-${name}`}
|
|
58
64
|
>
|
|
59
65
|
{children}
|
|
60
|
-
</
|
|
66
|
+
</div>
|
|
61
67
|
);
|
|
62
68
|
}
|