convex-cms 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin-dist/nitro.json +15 -0
- package/admin-dist/public/assets/CmsEmptyState-CRswfTzk.js +5 -0
- package/admin-dist/public/assets/CmsPageHeader-CirpXndm.js +1 -0
- package/admin-dist/public/assets/CmsStatusBadge-CbEUpQu-.js +1 -0
- package/admin-dist/public/assets/CmsToolbar-BI2nZOXp.js +1 -0
- package/admin-dist/public/assets/ContentEntryEditor-CBeCyK_m.js +4 -0
- package/admin-dist/public/assets/ErrorState-BIVaWmom.js +1 -0
- package/admin-dist/public/assets/TaxonomyFilter-ChaY6Y_x.js +1 -0
- package/admin-dist/public/assets/_contentTypeId-DQ8k_Rvw.js +1 -0
- package/admin-dist/public/assets/_entryId-CKU_glsK.js +1 -0
- package/admin-dist/public/assets/alert-BXjTqrwQ.js +1 -0
- package/admin-dist/public/assets/badge-hvUOzpVZ.js +1 -0
- package/admin-dist/public/assets/circle-check-big-CF_pR17r.js +1 -0
- package/admin-dist/public/assets/command-DU82cJlt.js +1 -0
- package/admin-dist/public/assets/content-_LXl3pp7.js +1 -0
- package/admin-dist/public/assets/content-types-KjxaXGxY.js +2 -0
- package/admin-dist/public/assets/globals-CS6BZ0zp.css +1 -0
- package/admin-dist/public/assets/index-DNGIZHL-.js +1 -0
- package/admin-dist/public/assets/label-KNtpL71g.js +1 -0
- package/admin-dist/public/assets/link-2-Bw2aI4V4.js +1 -0
- package/admin-dist/public/assets/list-sYepHjt_.js +1 -0
- package/admin-dist/public/assets/main-CKj5yfEi.js +97 -0
- package/admin-dist/public/assets/media-Bkrkffm7.js +1 -0
- package/admin-dist/public/assets/new._contentTypeId-C3LstjNs.js +1 -0
- package/admin-dist/public/assets/plus-DUn8v_Xf.js +1 -0
- package/admin-dist/public/assets/rotate-ccw-DJEoHcRI.js +1 -0
- package/admin-dist/public/assets/scroll-area-DfIlT0in.js +1 -0
- package/admin-dist/public/assets/search-MuAUDJKR.js +1 -0
- package/admin-dist/public/assets/select-BD29IXCI.js +1 -0
- package/admin-dist/public/assets/settings-DmMyn_6A.js +1 -0
- package/admin-dist/public/assets/switch-h3Rrnl5i.js +1 -0
- package/admin-dist/public/assets/tabs-imc8h-Dp.js +1 -0
- package/admin-dist/public/assets/taxonomies-dAsrT65H.js +1 -0
- package/admin-dist/public/assets/textarea-BTy7nwzR.js +1 -0
- package/admin-dist/public/assets/trash-SAWKZZHv.js +1 -0
- package/admin-dist/public/assets/triangle-alert-E52Vfeuh.js +1 -0
- package/admin-dist/public/assets/useBreadcrumbLabel-BECBMCzM.js +1 -0
- package/admin-dist/public/assets/usePermissions-Basjs9BT.js +1 -0
- package/admin-dist/public/favicon.ico +0 -0
- package/admin-dist/server/_chunks/_libs/@date-fns/tz.mjs +217 -0
- package/admin-dist/server/_chunks/_libs/@floating-ui/core.mjs +719 -0
- package/admin-dist/server/_chunks/_libs/@floating-ui/dom.mjs +622 -0
- package/admin-dist/server/_chunks/_libs/@floating-ui/react-dom.mjs +292 -0
- package/admin-dist/server/_chunks/_libs/@floating-ui/utils.mjs +320 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/number.mjs +6 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/primitive.mjs +11 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-arrow.mjs +23 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-avatar.mjs +119 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-checkbox.mjs +270 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-collection.mjs +69 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-compose-refs.mjs +39 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-context.mjs +137 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-dialog.mjs +325 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-direction.mjs +9 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-dismissable-layer.mjs +210 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-dropdown-menu.mjs +253 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-focus-guards.mjs +29 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-focus-scope.mjs +206 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-id.mjs +14 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-label.mjs +23 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-menu.mjs +812 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-popover.mjs +300 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-popper.mjs +286 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-portal.mjs +16 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-presence.mjs +128 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-primitive.mjs +141 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-roving-focus.mjs +224 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-scroll-area.mjs +721 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-select.mjs +1163 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-separator.mjs +28 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-slot.mjs +601 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-switch.mjs +152 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-tabs.mjs +189 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-use-callback-ref.mjs +11 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-use-controllable-state.mjs +69 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-use-effect-event.mjs +1 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-use-escape-keydown.mjs +17 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-use-is-hydrated.mjs +15 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-use-layout-effect.mjs +6 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-use-previous.mjs +14 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-use-size.mjs +39 -0
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-visually-hidden.mjs +33 -0
- package/admin-dist/server/_chunks/_libs/@tanstack/history.mjs +409 -0
- package/admin-dist/server/_chunks/_libs/@tanstack/react-router.mjs +1711 -0
- package/admin-dist/server/_chunks/_libs/@tanstack/react-store.mjs +56 -0
- package/admin-dist/server/_chunks/_libs/@tanstack/router-core.mjs +4829 -0
- package/admin-dist/server/_chunks/_libs/@tanstack/store.mjs +134 -0
- package/admin-dist/server/_chunks/_libs/react-dom.mjs +10781 -0
- package/admin-dist/server/_chunks/_libs/react.mjs +513 -0
- package/admin-dist/server/_libs/aria-hidden.mjs +122 -0
- package/admin-dist/server/_libs/class-variance-authority.mjs +44 -0
- package/admin-dist/server/_libs/clsx.mjs +16 -0
- package/admin-dist/server/_libs/cmdk.mjs +315 -0
- package/admin-dist/server/_libs/convex.mjs +4841 -0
- package/admin-dist/server/_libs/cookie-es.mjs +58 -0
- package/admin-dist/server/_libs/croner.mjs +1 -0
- package/admin-dist/server/_libs/crossws.mjs +1 -0
- package/admin-dist/server/_libs/date-fns.mjs +1716 -0
- package/admin-dist/server/_libs/detect-node-es.mjs +1 -0
- package/admin-dist/server/_libs/get-nonce.mjs +9 -0
- package/admin-dist/server/_libs/h3-v2.mjs +277 -0
- package/admin-dist/server/_libs/h3.mjs +401 -0
- package/admin-dist/server/_libs/hookable.mjs +1 -0
- package/admin-dist/server/_libs/isbot.mjs +20 -0
- package/admin-dist/server/_libs/lucide-react.mjs +850 -0
- package/admin-dist/server/_libs/ohash.mjs +1 -0
- package/admin-dist/server/_libs/react-day-picker.mjs +2201 -0
- package/admin-dist/server/_libs/react-remove-scroll-bar.mjs +82 -0
- package/admin-dist/server/_libs/react-remove-scroll.mjs +328 -0
- package/admin-dist/server/_libs/react-style-singleton.mjs +69 -0
- package/admin-dist/server/_libs/rou3.mjs +8 -0
- package/admin-dist/server/_libs/seroval-plugins.mjs +58 -0
- package/admin-dist/server/_libs/seroval.mjs +1765 -0
- package/admin-dist/server/_libs/srvx.mjs +719 -0
- package/admin-dist/server/_libs/tailwind-merge.mjs +3010 -0
- package/admin-dist/server/_libs/tiny-invariant.mjs +12 -0
- package/admin-dist/server/_libs/tiny-warning.mjs +5 -0
- package/admin-dist/server/_libs/tslib.mjs +39 -0
- package/admin-dist/server/_libs/ufo.mjs +54 -0
- package/admin-dist/server/_libs/unctx.mjs +1 -0
- package/admin-dist/server/_libs/unstorage.mjs +1 -0
- package/admin-dist/server/_libs/use-callback-ref.mjs +66 -0
- package/admin-dist/server/_libs/use-sidecar.mjs +106 -0
- package/admin-dist/server/_libs/use-sync-external-store.mjs +139 -0
- package/admin-dist/server/_libs/zod.mjs +4223 -0
- package/admin-dist/server/_ssr/CmsEmptyState-DU7-7-mV.mjs +290 -0
- package/admin-dist/server/_ssr/CmsPageHeader-CseW0AHm.mjs +24 -0
- package/admin-dist/server/_ssr/CmsStatusBadge-B_pi4KCp.mjs +127 -0
- package/admin-dist/server/_ssr/CmsToolbar-X75ex6ek.mjs +49 -0
- package/admin-dist/server/_ssr/ContentEntryEditor-CepusRsA.mjs +3720 -0
- package/admin-dist/server/_ssr/ErrorState-cI-bKLez.mjs +89 -0
- package/admin-dist/server/_ssr/TaxonomyFilter-Bwrq0-cz.mjs +188 -0
- package/admin-dist/server/_ssr/_contentTypeId-BqYKEcLr.mjs +379 -0
- package/admin-dist/server/_ssr/_entryId-CRfnqeDf.mjs +161 -0
- package/admin-dist/server/_ssr/_tanstack-start-manifest_v-BwDlABVk.mjs +4 -0
- package/admin-dist/server/_ssr/alert-CVt45UUP.mjs +92 -0
- package/admin-dist/server/_ssr/badge-6BsP37vG.mjs +125 -0
- package/admin-dist/server/_ssr/command-fy8epIKf.mjs +128 -0
- package/admin-dist/server/_ssr/config.server-D7JHDcDv.mjs +117 -0
- package/admin-dist/server/_ssr/content-B5RhL7uW.mjs +532 -0
- package/admin-dist/server/_ssr/content-types-BIOqCQYN.mjs +1166 -0
- package/admin-dist/server/_ssr/index-DHSHDPt1.mjs +193 -0
- package/admin-dist/server/_ssr/index.mjs +1275 -0
- package/admin-dist/server/_ssr/label-C8Dko1j7.mjs +22 -0
- package/admin-dist/server/_ssr/media-CSx3XttC.mjs +1832 -0
- package/admin-dist/server/_ssr/new._contentTypeId-DzanEZQM.mjs +144 -0
- package/admin-dist/server/_ssr/router-DDWcF-kt.mjs +1556 -0
- package/admin-dist/server/_ssr/scroll-area-bjPYwhXN.mjs +59 -0
- package/admin-dist/server/_ssr/select-BUhDDf4T.mjs +142 -0
- package/admin-dist/server/_ssr/settings-DAsxnw2q.mjs +348 -0
- package/admin-dist/server/_ssr/start-HYkvq4Ni.mjs +4 -0
- package/admin-dist/server/_ssr/switch-BgyRtQ1Z.mjs +31 -0
- package/admin-dist/server/_ssr/tabs-DzMdRB1A.mjs +628 -0
- package/admin-dist/server/_ssr/taxonomies-C8j8g5Q5.mjs +915 -0
- package/admin-dist/server/_ssr/textarea-9jNeYJSc.mjs +18 -0
- package/admin-dist/server/_ssr/trash-DYMxwhZB.mjs +291 -0
- package/admin-dist/server/_ssr/useBreadcrumbLabel-FNSAr2Ha.mjs +16 -0
- package/admin-dist/server/_ssr/usePermissions-BJGGahrJ.mjs +68 -0
- package/admin-dist/server/favicon.ico +0 -0
- package/admin-dist/server/index.mjs +627 -0
- package/dist/cli/index.js +0 -0
- package/dist/client/admin-config.d.ts +0 -1
- package/dist/client/admin-config.d.ts.map +1 -1
- package/dist/client/admin-config.js +0 -1
- package/dist/client/admin-config.js.map +1 -1
- package/dist/client/adminApi.d.ts.map +1 -1
- package/dist/client/agentTools.d.ts +1237 -135
- package/dist/client/agentTools.d.ts.map +1 -1
- package/dist/client/agentTools.js +33 -9
- package/dist/client/agentTools.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +9 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/mediaAssets.d.ts +35 -0
- package/dist/component/mediaAssets.d.ts.map +1 -1
- package/dist/component/mediaAssets.js +81 -0
- package/dist/component/mediaAssets.js.map +1 -1
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +2 -1
- package/dist/test.js.map +1 -1
- package/package.json +9 -5
- package/dist/component/auditLog.d.ts +0 -410
- package/dist/component/auditLog.d.ts.map +0 -1
- package/dist/component/auditLog.js +0 -607
- package/dist/component/auditLog.js.map +0 -1
- package/dist/component/types.d.ts +0 -4
- package/dist/component/types.d.ts.map +0 -1
- package/dist/component/types.js +0 -2
- package/dist/component/types.js.map +0 -1
- package/src/cli/commands/admin.ts +0 -104
- package/src/cli/index.ts +0 -21
- package/src/cli/utils/detectConvexUrl.ts +0 -54
- package/src/cli/utils/openBrowser.ts +0 -16
- package/src/client/admin-config.ts +0 -138
- package/src/client/adminApi.ts +0 -942
- package/src/client/agentTools.ts +0 -1311
- package/src/client/argTypes.ts +0 -316
- package/src/client/field-types.ts +0 -187
- package/src/client/index.ts +0 -1301
- package/src/client/queryBuilder.ts +0 -1100
- package/src/client/schema/codegen.ts +0 -500
- package/src/client/schema/defineContentType.ts +0 -501
- package/src/client/schema/index.ts +0 -169
- package/src/client/schema/schemaDrift.ts +0 -574
- package/src/client/schema/typedClient.ts +0 -688
- package/src/client/schema/types.ts +0 -666
- package/src/client/types.ts +0 -723
- package/src/client/workflows.ts +0 -141
- package/src/client/wrapper.ts +0 -4304
- package/src/component/_generated/api.ts +0 -140
- package/src/component/_generated/component.ts +0 -5029
- package/src/component/_generated/dataModel.ts +0 -60
- package/src/component/_generated/server.ts +0 -156
- package/src/component/authorization.ts +0 -647
- package/src/component/authorizationHooks.ts +0 -668
- package/src/component/bulkOperations.ts +0 -687
- package/src/component/contentEntries.ts +0 -1976
- package/src/component/contentEntryMutations.ts +0 -1223
- package/src/component/contentEntryValidation.ts +0 -707
- package/src/component/contentLock.ts +0 -550
- package/src/component/contentTypeMigration.ts +0 -1064
- package/src/component/contentTypeMutations.ts +0 -969
- package/src/component/contentTypes.ts +0 -346
- package/src/component/convex.config.ts +0 -44
- package/src/component/documentTypes.ts +0 -240
- package/src/component/eventEmitter.ts +0 -485
- package/src/component/exportImport.ts +0 -1169
- package/src/component/index.ts +0 -491
- package/src/component/lib/deepReferenceResolver.ts +0 -999
- package/src/component/lib/errors.ts +0 -816
- package/src/component/lib/index.ts +0 -145
- package/src/component/lib/mediaReferenceResolver.ts +0 -495
- package/src/component/lib/metadataExtractor.ts +0 -792
- package/src/component/lib/mutationAuth.ts +0 -199
- package/src/component/lib/queries.ts +0 -79
- package/src/component/lib/ragContentChunker.ts +0 -1371
- package/src/component/lib/referenceResolver.ts +0 -430
- package/src/component/lib/slugGenerator.ts +0 -262
- package/src/component/lib/slugUniqueness.ts +0 -333
- package/src/component/lib/softDelete.ts +0 -44
- package/src/component/localeFallbackChain.ts +0 -673
- package/src/component/localeFields.ts +0 -896
- package/src/component/mediaAssetMutations.ts +0 -725
- package/src/component/mediaAssets.ts +0 -932
- package/src/component/mediaFolderMutations.ts +0 -1046
- package/src/component/mediaUploadMutations.ts +0 -224
- package/src/component/mediaVariantMutations.ts +0 -900
- package/src/component/mediaVariants.ts +0 -793
- package/src/component/ragContentIndexer.ts +0 -1067
- package/src/component/rateLimitHooks.ts +0 -572
- package/src/component/roles.ts +0 -1360
- package/src/component/scheduledPublish.ts +0 -358
- package/src/component/schema.ts +0 -617
- package/src/component/taxonomies.ts +0 -949
- package/src/component/taxonomyMutations.ts +0 -1210
- package/src/component/trash.ts +0 -724
- package/src/component/userContext.ts +0 -898
- package/src/component/validation.ts +0 -1388
- package/src/component/validators.ts +0 -949
- package/src/component/versionMutations.ts +0 -392
- package/src/component/webhookTrigger.ts +0 -1922
- package/src/react/index.ts +0 -898
- package/src/test.ts +0 -1580
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports } from "../_chunks/_libs/react.mjs";
|
|
2
|
+
import { d as useNavigate, L as Link } from "../_chunks/_libs/@tanstack/react-router.mjs";
|
|
3
|
+
import { a as api, D as DropdownMenu, d as DropdownMenuTrigger, e as DropdownMenuContent, f as DropdownMenuItem, c as cn } from "./router-DDWcF-kt.mjs";
|
|
4
|
+
import { u as usePermissions } from "./usePermissions-BJGGahrJ.mjs";
|
|
5
|
+
import { C as CmsButton, B as Badge } from "./badge-6BsP37vG.mjs";
|
|
6
|
+
import { I as Input, C as CmsEmptyState, a as Checkbox, c as CmsDialog } from "./CmsEmptyState-DU7-7-mV.mjs";
|
|
7
|
+
import { S as Select, a as SelectTrigger, b as SelectValue, c as SelectContent, d as SelectItem } from "./select-BUhDDf4T.mjs";
|
|
8
|
+
import { E as ErrorState, a as ErrorAlert } from "./ErrorState-cI-bKLez.mjs";
|
|
9
|
+
import { C as CmsPageHeader } from "./CmsPageHeader-CseW0AHm.mjs";
|
|
10
|
+
import { C as CmsToolbar } from "./CmsToolbar-X75ex6ek.mjs";
|
|
11
|
+
import { C as CmsStatusBadge } from "./CmsStatusBadge-B_pi4KCp.mjs";
|
|
12
|
+
import { u as useQuery, d as useMutation } from "../_libs/convex.mjs";
|
|
13
|
+
import { Q as Plus, d as ChevronDown, N as Search, J as FileText, X, aj as CircleCheckBig, O as TriangleAlert } from "../_libs/lucide-react.mjs";
|
|
14
|
+
import "../_libs/tiny-warning.mjs";
|
|
15
|
+
import "../_chunks/_libs/@tanstack/router-core.mjs";
|
|
16
|
+
import "../_libs/cookie-es.mjs";
|
|
17
|
+
import "../_chunks/_libs/@tanstack/store.mjs";
|
|
18
|
+
import "../_chunks/_libs/@tanstack/history.mjs";
|
|
19
|
+
import "../_libs/tiny-invariant.mjs";
|
|
20
|
+
import "../_libs/seroval.mjs";
|
|
21
|
+
import "../_libs/seroval-plugins.mjs";
|
|
22
|
+
import "node:stream/web";
|
|
23
|
+
import "node:stream";
|
|
24
|
+
import "../_chunks/_libs/react-dom.mjs";
|
|
25
|
+
import "util";
|
|
26
|
+
import "crypto";
|
|
27
|
+
import "async_hooks";
|
|
28
|
+
import "stream";
|
|
29
|
+
import "../_libs/isbot.mjs";
|
|
30
|
+
import "../_chunks/_libs/@tanstack/react-store.mjs";
|
|
31
|
+
import "../_libs/use-sync-external-store.mjs";
|
|
32
|
+
import "../_libs/clsx.mjs";
|
|
33
|
+
import "../_libs/tailwind-merge.mjs";
|
|
34
|
+
import "../_chunks/_libs/@radix-ui/react-slot.mjs";
|
|
35
|
+
import "../_chunks/_libs/@radix-ui/react-compose-refs.mjs";
|
|
36
|
+
import "../_chunks/_libs/@radix-ui/react-dropdown-menu.mjs";
|
|
37
|
+
import "../_chunks/_libs/@radix-ui/primitive.mjs";
|
|
38
|
+
import "../_chunks/_libs/@radix-ui/react-context.mjs";
|
|
39
|
+
import "../_chunks/_libs/@radix-ui/react-use-controllable-state.mjs";
|
|
40
|
+
import "../_chunks/_libs/@radix-ui/react-use-layout-effect.mjs";
|
|
41
|
+
import "../_chunks/_libs/@radix-ui/react-primitive.mjs";
|
|
42
|
+
import "../_chunks/_libs/@radix-ui/react-menu.mjs";
|
|
43
|
+
import "../_chunks/_libs/@radix-ui/react-collection.mjs";
|
|
44
|
+
import "../_chunks/_libs/@radix-ui/react-direction.mjs";
|
|
45
|
+
import "../_chunks/_libs/@radix-ui/react-dismissable-layer.mjs";
|
|
46
|
+
import "../_chunks/_libs/@radix-ui/react-use-callback-ref.mjs";
|
|
47
|
+
import "../_chunks/_libs/@radix-ui/react-use-escape-keydown.mjs";
|
|
48
|
+
import "../_chunks/_libs/@radix-ui/react-focus-guards.mjs";
|
|
49
|
+
import "../_chunks/_libs/@radix-ui/react-focus-scope.mjs";
|
|
50
|
+
import "../_chunks/_libs/@radix-ui/react-popper.mjs";
|
|
51
|
+
import "../_chunks/_libs/@floating-ui/react-dom.mjs";
|
|
52
|
+
import "../_chunks/_libs/@floating-ui/dom.mjs";
|
|
53
|
+
import "../_chunks/_libs/@floating-ui/core.mjs";
|
|
54
|
+
import "../_chunks/_libs/@floating-ui/utils.mjs";
|
|
55
|
+
import "../_chunks/_libs/@radix-ui/react-arrow.mjs";
|
|
56
|
+
import "../_chunks/_libs/@radix-ui/react-use-size.mjs";
|
|
57
|
+
import "../_chunks/_libs/@radix-ui/react-portal.mjs";
|
|
58
|
+
import "../_chunks/_libs/@radix-ui/react-presence.mjs";
|
|
59
|
+
import "../_chunks/_libs/@radix-ui/react-roving-focus.mjs";
|
|
60
|
+
import "../_chunks/_libs/@radix-ui/react-id.mjs";
|
|
61
|
+
import "../_libs/aria-hidden.mjs";
|
|
62
|
+
import "../_libs/react-remove-scroll.mjs";
|
|
63
|
+
import "../_libs/tslib.mjs";
|
|
64
|
+
import "../_libs/react-remove-scroll-bar.mjs";
|
|
65
|
+
import "../_libs/react-style-singleton.mjs";
|
|
66
|
+
import "../_libs/get-nonce.mjs";
|
|
67
|
+
import "../_libs/use-sidecar.mjs";
|
|
68
|
+
import "../_libs/use-callback-ref.mjs";
|
|
69
|
+
import "../_chunks/_libs/@radix-ui/react-avatar.mjs";
|
|
70
|
+
import "../_chunks/_libs/@radix-ui/react-use-is-hydrated.mjs";
|
|
71
|
+
import "../_libs/class-variance-authority.mjs";
|
|
72
|
+
import "../_chunks/_libs/@radix-ui/react-popover.mjs";
|
|
73
|
+
import "./index.mjs";
|
|
74
|
+
import "node:async_hooks";
|
|
75
|
+
import "../_libs/h3-v2.mjs";
|
|
76
|
+
import "../_libs/rou3.mjs";
|
|
77
|
+
import "../_libs/srvx.mjs";
|
|
78
|
+
import "node:http";
|
|
79
|
+
import "node:https";
|
|
80
|
+
import "node:http2";
|
|
81
|
+
import "../_libs/zod.mjs";
|
|
82
|
+
import "../_chunks/_libs/@radix-ui/react-dialog.mjs";
|
|
83
|
+
import "../_chunks/_libs/@radix-ui/react-checkbox.mjs";
|
|
84
|
+
import "../_chunks/_libs/@radix-ui/react-use-previous.mjs";
|
|
85
|
+
import "../_chunks/_libs/@radix-ui/react-select.mjs";
|
|
86
|
+
import "../_chunks/_libs/@radix-ui/number.mjs";
|
|
87
|
+
import "../_chunks/_libs/@radix-ui/react-visually-hidden.mjs";
|
|
88
|
+
const ACTION_CONFIG = {
|
|
89
|
+
publish: {
|
|
90
|
+
title: "Publish Items",
|
|
91
|
+
description: "This will publish all selected items, making them publicly visible.",
|
|
92
|
+
confirmLabel: "Publish All",
|
|
93
|
+
confirmVariant: "success"
|
|
94
|
+
},
|
|
95
|
+
unpublish: {
|
|
96
|
+
title: "Unpublish Items",
|
|
97
|
+
description: "This will unpublish all selected items, changing them back to draft status.",
|
|
98
|
+
confirmLabel: "Unpublish All",
|
|
99
|
+
confirmVariant: "warning"
|
|
100
|
+
},
|
|
101
|
+
delete: {
|
|
102
|
+
title: "Delete Items",
|
|
103
|
+
description: "This will move all selected items to trash.",
|
|
104
|
+
warning: "Items in trash can be restored within the retention period.",
|
|
105
|
+
confirmLabel: "Delete All",
|
|
106
|
+
confirmVariant: "danger"
|
|
107
|
+
},
|
|
108
|
+
archive: {
|
|
109
|
+
title: "Archive Items",
|
|
110
|
+
description: "This will archive all selected items.",
|
|
111
|
+
confirmLabel: "Archive All",
|
|
112
|
+
confirmVariant: "secondary"
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
function BulkOperationModal({
|
|
116
|
+
action,
|
|
117
|
+
count,
|
|
118
|
+
isProcessing,
|
|
119
|
+
result,
|
|
120
|
+
onConfirm,
|
|
121
|
+
onCancel
|
|
122
|
+
}) {
|
|
123
|
+
const config = ACTION_CONFIG[action];
|
|
124
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
125
|
+
CmsDialog,
|
|
126
|
+
{
|
|
127
|
+
open: true,
|
|
128
|
+
onOpenChange: (open) => !open && !isProcessing && onCancel(),
|
|
129
|
+
title: config.title,
|
|
130
|
+
size: "sm",
|
|
131
|
+
footer: result ? /* @__PURE__ */ jsxRuntimeExports.jsx(CmsButton, { variant: "primary", onClick: onCancel, children: result.failed === 0 ? "Done" : "Close" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
132
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
133
|
+
CmsButton,
|
|
134
|
+
{
|
|
135
|
+
variant: "outline",
|
|
136
|
+
onClick: onCancel,
|
|
137
|
+
disabled: isProcessing,
|
|
138
|
+
children: "Cancel"
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
142
|
+
CmsButton,
|
|
143
|
+
{
|
|
144
|
+
variant: config.confirmVariant,
|
|
145
|
+
onClick: onConfirm,
|
|
146
|
+
loading: isProcessing,
|
|
147
|
+
children: config.confirmLabel
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] }),
|
|
151
|
+
children: result ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-4", children: result.failed === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-3 py-4 text-center", children: [
|
|
152
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CircleCheckBig, { className: "size-6" }) }),
|
|
153
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
154
|
+
"Successfully processed",
|
|
155
|
+
" ",
|
|
156
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold text-foreground", children: result.succeeded }),
|
|
157
|
+
" ",
|
|
158
|
+
result.succeeded === 1 ? "item" : "items"
|
|
159
|
+
] })
|
|
160
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
|
|
161
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
162
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-lg border border-emerald-200 bg-emerald-50 p-3 text-center", children: [
|
|
163
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-2xl font-semibold text-emerald-700", children: result.succeeded }),
|
|
164
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-emerald-600", children: "Succeeded" })
|
|
165
|
+
] }),
|
|
166
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-lg border border-red-200 bg-red-50 p-3 text-center", children: [
|
|
167
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-2xl font-semibold text-red-700", children: result.failed }),
|
|
168
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-600", children: "Failed" })
|
|
169
|
+
] })
|
|
170
|
+
] }),
|
|
171
|
+
result.errors && result.errors.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-lg border border-amber-200 bg-amber-50 p-3", children: [
|
|
172
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-2 text-sm font-medium text-amber-800", children: "Errors:" }),
|
|
173
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-1 text-xs text-amber-700", children: [
|
|
174
|
+
result.errors.slice(0, 5).map((error, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "truncate", children: [
|
|
175
|
+
"• ",
|
|
176
|
+
error
|
|
177
|
+
] }, index)),
|
|
178
|
+
result.errors.length > 5 && /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "text-amber-600", children: [
|
|
179
|
+
"...and ",
|
|
180
|
+
result.errors.length - 5,
|
|
181
|
+
" more errors"
|
|
182
|
+
] })
|
|
183
|
+
] })
|
|
184
|
+
] })
|
|
185
|
+
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
|
|
186
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
187
|
+
"You are about to ",
|
|
188
|
+
action,
|
|
189
|
+
" ",
|
|
190
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-semibold text-foreground", children: [
|
|
191
|
+
count,
|
|
192
|
+
" ",
|
|
193
|
+
count === 1 ? "item" : "items"
|
|
194
|
+
] }),
|
|
195
|
+
"."
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: config.description }),
|
|
198
|
+
config.warning && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 p-3", children: [
|
|
199
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TriangleAlert, { className: "mt-0.5 size-4 shrink-0 text-amber-600" }),
|
|
200
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-amber-800", children: [
|
|
201
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "Note:" }),
|
|
202
|
+
" ",
|
|
203
|
+
config.warning
|
|
204
|
+
] })
|
|
205
|
+
] })
|
|
206
|
+
] })
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
function BulkActionBar({
|
|
211
|
+
selectedIds,
|
|
212
|
+
onClearSelection,
|
|
213
|
+
onOperationComplete
|
|
214
|
+
}) {
|
|
215
|
+
const [activeAction, setActiveAction] = reactExports.useState(null);
|
|
216
|
+
const [isProcessing, setIsProcessing] = reactExports.useState(false);
|
|
217
|
+
const [result, setResult] = reactExports.useState(null);
|
|
218
|
+
const bulkPublish = useMutation(api.bulkOperations.bulkPublish);
|
|
219
|
+
const bulkUnpublish = useMutation(api.bulkOperations.bulkUnpublish);
|
|
220
|
+
const bulkDelete = useMutation(api.bulkOperations.bulkDelete);
|
|
221
|
+
const bulkUpdate = useMutation(api.bulkOperations.bulkUpdate);
|
|
222
|
+
const handleAction = reactExports.useCallback((action) => {
|
|
223
|
+
setActiveAction(action);
|
|
224
|
+
setResult(null);
|
|
225
|
+
}, []);
|
|
226
|
+
const handleConfirm = reactExports.useCallback(async () => {
|
|
227
|
+
if (!activeAction || selectedIds.length === 0) return;
|
|
228
|
+
setIsProcessing(true);
|
|
229
|
+
setResult(null);
|
|
230
|
+
try {
|
|
231
|
+
let response;
|
|
232
|
+
switch (activeAction) {
|
|
233
|
+
case "publish":
|
|
234
|
+
response = await bulkPublish({
|
|
235
|
+
ids: selectedIds,
|
|
236
|
+
changeDescription: "Bulk published from admin"
|
|
237
|
+
});
|
|
238
|
+
break;
|
|
239
|
+
case "unpublish":
|
|
240
|
+
response = await bulkUnpublish({
|
|
241
|
+
ids: selectedIds
|
|
242
|
+
});
|
|
243
|
+
break;
|
|
244
|
+
case "delete":
|
|
245
|
+
response = await bulkDelete({
|
|
246
|
+
ids: selectedIds,
|
|
247
|
+
hardDelete: false
|
|
248
|
+
});
|
|
249
|
+
break;
|
|
250
|
+
case "archive":
|
|
251
|
+
response = await bulkUpdate({
|
|
252
|
+
ids: selectedIds,
|
|
253
|
+
status: "archived"
|
|
254
|
+
});
|
|
255
|
+
break;
|
|
256
|
+
default:
|
|
257
|
+
throw new Error(`Unknown action: ${activeAction}`);
|
|
258
|
+
}
|
|
259
|
+
setResult({
|
|
260
|
+
succeeded: response.succeeded,
|
|
261
|
+
failed: response.failed,
|
|
262
|
+
errors: response.errors?.map((e) => `${e.id}: ${e.error}`)
|
|
263
|
+
});
|
|
264
|
+
if (response.failed === 0) {
|
|
265
|
+
setTimeout(() => {
|
|
266
|
+
setActiveAction(null);
|
|
267
|
+
onClearSelection();
|
|
268
|
+
onOperationComplete?.();
|
|
269
|
+
}, 1500);
|
|
270
|
+
}
|
|
271
|
+
} catch (error) {
|
|
272
|
+
const message = error instanceof Error ? error.message : "Operation failed";
|
|
273
|
+
setResult({
|
|
274
|
+
succeeded: 0,
|
|
275
|
+
failed: selectedIds.length,
|
|
276
|
+
errors: [message]
|
|
277
|
+
});
|
|
278
|
+
} finally {
|
|
279
|
+
setIsProcessing(false);
|
|
280
|
+
}
|
|
281
|
+
}, [
|
|
282
|
+
activeAction,
|
|
283
|
+
selectedIds,
|
|
284
|
+
bulkPublish,
|
|
285
|
+
bulkUnpublish,
|
|
286
|
+
bulkDelete,
|
|
287
|
+
bulkUpdate,
|
|
288
|
+
onClearSelection,
|
|
289
|
+
onOperationComplete
|
|
290
|
+
]);
|
|
291
|
+
const handleCancel = reactExports.useCallback(() => {
|
|
292
|
+
setActiveAction(null);
|
|
293
|
+
setResult(null);
|
|
294
|
+
}, []);
|
|
295
|
+
if (selectedIds.length === 0) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
299
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-x-0 bottom-0 z-50 border-t bg-background/95 px-6 py-3 shadow-lg backdrop-blur supports-[backdrop-filter]:bg-background/80", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mx-auto flex max-w-7xl items-center justify-between", children: [
|
|
300
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
301
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", className: "text-sm font-semibold", children: selectedIds.length }),
|
|
302
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-muted-foreground", children: [
|
|
303
|
+
selectedIds.length === 1 ? "item" : "items",
|
|
304
|
+
" selected"
|
|
305
|
+
] }),
|
|
306
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
307
|
+
"button",
|
|
308
|
+
{
|
|
309
|
+
type: "button",
|
|
310
|
+
onClick: onClearSelection,
|
|
311
|
+
className: "flex items-center gap-1 text-sm text-muted-foreground transition-colors hover:text-foreground",
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "size-3" }),
|
|
314
|
+
"Clear"
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] }),
|
|
319
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
320
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
321
|
+
CmsButton,
|
|
322
|
+
{
|
|
323
|
+
variant: "success",
|
|
324
|
+
size: "sm",
|
|
325
|
+
onClick: () => handleAction("publish"),
|
|
326
|
+
children: "Publish"
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
330
|
+
CmsButton,
|
|
331
|
+
{
|
|
332
|
+
variant: "warning",
|
|
333
|
+
size: "sm",
|
|
334
|
+
onClick: () => handleAction("unpublish"),
|
|
335
|
+
children: "Unpublish"
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
339
|
+
CmsButton,
|
|
340
|
+
{
|
|
341
|
+
variant: "secondary",
|
|
342
|
+
size: "sm",
|
|
343
|
+
onClick: () => handleAction("archive"),
|
|
344
|
+
children: "Archive"
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
348
|
+
CmsButton,
|
|
349
|
+
{
|
|
350
|
+
variant: "danger",
|
|
351
|
+
size: "sm",
|
|
352
|
+
onClick: () => handleAction("delete"),
|
|
353
|
+
children: "Delete"
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
] })
|
|
357
|
+
] }) }),
|
|
358
|
+
activeAction && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
359
|
+
BulkOperationModal,
|
|
360
|
+
{
|
|
361
|
+
action: activeAction,
|
|
362
|
+
count: selectedIds.length,
|
|
363
|
+
isProcessing,
|
|
364
|
+
result,
|
|
365
|
+
onConfirm: handleConfirm,
|
|
366
|
+
onCancel: handleCancel
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
] });
|
|
370
|
+
}
|
|
371
|
+
function ContentPage() {
|
|
372
|
+
const navigate = useNavigate();
|
|
373
|
+
const [selectedTypeId, setSelectedTypeId] = reactExports.useState("");
|
|
374
|
+
const [selectedStatus, setSelectedStatus] = reactExports.useState("");
|
|
375
|
+
const [searchQuery, setSearchQuery] = reactExports.useState("");
|
|
376
|
+
const [dismissedError, setDismissedError] = reactExports.useState(null);
|
|
377
|
+
const [selectedIds, setSelectedIds] = reactExports.useState(/* @__PURE__ */ new Set());
|
|
378
|
+
const {
|
|
379
|
+
canCreate,
|
|
380
|
+
canUpdate
|
|
381
|
+
} = usePermissions();
|
|
382
|
+
const contentTypesResult = useQuery(api.contentTypes.list, {
|
|
383
|
+
isActive: true
|
|
384
|
+
});
|
|
385
|
+
const contentTypes = contentTypesResult?.page ?? [];
|
|
386
|
+
const contentTypesError = contentTypesResult?.error;
|
|
387
|
+
const isLoadingContentTypes = contentTypesResult === void 0;
|
|
388
|
+
const entriesResult = useQuery(api.entries.list, {
|
|
389
|
+
contentTypeId: selectedTypeId || void 0,
|
|
390
|
+
status: selectedStatus || void 0,
|
|
391
|
+
search: searchQuery.trim() || void 0,
|
|
392
|
+
paginationOpts: {
|
|
393
|
+
numItems: 50,
|
|
394
|
+
cursor: null
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
const entries = entriesResult?.page ?? [];
|
|
398
|
+
const entriesError = entriesResult?.error;
|
|
399
|
+
const isLoadingEntries = entriesResult === void 0;
|
|
400
|
+
const isLoading = isLoadingContentTypes || isLoadingEntries;
|
|
401
|
+
const handleRetry = reactExports.useCallback(() => {
|
|
402
|
+
setDismissedError(null);
|
|
403
|
+
window.location.reload();
|
|
404
|
+
}, []);
|
|
405
|
+
const handleCreateEntry = (contentTypeId) => {
|
|
406
|
+
navigate({
|
|
407
|
+
to: "/entries/new/$contentTypeId",
|
|
408
|
+
params: {
|
|
409
|
+
contentTypeId
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
const getContentTypeName = (contentTypeId) => {
|
|
414
|
+
const type = contentTypes.find((t) => t._id === contentTypeId);
|
|
415
|
+
return type?.displayName ?? "Unknown";
|
|
416
|
+
};
|
|
417
|
+
const getEntryTitle = (entry, contentTypeId) => {
|
|
418
|
+
const type = contentTypes.find((t) => t._id === contentTypeId);
|
|
419
|
+
const titleField = type?.titleField ?? "title";
|
|
420
|
+
const title = entry.data[titleField];
|
|
421
|
+
return typeof title === "string" && title ? title : "Untitled";
|
|
422
|
+
};
|
|
423
|
+
const formatDate = (timestamp) => {
|
|
424
|
+
return new Date(timestamp).toLocaleDateString("en-US", {
|
|
425
|
+
year: "numeric",
|
|
426
|
+
month: "short",
|
|
427
|
+
day: "numeric"
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
const handleSelectItem = reactExports.useCallback((id, selected) => {
|
|
431
|
+
setSelectedIds((prev) => {
|
|
432
|
+
const next = new Set(prev);
|
|
433
|
+
if (selected) {
|
|
434
|
+
next.add(id);
|
|
435
|
+
} else {
|
|
436
|
+
next.delete(id);
|
|
437
|
+
}
|
|
438
|
+
return next;
|
|
439
|
+
});
|
|
440
|
+
}, []);
|
|
441
|
+
const handleSelectAll = reactExports.useCallback(() => {
|
|
442
|
+
if (selectedIds.size === entries.length && entries.length > 0) {
|
|
443
|
+
setSelectedIds(/* @__PURE__ */ new Set());
|
|
444
|
+
} else {
|
|
445
|
+
setSelectedIds(new Set(entries.map((e) => e._id)));
|
|
446
|
+
}
|
|
447
|
+
}, [selectedIds.size, entries]);
|
|
448
|
+
const handleClearSelection = reactExports.useCallback(() => {
|
|
449
|
+
setSelectedIds(/* @__PURE__ */ new Set());
|
|
450
|
+
}, []);
|
|
451
|
+
if (contentTypesError && entriesError) {
|
|
452
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6 p-6", children: [
|
|
453
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CmsPageHeader, { title: "Content", description: "Browse and manage content entries across all content types." }),
|
|
454
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorState, { error: contentTypesError, title: "Failed to load content", onRetry: handleRetry })
|
|
455
|
+
] });
|
|
456
|
+
}
|
|
457
|
+
if (isLoading) {
|
|
458
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6 p-6", children: [
|
|
459
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CmsPageHeader, { title: "Content", description: "Browse and manage content entries across all content types." }),
|
|
460
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-12", children: [
|
|
461
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "size-8 animate-spin rounded-full border-2 border-muted border-t-primary" }),
|
|
462
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-4 text-sm text-muted-foreground", children: "Loading content..." })
|
|
463
|
+
] })
|
|
464
|
+
] });
|
|
465
|
+
}
|
|
466
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6 p-6", children: [
|
|
467
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CmsPageHeader, { title: "Content", description: "Browse and manage content entries across all content types." }),
|
|
468
|
+
contentTypesError && dismissedError !== "contentTypes" && /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorAlert, { error: contentTypesError, onDismiss: () => setDismissedError("contentTypes"), onRetry: handleRetry }),
|
|
469
|
+
entriesError && dismissedError !== "entries" && /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorAlert, { error: entriesError, onDismiss: () => setDismissedError("entries"), onRetry: handleRetry }),
|
|
470
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CmsToolbar, { left: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
471
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
|
|
472
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Search, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
|
|
473
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Input, { type: "text", placeholder: "Search content...", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), className: "w-64 pl-9", "data-testid": "content-search-input" })
|
|
474
|
+
] }),
|
|
475
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: selectedTypeId || "all", onValueChange: (v) => setSelectedTypeId(v === "all" ? "" : v), children: [
|
|
476
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-48", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "All Content Types" }) }),
|
|
477
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
478
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "all", children: "All Content Types" }),
|
|
479
|
+
contentTypes.map((type) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: type._id, children: type.displayName }, type._id))
|
|
480
|
+
] })
|
|
481
|
+
] }),
|
|
482
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: selectedStatus || "all", onValueChange: (v) => setSelectedStatus(v === "all" ? "" : v), children: [
|
|
483
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-36", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "All Statuses" }) }),
|
|
484
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
485
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "all", children: "All Statuses" }),
|
|
486
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "draft", children: "Draft" }),
|
|
487
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "published", children: "Published" }),
|
|
488
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "scheduled", children: "Scheduled" }),
|
|
489
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "archived", children: "Archived" })
|
|
490
|
+
] })
|
|
491
|
+
] })
|
|
492
|
+
] }), right: canCreate("contentEntries") && /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
493
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(CmsButton, { disabled: contentTypes.length === 0, children: [
|
|
494
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "size-4" }),
|
|
495
|
+
"Create Entry",
|
|
496
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "size-4" })
|
|
497
|
+
] }) }),
|
|
498
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuContent, { align: "end", children: contentTypes.map((type) => /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuItem, { onClick: () => handleCreateEntry(type._id), children: type.displayName }, type._id)) })
|
|
499
|
+
] }) }),
|
|
500
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BulkActionBar, { selectedIds: Array.from(selectedIds), onClearSelection: handleClearSelection, onOperationComplete: handleClearSelection }),
|
|
501
|
+
entries.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(CmsEmptyState, { icon: /* @__PURE__ */ jsxRuntimeExports.jsx(FileText, { className: "size-6" }), title: "No content entries yet", description: contentTypes.length === 0 ? "Create a content type first, then start adding content entries." : 'Click "Create Entry" to add your first content entry.' }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-lg border bg-card", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("table", { className: "w-full", children: [
|
|
502
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("thead", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: "border-b", children: [
|
|
503
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "w-10 p-3 text-left", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { checked: selectedIds.size === entries.length && entries.length > 0, onCheckedChange: handleSelectAll, "aria-label": "Select all entries" }) }),
|
|
504
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "p-3 text-left text-sm font-medium text-muted-foreground", children: "Title" }),
|
|
505
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "p-3 text-left text-sm font-medium text-muted-foreground", children: "Type" }),
|
|
506
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "p-3 text-left text-sm font-medium text-muted-foreground", children: "Status" }),
|
|
507
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "p-3 text-left text-sm font-medium text-muted-foreground", children: "Updated" }),
|
|
508
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "p-3 text-left text-sm font-medium text-muted-foreground", children: "Actions" })
|
|
509
|
+
] }) }),
|
|
510
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: entries.map((entry) => /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: cn("border-b last:border-0 transition-colors hover:bg-muted/50", selectedIds.has(entry._id) && "bg-primary/5"), children: [
|
|
511
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { checked: selectedIds.has(entry._id), onCheckedChange: (checked) => handleSelectItem(entry._id, checked), "aria-label": `Select ${getEntryTitle(entry, entry.contentTypeId)}` }) }),
|
|
512
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Link, { to: "/entries/$entryId", params: {
|
|
513
|
+
entryId: entry._id
|
|
514
|
+
}, className: "block", children: [
|
|
515
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-foreground hover:text-primary", children: getEntryTitle(entry, entry.contentTypeId) }),
|
|
516
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-xs text-muted-foreground", children: entry.slug })
|
|
517
|
+
] }) }),
|
|
518
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "p-3 text-sm text-muted-foreground", children: getContentTypeName(entry.contentTypeId) }),
|
|
519
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CmsStatusBadge, { status: entry.status }) }),
|
|
520
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "p-3 text-sm text-muted-foreground", children: formatDate(entry._creationTime) }),
|
|
521
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "p-3", children: canUpdate("contentEntries") ? /* @__PURE__ */ jsxRuntimeExports.jsx(CmsButton, { variant: "outline", size: "sm", asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/entries/$entryId", params: {
|
|
522
|
+
entryId: entry._id
|
|
523
|
+
}, children: "Edit" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CmsButton, { variant: "outline", size: "sm", asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/entries/$entryId", params: {
|
|
524
|
+
entryId: entry._id
|
|
525
|
+
}, children: "View" }) }) })
|
|
526
|
+
] }, entry._id)) })
|
|
527
|
+
] }) })
|
|
528
|
+
] });
|
|
529
|
+
}
|
|
530
|
+
export {
|
|
531
|
+
ContentPage as component
|
|
532
|
+
};
|