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,1556 @@
|
|
|
1
|
+
import { c as createRouter, a as createRootRoute, b as createFileRoute, l as lazyRouteComponent, O as Outlet, H as HeadContent, S as Scripts, u as useRouterState, L as Link, d as useNavigate } from "../_chunks/_libs/@tanstack/react-router.mjs";
|
|
2
|
+
import { r as reactExports, j as jsxRuntimeExports } from "../_chunks/_libs/react.mjs";
|
|
3
|
+
import { c as clsx } from "../_libs/clsx.mjs";
|
|
4
|
+
import { t as twMerge } from "../_libs/tailwind-merge.mjs";
|
|
5
|
+
import { S as Slot } from "../_chunks/_libs/@radix-ui/react-slot.mjs";
|
|
6
|
+
import { R as Root2$1, T as Trigger$1, P as Portal2, C as Content2$1, L as Label2, S as Separator2, I as Item2 } from "../_chunks/_libs/@radix-ui/react-dropdown-menu.mjs";
|
|
7
|
+
import { R as Root, I as Image, F as Fallback } from "../_chunks/_libs/@radix-ui/react-avatar.mjs";
|
|
8
|
+
import { c as cva } from "../_libs/class-variance-authority.mjs";
|
|
9
|
+
import { R as Root2, T as Trigger, P as Portal, C as Content2 } from "../_chunks/_libs/@radix-ui/react-popover.mjs";
|
|
10
|
+
import { c as createServerFn, T as TSS_SERVER_FUNCTION, g as getServerFnById } from "./index.mjs";
|
|
11
|
+
import { v, c as componentsGeneric, C as ConvexReactClient, a as ConvexProvider, u as useQuery, b as anyApi } from "../_libs/convex.mjs";
|
|
12
|
+
import { L as LoaderCircle, a as Layers, H as House, B as Bell, C as CircleQuestionMark, b as Book, c as Code, M as MessageSquare, E as ExternalLink, d as ChevronDown, U as User, e as LogOut, f as ChevronRight, g as CircleAlert, h as Eye, S as SquarePen, A as Archive, i as Bookmark, F as Flag, j as Heart, k as Star, P as Package, l as Phone, m as Mail, D as DollarSign, n as MapPin, o as Folder, p as Braces, q as SquareCheckBig, T as ToggleLeft, r as Hash, s as Link$1, t as Clock, u as Calendar, G as Globe, v as Lock, w as Trash2, x as Settings, y as FileCode, z as Tags, I as Image$1, J as FileText, K as LayoutDashboard } from "../_libs/lucide-react.mjs";
|
|
13
|
+
import { o as object, b as boolean, s as string, _ as _enum, n as number, a as array, r as record } from "../_libs/zod.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 "../_chunks/_libs/@radix-ui/react-compose-refs.mjs";
|
|
33
|
+
import "../_chunks/_libs/@radix-ui/primitive.mjs";
|
|
34
|
+
import "../_chunks/_libs/@radix-ui/react-context.mjs";
|
|
35
|
+
import "../_chunks/_libs/@radix-ui/react-use-controllable-state.mjs";
|
|
36
|
+
import "../_chunks/_libs/@radix-ui/react-use-layout-effect.mjs";
|
|
37
|
+
import "../_chunks/_libs/@radix-ui/react-primitive.mjs";
|
|
38
|
+
import "../_chunks/_libs/@radix-ui/react-menu.mjs";
|
|
39
|
+
import "../_chunks/_libs/@radix-ui/react-collection.mjs";
|
|
40
|
+
import "../_chunks/_libs/@radix-ui/react-direction.mjs";
|
|
41
|
+
import "../_chunks/_libs/@radix-ui/react-dismissable-layer.mjs";
|
|
42
|
+
import "../_chunks/_libs/@radix-ui/react-use-callback-ref.mjs";
|
|
43
|
+
import "../_chunks/_libs/@radix-ui/react-use-escape-keydown.mjs";
|
|
44
|
+
import "../_chunks/_libs/@radix-ui/react-focus-guards.mjs";
|
|
45
|
+
import "../_chunks/_libs/@radix-ui/react-focus-scope.mjs";
|
|
46
|
+
import "../_chunks/_libs/@radix-ui/react-popper.mjs";
|
|
47
|
+
import "../_chunks/_libs/@floating-ui/react-dom.mjs";
|
|
48
|
+
import "../_chunks/_libs/@floating-ui/dom.mjs";
|
|
49
|
+
import "../_chunks/_libs/@floating-ui/core.mjs";
|
|
50
|
+
import "../_chunks/_libs/@floating-ui/utils.mjs";
|
|
51
|
+
import "../_chunks/_libs/@radix-ui/react-arrow.mjs";
|
|
52
|
+
import "../_chunks/_libs/@radix-ui/react-use-size.mjs";
|
|
53
|
+
import "../_chunks/_libs/@radix-ui/react-portal.mjs";
|
|
54
|
+
import "../_chunks/_libs/@radix-ui/react-presence.mjs";
|
|
55
|
+
import "../_chunks/_libs/@radix-ui/react-roving-focus.mjs";
|
|
56
|
+
import "../_chunks/_libs/@radix-ui/react-id.mjs";
|
|
57
|
+
import "../_libs/aria-hidden.mjs";
|
|
58
|
+
import "../_libs/react-remove-scroll.mjs";
|
|
59
|
+
import "../_libs/tslib.mjs";
|
|
60
|
+
import "../_libs/react-remove-scroll-bar.mjs";
|
|
61
|
+
import "../_libs/react-style-singleton.mjs";
|
|
62
|
+
import "../_libs/get-nonce.mjs";
|
|
63
|
+
import "../_libs/use-sidecar.mjs";
|
|
64
|
+
import "../_libs/use-callback-ref.mjs";
|
|
65
|
+
import "../_chunks/_libs/@radix-ui/react-use-is-hydrated.mjs";
|
|
66
|
+
import "node:async_hooks";
|
|
67
|
+
import "../_libs/h3-v2.mjs";
|
|
68
|
+
import "../_libs/rou3.mjs";
|
|
69
|
+
import "../_libs/srvx.mjs";
|
|
70
|
+
import "node:http";
|
|
71
|
+
import "node:https";
|
|
72
|
+
import "node:http2";
|
|
73
|
+
const globalsCss = "/assets/globals-CS6BZ0zp.css";
|
|
74
|
+
function cn(...inputs) {
|
|
75
|
+
return twMerge(clsx(inputs));
|
|
76
|
+
}
|
|
77
|
+
v.union(
|
|
78
|
+
v.literal("admin"),
|
|
79
|
+
v.literal("editor"),
|
|
80
|
+
v.literal("author"),
|
|
81
|
+
v.literal("viewer")
|
|
82
|
+
);
|
|
83
|
+
const resourceValidator = v.union(
|
|
84
|
+
v.literal("contentTypes"),
|
|
85
|
+
v.literal("contentEntries"),
|
|
86
|
+
v.literal("mediaItems"),
|
|
87
|
+
v.literal("settings")
|
|
88
|
+
);
|
|
89
|
+
const actionValidator = v.union(
|
|
90
|
+
v.literal("create"),
|
|
91
|
+
v.literal("read"),
|
|
92
|
+
v.literal("update"),
|
|
93
|
+
v.literal("delete"),
|
|
94
|
+
v.literal("publish"),
|
|
95
|
+
v.literal("unpublish"),
|
|
96
|
+
v.literal("restore"),
|
|
97
|
+
v.literal("manage"),
|
|
98
|
+
v.literal("move")
|
|
99
|
+
);
|
|
100
|
+
v.object({
|
|
101
|
+
resource: resourceValidator,
|
|
102
|
+
action: actionValidator,
|
|
103
|
+
scope: v.optional(v.union(v.literal("all"), v.literal("own")))
|
|
104
|
+
});
|
|
105
|
+
function fullCrud(resource, scope = "all") {
|
|
106
|
+
return [
|
|
107
|
+
{ resource, action: "create", scope },
|
|
108
|
+
{ resource, action: "read", scope },
|
|
109
|
+
{ resource, action: "update", scope },
|
|
110
|
+
{ resource, action: "delete", scope }
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
function readOnly(resource, scope = "all") {
|
|
114
|
+
return [{ resource, action: "read", scope }];
|
|
115
|
+
}
|
|
116
|
+
function publishPermissions(scope = "all") {
|
|
117
|
+
return [
|
|
118
|
+
{ resource: "contentEntries", action: "publish", scope },
|
|
119
|
+
{ resource: "contentEntries", action: "unpublish", scope }
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
const ADMIN_ROLE = {
|
|
123
|
+
name: "admin",
|
|
124
|
+
displayName: "Administrator",
|
|
125
|
+
description: "Full access to all CMS features including settings and content type management",
|
|
126
|
+
isSystem: true,
|
|
127
|
+
permissions: [
|
|
128
|
+
// Content types - full management
|
|
129
|
+
...fullCrud("contentTypes"),
|
|
130
|
+
// Content entries - full CRUD + publish
|
|
131
|
+
...fullCrud("contentEntries"),
|
|
132
|
+
...publishPermissions(),
|
|
133
|
+
{ resource: "contentEntries", action: "restore" },
|
|
134
|
+
// Media - full management
|
|
135
|
+
...fullCrud("mediaItems"),
|
|
136
|
+
// Settings - full access
|
|
137
|
+
{ resource: "settings", action: "manage" },
|
|
138
|
+
...readOnly("settings")
|
|
139
|
+
]
|
|
140
|
+
};
|
|
141
|
+
const EDITOR_ROLE = {
|
|
142
|
+
name: "editor",
|
|
143
|
+
displayName: "Editor",
|
|
144
|
+
description: "Can manage all content and media, but cannot modify settings or content types",
|
|
145
|
+
isSystem: true,
|
|
146
|
+
permissions: [
|
|
147
|
+
// Content types - read only
|
|
148
|
+
...readOnly("contentTypes"),
|
|
149
|
+
// Content entries - full CRUD + publish
|
|
150
|
+
...fullCrud("contentEntries"),
|
|
151
|
+
...publishPermissions(),
|
|
152
|
+
{ resource: "contentEntries", action: "restore" },
|
|
153
|
+
// Media - full management
|
|
154
|
+
...fullCrud("mediaItems")
|
|
155
|
+
]
|
|
156
|
+
};
|
|
157
|
+
const AUTHOR_ROLE = {
|
|
158
|
+
name: "author",
|
|
159
|
+
displayName: "Author",
|
|
160
|
+
description: "Can create and manage own content and media",
|
|
161
|
+
isSystem: true,
|
|
162
|
+
permissions: [
|
|
163
|
+
// Content types - read only
|
|
164
|
+
...readOnly("contentTypes"),
|
|
165
|
+
// Content entries - own content only
|
|
166
|
+
{ resource: "contentEntries", action: "create" },
|
|
167
|
+
{ resource: "contentEntries", action: "read", scope: "own" },
|
|
168
|
+
{ resource: "contentEntries", action: "update", scope: "own" },
|
|
169
|
+
{ resource: "contentEntries", action: "delete", scope: "own" },
|
|
170
|
+
// Authors can publish/unpublish their own content
|
|
171
|
+
{ resource: "contentEntries", action: "publish", scope: "own" },
|
|
172
|
+
{ resource: "contentEntries", action: "unpublish", scope: "own" },
|
|
173
|
+
// Media - can create and manage own, read all (for embedding)
|
|
174
|
+
{ resource: "mediaItems", action: "create" },
|
|
175
|
+
{ resource: "mediaItems", action: "read", scope: "all" },
|
|
176
|
+
// Can read all for embedding
|
|
177
|
+
{ resource: "mediaItems", action: "update", scope: "own" },
|
|
178
|
+
{ resource: "mediaItems", action: "delete", scope: "own" }
|
|
179
|
+
]
|
|
180
|
+
};
|
|
181
|
+
const VIEWER_ROLE = {
|
|
182
|
+
name: "viewer",
|
|
183
|
+
displayName: "Viewer",
|
|
184
|
+
description: "Read-only access to published content and media",
|
|
185
|
+
isSystem: true,
|
|
186
|
+
permissions: [
|
|
187
|
+
// Content types - read only
|
|
188
|
+
...readOnly("contentTypes"),
|
|
189
|
+
// Content entries - read published only (scope: "all" means all published)
|
|
190
|
+
...readOnly("contentEntries"),
|
|
191
|
+
// Media - read only
|
|
192
|
+
...readOnly("mediaItems")
|
|
193
|
+
]
|
|
194
|
+
};
|
|
195
|
+
const DEFAULT_ROLES = {
|
|
196
|
+
admin: ADMIN_ROLE,
|
|
197
|
+
editor: EDITOR_ROLE,
|
|
198
|
+
author: AUTHOR_ROLE,
|
|
199
|
+
viewer: VIEWER_ROLE
|
|
200
|
+
};
|
|
201
|
+
function permissionMatches(granted, requested) {
|
|
202
|
+
if (granted.resource !== requested.resource || granted.action !== requested.action) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
const grantedScope = granted.scope ?? "all";
|
|
206
|
+
const requestedScope = requested.scope ?? "all";
|
|
207
|
+
if (grantedScope === "all") {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
return requestedScope === "own";
|
|
211
|
+
}
|
|
212
|
+
function hasPermission(roleName, permission, customRoles) {
|
|
213
|
+
const role = DEFAULT_ROLES[roleName] ?? customRoles?.[roleName];
|
|
214
|
+
if (!role) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
return role.permissions.some((p) => permissionMatches(p, permission));
|
|
218
|
+
}
|
|
219
|
+
function getRolePermissions(roleName, customRoles) {
|
|
220
|
+
const role = DEFAULT_ROLES[roleName] ?? customRoles?.[roleName];
|
|
221
|
+
return role?.permissions ?? [];
|
|
222
|
+
}
|
|
223
|
+
function getRole(roleName, customRoles) {
|
|
224
|
+
return DEFAULT_ROLES[roleName] ?? customRoles?.[roleName];
|
|
225
|
+
}
|
|
226
|
+
function getResourcePermissions(roleName, resource, customRoles) {
|
|
227
|
+
return getRolePermissions(roleName, customRoles).filter(
|
|
228
|
+
(p) => p.resource === resource
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
function canAccessResource(roleName, resource, customRoles) {
|
|
232
|
+
return getResourcePermissions(roleName, resource, customRoles).length > 0;
|
|
233
|
+
}
|
|
234
|
+
const AuthContext = reactExports.createContext(null);
|
|
235
|
+
function AuthProvider({
|
|
236
|
+
children,
|
|
237
|
+
getUser,
|
|
238
|
+
getUserRole,
|
|
239
|
+
onLogout,
|
|
240
|
+
autoRedirectToLogin = false,
|
|
241
|
+
loginUrl = "/login"
|
|
242
|
+
}) {
|
|
243
|
+
const [user, setUser] = reactExports.useState(null);
|
|
244
|
+
const [role, setRole] = reactExports.useState(null);
|
|
245
|
+
const [authState, setAuthState] = reactExports.useState("loading");
|
|
246
|
+
const [error, setError] = reactExports.useState(null);
|
|
247
|
+
const loadAuth = reactExports.useCallback(async () => {
|
|
248
|
+
setAuthState("loading");
|
|
249
|
+
setError(null);
|
|
250
|
+
try {
|
|
251
|
+
const currentUser = await getUser();
|
|
252
|
+
if (!currentUser) {
|
|
253
|
+
setUser(null);
|
|
254
|
+
setRole(null);
|
|
255
|
+
setAuthState("unauthenticated");
|
|
256
|
+
if (autoRedirectToLogin && typeof window !== "undefined") {
|
|
257
|
+
window.location.href = loginUrl;
|
|
258
|
+
}
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const userRole = await getUserRole({ userId: currentUser.id });
|
|
262
|
+
setUser(currentUser);
|
|
263
|
+
setRole(userRole);
|
|
264
|
+
setAuthState("authenticated");
|
|
265
|
+
} catch (err) {
|
|
266
|
+
console.error("Authentication error:", err);
|
|
267
|
+
setUser(null);
|
|
268
|
+
setRole(null);
|
|
269
|
+
setError(err instanceof Error ? err.message : "Authentication failed");
|
|
270
|
+
setAuthState("error");
|
|
271
|
+
}
|
|
272
|
+
}, [getUser, getUserRole, autoRedirectToLogin, loginUrl]);
|
|
273
|
+
reactExports.useEffect(() => {
|
|
274
|
+
loadAuth();
|
|
275
|
+
}, [loadAuth]);
|
|
276
|
+
const checkPermission = reactExports.useCallback(
|
|
277
|
+
(permission) => {
|
|
278
|
+
if (!role) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
return hasPermission(role, permission);
|
|
282
|
+
},
|
|
283
|
+
[role]
|
|
284
|
+
);
|
|
285
|
+
const logout = reactExports.useCallback(async () => {
|
|
286
|
+
try {
|
|
287
|
+
if (onLogout) {
|
|
288
|
+
await onLogout();
|
|
289
|
+
}
|
|
290
|
+
setUser(null);
|
|
291
|
+
setRole(null);
|
|
292
|
+
setAuthState("unauthenticated");
|
|
293
|
+
if (autoRedirectToLogin && typeof window !== "undefined") {
|
|
294
|
+
window.location.href = loginUrl;
|
|
295
|
+
}
|
|
296
|
+
} catch (err) {
|
|
297
|
+
console.error("Logout error:", err);
|
|
298
|
+
setError(err instanceof Error ? err.message : "Logout failed");
|
|
299
|
+
}
|
|
300
|
+
}, [onLogout, autoRedirectToLogin, loginUrl]);
|
|
301
|
+
const refresh = reactExports.useCallback(async () => {
|
|
302
|
+
await loadAuth();
|
|
303
|
+
}, [loadAuth]);
|
|
304
|
+
const value = {
|
|
305
|
+
user,
|
|
306
|
+
role,
|
|
307
|
+
authState,
|
|
308
|
+
isLoading: authState === "loading",
|
|
309
|
+
isAuthenticated: authState === "authenticated",
|
|
310
|
+
error,
|
|
311
|
+
checkPermission,
|
|
312
|
+
logout,
|
|
313
|
+
refresh
|
|
314
|
+
};
|
|
315
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(AuthContext.Provider, { value, children });
|
|
316
|
+
}
|
|
317
|
+
function useAuth() {
|
|
318
|
+
const context = reactExports.useContext(AuthContext);
|
|
319
|
+
if (!context) {
|
|
320
|
+
throw new Error("useAuth must be used within an AuthProvider");
|
|
321
|
+
}
|
|
322
|
+
return context;
|
|
323
|
+
}
|
|
324
|
+
const ThemeContext = reactExports.createContext(null);
|
|
325
|
+
const STORAGE_KEY = "convex-cms-theme";
|
|
326
|
+
function getSystemTheme() {
|
|
327
|
+
if (typeof window === "undefined") return "light";
|
|
328
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
329
|
+
}
|
|
330
|
+
function getStoredTheme() {
|
|
331
|
+
if (typeof window === "undefined") return "system";
|
|
332
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
333
|
+
if (stored === "light" || stored === "dark" || stored === "system") {
|
|
334
|
+
return stored;
|
|
335
|
+
}
|
|
336
|
+
return "system";
|
|
337
|
+
}
|
|
338
|
+
function ThemeProvider({ children }) {
|
|
339
|
+
const [theme, setThemeState] = reactExports.useState(() => getStoredTheme());
|
|
340
|
+
const [resolvedTheme, setResolvedTheme] = reactExports.useState(() => {
|
|
341
|
+
const stored = getStoredTheme();
|
|
342
|
+
return stored === "system" ? getSystemTheme() : stored;
|
|
343
|
+
});
|
|
344
|
+
const applyTheme = reactExports.useCallback((newTheme) => {
|
|
345
|
+
const resolved = newTheme === "system" ? getSystemTheme() : newTheme;
|
|
346
|
+
setResolvedTheme(resolved);
|
|
347
|
+
const root = document.documentElement;
|
|
348
|
+
root.classList.remove("light", "dark");
|
|
349
|
+
root.classList.add(resolved);
|
|
350
|
+
}, []);
|
|
351
|
+
const setTheme = reactExports.useCallback(
|
|
352
|
+
(newTheme) => {
|
|
353
|
+
setThemeState(newTheme);
|
|
354
|
+
localStorage.setItem(STORAGE_KEY, newTheme);
|
|
355
|
+
applyTheme(newTheme);
|
|
356
|
+
},
|
|
357
|
+
[applyTheme]
|
|
358
|
+
);
|
|
359
|
+
reactExports.useEffect(() => {
|
|
360
|
+
applyTheme(theme);
|
|
361
|
+
}, [theme, applyTheme]);
|
|
362
|
+
reactExports.useEffect(() => {
|
|
363
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
364
|
+
const handleChange = () => {
|
|
365
|
+
if (theme === "system") {
|
|
366
|
+
applyTheme("system");
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
370
|
+
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
371
|
+
}, [theme, applyTheme]);
|
|
372
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: { theme, resolvedTheme, setTheme }, children });
|
|
373
|
+
}
|
|
374
|
+
function useTheme() {
|
|
375
|
+
const context = reactExports.useContext(ThemeContext);
|
|
376
|
+
if (!context) {
|
|
377
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
378
|
+
}
|
|
379
|
+
return context;
|
|
380
|
+
}
|
|
381
|
+
const navItemSchema = object({
|
|
382
|
+
id: string(),
|
|
383
|
+
path: string(),
|
|
384
|
+
label: string(),
|
|
385
|
+
icon: string(),
|
|
386
|
+
visible: boolean().default(true),
|
|
387
|
+
section: _enum(["main", "config"]).default("main"),
|
|
388
|
+
badge: string().optional(),
|
|
389
|
+
exact: boolean().optional()
|
|
390
|
+
});
|
|
391
|
+
const brandingSchema = object({
|
|
392
|
+
appName: string().default("Convex CMS"),
|
|
393
|
+
logo: string().optional(),
|
|
394
|
+
favicon: string().optional()
|
|
395
|
+
});
|
|
396
|
+
const layoutSchema = object({
|
|
397
|
+
sidebarWidth: number().min(200).max(400).default(256),
|
|
398
|
+
sidebarCollapsible: boolean().default(false)
|
|
399
|
+
});
|
|
400
|
+
const navigationSchema = object({
|
|
401
|
+
showDashboard: boolean().default(true),
|
|
402
|
+
showContent: boolean().default(true),
|
|
403
|
+
showMedia: boolean().default(true),
|
|
404
|
+
showTaxonomies: boolean().default(true),
|
|
405
|
+
showContentTypes: boolean().default(true),
|
|
406
|
+
showTrash: boolean().default(true),
|
|
407
|
+
showSettings: boolean().default(true),
|
|
408
|
+
customItems: array(navItemSchema).default([])
|
|
409
|
+
});
|
|
410
|
+
const themeSchema = object({
|
|
411
|
+
mode: _enum(["light", "dark", "system"]).default("system"),
|
|
412
|
+
allowModeSwitch: boolean().default(true),
|
|
413
|
+
tokens: record(string(), string()).optional()
|
|
414
|
+
});
|
|
415
|
+
const adminConfigSchema = object({
|
|
416
|
+
branding: brandingSchema.default(() => brandingSchema.parse({})),
|
|
417
|
+
layout: layoutSchema.default(() => layoutSchema.parse({})),
|
|
418
|
+
navigation: navigationSchema.default(() => navigationSchema.parse({})),
|
|
419
|
+
theme: themeSchema.default(() => themeSchema.parse({}))
|
|
420
|
+
});
|
|
421
|
+
const DEFAULT_NAV_ITEMS = [
|
|
422
|
+
{
|
|
423
|
+
id: "dashboard",
|
|
424
|
+
path: "/",
|
|
425
|
+
label: "Dashboard",
|
|
426
|
+
icon: "LayoutDashboard",
|
|
427
|
+
section: "main",
|
|
428
|
+
exact: true
|
|
429
|
+
},
|
|
430
|
+
{ id: "content", path: "/content", label: "Content", icon: "FileText", section: "main" },
|
|
431
|
+
{ id: "media", path: "/media", label: "Media", icon: "Image", section: "main" },
|
|
432
|
+
{ id: "taxonomies", path: "/taxonomies", label: "Taxonomies", icon: "Tags", section: "main" },
|
|
433
|
+
{
|
|
434
|
+
id: "content-types",
|
|
435
|
+
path: "/content-types",
|
|
436
|
+
label: "Content Types",
|
|
437
|
+
icon: "Layers",
|
|
438
|
+
section: "config"
|
|
439
|
+
},
|
|
440
|
+
{ id: "trash", path: "/trash", label: "Trash", icon: "Trash2", section: "config" },
|
|
441
|
+
{ id: "settings", path: "/settings", label: "Settings", icon: "Settings", section: "config" }
|
|
442
|
+
];
|
|
443
|
+
function resolveAdminConfig(input) {
|
|
444
|
+
return adminConfigSchema.parse(input ?? {});
|
|
445
|
+
}
|
|
446
|
+
function getVisibleNavItems(config) {
|
|
447
|
+
const visibilityMap = {
|
|
448
|
+
dashboard: config.navigation.showDashboard,
|
|
449
|
+
content: config.navigation.showContent,
|
|
450
|
+
media: config.navigation.showMedia,
|
|
451
|
+
taxonomies: config.navigation.showTaxonomies,
|
|
452
|
+
"content-types": config.navigation.showContentTypes,
|
|
453
|
+
trash: config.navigation.showTrash,
|
|
454
|
+
settings: config.navigation.showSettings
|
|
455
|
+
};
|
|
456
|
+
const filtered = DEFAULT_NAV_ITEMS.filter((item) => visibilityMap[item.id] !== false);
|
|
457
|
+
const allItems = [...filtered, ...config.navigation.customItems.filter((i) => i.visible !== false)];
|
|
458
|
+
return {
|
|
459
|
+
main: allItems.filter((i) => i.section === "main"),
|
|
460
|
+
config: allItems.filter((i) => i.section === "config")
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
const AdminConfigContext = reactExports.createContext(null);
|
|
464
|
+
function AdminConfigProvider({
|
|
465
|
+
config,
|
|
466
|
+
children
|
|
467
|
+
}) {
|
|
468
|
+
const navItems = getVisibleNavItems(config);
|
|
469
|
+
const value = { ...config, navItems };
|
|
470
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(AdminConfigContext.Provider, { value, children });
|
|
471
|
+
}
|
|
472
|
+
function useAdminConfig() {
|
|
473
|
+
const config = reactExports.useContext(AdminConfigContext);
|
|
474
|
+
if (!config) {
|
|
475
|
+
throw new Error("useAdminConfig must be used within AdminConfigProvider");
|
|
476
|
+
}
|
|
477
|
+
return config;
|
|
478
|
+
}
|
|
479
|
+
const api = anyApi;
|
|
480
|
+
componentsGeneric();
|
|
481
|
+
const SettingsConfigContext = reactExports.createContext(null);
|
|
482
|
+
function SettingsConfigProvider({
|
|
483
|
+
baseConfig,
|
|
484
|
+
children
|
|
485
|
+
}) {
|
|
486
|
+
const settings = useQuery(api.settings.get);
|
|
487
|
+
const mergedConfig = reactExports.useMemo(() => {
|
|
488
|
+
if (!settings) return baseConfig;
|
|
489
|
+
return {
|
|
490
|
+
...baseConfig,
|
|
491
|
+
navigation: {
|
|
492
|
+
...baseConfig.navigation,
|
|
493
|
+
showMedia: baseConfig.navigation.showMedia && settings.features.mediaManagement
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}, [baseConfig, settings]);
|
|
497
|
+
const contextValue = reactExports.useMemo(
|
|
498
|
+
() => ({ baseConfig, settings }),
|
|
499
|
+
[baseConfig, settings]
|
|
500
|
+
);
|
|
501
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsConfigContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AdminConfigProvider, { config: mergedConfig, children }) });
|
|
502
|
+
}
|
|
503
|
+
function useSettingsConfig() {
|
|
504
|
+
const ctx = reactExports.useContext(SettingsConfigContext);
|
|
505
|
+
if (!ctx) {
|
|
506
|
+
throw new Error("useSettingsConfig must be used within SettingsConfigProvider");
|
|
507
|
+
}
|
|
508
|
+
return ctx;
|
|
509
|
+
}
|
|
510
|
+
const BreadcrumbContext = reactExports.createContext(null);
|
|
511
|
+
function BreadcrumbProvider({ children }) {
|
|
512
|
+
const [overrides, setOverrides] = reactExports.useState(/* @__PURE__ */ new Map());
|
|
513
|
+
const setOverride = reactExports.useCallback((path, label) => {
|
|
514
|
+
setOverrides((prev) => {
|
|
515
|
+
const next = new Map(prev);
|
|
516
|
+
next.set(path, label);
|
|
517
|
+
return next;
|
|
518
|
+
});
|
|
519
|
+
}, []);
|
|
520
|
+
const clearOverride = reactExports.useCallback((path) => {
|
|
521
|
+
setOverrides((prev) => {
|
|
522
|
+
const next = new Map(prev);
|
|
523
|
+
next.delete(path);
|
|
524
|
+
return next;
|
|
525
|
+
});
|
|
526
|
+
}, []);
|
|
527
|
+
const value = reactExports.useMemo(
|
|
528
|
+
() => ({ overrides, setOverride, clearOverride }),
|
|
529
|
+
[overrides, setOverride, clearOverride]
|
|
530
|
+
);
|
|
531
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbContext.Provider, { value, children });
|
|
532
|
+
}
|
|
533
|
+
function useBreadcrumbContext() {
|
|
534
|
+
const context = reactExports.useContext(BreadcrumbContext);
|
|
535
|
+
if (!context) {
|
|
536
|
+
throw new Error("useBreadcrumbContext must be used within a BreadcrumbProvider");
|
|
537
|
+
}
|
|
538
|
+
return context;
|
|
539
|
+
}
|
|
540
|
+
const iconRegistry = {
|
|
541
|
+
LayoutDashboard,
|
|
542
|
+
FileText,
|
|
543
|
+
Image: Image$1,
|
|
544
|
+
Layers,
|
|
545
|
+
Tags,
|
|
546
|
+
FileCode,
|
|
547
|
+
Settings,
|
|
548
|
+
Trash2,
|
|
549
|
+
HelpCircle: CircleQuestionMark,
|
|
550
|
+
Home: House,
|
|
551
|
+
User,
|
|
552
|
+
Bell,
|
|
553
|
+
Lock,
|
|
554
|
+
Globe,
|
|
555
|
+
Calendar,
|
|
556
|
+
Clock,
|
|
557
|
+
Link: Link$1,
|
|
558
|
+
Hash,
|
|
559
|
+
ToggleLeft,
|
|
560
|
+
ChevronDown,
|
|
561
|
+
CheckSquare: SquareCheckBig,
|
|
562
|
+
Braces,
|
|
563
|
+
Folder,
|
|
564
|
+
MapPin,
|
|
565
|
+
DollarSign,
|
|
566
|
+
Mail,
|
|
567
|
+
Phone,
|
|
568
|
+
Package,
|
|
569
|
+
Star,
|
|
570
|
+
Heart,
|
|
571
|
+
Flag,
|
|
572
|
+
Bookmark,
|
|
573
|
+
Archive,
|
|
574
|
+
Edit: SquarePen,
|
|
575
|
+
Eye,
|
|
576
|
+
AlertCircle: CircleAlert
|
|
577
|
+
};
|
|
578
|
+
function Icon({
|
|
579
|
+
name,
|
|
580
|
+
className = "size-5"
|
|
581
|
+
}) {
|
|
582
|
+
const IconComponent = iconRegistry[name];
|
|
583
|
+
if (!IconComponent) {
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(IconComponent, { className });
|
|
587
|
+
}
|
|
588
|
+
function Sidebar() {
|
|
589
|
+
const routerState = useRouterState();
|
|
590
|
+
const currentPath = routerState.location.pathname;
|
|
591
|
+
const config = useAdminConfig();
|
|
592
|
+
const { navItems, branding, layout } = config;
|
|
593
|
+
const isActive = (to, exact) => {
|
|
594
|
+
if (exact) {
|
|
595
|
+
return currentPath === to;
|
|
596
|
+
}
|
|
597
|
+
return currentPath.startsWith(to);
|
|
598
|
+
};
|
|
599
|
+
const renderNavItem = (item) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
600
|
+
Link,
|
|
601
|
+
{
|
|
602
|
+
to: item.path,
|
|
603
|
+
className: cn(
|
|
604
|
+
"flex items-center gap-3 rounded-md px-2 py-2 text-sm font-medium transition-colors",
|
|
605
|
+
isActive(item.path, item.exact) ? "bg-sidebar-accent text-sidebar-accent-foreground" : "text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground"
|
|
606
|
+
),
|
|
607
|
+
children: [
|
|
608
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { name: item.icon, className: "size-5" }),
|
|
609
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-1", children: item.label }),
|
|
610
|
+
item.badge && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-sidebar-primary px-2 py-0.5 text-xs text-sidebar-primary-foreground", children: item.badge })
|
|
611
|
+
]
|
|
612
|
+
},
|
|
613
|
+
item.id
|
|
614
|
+
);
|
|
615
|
+
const sidebarWidth = layout.sidebarWidth;
|
|
616
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
617
|
+
"aside",
|
|
618
|
+
{
|
|
619
|
+
className: "fixed inset-y-0 left-0 z-50 flex flex-col border-r border-sidebar-border bg-sidebar",
|
|
620
|
+
style: { width: sidebarWidth },
|
|
621
|
+
children: [
|
|
622
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-14 items-center gap-2 border-b border-sidebar-border px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Link, { to: "/", className: "flex items-center gap-2 font-semibold text-sidebar-foreground", children: [
|
|
623
|
+
branding.logo ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: branding.logo, alt: branding.appName, className: "size-8" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Layers, { className: "size-4" }) }),
|
|
624
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-base", children: branding.appName })
|
|
625
|
+
] }) }),
|
|
626
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("nav", { className: "flex-1 space-y-6 overflow-y-auto p-4", children: [
|
|
627
|
+
navItems.main.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
|
|
628
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 text-xs font-medium uppercase tracking-wider text-sidebar-foreground/60", children: "Main" }),
|
|
629
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1 pt-2", children: navItems.main.map(renderNavItem) })
|
|
630
|
+
] }),
|
|
631
|
+
navItems.config.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
|
|
632
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 text-xs font-medium uppercase tracking-wider text-sidebar-foreground/60", children: "Configuration" }),
|
|
633
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1 pt-2", children: navItems.config.map(renderNavItem) })
|
|
634
|
+
] })
|
|
635
|
+
] }),
|
|
636
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-sidebar-border p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between text-xs text-sidebar-foreground/60", children: [
|
|
637
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Version" }),
|
|
638
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono", children: "0.1.0" })
|
|
639
|
+
] }) })
|
|
640
|
+
]
|
|
641
|
+
}
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
function Breadcrumb({ ...props }) {
|
|
645
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...props });
|
|
646
|
+
}
|
|
647
|
+
function BreadcrumbList({ className, ...props }) {
|
|
648
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
649
|
+
"ol",
|
|
650
|
+
{
|
|
651
|
+
"data-slot": "breadcrumb-list",
|
|
652
|
+
className: cn(
|
|
653
|
+
"text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
|
|
654
|
+
className
|
|
655
|
+
),
|
|
656
|
+
...props
|
|
657
|
+
}
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
661
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
662
|
+
"li",
|
|
663
|
+
{
|
|
664
|
+
"data-slot": "breadcrumb-item",
|
|
665
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
666
|
+
...props
|
|
667
|
+
}
|
|
668
|
+
);
|
|
669
|
+
}
|
|
670
|
+
function BreadcrumbLink({
|
|
671
|
+
asChild,
|
|
672
|
+
className,
|
|
673
|
+
...props
|
|
674
|
+
}) {
|
|
675
|
+
const Comp = asChild ? Slot : "a";
|
|
676
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
677
|
+
Comp,
|
|
678
|
+
{
|
|
679
|
+
"data-slot": "breadcrumb-link",
|
|
680
|
+
className: cn("hover:text-foreground transition-colors", className),
|
|
681
|
+
...props
|
|
682
|
+
}
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
686
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
687
|
+
"span",
|
|
688
|
+
{
|
|
689
|
+
"data-slot": "breadcrumb-page",
|
|
690
|
+
role: "link",
|
|
691
|
+
"aria-disabled": "true",
|
|
692
|
+
"aria-current": "page",
|
|
693
|
+
className: cn("text-foreground font-normal", className),
|
|
694
|
+
...props
|
|
695
|
+
}
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
function BreadcrumbSeparator({
|
|
699
|
+
children,
|
|
700
|
+
className,
|
|
701
|
+
...props
|
|
702
|
+
}) {
|
|
703
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
704
|
+
"li",
|
|
705
|
+
{
|
|
706
|
+
"data-slot": "breadcrumb-separator",
|
|
707
|
+
role: "presentation",
|
|
708
|
+
"aria-hidden": "true",
|
|
709
|
+
className: cn("[&>svg]:size-3.5", className),
|
|
710
|
+
...props,
|
|
711
|
+
children: children ?? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, {})
|
|
712
|
+
}
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
function DropdownMenu({
|
|
716
|
+
...props
|
|
717
|
+
}) {
|
|
718
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Root2$1, { "data-slot": "dropdown-menu", ...props });
|
|
719
|
+
}
|
|
720
|
+
function DropdownMenuTrigger({
|
|
721
|
+
...props
|
|
722
|
+
}) {
|
|
723
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
724
|
+
Trigger$1,
|
|
725
|
+
{
|
|
726
|
+
"data-slot": "dropdown-menu-trigger",
|
|
727
|
+
...props
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
function DropdownMenuContent({
|
|
732
|
+
className,
|
|
733
|
+
sideOffset = 4,
|
|
734
|
+
...props
|
|
735
|
+
}) {
|
|
736
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Portal2, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
737
|
+
Content2$1,
|
|
738
|
+
{
|
|
739
|
+
"data-slot": "dropdown-menu-content",
|
|
740
|
+
sideOffset,
|
|
741
|
+
className: cn(
|
|
742
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
743
|
+
className
|
|
744
|
+
),
|
|
745
|
+
...props
|
|
746
|
+
}
|
|
747
|
+
) });
|
|
748
|
+
}
|
|
749
|
+
function DropdownMenuItem({
|
|
750
|
+
className,
|
|
751
|
+
inset,
|
|
752
|
+
variant = "default",
|
|
753
|
+
...props
|
|
754
|
+
}) {
|
|
755
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
756
|
+
Item2,
|
|
757
|
+
{
|
|
758
|
+
"data-slot": "dropdown-menu-item",
|
|
759
|
+
"data-inset": inset,
|
|
760
|
+
"data-variant": variant,
|
|
761
|
+
className: cn(
|
|
762
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
763
|
+
className
|
|
764
|
+
),
|
|
765
|
+
...props
|
|
766
|
+
}
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
function DropdownMenuLabel({
|
|
770
|
+
className,
|
|
771
|
+
inset,
|
|
772
|
+
...props
|
|
773
|
+
}) {
|
|
774
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
775
|
+
Label2,
|
|
776
|
+
{
|
|
777
|
+
"data-slot": "dropdown-menu-label",
|
|
778
|
+
"data-inset": inset,
|
|
779
|
+
className: cn(
|
|
780
|
+
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
781
|
+
className
|
|
782
|
+
),
|
|
783
|
+
...props
|
|
784
|
+
}
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
function DropdownMenuSeparator({
|
|
788
|
+
className,
|
|
789
|
+
...props
|
|
790
|
+
}) {
|
|
791
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
792
|
+
Separator2,
|
|
793
|
+
{
|
|
794
|
+
"data-slot": "dropdown-menu-separator",
|
|
795
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
796
|
+
...props
|
|
797
|
+
}
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
function Avatar({
|
|
801
|
+
className,
|
|
802
|
+
...props
|
|
803
|
+
}) {
|
|
804
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
805
|
+
Root,
|
|
806
|
+
{
|
|
807
|
+
"data-slot": "avatar",
|
|
808
|
+
className: cn(
|
|
809
|
+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
810
|
+
className
|
|
811
|
+
),
|
|
812
|
+
...props
|
|
813
|
+
}
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
function AvatarImage({
|
|
817
|
+
className,
|
|
818
|
+
...props
|
|
819
|
+
}) {
|
|
820
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
821
|
+
Image,
|
|
822
|
+
{
|
|
823
|
+
"data-slot": "avatar-image",
|
|
824
|
+
className: cn("aspect-square size-full", className),
|
|
825
|
+
...props
|
|
826
|
+
}
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
function AvatarFallback({
|
|
830
|
+
className,
|
|
831
|
+
...props
|
|
832
|
+
}) {
|
|
833
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
834
|
+
Fallback,
|
|
835
|
+
{
|
|
836
|
+
"data-slot": "avatar-fallback",
|
|
837
|
+
className: cn(
|
|
838
|
+
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
839
|
+
className
|
|
840
|
+
),
|
|
841
|
+
...props
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
const buttonVariants = cva(
|
|
846
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
847
|
+
{
|
|
848
|
+
variants: {
|
|
849
|
+
variant: {
|
|
850
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
851
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
852
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
853
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
854
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
855
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
856
|
+
},
|
|
857
|
+
size: {
|
|
858
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
859
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
860
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
861
|
+
icon: "size-9",
|
|
862
|
+
"icon-sm": "size-8",
|
|
863
|
+
"icon-lg": "size-10"
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
defaultVariants: {
|
|
867
|
+
variant: "default",
|
|
868
|
+
size: "default"
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
);
|
|
872
|
+
function Button({
|
|
873
|
+
className,
|
|
874
|
+
variant = "default",
|
|
875
|
+
size = "default",
|
|
876
|
+
asChild = false,
|
|
877
|
+
...props
|
|
878
|
+
}) {
|
|
879
|
+
const Comp = asChild ? Slot : "button";
|
|
880
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
881
|
+
Comp,
|
|
882
|
+
{
|
|
883
|
+
"data-slot": "button",
|
|
884
|
+
"data-variant": variant,
|
|
885
|
+
"data-size": size,
|
|
886
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
887
|
+
...props
|
|
888
|
+
}
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
function Popover({
|
|
892
|
+
...props
|
|
893
|
+
}) {
|
|
894
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Root2, { "data-slot": "popover", ...props });
|
|
895
|
+
}
|
|
896
|
+
function PopoverTrigger({
|
|
897
|
+
...props
|
|
898
|
+
}) {
|
|
899
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Trigger, { "data-slot": "popover-trigger", ...props });
|
|
900
|
+
}
|
|
901
|
+
function PopoverContent({
|
|
902
|
+
className,
|
|
903
|
+
align = "center",
|
|
904
|
+
sideOffset = 4,
|
|
905
|
+
...props
|
|
906
|
+
}) {
|
|
907
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
908
|
+
Content2,
|
|
909
|
+
{
|
|
910
|
+
"data-slot": "popover-content",
|
|
911
|
+
align,
|
|
912
|
+
sideOffset,
|
|
913
|
+
className: cn(
|
|
914
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
915
|
+
className
|
|
916
|
+
),
|
|
917
|
+
...props
|
|
918
|
+
}
|
|
919
|
+
) });
|
|
920
|
+
}
|
|
921
|
+
const KEYBOARD_SHORTCUTS = [
|
|
922
|
+
{ keys: ["⌘", "S"], description: "Save entry" },
|
|
923
|
+
{ keys: ["⌘", "⇧", "P"], description: "Publish entry" },
|
|
924
|
+
{ keys: ["⌘", "K"], description: "Quick search" },
|
|
925
|
+
{ keys: ["Esc"], description: "Close modal/panel" }
|
|
926
|
+
];
|
|
927
|
+
const HELP_RESOURCES = [
|
|
928
|
+
{ label: "Documentation", url: "https://docs.convex.dev", icon: Book },
|
|
929
|
+
{ label: "API Reference", url: "https://docs.convex.dev/api", icon: Code },
|
|
930
|
+
{ label: "Community Discord", url: "https://discord.gg/convex", icon: MessageSquare }
|
|
931
|
+
];
|
|
932
|
+
const routeLabels = {
|
|
933
|
+
"/": "Dashboard",
|
|
934
|
+
"/content": "Content",
|
|
935
|
+
"/media": "Media Library",
|
|
936
|
+
"/content-types": "Content Types",
|
|
937
|
+
"/settings": "Settings",
|
|
938
|
+
"/taxonomies": "Taxonomies",
|
|
939
|
+
"/trash": "Trash",
|
|
940
|
+
"/entries": "Entries",
|
|
941
|
+
"/entries/type": "Content Types",
|
|
942
|
+
"/entries/new": "New Entry"
|
|
943
|
+
};
|
|
944
|
+
function getBreadcrumbs(pathname, appName, overrides) {
|
|
945
|
+
const breadcrumbs = [{ label: appName, to: "/" }];
|
|
946
|
+
if (pathname === "/") {
|
|
947
|
+
return breadcrumbs;
|
|
948
|
+
}
|
|
949
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
950
|
+
let currentPath = "";
|
|
951
|
+
segments.forEach((segment, index) => {
|
|
952
|
+
currentPath += `/${segment}`;
|
|
953
|
+
const isLast = index === segments.length - 1;
|
|
954
|
+
let label = overrides.get(currentPath) ?? routeLabels[currentPath];
|
|
955
|
+
if (!label) {
|
|
956
|
+
label = segment.charAt(0).toUpperCase() + segment.slice(1).replace(/-/g, " ");
|
|
957
|
+
}
|
|
958
|
+
if (isLast) {
|
|
959
|
+
breadcrumbs.push({ label });
|
|
960
|
+
} else {
|
|
961
|
+
breadcrumbs.push({ label, to: currentPath });
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
return breadcrumbs;
|
|
965
|
+
}
|
|
966
|
+
function Header() {
|
|
967
|
+
const routerState = useRouterState();
|
|
968
|
+
const navigate = useNavigate();
|
|
969
|
+
const { branding } = useAdminConfig();
|
|
970
|
+
let overrides = /* @__PURE__ */ new Map();
|
|
971
|
+
try {
|
|
972
|
+
const breadcrumbContext = useBreadcrumbContext();
|
|
973
|
+
overrides = breadcrumbContext.overrides;
|
|
974
|
+
} catch {
|
|
975
|
+
}
|
|
976
|
+
const breadcrumbs = getBreadcrumbs(routerState.location.pathname, branding.appName, overrides);
|
|
977
|
+
let user = null;
|
|
978
|
+
let role = null;
|
|
979
|
+
let logout = async () => {
|
|
980
|
+
};
|
|
981
|
+
let isAuthenticated = false;
|
|
982
|
+
try {
|
|
983
|
+
const auth = useAuth();
|
|
984
|
+
user = auth.user;
|
|
985
|
+
role = auth.role;
|
|
986
|
+
logout = auth.logout;
|
|
987
|
+
isAuthenticated = auth.isAuthenticated;
|
|
988
|
+
} catch {
|
|
989
|
+
}
|
|
990
|
+
const roleDefinition = role ? getRole(role) : null;
|
|
991
|
+
const roleDisplayName = roleDefinition?.displayName ?? role ?? "No Role";
|
|
992
|
+
const userDisplayName = user?.name ?? user?.email ?? "User";
|
|
993
|
+
const getInitials = (name) => {
|
|
994
|
+
const parts = name.split(" ");
|
|
995
|
+
if (parts.length >= 2) {
|
|
996
|
+
return `${parts[0][0]}${parts[1][0]}`.toUpperCase();
|
|
997
|
+
}
|
|
998
|
+
return name.slice(0, 2).toUpperCase();
|
|
999
|
+
};
|
|
1000
|
+
const userInitials = user?.name ? getInitials(user.name) : "U";
|
|
1001
|
+
const handleLogout = async () => {
|
|
1002
|
+
await logout();
|
|
1003
|
+
};
|
|
1004
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: "sticky top-0 z-40 flex h-14 items-center justify-between border-b border-border bg-background/95 px-6 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: [
|
|
1005
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Breadcrumb, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbList, { children: breadcrumbs.map((crumb, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [
|
|
1006
|
+
index > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbSeparator, {}),
|
|
1007
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbItem, { children: crumb.to ? /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Link, { to: crumb.to, className: "flex items-center gap-1.5", children: [
|
|
1008
|
+
index === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(House, { className: "size-3.5" }),
|
|
1009
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: crumb.label })
|
|
1010
|
+
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbPage, { children: crumb.label }) })
|
|
1011
|
+
] }, index)) }) }),
|
|
1012
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1013
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
|
|
1014
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "size-9", children: [
|
|
1015
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Bell, { className: "size-4" }),
|
|
1016
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Notifications" })
|
|
1017
|
+
] }) }),
|
|
1018
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(PopoverContent, { align: "end", className: "w-80", children: [
|
|
1019
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between pb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "font-medium", children: "Notifications" }) }),
|
|
1020
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
|
|
1021
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Bell, { className: "size-8 text-muted-foreground/50" }),
|
|
1022
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-2 text-sm font-medium", children: "No notifications yet" }),
|
|
1023
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "You're all caught up!" })
|
|
1024
|
+
] })
|
|
1025
|
+
] })
|
|
1026
|
+
] }),
|
|
1027
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
|
|
1028
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "size-9", children: [
|
|
1029
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CircleQuestionMark, { className: "size-4" }),
|
|
1030
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Help" })
|
|
1031
|
+
] }) }),
|
|
1032
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(PopoverContent, { align: "end", className: "w-72", children: [
|
|
1033
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "font-medium", children: "Help & Resources" }) }),
|
|
1034
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
|
|
1035
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
1036
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h5", { className: "mb-2 text-xs font-medium text-muted-foreground", children: "Keyboard Shortcuts" }),
|
|
1037
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1", children: KEYBOARD_SHORTCUTS.map((shortcut, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
1038
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: shortcut.description }),
|
|
1039
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-0.5", children: shortcut.keys.map((key, keyIndex) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1040
|
+
"kbd",
|
|
1041
|
+
{
|
|
1042
|
+
className: "rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-xs",
|
|
1043
|
+
children: key
|
|
1044
|
+
},
|
|
1045
|
+
keyIndex
|
|
1046
|
+
)) })
|
|
1047
|
+
] }, index)) })
|
|
1048
|
+
] }),
|
|
1049
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
1050
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h5", { className: "mb-2 text-xs font-medium text-muted-foreground", children: "Resources" }),
|
|
1051
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1", children: HELP_RESOURCES.map((resource) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1052
|
+
"a",
|
|
1053
|
+
{
|
|
1054
|
+
href: resource.url,
|
|
1055
|
+
target: "_blank",
|
|
1056
|
+
rel: "noopener noreferrer",
|
|
1057
|
+
className: "flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent",
|
|
1058
|
+
children: [
|
|
1059
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(resource.icon, { className: "size-4 text-muted-foreground" }),
|
|
1060
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-1", children: resource.label }),
|
|
1061
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { className: "size-3 text-muted-foreground" })
|
|
1062
|
+
]
|
|
1063
|
+
},
|
|
1064
|
+
resource.label
|
|
1065
|
+
)) })
|
|
1066
|
+
] })
|
|
1067
|
+
] })
|
|
1068
|
+
] })
|
|
1069
|
+
] }),
|
|
1070
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
1071
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", className: "h-9 gap-2 pl-2 pr-3", children: [
|
|
1072
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Avatar, { className: "size-6", children: [
|
|
1073
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AvatarImage, { src: user?.avatarUrl, alt: userDisplayName }),
|
|
1074
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: "text-xs", children: userInitials })
|
|
1075
|
+
] }),
|
|
1076
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: userDisplayName }),
|
|
1077
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "size-3.5 text-muted-foreground" })
|
|
1078
|
+
] }) }),
|
|
1079
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [
|
|
1080
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuLabel, { className: "font-normal", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
|
|
1081
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-medium", children: userDisplayName }),
|
|
1082
|
+
user?.email && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: user.email }),
|
|
1083
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: roleDisplayName })
|
|
1084
|
+
] }) }),
|
|
1085
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
|
|
1086
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: () => navigate({ to: "/settings" }), children: [
|
|
1087
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(User, { className: "mr-2 size-4" }),
|
|
1088
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Profile & Settings" })
|
|
1089
|
+
] }),
|
|
1090
|
+
isAuthenticated && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
1091
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
|
|
1092
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: handleLogout, className: "text-destructive focus:text-destructive", children: [
|
|
1093
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(LogOut, { className: "mr-2 size-4" }),
|
|
1094
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Logout" })
|
|
1095
|
+
] })
|
|
1096
|
+
] })
|
|
1097
|
+
] })
|
|
1098
|
+
] })
|
|
1099
|
+
] })
|
|
1100
|
+
] });
|
|
1101
|
+
}
|
|
1102
|
+
function AdminLayout({ children }) {
|
|
1103
|
+
const { layout } = useAdminConfig();
|
|
1104
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-h-screen bg-background", children: [
|
|
1105
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Sidebar, {}),
|
|
1106
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-1 flex-col", style: { marginLeft: layout.sidebarWidth }, children: [
|
|
1107
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Header, {}),
|
|
1108
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("main", { className: "flex-1 overflow-auto p-6", children })
|
|
1109
|
+
] })
|
|
1110
|
+
] });
|
|
1111
|
+
}
|
|
1112
|
+
function DefaultLoading() {
|
|
1113
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "route-guard route-guard--loading bg-background flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-8 w-8 animate-spin text-muted-foreground" }) });
|
|
1114
|
+
}
|
|
1115
|
+
function DefaultUnauthenticated() {
|
|
1116
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "route-guard route-guard--unauthenticated", children: [
|
|
1117
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "route-guard-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1118
|
+
"svg",
|
|
1119
|
+
{
|
|
1120
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1121
|
+
width: "48",
|
|
1122
|
+
height: "48",
|
|
1123
|
+
viewBox: "0 0 24 24",
|
|
1124
|
+
fill: "none",
|
|
1125
|
+
stroke: "currentColor",
|
|
1126
|
+
strokeWidth: "2",
|
|
1127
|
+
strokeLinecap: "round",
|
|
1128
|
+
strokeLinejoin: "round",
|
|
1129
|
+
children: [
|
|
1130
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }),
|
|
1131
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
1132
|
+
]
|
|
1133
|
+
}
|
|
1134
|
+
) }),
|
|
1135
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: "Authentication Required" }),
|
|
1136
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Please log in to access the admin panel." })
|
|
1137
|
+
] });
|
|
1138
|
+
}
|
|
1139
|
+
function DefaultUnauthorized({
|
|
1140
|
+
requiredRole,
|
|
1141
|
+
requiredPermission
|
|
1142
|
+
}) {
|
|
1143
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "route-guard route-guard--unauthorized", children: [
|
|
1144
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "route-guard-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1145
|
+
"svg",
|
|
1146
|
+
{
|
|
1147
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1148
|
+
width: "48",
|
|
1149
|
+
height: "48",
|
|
1150
|
+
viewBox: "0 0 24 24",
|
|
1151
|
+
fill: "none",
|
|
1152
|
+
stroke: "currentColor",
|
|
1153
|
+
strokeWidth: "2",
|
|
1154
|
+
strokeLinecap: "round",
|
|
1155
|
+
strokeLinejoin: "round",
|
|
1156
|
+
children: [
|
|
1157
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1158
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "4.93", y1: "4.93", x2: "19.07", y2: "19.07" })
|
|
1159
|
+
]
|
|
1160
|
+
}
|
|
1161
|
+
) }),
|
|
1162
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: "Access Denied" }),
|
|
1163
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "You don't have permission to access this page." }),
|
|
1164
|
+
requiredRole && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "route-guard-detail", children: [
|
|
1165
|
+
"Required role: ",
|
|
1166
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: requiredRole })
|
|
1167
|
+
] }),
|
|
1168
|
+
requiredPermission && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "route-guard-detail", children: [
|
|
1169
|
+
"Required permission:",
|
|
1170
|
+
" ",
|
|
1171
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("strong", { children: [
|
|
1172
|
+
requiredPermission.action,
|
|
1173
|
+
" on ",
|
|
1174
|
+
requiredPermission.resource
|
|
1175
|
+
] })
|
|
1176
|
+
] })
|
|
1177
|
+
] });
|
|
1178
|
+
}
|
|
1179
|
+
function DefaultError({ error }) {
|
|
1180
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "route-guard route-guard--error", children: [
|
|
1181
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "route-guard-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1182
|
+
"svg",
|
|
1183
|
+
{
|
|
1184
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1185
|
+
width: "48",
|
|
1186
|
+
height: "48",
|
|
1187
|
+
viewBox: "0 0 24 24",
|
|
1188
|
+
fill: "none",
|
|
1189
|
+
stroke: "currentColor",
|
|
1190
|
+
strokeWidth: "2",
|
|
1191
|
+
strokeLinecap: "round",
|
|
1192
|
+
strokeLinejoin: "round",
|
|
1193
|
+
children: [
|
|
1194
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1195
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
1196
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
1197
|
+
]
|
|
1198
|
+
}
|
|
1199
|
+
) }),
|
|
1200
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: "Authentication Error" }),
|
|
1201
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: error })
|
|
1202
|
+
] });
|
|
1203
|
+
}
|
|
1204
|
+
function RouteGuard({
|
|
1205
|
+
children,
|
|
1206
|
+
requiredPermission,
|
|
1207
|
+
requiredRole,
|
|
1208
|
+
loadingComponent,
|
|
1209
|
+
unauthenticatedComponent,
|
|
1210
|
+
unauthorizedComponent,
|
|
1211
|
+
onUnauthenticated,
|
|
1212
|
+
onUnauthorized
|
|
1213
|
+
}) {
|
|
1214
|
+
const { authState, role, checkPermission, error } = useAuth();
|
|
1215
|
+
if (authState === "loading") {
|
|
1216
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: loadingComponent ?? /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultLoading, {}) });
|
|
1217
|
+
}
|
|
1218
|
+
if (authState === "error") {
|
|
1219
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultError, { error: error ?? "An error occurred" });
|
|
1220
|
+
}
|
|
1221
|
+
if (authState === "unauthenticated") {
|
|
1222
|
+
onUnauthenticated?.();
|
|
1223
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: unauthenticatedComponent ?? /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultUnauthenticated, {}) });
|
|
1224
|
+
}
|
|
1225
|
+
if (!role) {
|
|
1226
|
+
onUnauthorized?.();
|
|
1227
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: unauthorizedComponent ?? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1228
|
+
DefaultUnauthorized,
|
|
1229
|
+
{
|
|
1230
|
+
requiredRole,
|
|
1231
|
+
requiredPermission
|
|
1232
|
+
}
|
|
1233
|
+
) });
|
|
1234
|
+
}
|
|
1235
|
+
if (requiredRole && role !== requiredRole) {
|
|
1236
|
+
onUnauthorized?.();
|
|
1237
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: unauthorizedComponent ?? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1238
|
+
DefaultUnauthorized,
|
|
1239
|
+
{
|
|
1240
|
+
requiredRole,
|
|
1241
|
+
requiredPermission
|
|
1242
|
+
}
|
|
1243
|
+
) });
|
|
1244
|
+
}
|
|
1245
|
+
if (requiredPermission && !checkPermission(requiredPermission)) {
|
|
1246
|
+
onUnauthorized?.();
|
|
1247
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: unauthorizedComponent ?? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1248
|
+
DefaultUnauthorized,
|
|
1249
|
+
{
|
|
1250
|
+
requiredRole,
|
|
1251
|
+
requiredPermission
|
|
1252
|
+
}
|
|
1253
|
+
) });
|
|
1254
|
+
}
|
|
1255
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
|
|
1256
|
+
}
|
|
1257
|
+
const createSsrRpc = (functionId, importer) => {
|
|
1258
|
+
const url = "/_serverFn/" + functionId;
|
|
1259
|
+
const serverFnMeta = { id: functionId };
|
|
1260
|
+
const fn = async (...args) => {
|
|
1261
|
+
const serverFn = await getServerFnById(functionId);
|
|
1262
|
+
return serverFn(...args);
|
|
1263
|
+
};
|
|
1264
|
+
return Object.assign(fn, {
|
|
1265
|
+
url,
|
|
1266
|
+
serverFnMeta,
|
|
1267
|
+
[TSS_SERVER_FUNCTION]: true
|
|
1268
|
+
});
|
|
1269
|
+
};
|
|
1270
|
+
const getServerConfig = createServerFn({
|
|
1271
|
+
method: "GET"
|
|
1272
|
+
}).handler(createSsrRpc("dff4e5b7f7b29b6a323200a2df0a5335d739cf583e83c9e514598af6b5ade819"));
|
|
1273
|
+
const mockGetUser = () => {
|
|
1274
|
+
return {
|
|
1275
|
+
id: "mock_user_123",
|
|
1276
|
+
name: "Demo Admin",
|
|
1277
|
+
email: "admin@example.com"
|
|
1278
|
+
};
|
|
1279
|
+
};
|
|
1280
|
+
const mockGetUserRole = () => {
|
|
1281
|
+
return "admin";
|
|
1282
|
+
};
|
|
1283
|
+
const mockLogout = () => {
|
|
1284
|
+
console.log("Logout called (mock mode)");
|
|
1285
|
+
};
|
|
1286
|
+
const noAuthGetUser = () => null;
|
|
1287
|
+
const noAuthGetUserRole = () => null;
|
|
1288
|
+
const noAuthLogout = () => {
|
|
1289
|
+
};
|
|
1290
|
+
function getAuthConfig(authMode) {
|
|
1291
|
+
switch (authMode) {
|
|
1292
|
+
case "mock":
|
|
1293
|
+
case "demo":
|
|
1294
|
+
return {
|
|
1295
|
+
getUser: mockGetUser,
|
|
1296
|
+
getUserRole: mockGetUserRole,
|
|
1297
|
+
onLogout: mockLogout
|
|
1298
|
+
};
|
|
1299
|
+
case "none":
|
|
1300
|
+
case "disabled":
|
|
1301
|
+
return {
|
|
1302
|
+
getUser: noAuthGetUser,
|
|
1303
|
+
getUserRole: noAuthGetUserRole,
|
|
1304
|
+
onLogout: noAuthLogout
|
|
1305
|
+
};
|
|
1306
|
+
default:
|
|
1307
|
+
return {
|
|
1308
|
+
getUser: mockGetUser,
|
|
1309
|
+
getUserRole: mockGetUserRole,
|
|
1310
|
+
onLogout: mockLogout
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
const Route$a = createRootRoute({
|
|
1315
|
+
head: () => ({
|
|
1316
|
+
meta: [
|
|
1317
|
+
{
|
|
1318
|
+
charSet: "utf-8"
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
name: "viewport",
|
|
1322
|
+
content: "width=device-width, initial-scale=1"
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
title: "Convex CMS Admin"
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
name: "description",
|
|
1329
|
+
content: "Admin interface for Convex CMS - manage content, media, and publishing workflows"
|
|
1330
|
+
}
|
|
1331
|
+
],
|
|
1332
|
+
links: [
|
|
1333
|
+
{ rel: "stylesheet", href: globalsCss },
|
|
1334
|
+
{ rel: "icon", href: "/favicon.ico" }
|
|
1335
|
+
]
|
|
1336
|
+
}),
|
|
1337
|
+
// Load server config at route initialization
|
|
1338
|
+
loader: async () => {
|
|
1339
|
+
const config = await getServerConfig();
|
|
1340
|
+
return { config };
|
|
1341
|
+
},
|
|
1342
|
+
component: RootComponent
|
|
1343
|
+
});
|
|
1344
|
+
function RootComponent() {
|
|
1345
|
+
const { config } = Route$a.useLoaderData();
|
|
1346
|
+
const authConfig = reactExports.useMemo(() => getAuthConfig(config.authMode), [config.authMode]);
|
|
1347
|
+
const adminConfig = reactExports.useMemo(
|
|
1348
|
+
() => resolveAdminConfig(config.adminConfig),
|
|
1349
|
+
[config.adminConfig]
|
|
1350
|
+
);
|
|
1351
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(RootDocument, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ConvexProviderWrapper, { config, adminConfig, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1352
|
+
AuthProvider,
|
|
1353
|
+
{
|
|
1354
|
+
getUser: authConfig.getUser,
|
|
1355
|
+
getUserRole: authConfig.getUserRole,
|
|
1356
|
+
onLogout: authConfig.onLogout,
|
|
1357
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(RouteGuard, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AdminLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Outlet, {}) }) })
|
|
1358
|
+
}
|
|
1359
|
+
) }) }) }) });
|
|
1360
|
+
}
|
|
1361
|
+
function ConvexProviderWrapper({
|
|
1362
|
+
children,
|
|
1363
|
+
config,
|
|
1364
|
+
adminConfig
|
|
1365
|
+
}) {
|
|
1366
|
+
const convex = reactExports.useMemo(() => {
|
|
1367
|
+
if (!config.convexUrl) return null;
|
|
1368
|
+
return new ConvexReactClient(config.convexUrl);
|
|
1369
|
+
}, [config.convexUrl]);
|
|
1370
|
+
if (!convex) {
|
|
1371
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center bg-background p-6", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-lg space-y-4 rounded-lg border border-amber-200 bg-amber-50 p-6 text-center", children: [
|
|
1372
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-semibold text-amber-900", children: "Convex Configuration Required" }),
|
|
1373
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-amber-800", children: "Please provide a Convex deployment URL to connect to your backend." }),
|
|
1374
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2 text-left text-sm text-amber-700", children: [
|
|
1375
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-medium", children: "Options:" }),
|
|
1376
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-inside list-disc space-y-1", children: [
|
|
1377
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
|
|
1378
|
+
"Run with URL:",
|
|
1379
|
+
" ",
|
|
1380
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "rounded bg-amber-100 px-1", children: "npx convex-cms admin --url YOUR_URL" })
|
|
1381
|
+
] }),
|
|
1382
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
|
|
1383
|
+
"Set environment variable:",
|
|
1384
|
+
" ",
|
|
1385
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "rounded bg-amber-100 px-1", children: "CONVEX_URL=YOUR_URL" })
|
|
1386
|
+
] }),
|
|
1387
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
|
|
1388
|
+
"Add to",
|
|
1389
|
+
" ",
|
|
1390
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "rounded bg-amber-100 px-1", children: ".env.local" }),
|
|
1391
|
+
":",
|
|
1392
|
+
" ",
|
|
1393
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "rounded bg-amber-100 px-1", children: "CONVEX_URL=YOUR_URL" })
|
|
1394
|
+
] })
|
|
1395
|
+
] })
|
|
1396
|
+
] }),
|
|
1397
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-amber-700", children: [
|
|
1398
|
+
"Run",
|
|
1399
|
+
" ",
|
|
1400
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "rounded bg-amber-100 px-1", children: "npx convex dev" }),
|
|
1401
|
+
" to start Convex and get your URL."
|
|
1402
|
+
] })
|
|
1403
|
+
] }) });
|
|
1404
|
+
}
|
|
1405
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ConvexProvider, { client: convex, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsConfigProvider, { baseConfig: adminConfig, children }) });
|
|
1406
|
+
}
|
|
1407
|
+
function RootDocument({ children }) {
|
|
1408
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("html", { lang: "en", children: [
|
|
1409
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("head", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(HeadContent, {}) }),
|
|
1410
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("body", { children: [
|
|
1411
|
+
children,
|
|
1412
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Scripts, {})
|
|
1413
|
+
] })
|
|
1414
|
+
] });
|
|
1415
|
+
}
|
|
1416
|
+
const $$splitComponentImporter$9 = () => import("./trash-DYMxwhZB.mjs");
|
|
1417
|
+
const Route$9 = createFileRoute("/trash")({
|
|
1418
|
+
component: lazyRouteComponent($$splitComponentImporter$9, "component")
|
|
1419
|
+
});
|
|
1420
|
+
const $$splitComponentImporter$8 = () => import("./taxonomies-C8j8g5Q5.mjs");
|
|
1421
|
+
const Route$8 = createFileRoute("/taxonomies")({
|
|
1422
|
+
component: lazyRouteComponent($$splitComponentImporter$8, "component")
|
|
1423
|
+
});
|
|
1424
|
+
const $$splitComponentImporter$7 = () => import("./settings-DAsxnw2q.mjs");
|
|
1425
|
+
const Route$7 = createFileRoute("/settings")({
|
|
1426
|
+
component: lazyRouteComponent($$splitComponentImporter$7, "component")
|
|
1427
|
+
});
|
|
1428
|
+
const $$splitComponentImporter$6 = () => import("./media-CSx3XttC.mjs");
|
|
1429
|
+
const Route$6 = createFileRoute("/media")({
|
|
1430
|
+
component: lazyRouteComponent($$splitComponentImporter$6, "component")
|
|
1431
|
+
});
|
|
1432
|
+
const $$splitComponentImporter$5 = () => import("./content-types-BIOqCQYN.mjs");
|
|
1433
|
+
const Route$5 = createFileRoute("/content-types")({
|
|
1434
|
+
component: lazyRouteComponent($$splitComponentImporter$5, "component")
|
|
1435
|
+
});
|
|
1436
|
+
const $$splitComponentImporter$4 = () => import("./content-B5RhL7uW.mjs");
|
|
1437
|
+
const Route$4 = createFileRoute("/content")({
|
|
1438
|
+
component: lazyRouteComponent($$splitComponentImporter$4, "component")
|
|
1439
|
+
});
|
|
1440
|
+
const $$splitComponentImporter$3 = () => import("./index-DHSHDPt1.mjs");
|
|
1441
|
+
const Route$3 = createFileRoute("/")({
|
|
1442
|
+
component: lazyRouteComponent($$splitComponentImporter$3, "component")
|
|
1443
|
+
});
|
|
1444
|
+
const $$splitComponentImporter$2 = () => import("./_entryId-CRfnqeDf.mjs");
|
|
1445
|
+
const Route$2 = createFileRoute("/entries/$entryId")({
|
|
1446
|
+
component: lazyRouteComponent($$splitComponentImporter$2, "component")
|
|
1447
|
+
});
|
|
1448
|
+
const $$splitComponentImporter$1 = () => import("./_contentTypeId-BqYKEcLr.mjs");
|
|
1449
|
+
const Route$1 = createFileRoute("/entries/type/$contentTypeId")({
|
|
1450
|
+
component: lazyRouteComponent($$splitComponentImporter$1, "component")
|
|
1451
|
+
});
|
|
1452
|
+
const $$splitComponentImporter = () => import("./new._contentTypeId-DzanEZQM.mjs");
|
|
1453
|
+
const Route = createFileRoute("/entries/new/$contentTypeId")({
|
|
1454
|
+
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
1455
|
+
});
|
|
1456
|
+
const TrashRoute = Route$9.update({
|
|
1457
|
+
id: "/trash",
|
|
1458
|
+
path: "/trash",
|
|
1459
|
+
getParentRoute: () => Route$a
|
|
1460
|
+
});
|
|
1461
|
+
const TaxonomiesRoute = Route$8.update({
|
|
1462
|
+
id: "/taxonomies",
|
|
1463
|
+
path: "/taxonomies",
|
|
1464
|
+
getParentRoute: () => Route$a
|
|
1465
|
+
});
|
|
1466
|
+
const SettingsRoute = Route$7.update({
|
|
1467
|
+
id: "/settings",
|
|
1468
|
+
path: "/settings",
|
|
1469
|
+
getParentRoute: () => Route$a
|
|
1470
|
+
});
|
|
1471
|
+
const MediaRoute = Route$6.update({
|
|
1472
|
+
id: "/media",
|
|
1473
|
+
path: "/media",
|
|
1474
|
+
getParentRoute: () => Route$a
|
|
1475
|
+
});
|
|
1476
|
+
const ContentTypesRoute = Route$5.update({
|
|
1477
|
+
id: "/content-types",
|
|
1478
|
+
path: "/content-types",
|
|
1479
|
+
getParentRoute: () => Route$a
|
|
1480
|
+
});
|
|
1481
|
+
const ContentRoute = Route$4.update({
|
|
1482
|
+
id: "/content",
|
|
1483
|
+
path: "/content",
|
|
1484
|
+
getParentRoute: () => Route$a
|
|
1485
|
+
});
|
|
1486
|
+
const IndexRoute = Route$3.update({
|
|
1487
|
+
id: "/",
|
|
1488
|
+
path: "/",
|
|
1489
|
+
getParentRoute: () => Route$a
|
|
1490
|
+
});
|
|
1491
|
+
const EntriesEntryIdRoute = Route$2.update({
|
|
1492
|
+
id: "/entries/$entryId",
|
|
1493
|
+
path: "/entries/$entryId",
|
|
1494
|
+
getParentRoute: () => Route$a
|
|
1495
|
+
});
|
|
1496
|
+
const EntriesTypeContentTypeIdRoute = Route$1.update({
|
|
1497
|
+
id: "/entries/type/$contentTypeId",
|
|
1498
|
+
path: "/entries/type/$contentTypeId",
|
|
1499
|
+
getParentRoute: () => Route$a
|
|
1500
|
+
});
|
|
1501
|
+
const EntriesNewContentTypeIdRoute = Route.update({
|
|
1502
|
+
id: "/entries/new/$contentTypeId",
|
|
1503
|
+
path: "/entries/new/$contentTypeId",
|
|
1504
|
+
getParentRoute: () => Route$a
|
|
1505
|
+
});
|
|
1506
|
+
const rootRouteChildren = {
|
|
1507
|
+
IndexRoute,
|
|
1508
|
+
ContentRoute,
|
|
1509
|
+
ContentTypesRoute,
|
|
1510
|
+
MediaRoute,
|
|
1511
|
+
SettingsRoute,
|
|
1512
|
+
TaxonomiesRoute,
|
|
1513
|
+
TrashRoute,
|
|
1514
|
+
EntriesEntryIdRoute,
|
|
1515
|
+
EntriesNewContentTypeIdRoute,
|
|
1516
|
+
EntriesTypeContentTypeIdRoute
|
|
1517
|
+
};
|
|
1518
|
+
const routeTree = Route$a._addFileChildren(rootRouteChildren)._addFileTypes();
|
|
1519
|
+
function getRouter() {
|
|
1520
|
+
const router2 = createRouter({
|
|
1521
|
+
routeTree,
|
|
1522
|
+
scrollRestoration: true,
|
|
1523
|
+
defaultPreload: "intent"
|
|
1524
|
+
});
|
|
1525
|
+
return router2;
|
|
1526
|
+
}
|
|
1527
|
+
const router = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1528
|
+
__proto__: null,
|
|
1529
|
+
getRouter
|
|
1530
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1531
|
+
export {
|
|
1532
|
+
Button as B,
|
|
1533
|
+
DropdownMenu as D,
|
|
1534
|
+
Popover as P,
|
|
1535
|
+
RouteGuard as R,
|
|
1536
|
+
api as a,
|
|
1537
|
+
useTheme as b,
|
|
1538
|
+
cn as c,
|
|
1539
|
+
DropdownMenuTrigger as d,
|
|
1540
|
+
DropdownMenuContent as e,
|
|
1541
|
+
DropdownMenuItem as f,
|
|
1542
|
+
DropdownMenuSeparator as g,
|
|
1543
|
+
Route$2 as h,
|
|
1544
|
+
Route$1 as i,
|
|
1545
|
+
PopoverTrigger as j,
|
|
1546
|
+
PopoverContent as k,
|
|
1547
|
+
useAuth as l,
|
|
1548
|
+
getResourcePermissions as m,
|
|
1549
|
+
canAccessResource as n,
|
|
1550
|
+
hasPermission as o,
|
|
1551
|
+
Route as p,
|
|
1552
|
+
buttonVariants as q,
|
|
1553
|
+
useBreadcrumbContext as r,
|
|
1554
|
+
router as s,
|
|
1555
|
+
useSettingsConfig as u
|
|
1556
|
+
};
|