@conloca/cms-spa 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/dist/spa/main.css +229 -1
- package/dist/ts/.build-inputs.json +187 -0
- package/dist/ts/App.d.ts +5 -1
- package/dist/ts/App.d.ts.map +1 -1
- package/dist/ts/App.js +13 -6
- package/dist/ts/App.js.map +1 -1
- package/dist/ts/CmsSpaApp.d.ts.map +1 -1
- package/dist/ts/CmsSpaApp.js +4 -1
- package/dist/ts/CmsSpaApp.js.map +1 -1
- package/dist/ts/components/CMSDashboard.d.ts.map +1 -1
- package/dist/ts/components/CMSDashboard.js +2 -1
- package/dist/ts/components/CMSDashboard.js.map +1 -1
- 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/dialogs/DeleteConfirmDialog.d.ts +6 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.js +2 -2
- package/dist/ts/components/dialogs/DeleteConfirmDialog.js.map +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/MakePagesEditableDialog.d.ts +10 -0
- package/dist/ts/components/dialogs/MakePagesEditableDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/MakePagesEditableDialog.js +35 -0
- package/dist/ts/components/dialogs/MakePagesEditableDialog.js.map +1 -0
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts +6 -1
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/MoveFolderDialog.js +3 -3
- package/dist/ts/components/dialogs/MoveFolderDialog.js.map +1 -1
- package/dist/ts/components/editor/CMSMDXEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/CMSMDXEditor.js +53 -62
- package/dist/ts/components/editor/CMSMDXEditor.js.map +1 -1
- package/dist/ts/components/editor/DocsPreviewButton.d.ts +6 -0
- package/dist/ts/components/editor/DocsPreviewButton.d.ts.map +1 -0
- package/dist/ts/components/editor/DocsPreviewButton.js +15 -0
- package/dist/ts/components/editor/DocsPreviewButton.js.map +1 -0
- package/dist/ts/components/editor/ImagePickerDialog.js +2 -2
- package/dist/ts/components/editor/ImagePickerDialog.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/MdxPageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/MdxPageEditor.js +2 -1
- package/dist/ts/components/editor/MdxPageEditor.js.map +1 -1
- package/dist/ts/components/editor/PageEditor.d.ts +1 -1
- package/dist/ts/components/editor/PageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditor.js +47 -19
- 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/PageEditorWrapper.js +31 -5
- package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -1
- package/dist/ts/components/editor/draft-media-config.d.ts +32 -2
- package/dist/ts/components/editor/draft-media-config.d.ts.map +1 -1
- package/dist/ts/components/editor/draft-media-config.js +194 -39
- package/dist/ts/components/editor/draft-media-config.js.map +1 -1
- 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/editor/preview-availability.d.ts +8 -5
- package/dist/ts/components/editor/preview-availability.d.ts.map +1 -1
- package/dist/ts/components/editor/preview-availability.js +8 -5
- package/dist/ts/components/editor/preview-availability.js.map +1 -1
- package/dist/ts/components/editors/DataEditor.d.ts +6 -2
- package/dist/ts/components/editors/DataEditor.d.ts.map +1 -1
- package/dist/ts/components/editors/DataEditor.js +46 -19
- package/dist/ts/components/editors/DataEditor.js.map +1 -1
- package/dist/ts/components/fields/ImageField.js +2 -2
- package/dist/ts/components/fields/ImageField.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/AssetCard.js +3 -2
- package/dist/ts/components/media/AssetCard.js.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/AssetDetailSidebar.js +7 -2
- package/dist/ts/components/media/AssetDetailSidebar.js.map +1 -1
- package/dist/ts/components/media/AssetUsageList.d.ts +13 -0
- package/dist/ts/components/media/AssetUsageList.d.ts.map +1 -0
- package/dist/ts/components/media/AssetUsageList.js +35 -0
- package/dist/ts/components/media/AssetUsageList.js.map +1 -0
- 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/MediaLibrary.js +6 -4
- package/dist/ts/components/media/MediaLibrary.js.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/media/index.d.ts +1 -0
- package/dist/ts/components/media/index.d.ts.map +1 -1
- package/dist/ts/components/media/index.js +1 -0
- package/dist/ts/components/media/index.js.map +1 -1
- package/dist/ts/components/pages/DataList.d.ts.map +1 -1
- package/dist/ts/components/pages/DataList.js +48 -31
- package/dist/ts/components/pages/DataList.js.map +1 -1
- package/dist/ts/components/pages/MediaPage.d.ts.map +1 -1
- package/dist/ts/components/pages/MediaPage.js +7 -5
- package/dist/ts/components/pages/MediaPage.js.map +1 -1
- package/dist/ts/components/pages/NoPagesYet.d.ts +5 -0
- package/dist/ts/components/pages/NoPagesYet.d.ts.map +1 -0
- package/dist/ts/components/pages/NoPagesYet.js +16 -0
- package/dist/ts/components/pages/NoPagesYet.js.map +1 -0
- package/dist/ts/components/pages/PageList.d.ts.map +1 -1
- package/dist/ts/components/pages/PageList.js +19 -8
- 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/sandbox/ContentSandbox.js +36 -5
- package/dist/ts/components/sandbox/ContentSandbox.js.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-wrapper.d.ts +65 -0
- package/dist/ts/content-wrapper.d.ts.map +1 -0
- package/dist/ts/content-wrapper.js +190 -0
- package/dist/ts/content-wrapper.js.map +1 -0
- package/dist/ts/convert-pages.d.ts +30 -0
- package/dist/ts/convert-pages.d.ts.map +1 -0
- package/dist/ts/convert-pages.js +85 -0
- package/dist/ts/convert-pages.js.map +1 -0
- package/dist/ts/data-schemas.d.ts.map +1 -1
- package/dist/ts/frame/channel.d.ts +40 -0
- package/dist/ts/frame/channel.d.ts.map +1 -0
- package/dist/ts/frame/channel.js +233 -0
- package/dist/ts/frame/channel.js.map +1 -0
- package/dist/ts/frame/editor-frame.d.ts +23 -0
- package/dist/ts/frame/editor-frame.d.ts.map +1 -0
- package/dist/ts/frame/editor-frame.js +159 -0
- package/dist/ts/frame/editor-frame.js.map +1 -0
- package/dist/ts/frame/media-cache.d.ts +37 -0
- package/dist/ts/frame/media-cache.d.ts.map +1 -0
- package/dist/ts/frame/media-cache.js +138 -0
- package/dist/ts/frame/media-cache.js.map +1 -0
- package/dist/ts/frame/memory-router.d.ts +10 -0
- package/dist/ts/frame/memory-router.d.ts.map +1 -0
- package/dist/ts/frame/memory-router.js +39 -0
- package/dist/ts/frame/memory-router.js.map +1 -0
- package/dist/ts/frame/parent-hello.d.ts +11 -0
- package/dist/ts/frame/parent-hello.d.ts.map +1 -0
- package/dist/ts/frame/parent-hello.js +53 -0
- package/dist/ts/frame/parent-hello.js.map +1 -0
- package/dist/ts/frame/protocol.d.ts +209 -0
- package/dist/ts/frame/protocol.d.ts.map +1 -0
- package/dist/ts/frame/protocol.js +200 -0
- package/dist/ts/frame/protocol.js.map +1 -0
- package/dist/ts/frame/rpc-content-client.d.ts +10 -0
- package/dist/ts/frame/rpc-content-client.d.ts.map +1 -0
- package/dist/ts/frame/rpc-content-client.js +51 -0
- package/dist/ts/frame/rpc-content-client.js.map +1 -0
- package/dist/ts/frame/save-shortcut.d.ts +8 -0
- package/dist/ts/frame/save-shortcut.d.ts.map +1 -0
- package/dist/ts/frame/save-shortcut.js +26 -0
- package/dist/ts/frame/save-shortcut.js.map +1 -0
- package/dist/ts/hooks/index.d.ts +2 -0
- package/dist/ts/hooks/index.d.ts.map +1 -1
- package/dist/ts/hooks/index.js +1 -0
- package/dist/ts/hooks/index.js.map +1 -1
- package/dist/ts/hooks/usePageConversion.d.ts +11 -0
- package/dist/ts/hooks/usePageConversion.d.ts.map +1 -0
- package/dist/ts/hooks/usePageConversion.js +47 -0
- package/dist/ts/hooks/usePageConversion.js.map +1 -0
- package/dist/ts/hooks/useUploadFlow.d.ts.map +1 -1
- package/dist/ts/hooks/useUploadFlow.js +41 -7
- package/dist/ts/hooks/useUploadFlow.js.map +1 -1
- package/dist/ts/host-style-probe.d.ts +32 -37
- package/dist/ts/host-style-probe.d.ts.map +1 -1
- package/dist/ts/host-style-probe.js +86 -68
- package/dist/ts/host-style-probe.js.map +1 -1
- package/dist/ts/index.d.ts +6 -2
- package/dist/ts/index.d.ts.map +1 -1
- package/dist/ts/index.js +9 -2
- package/dist/ts/index.js.map +1 -1
- package/dist/ts/main-spa.d.ts.map +1 -1
- package/dist/ts/main-spa.js +2 -1
- package/dist/ts/main-spa.js.map +1 -1
- package/dist/ts/media/prepare-image-upload.d.ts +19 -0
- package/dist/ts/media/prepare-image-upload.d.ts.map +1 -0
- package/dist/ts/media/prepare-image-upload.js +93 -0
- package/dist/ts/media/prepare-image-upload.js.map +1 -0
- package/dist/ts/media/use-asset-serve-src.d.ts +7 -0
- package/dist/ts/media/use-asset-serve-src.d.ts.map +1 -0
- package/dist/ts/media/use-asset-serve-src.js +17 -0
- package/dist/ts/media/use-asset-serve-src.js.map +1 -0
- package/dist/ts/page-schemas.d.ts.map +1 -1
- package/dist/ts/prose-surface-css.d.ts +3 -5
- package/dist/ts/prose-surface-css.d.ts.map +1 -1
- package/dist/ts/prose-surface-css.js +3 -5
- package/dist/ts/prose-surface-css.js.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 +4 -21
- package/dist/ts/site-styles.d.ts.map +1 -1
- package/dist/ts/site-styles.js.map +1 -1
- package/dist/ts/ui-config.d.ts +62 -3
- package/dist/ts/ui-config.d.ts.map +1 -1
- package/dist/ts/ui-config.js +18 -0
- package/dist/ts/ui-config.js.map +1 -1
- package/dist/ts/utils/asset-url.d.ts +3 -0
- package/dist/ts/utils/asset-url.d.ts.map +1 -1
- package/dist/ts/utils/asset-url.js +4 -0
- package/dist/ts/utils/asset-url.js.map +1 -1
- package/dist/ts/utils/data-entry-validation.d.ts +11 -0
- package/dist/ts/utils/data-entry-validation.d.ts.map +1 -0
- package/dist/ts/utils/data-entry-validation.js +15 -0
- package/dist/ts/utils/data-entry-validation.js.map +1 -0
- package/package.json +20 -11
- package/src/App.tsx +22 -10
- package/src/CmsSpaApp.tsx +5 -1
- package/src/components/CMSDashboard.tsx +16 -8
- package/src/components/dialogs/DeleteConfirmDialog.tsx +14 -1
- package/src/components/dialogs/MakePagesEditableDialog.tsx +112 -0
- package/src/components/dialogs/MoveFolderDialog.tsx +9 -2
- package/src/components/editor/CMSMDXEditor.tsx +56 -76
- package/src/components/editor/DocsPreviewButton.tsx +25 -0
- package/src/components/editor/ImagePickerDialog.tsx +2 -2
- package/src/components/editor/MdxPageEditor.tsx +2 -0
- package/src/components/editor/PageEditor.tsx +46 -22
- package/src/components/editor/PageEditorWrapper.tsx +34 -5
- package/src/components/editor/draft-media-config.ts +199 -41
- package/src/components/editor/preview-availability.ts +9 -5
- package/src/components/editors/DataEditor.tsx +65 -32
- package/src/components/fields/ImageField.tsx +2 -2
- package/src/components/media/AssetCard.tsx +12 -9
- package/src/components/media/AssetDetailSidebar.tsx +38 -25
- package/src/components/media/AssetUsageList.tsx +84 -0
- package/src/components/media/MediaLibrary.tsx +6 -4
- package/src/components/media/index.ts +1 -0
- package/src/components/pages/DataList.tsx +53 -29
- package/src/components/pages/MediaPage.tsx +14 -5
- package/src/components/pages/NoPagesYet.tsx +41 -0
- package/src/components/pages/PageList.tsx +40 -27
- package/src/components/sandbox/ContentSandbox.tsx +34 -5
- package/src/content-wrapper.ts +284 -0
- package/src/convert-pages.ts +110 -0
- package/src/frame/channel.ts +258 -0
- package/src/frame/editor-frame.ts +184 -0
- package/src/frame/media-cache.ts +157 -0
- package/src/frame/memory-router.ts +39 -0
- package/src/frame/parent-hello.ts +62 -0
- package/src/frame/protocol.ts +332 -0
- package/src/frame/rpc-content-client.ts +58 -0
- package/src/frame/save-shortcut.ts +25 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/usePageConversion.ts +55 -0
- package/src/hooks/useUploadFlow.ts +44 -7
- package/src/host-style-probe.ts +104 -90
- package/src/index.ts +10 -2
- package/src/main-spa.tsx +2 -0
- package/src/main.css +2 -1
- package/src/media/prepare-image-upload.ts +118 -0
- package/src/media/use-asset-serve-src.ts +22 -0
- package/src/prose-surface-css.ts +3 -5
- package/src/site-styles.ts +4 -22
- package/src/ui-config.ts +74 -3
- package/src/utils/asset-url.ts +6 -0
- package/src/utils/data-entry-validation.ts +16 -0
- package/dist/ts/host-discovery.d.ts +0 -40
- package/dist/ts/host-discovery.d.ts.map +0 -1
- package/dist/ts/host-discovery.js +0 -39
- package/dist/ts/host-discovery.js.map +0 -1
- package/src/host-discovery.ts +0 -77
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AssetEntry } from '@conloca/content-api-client';
|
|
1
2
|
/** An asset path relative to the media root; this is the identity accepted by asset routes. */
|
|
2
3
|
export declare function assetPath(folder: string | undefined, filename: string): string;
|
|
3
4
|
/** Backwards-compatible name used by editor components. */
|
|
@@ -8,4 +9,6 @@ export declare function appendAssetUrlPath(base: string, path: string): string;
|
|
|
8
9
|
export declare function buildAssetServeUrl(basePath: string, folder: string | undefined, filename: string): string;
|
|
9
10
|
/** The content reference written when the editor picks an asset. */
|
|
10
11
|
export declare function buildAssetRef(folder: string | undefined, filename: string): string;
|
|
12
|
+
/** The link a pick of `asset` stores: the one the server gave it, else the site link `buildAssetRef` builds. */
|
|
13
|
+
export declare function assetRefOf(asset: Pick<AssetEntry, 'folder' | 'filename' | 'ref'>): string;
|
|
11
14
|
//# sourceMappingURL=asset-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-url.d.ts","sourceRoot":"","sources":["../../../src/utils/asset-url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asset-url.d.ts","sourceRoot":"","sources":["../../../src/utils/asset-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAG9D,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG9E;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrE;AAED,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzG;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElF;AAED,gHAAgH;AAChH,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC,GAAG,MAAM,CAEzF"}
|
|
@@ -23,4 +23,8 @@ export function buildAssetServeUrl(basePath, folder, filename) {
|
|
|
23
23
|
export function buildAssetRef(folder, filename) {
|
|
24
24
|
return buildAssetServeUrl(getUIConfig().assetRefBase ?? '/assets', folder, filename);
|
|
25
25
|
}
|
|
26
|
+
/** The link a pick of `asset` stores: the one the server gave it, else the site link `buildAssetRef` builds. */
|
|
27
|
+
export function assetRefOf(asset) {
|
|
28
|
+
return asset.ref ?? buildAssetRef(asset.folder, asset.filename);
|
|
29
|
+
}
|
|
26
30
|
//# sourceMappingURL=asset-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-url.js","sourceRoot":"","sources":["../../../src/utils/asset-url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asset-url.js","sourceRoot":"","sources":["../../../src/utils/asset-url.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,+FAA+F;AAC/F,MAAM,UAAU,SAAS,CAAC,MAA0B,EAAE,QAAgB;IACpE,MAAM,SAAS,GAAG,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IACpD,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC3D,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,cAAc,CAAC,MAA0B,EAAE,QAAgB;IACzE,OAAO,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACrC,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,IAAY;IAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACjE,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,MAAM,EAAE,CAAC;AAC3D,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,MAA0B,EAAE,QAAgB;IAC/F,OAAO,GAAG,QAAQ,IAAI,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;AACtD,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,aAAa,CAAC,MAA0B,EAAE,QAAgB;IACxE,OAAO,kBAAkB,CAAC,WAAW,EAAE,CAAC,YAAY,IAAI,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AACvF,CAAC;AAED,gHAAgH;AAChH,MAAM,UAAU,UAAU,CAAC,KAAsD;IAC/E,OAAO,KAAK,CAAC,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DataCollectionEntry } from '@conloca/content-api-client';
|
|
2
|
+
import type { HostSchema } from '../host-schema.js';
|
|
3
|
+
/**
|
|
4
|
+
* Why the build would reject `values` as a data entry of `schema`, or null when it accepts them.
|
|
5
|
+
*
|
|
6
|
+
* Only the verdict is read: a pruning validator (`typia.plain.createValidatePrune`) drops undeclared
|
|
7
|
+
* keys from what it validates, so it gets a copy and the caller stores `values` as they are, keys
|
|
8
|
+
* written outside the form included.
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateEntryData(schema: HostSchema, values: DataCollectionEntry['data']): string | null;
|
|
11
|
+
//# sourceMappingURL=data-entry-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-entry-validation.d.ts","sourceRoot":"","sources":["../../../src/utils/data-entry-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAKxG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why the build would reject `values` as a data entry of `schema`, or null when it accepts them.
|
|
3
|
+
*
|
|
4
|
+
* Only the verdict is read: a pruning validator (`typia.plain.createValidatePrune`) drops undeclared
|
|
5
|
+
* keys from what it validates, so it gets a copy and the caller stores `values` as they are, keys
|
|
6
|
+
* written outside the form included.
|
|
7
|
+
*/
|
|
8
|
+
export function validateEntryData(schema, values) {
|
|
9
|
+
const result = schema.validate(structuredClone(values));
|
|
10
|
+
if (result.success)
|
|
11
|
+
return null;
|
|
12
|
+
const fields = result.errors.map((error) => `${error.path.replace(/^\$input\./, '')} (expected ${error.expected})`);
|
|
13
|
+
return `Fix these fields before saving: ${fields.join(', ')}`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=data-entry-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-entry-validation.js","sourceRoot":"","sources":["../../../src/utils/data-entry-validation.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAkB,EAAE,MAAmC;IACvF,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,cAAc,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpH,OAAO,mCAAmC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAChE,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.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -55,16 +55,16 @@
|
|
|
55
55
|
"import": "./dist/ts/merge-default-props.js",
|
|
56
56
|
"default": "./dist/ts/merge-default-props.js"
|
|
57
57
|
},
|
|
58
|
+
"./content-wrapper": {
|
|
59
|
+
"types": "./dist/ts/content-wrapper.d.ts",
|
|
60
|
+
"import": "./dist/ts/content-wrapper.js",
|
|
61
|
+
"default": "./dist/ts/content-wrapper.js"
|
|
62
|
+
},
|
|
58
63
|
"./puck-config": {
|
|
59
64
|
"types": "./dist/ts/puck-config.d.ts",
|
|
60
65
|
"import": "./dist/ts/puck-config.js",
|
|
61
66
|
"default": "./dist/ts/puck-config.js"
|
|
62
67
|
},
|
|
63
|
-
"./host-discovery": {
|
|
64
|
-
"types": "./dist/ts/host-discovery.d.ts",
|
|
65
|
-
"import": "./dist/ts/host-discovery.js",
|
|
66
|
-
"default": "./dist/ts/host-discovery.js"
|
|
67
|
-
},
|
|
68
68
|
"./site-styles": {
|
|
69
69
|
"types": "./dist/ts/site-styles.d.ts",
|
|
70
70
|
"import": "./dist/ts/site-styles.js",
|
|
@@ -75,6 +75,16 @@
|
|
|
75
75
|
"import": "./dist/ts/theme.js",
|
|
76
76
|
"default": "./dist/ts/theme.js"
|
|
77
77
|
},
|
|
78
|
+
"./frame-protocol": {
|
|
79
|
+
"types": "./dist/ts/frame/protocol.d.ts",
|
|
80
|
+
"import": "./dist/ts/frame/protocol.js",
|
|
81
|
+
"default": "./dist/ts/frame/protocol.js"
|
|
82
|
+
},
|
|
83
|
+
"./frame-channel": {
|
|
84
|
+
"types": "./dist/ts/frame/channel.d.ts",
|
|
85
|
+
"import": "./dist/ts/frame/channel.js",
|
|
86
|
+
"default": "./dist/ts/frame/channel.js"
|
|
87
|
+
},
|
|
78
88
|
"./mock-puck-config": {
|
|
79
89
|
"types": "./dist/ts/mock-puck-config.d.ts",
|
|
80
90
|
"import": "./dist/ts/mock-puck-config.js",
|
|
@@ -124,8 +134,8 @@
|
|
|
124
134
|
"test": "nx run cms-spa:test --outputStyle=stream"
|
|
125
135
|
},
|
|
126
136
|
"dependencies": {
|
|
127
|
-
"@conloca/content-api-client": "0.2.
|
|
128
|
-
"@conloca/mdx": "0.2.
|
|
137
|
+
"@conloca/content-api-client": "0.2.4",
|
|
138
|
+
"@conloca/mdx": "0.2.4",
|
|
129
139
|
"@lexical/react": "^0.48.0",
|
|
130
140
|
"@mdxeditor/editor": "^4.2.3",
|
|
131
141
|
"@puckeditor/core": "^0.23.0",
|
|
@@ -160,7 +170,7 @@
|
|
|
160
170
|
"@tailwindcss/vite": "^4.3.3",
|
|
161
171
|
"@testing-library/jest-dom": "^7.0.1",
|
|
162
172
|
"@testing-library/react": "^16.3.3",
|
|
163
|
-
"@ttsc/unplugin": "
|
|
173
|
+
"@ttsc/unplugin": "0.34.1",
|
|
164
174
|
"@vitejs/plugin-react": "^5.2.0",
|
|
165
175
|
"@vitest/browser-playwright": "^4.1.11",
|
|
166
176
|
"bun-tailwindcss": "^0.0.9",
|
|
@@ -172,7 +182,7 @@
|
|
|
172
182
|
"react-refresh-typescript": "^2.0.12",
|
|
173
183
|
"storybook": "^10.6.2",
|
|
174
184
|
"tailwindcss": "^4.3.3",
|
|
175
|
-
"ttsc": "0.
|
|
185
|
+
"ttsc": "0.34.1",
|
|
176
186
|
"typescript": "^6.0.3",
|
|
177
187
|
"typia": "^14.0.4",
|
|
178
188
|
"vite": "^7.3.6",
|
|
@@ -180,7 +190,6 @@
|
|
|
180
190
|
},
|
|
181
191
|
"nx": {
|
|
182
192
|
"targets": {
|
|
183
|
-
"clean": {},
|
|
184
193
|
"dev": {
|
|
185
194
|
"executor": "nx:run-commands",
|
|
186
195
|
"dependsOn": [
|
package/src/App.tsx
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { Config } from '@puckeditor/core';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import { useEffect, useMemo } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
createBrowserRouter,
|
|
5
|
+
createMemoryRouter,
|
|
6
|
+
createRoutesFromElements,
|
|
7
|
+
Route,
|
|
8
|
+
RouterProvider,
|
|
9
|
+
Routes,
|
|
10
|
+
} from 'react-router-dom';
|
|
4
11
|
import { CMSDashboard } from './components/CMSDashboard.js';
|
|
5
12
|
import { CMSLayout } from './components/CMSLayout.js';
|
|
6
13
|
import { FragmentEditor } from './components/editor/FragmentEditor.js';
|
|
@@ -11,7 +18,9 @@ import { MediaPage } from './components/pages/MediaPage.js';
|
|
|
11
18
|
import { PageList } from './components/pages/PageList.js';
|
|
12
19
|
import { RouteErrorPage } from './components/RouteErrorPage.js';
|
|
13
20
|
import { type DataSchemas, useDataSchemas } from './data-schemas.js';
|
|
21
|
+
import { syncMemoryRouter } from './frame/memory-router.js';
|
|
14
22
|
import { usePuckConfig } from './puck-config.js';
|
|
23
|
+
import type { MemoryRouterConfig } from './ui-config.js';
|
|
15
24
|
|
|
16
25
|
export interface RouteDeps {
|
|
17
26
|
puckConfig: Config;
|
|
@@ -70,18 +79,21 @@ export function AppRoutes() {
|
|
|
70
79
|
/**
|
|
71
80
|
* Production app entry. Uses the Data Router API so v7's `useBlocker` works
|
|
72
81
|
* for the unsaved-changes navigation guard in MdxPageEditor / FragmentEditor.
|
|
82
|
+
* With `memoryRouter` the route lives in memory and is mirrored to the parent
|
|
83
|
+
* frame instead of the address bar.
|
|
73
84
|
*/
|
|
74
|
-
export default function App({ basename }: { basename?: string } = {}) {
|
|
85
|
+
export default function App({ basename, memoryRouter }: { basename?: string; memoryRouter?: MemoryRouterConfig } = {}) {
|
|
75
86
|
const puckConfig = usePuckConfig();
|
|
76
87
|
const dataSchemas = useDataSchemas();
|
|
77
88
|
|
|
78
|
-
const router = useMemo(
|
|
79
|
-
()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
const router = useMemo(() => {
|
|
90
|
+
const routes = createRoutesFromElements(routeElements({ puckConfig, dataSchemas }));
|
|
91
|
+
return memoryRouter
|
|
92
|
+
? createMemoryRouter(routes, { initialEntries: [memoryRouter.initialPath] })
|
|
93
|
+
: createBrowserRouter(routes, { basename });
|
|
94
|
+
}, [puckConfig, dataSchemas, basename, memoryRouter]);
|
|
95
|
+
|
|
96
|
+
useEffect(() => (memoryRouter ? syncMemoryRouter(router, memoryRouter) : undefined), [router, memoryRouter]);
|
|
85
97
|
|
|
86
98
|
return <RouterProvider router={router} />;
|
|
87
99
|
}
|
package/src/CmsSpaApp.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
|
3
3
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
4
4
|
import { useEffect, useMemo } from 'react';
|
|
5
5
|
import App from './App.js';
|
|
6
|
+
import { clearMediaCache } from './frame/media-cache.js';
|
|
6
7
|
import { CanvasThemeProvider } from './hooks/useCanvasTheme.js';
|
|
7
8
|
import { ThemeProvider } from './hooks/useTheme.js';
|
|
8
9
|
import { getUIConfig } from './ui-config.js';
|
|
@@ -40,6 +41,9 @@ export function CmsSpaApp() {
|
|
|
40
41
|
};
|
|
41
42
|
}, [queryClient]);
|
|
42
43
|
|
|
44
|
+
// Loaded media belongs to this mount's site and branch.
|
|
45
|
+
useEffect(() => clearMediaCache, []);
|
|
46
|
+
|
|
43
47
|
// Every content write in the editor goes through this one client, so the
|
|
44
48
|
// read-only seam is installed here and nowhere else: a surface added later
|
|
45
49
|
// is gated whether or not its author knew the seam existed. Reads are
|
|
@@ -54,7 +58,7 @@ export function CmsSpaApp() {
|
|
|
54
58
|
<QueryClientProvider client={queryClient}>
|
|
55
59
|
<ThemeProvider>
|
|
56
60
|
<CanvasThemeProvider>
|
|
57
|
-
<App basename={config.basename} />
|
|
61
|
+
<App basename={config.basename} memoryRouter={config.memoryRouter} />
|
|
58
62
|
</CanvasThemeProvider>
|
|
59
63
|
</ThemeProvider>
|
|
60
64
|
{config.enableDevtools && <ReactQueryDevtools initialIsOpen={false} />}
|
|
@@ -6,6 +6,7 @@ import { Link } from 'react-router-dom';
|
|
|
6
6
|
import { SectionCard } from './cards/SectionCard.js';
|
|
7
7
|
import { RecentActivity } from './dashboard/RecentActivity.js';
|
|
8
8
|
import { CreatePageFlow } from './dialogs/CreatePageFlow.js';
|
|
9
|
+
import { NoPagesYet } from './pages/NoPagesYet.js';
|
|
9
10
|
|
|
10
11
|
const DASHBOARD_SITE = 'default';
|
|
11
12
|
|
|
@@ -110,15 +111,22 @@ export function CMSDashboard() {
|
|
|
110
111
|
/>
|
|
111
112
|
</div>
|
|
112
113
|
|
|
113
|
-
{/* Recent Activity */}
|
|
114
|
-
|
|
115
|
-
<div className="
|
|
116
|
-
<
|
|
117
|
-
Recent Activity
|
|
118
|
-
</h2>
|
|
114
|
+
{/* Only a load that succeeded empty means no pages; a failed load keeps Recent Activity. */}
|
|
115
|
+
{sitePages !== undefined && pagesCount === 0 ? (
|
|
116
|
+
<div className="bg-white dark:bg-grey-02 border border-grey-09 dark:border-grey-03 rounded-lg">
|
|
117
|
+
<NoPagesYet onCreatePage={() => setShowCreateDialog(true)} />
|
|
119
118
|
</div>
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
) : (
|
|
120
|
+
/* Recent Activity */
|
|
121
|
+
<div className="bg-white dark:bg-grey-02 border border-grey-09 dark:border-grey-03 rounded-lg">
|
|
122
|
+
<div className="px-4 py-3 border-b border-grey-09 dark:border-grey-03">
|
|
123
|
+
<h2 className="text-xs font-medium uppercase tracking-wider text-grey-05 dark:text-grey-06">
|
|
124
|
+
Recent Activity
|
|
125
|
+
</h2>
|
|
126
|
+
</div>
|
|
127
|
+
<RecentActivity />
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
122
130
|
|
|
123
131
|
<CreatePageFlow open={showCreateDialog} onOpenChange={setShowCreateDialog} site={DASHBOARD_SITE} />
|
|
124
132
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import { Button } from '../ui/index.js';
|
|
2
3
|
|
|
3
4
|
interface DeleteConfirmDialogProps {
|
|
@@ -8,6 +9,10 @@ interface DeleteConfirmDialogProps {
|
|
|
8
9
|
message?: string;
|
|
9
10
|
itemName?: string;
|
|
10
11
|
isDeleting?: boolean;
|
|
12
|
+
/** Shown above the warning, e.g. the pages that use what is about to go. */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/** Holds the confirm button until the caller is ready, e.g. until those pages are known. */
|
|
15
|
+
confirmDisabled?: boolean;
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
export function DeleteConfirmDialog({
|
|
@@ -18,6 +23,8 @@ export function DeleteConfirmDialog({
|
|
|
18
23
|
message,
|
|
19
24
|
itemName,
|
|
20
25
|
isDeleting = false,
|
|
26
|
+
children,
|
|
27
|
+
confirmDisabled = false,
|
|
21
28
|
}: DeleteConfirmDialogProps) {
|
|
22
29
|
if (!isOpen) return null;
|
|
23
30
|
|
|
@@ -35,6 +42,7 @@ export function DeleteConfirmDialog({
|
|
|
35
42
|
"{itemName}"
|
|
36
43
|
</p>
|
|
37
44
|
)}
|
|
45
|
+
{children}
|
|
38
46
|
<p className="text-red-04 dark:text-red-08 text-sm mt-3" data-testid="delete-warning-message">
|
|
39
47
|
This action cannot be undone.
|
|
40
48
|
</p>
|
|
@@ -44,7 +52,12 @@ export function DeleteConfirmDialog({
|
|
|
44
52
|
<Button variant="outline" onClick={onCancel} disabled={isDeleting}>
|
|
45
53
|
Cancel
|
|
46
54
|
</Button>
|
|
47
|
-
<Button
|
|
55
|
+
<Button
|
|
56
|
+
variant="destructive"
|
|
57
|
+
onClick={onConfirm}
|
|
58
|
+
disabled={isDeleting || confirmDisabled}
|
|
59
|
+
className="flex items-center gap-2"
|
|
60
|
+
>
|
|
48
61
|
{isDeleting ? (
|
|
49
62
|
<>
|
|
50
63
|
<span className="inline-block animate-spin rounded-full h-4 w-4 border-b-2 border-white" />
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as Dialog from '@radix-ui/react-dialog';
|
|
2
|
+
import { X } from 'lucide-react';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { conversionPrompt } from '../../convert-pages.js';
|
|
5
|
+
import type { PageConversionOffer } from '../../hooks/index.js';
|
|
6
|
+
import { Button, IconButton, Textarea } from '../ui/index.js';
|
|
7
|
+
|
|
8
|
+
interface MakePagesEditableDialogProps {
|
|
9
|
+
open: boolean;
|
|
10
|
+
onOpenChange: (open: boolean) => void;
|
|
11
|
+
offer: PageConversionOffer;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Lets the person editing choose Astro pages to convert and copy the prompt that has a coding agent convert them. */
|
|
15
|
+
export function MakePagesEditableDialog({ open, onOpenChange, offer }: MakePagesEditableDialogProps) {
|
|
16
|
+
return (
|
|
17
|
+
<Dialog.Root open={open} onOpenChange={onOpenChange}>
|
|
18
|
+
<Dialog.Portal>
|
|
19
|
+
<Dialog.Overlay className="fixed inset-0 z-50 bg-black/50 backdrop-blur-sm" />
|
|
20
|
+
<Dialog.Content
|
|
21
|
+
className="fixed top-1/2 left-1/2 z-50 -translate-x-1/2 -translate-y-1/2 bg-overlay rounded-lg shadow-lg p-6 w-full max-w-md mx-4 max-h-[90vh] overflow-y-auto"
|
|
22
|
+
aria-describedby={undefined}
|
|
23
|
+
>
|
|
24
|
+
<div className="flex items-center justify-between mb-4">
|
|
25
|
+
<Dialog.Title className="text-lg font-semibold">Make existing pages editable</Dialog.Title>
|
|
26
|
+
<Dialog.Close asChild>
|
|
27
|
+
<IconButton icon={X} ariaLabel="Close" variant="ghost" />
|
|
28
|
+
</Dialog.Close>
|
|
29
|
+
</div>
|
|
30
|
+
{/* Dialog.Content mounts the picker on every open, so each open starts with nothing chosen. */}
|
|
31
|
+
<RoutePicker offer={offer} />
|
|
32
|
+
</Dialog.Content>
|
|
33
|
+
</Dialog.Portal>
|
|
34
|
+
</Dialog.Root>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function RoutePicker({ offer }: { offer: PageConversionOffer }) {
|
|
39
|
+
const { facts, collection, candidates } = offer;
|
|
40
|
+
const [checked, setChecked] = useState<ReadonlySet<string>>(new Set());
|
|
41
|
+
const [copied, setCopied] = useState<'copied' | 'failed' | undefined>();
|
|
42
|
+
const chosen = candidates?.filter((route) => checked.has(route)) ?? [];
|
|
43
|
+
const prompt = conversionPrompt({ facts, collection, routes: chosen.length > 0 ? chosen : undefined });
|
|
44
|
+
|
|
45
|
+
const toggle = (route: string) => {
|
|
46
|
+
const next = new Set(checked);
|
|
47
|
+
if (!next.delete(route)) next.add(route);
|
|
48
|
+
setChecked(next);
|
|
49
|
+
setCopied(undefined);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const copy = async () => {
|
|
53
|
+
try {
|
|
54
|
+
await navigator.clipboard.writeText(prompt);
|
|
55
|
+
setCopied('copied');
|
|
56
|
+
} catch {
|
|
57
|
+
setCopied('failed');
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className="space-y-4 text-sm">
|
|
63
|
+
{candidates === undefined ? (
|
|
64
|
+
<p className="text-grey-04 dark:text-grey-07">
|
|
65
|
+
Conloca doesn't have this site's page list yet. The prompt asks your coding agent to update Conloca first,
|
|
66
|
+
then list the pages so you can choose.
|
|
67
|
+
</p>
|
|
68
|
+
) : (
|
|
69
|
+
<>
|
|
70
|
+
<p className="text-grey-04 dark:text-grey-07">
|
|
71
|
+
Choose the pages to convert. Pages you don't choose stay as they are.
|
|
72
|
+
</p>
|
|
73
|
+
<ul className="max-h-60 overflow-y-auto space-y-2">
|
|
74
|
+
{candidates.map((route) => (
|
|
75
|
+
<li key={route}>
|
|
76
|
+
<label className="flex items-center gap-2">
|
|
77
|
+
<input
|
|
78
|
+
type="checkbox"
|
|
79
|
+
checked={checked.has(route)}
|
|
80
|
+
onChange={() => toggle(route)}
|
|
81
|
+
className="w-4 h-4 rounded-md border-grey-09 text-azure-04 focus:ring-azure-04"
|
|
82
|
+
/>
|
|
83
|
+
<span className="text-sm font-medium text-grey-01 dark:text-grey-12">{route}</span>
|
|
84
|
+
</label>
|
|
85
|
+
</li>
|
|
86
|
+
))}
|
|
87
|
+
</ul>
|
|
88
|
+
</>
|
|
89
|
+
)}
|
|
90
|
+
<p className="text-grey-04 dark:text-grey-07">
|
|
91
|
+
Copy the prompt, then paste it into your coding agent or send it to your developer. Review the changes, then
|
|
92
|
+
commit, push and deploy; converted pages then show up here.
|
|
93
|
+
</p>
|
|
94
|
+
{/* Only shown when the clipboard refuses, so the prompt can still be copied by hand. */}
|
|
95
|
+
{copied === 'failed' && <Textarea aria-label="Prompt" readOnly value={prompt} rows={6} />}
|
|
96
|
+
<p role="status" className="text-grey-04 dark:text-grey-07 min-h-5">
|
|
97
|
+
{copied === 'copied' && 'Copied. Paste it into your coding agent.'}
|
|
98
|
+
{copied === 'failed' && 'Copying failed. Select the prompt above and copy it yourself.'}
|
|
99
|
+
</p>
|
|
100
|
+
<div className="flex gap-2 pt-4">
|
|
101
|
+
<Button onClick={copy} disabled={candidates !== undefined && chosen.length === 0} className="flex-1">
|
|
102
|
+
Copy prompt
|
|
103
|
+
</Button>
|
|
104
|
+
<Dialog.Close asChild>
|
|
105
|
+
<Button variant="outline" className="flex-1">
|
|
106
|
+
Close
|
|
107
|
+
</Button>
|
|
108
|
+
</Dialog.Close>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Folder, X } from 'lucide-react';
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { type ReactNode, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { type FolderTreeNode, useFolderTree } from '../../hooks/index.js';
|
|
4
4
|
import { cn } from '../../utils/cn.js';
|
|
5
5
|
import { contentFailureMessage } from '../../utils/content-failure.js';
|
|
@@ -13,6 +13,10 @@ interface MoveFolderDialogProps {
|
|
|
13
13
|
onMove: (targetFolder: string) => Promise<void>;
|
|
14
14
|
onCancel: () => void;
|
|
15
15
|
isMoving?: boolean;
|
|
16
|
+
/** Shown above the folder list, e.g. the pages that link what is about to move. */
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
/** Holds the Move button until the caller is ready, e.g. until those pages are known. */
|
|
19
|
+
confirmDisabled?: boolean;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
interface FolderOptionProps {
|
|
@@ -69,6 +73,8 @@ export function MoveFolderDialog({
|
|
|
69
73
|
onMove,
|
|
70
74
|
onCancel,
|
|
71
75
|
isMoving = false,
|
|
76
|
+
children,
|
|
77
|
+
confirmDisabled = false,
|
|
72
78
|
}: MoveFolderDialogProps) {
|
|
73
79
|
const [selectedFolder, setSelectedFolder] = useState<string | null>(null);
|
|
74
80
|
const [moveError, setMoveError] = useState<string | null>(null);
|
|
@@ -117,7 +123,7 @@ export function MoveFolderDialog({
|
|
|
117
123
|
|
|
118
124
|
if (!isOpen) return null;
|
|
119
125
|
|
|
120
|
-
const canMove = selectedFolder !== null && selectedFolder !== currentFolder;
|
|
126
|
+
const canMove = selectedFolder !== null && selectedFolder !== currentFolder && !confirmDisabled;
|
|
121
127
|
|
|
122
128
|
return (
|
|
123
129
|
<div
|
|
@@ -134,6 +140,7 @@ export function MoveFolderDialog({
|
|
|
134
140
|
<IconButton icon={X} ariaLabel="Cancel" onClick={onCancel} variant="ghost" />
|
|
135
141
|
</div>
|
|
136
142
|
|
|
143
|
+
{children ? <div className="px-6 pt-4">{children}</div> : null}
|
|
137
144
|
{/* Folder list */}
|
|
138
145
|
<div className="p-4 max-h-80 overflow-y-auto">
|
|
139
146
|
{isLoading ? (
|