@orion-studios/payload-studio 0.6.0-beta.20 → 0.6.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/client.js +193 -170
- package/dist/admin/client.mjs +198 -175
- package/dist/admin/index.js +37 -25
- package/dist/admin/index.mjs +1 -1
- package/dist/{chunk-3AHBR7RI.mjs → chunk-JC3UV74N.mjs} +37 -25
- package/dist/index.js +37 -25
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/admin/client.mjs
CHANGED
|
@@ -2667,15 +2667,15 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2667
2667
|
}
|
|
2668
2668
|
|
|
2669
2669
|
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
2670
|
-
import { useEffect as
|
|
2670
|
+
import { useEffect as useEffect9, useMemo as useMemo5, useState as useState10 } from "react";
|
|
2671
2671
|
import Link2 from "next/link";
|
|
2672
|
+
import { useAuth as useAuth5 } from "@payloadcms/ui";
|
|
2673
|
+
|
|
2674
|
+
// src/admin/components/studio/AdminStudioNewPageView.tsx
|
|
2675
|
+
import { useState as useState8 } from "react";
|
|
2672
2676
|
import { useAuth as useAuth3 } from "@payloadcms/ui";
|
|
2673
2677
|
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2674
|
-
var
|
|
2675
|
-
if (!user || typeof user !== "object") return false;
|
|
2676
|
-
const role = user.role;
|
|
2677
|
-
return typeof role === "string" && (role === "admin" || role === "developer");
|
|
2678
|
-
};
|
|
2678
|
+
var pageTemplates = ["standard", "landing", "services", "contact"];
|
|
2679
2679
|
var getPropString3 = (props, key, fallback) => {
|
|
2680
2680
|
if (!props || typeof props !== "object") return fallback;
|
|
2681
2681
|
const direct = props[key];
|
|
@@ -2687,92 +2687,116 @@ var getPropString3 = (props, key, fallback) => {
|
|
|
2687
2687
|
}
|
|
2688
2688
|
return fallback;
|
|
2689
2689
|
};
|
|
2690
|
-
|
|
2690
|
+
var canManagePages = (user) => {
|
|
2691
|
+
if (!user || typeof user !== "object") return false;
|
|
2692
|
+
const role = user.role;
|
|
2693
|
+
return role === "admin" || role === "developer" || role === "editor";
|
|
2694
|
+
};
|
|
2695
|
+
var slugify = (value) => value.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
2696
|
+
function AdminStudioNewPageView(props) {
|
|
2691
2697
|
const { user } = useAuth3();
|
|
2692
|
-
const pagesCollectionSlug = getPropString3(props, "pagesCollectionSlug", "pages");
|
|
2693
2698
|
const adminBasePath = useAdminBasePath();
|
|
2694
|
-
const
|
|
2695
|
-
const [
|
|
2699
|
+
const pagesCollectionSlug = getPropString3(props, "pagesCollectionSlug", "pages");
|
|
2700
|
+
const [submitting, setSubmitting] = useState8(false);
|
|
2696
2701
|
const [error, setError] = useState8(null);
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
try {
|
|
2713
|
-
const res = await fetch(apiURL, { credentials: "include" });
|
|
2714
|
-
if (!res.ok) {
|
|
2715
|
-
const body = await res.text();
|
|
2716
|
-
throw new Error(body || "Failed to fetch pages");
|
|
2717
|
-
}
|
|
2718
|
-
const data = await res.json();
|
|
2719
|
-
if (!cancelled) {
|
|
2720
|
-
setDocs(Array.isArray(data.docs) ? data.docs : []);
|
|
2721
|
-
}
|
|
2722
|
-
} catch (err) {
|
|
2723
|
-
if (!cancelled) {
|
|
2724
|
-
setError(err instanceof Error ? err.message : "Failed to fetch pages");
|
|
2725
|
-
}
|
|
2726
|
-
} finally {
|
|
2727
|
-
if (!cancelled) {
|
|
2728
|
-
setLoading(false);
|
|
2729
|
-
}
|
|
2702
|
+
if (!canManagePages(user)) {
|
|
2703
|
+
return /* @__PURE__ */ jsx18(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx18(
|
|
2704
|
+
AdminPage,
|
|
2705
|
+
{
|
|
2706
|
+
breadcrumbs: [
|
|
2707
|
+
{ label: "Dashboard", href: adminBasePath },
|
|
2708
|
+
{ label: "Pages", href: resolveAdminPath(adminBasePath, "/pages") },
|
|
2709
|
+
{ label: "New Page" }
|
|
2710
|
+
],
|
|
2711
|
+
description: "You do not have access to create pages.",
|
|
2712
|
+
title: "New Page",
|
|
2713
|
+
children: /* @__PURE__ */ jsxs15("div", { className: "orion-admin-card", children: [
|
|
2714
|
+
/* @__PURE__ */ jsx18("strong", { children: "Access denied" }),
|
|
2715
|
+
/* @__PURE__ */ jsx18("span", { children: "This section is restricted to administrator, developer, and editor accounts." })
|
|
2716
|
+
] })
|
|
2730
2717
|
}
|
|
2731
|
-
};
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2718
|
+
) });
|
|
2719
|
+
}
|
|
2720
|
+
const createPage = async (event) => {
|
|
2721
|
+
event.preventDefault();
|
|
2722
|
+
setSubmitting(true);
|
|
2723
|
+
setError(null);
|
|
2724
|
+
try {
|
|
2725
|
+
const formData = new FormData(event.currentTarget);
|
|
2726
|
+
const titleValue = String(formData.get("title") || "").trim();
|
|
2727
|
+
const slugValue = String(formData.get("slug") || "").trim();
|
|
2728
|
+
const templateValue = String(formData.get("template") || "standard").trim();
|
|
2729
|
+
const template = pageTemplates.includes(templateValue) ? templateValue : "standard";
|
|
2730
|
+
const title = titleValue || "Untitled Page";
|
|
2731
|
+
const slug = slugValue || slugify(title) || "untitled-page";
|
|
2732
|
+
const response = await fetch(`/api/${pagesCollectionSlug}`, {
|
|
2733
|
+
body: JSON.stringify({
|
|
2734
|
+
_status: "draft",
|
|
2735
|
+
slug,
|
|
2736
|
+
template,
|
|
2737
|
+
title
|
|
2738
|
+
}),
|
|
2739
|
+
credentials: "include",
|
|
2740
|
+
headers: {
|
|
2741
|
+
"Content-Type": "application/json"
|
|
2742
|
+
},
|
|
2743
|
+
method: "POST"
|
|
2744
|
+
});
|
|
2745
|
+
if (!response.ok) {
|
|
2746
|
+
throw new Error(`Failed to create page (${response.status}).`);
|
|
2747
|
+
}
|
|
2748
|
+
const payload = await response.json();
|
|
2749
|
+
const id = typeof payload.id === "string" || typeof payload.id === "number" ? String(payload.id) : "";
|
|
2750
|
+
if (!id) {
|
|
2751
|
+
throw new Error("Page created but no document ID was returned.");
|
|
2752
|
+
}
|
|
2753
|
+
window.location.assign(resolveAdminPath(adminBasePath, `/pages/${id}`));
|
|
2754
|
+
} catch (createError) {
|
|
2755
|
+
setError(createError instanceof Error ? createError.message : "Failed to create page.");
|
|
2756
|
+
} finally {
|
|
2757
|
+
setSubmitting(false);
|
|
2758
|
+
}
|
|
2759
|
+
};
|
|
2760
|
+
return /* @__PURE__ */ jsx18(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx18(
|
|
2738
2761
|
AdminPage,
|
|
2739
2762
|
{
|
|
2740
|
-
actions: hasAdminAccess(user) ? /* @__PURE__ */ jsx18(Link2, { className: "orion-admin-action-button", href: newPagePath, children: "New Page" }) : null,
|
|
2741
2763
|
breadcrumbs: [
|
|
2742
2764
|
{ label: "Dashboard", href: adminBasePath },
|
|
2743
|
-
{ label: "Pages" }
|
|
2765
|
+
{ label: "Pages", href: resolveAdminPath(adminBasePath, "/pages") },
|
|
2766
|
+
{ label: "New Page" }
|
|
2744
2767
|
],
|
|
2745
|
-
description: "
|
|
2746
|
-
title: "
|
|
2747
|
-
children: [
|
|
2748
|
-
loading ? /* @__PURE__ */ jsx18("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
2768
|
+
description: "Create a new page and open it in the custom editor.",
|
|
2769
|
+
title: "New Page",
|
|
2770
|
+
children: /* @__PURE__ */ jsxs15("form", { className: "orion-admin-form", onSubmit: createPage, children: [
|
|
2749
2771
|
error ? /* @__PURE__ */ jsx18("div", { className: "orion-admin-error", children: error }) : null,
|
|
2750
|
-
/* @__PURE__ */ jsxs15("
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2772
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
2773
|
+
"Title",
|
|
2774
|
+
/* @__PURE__ */ jsx18("input", { name: "title", placeholder: "Services", required: true, type: "text" })
|
|
2775
|
+
] }),
|
|
2776
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
2777
|
+
"Slug",
|
|
2778
|
+
/* @__PURE__ */ jsx18("input", { name: "slug", placeholder: "services", type: "text" })
|
|
2779
|
+
] }),
|
|
2780
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
2781
|
+
"Template",
|
|
2782
|
+
/* @__PURE__ */ jsxs15("select", { defaultValue: "standard", name: "template", children: [
|
|
2783
|
+
/* @__PURE__ */ jsx18("option", { value: "standard", children: "Standard" }),
|
|
2784
|
+
/* @__PURE__ */ jsx18("option", { value: "landing", children: "Landing" }),
|
|
2785
|
+
/* @__PURE__ */ jsx18("option", { value: "contact", children: "Contact" }),
|
|
2786
|
+
/* @__PURE__ */ jsx18("option", { value: "services", children: "Services" })
|
|
2787
|
+
] })
|
|
2788
|
+
] }),
|
|
2789
|
+
/* @__PURE__ */ jsx18("button", { disabled: submitting, type: "submit", children: submitting ? "Creating..." : "Create Page" })
|
|
2790
|
+
] })
|
|
2767
2791
|
}
|
|
2768
2792
|
) });
|
|
2769
2793
|
}
|
|
2770
2794
|
|
|
2771
2795
|
// src/admin/components/studio/AdminStudioPageEditView.tsx
|
|
2772
|
-
import { useEffect as
|
|
2796
|
+
import { useEffect as useEffect8, useMemo as useMemo4, useRef as useRef3, useState as useState9 } from "react";
|
|
2773
2797
|
import { SetStepNav, toast, useAuth as useAuth4 } from "@payloadcms/ui";
|
|
2774
2798
|
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2775
|
-
var
|
|
2799
|
+
var hasAdminAccess = (user) => {
|
|
2776
2800
|
if (!user || typeof user !== "object") return false;
|
|
2777
2801
|
const role = user.role;
|
|
2778
2802
|
return typeof role === "string" && (role === "admin" || role === "developer");
|
|
@@ -2819,10 +2843,10 @@ function AdminStudioPageEditView(props) {
|
|
|
2819
2843
|
const [canRedo, setCanRedo] = useState9(false);
|
|
2820
2844
|
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
2821
2845
|
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
2822
|
-
const pageIDFromParams =
|
|
2846
|
+
const pageIDFromParams = useMemo4(() => getParam(props.params, "id"), [props.params]);
|
|
2823
2847
|
const [pageID, setPageID] = useState9(pageIDFromParams);
|
|
2824
2848
|
const [didResolvePathFallback, setDidResolvePathFallback] = useState9(false);
|
|
2825
|
-
|
|
2849
|
+
useEffect8(() => {
|
|
2826
2850
|
if (pageIDFromParams) {
|
|
2827
2851
|
setPageID(pageIDFromParams);
|
|
2828
2852
|
setDidResolvePathFallback(true);
|
|
@@ -2833,7 +2857,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2833
2857
|
}
|
|
2834
2858
|
setDidResolvePathFallback(true);
|
|
2835
2859
|
}, [pageIDFromParams]);
|
|
2836
|
-
const canPublish =
|
|
2860
|
+
const canPublish = hasAdminAccess(user) || isEditor(user);
|
|
2837
2861
|
const refreshUnpublishedState = async (id) => {
|
|
2838
2862
|
try {
|
|
2839
2863
|
const response = await fetch(
|
|
@@ -2866,7 +2890,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2866
2890
|
} catch {
|
|
2867
2891
|
}
|
|
2868
2892
|
};
|
|
2869
|
-
|
|
2893
|
+
useEffect8(() => {
|
|
2870
2894
|
if (!pageID) {
|
|
2871
2895
|
return;
|
|
2872
2896
|
}
|
|
@@ -2889,7 +2913,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2889
2913
|
}
|
|
2890
2914
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
2891
2915
|
};
|
|
2892
|
-
|
|
2916
|
+
useEffect8(() => {
|
|
2893
2917
|
const onMessage = (event) => {
|
|
2894
2918
|
const data = event.data;
|
|
2895
2919
|
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
@@ -3116,11 +3140,13 @@ function AdminStudioPageEditView(props) {
|
|
|
3116
3140
|
] }) });
|
|
3117
3141
|
}
|
|
3118
3142
|
|
|
3119
|
-
// src/admin/components/studio/
|
|
3120
|
-
import { useState as useState10 } from "react";
|
|
3121
|
-
import { useAuth as useAuth5 } from "@payloadcms/ui";
|
|
3143
|
+
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
3122
3144
|
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3123
|
-
var
|
|
3145
|
+
var hasAdminAccess2 = (user) => {
|
|
3146
|
+
if (!user || typeof user !== "object") return false;
|
|
3147
|
+
const role = user.role;
|
|
3148
|
+
return typeof role === "string" && (role === "admin" || role === "developer");
|
|
3149
|
+
};
|
|
3124
3150
|
var getPropString5 = (props, key, fallback) => {
|
|
3125
3151
|
if (!props || typeof props !== "object") return fallback;
|
|
3126
3152
|
const direct = props[key];
|
|
@@ -3132,107 +3158,104 @@ var getPropString5 = (props, key, fallback) => {
|
|
|
3132
3158
|
}
|
|
3133
3159
|
return fallback;
|
|
3134
3160
|
};
|
|
3135
|
-
|
|
3136
|
-
if (!user || typeof user !== "object") return false;
|
|
3137
|
-
const role = user.role;
|
|
3138
|
-
return role === "admin" || role === "developer" || role === "editor";
|
|
3139
|
-
};
|
|
3140
|
-
var slugify = (value) => value.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
3141
|
-
function AdminStudioNewPageView(props) {
|
|
3142
|
-
const { user } = useAuth5();
|
|
3161
|
+
function AdminStudioPagesListView(props) {
|
|
3143
3162
|
const adminBasePath = useAdminBasePath();
|
|
3163
|
+
const [pathname, setPathname] = useState10(null);
|
|
3164
|
+
useEffect9(() => {
|
|
3165
|
+
const updatePathname = () => setPathname(window.location.pathname);
|
|
3166
|
+
updatePathname();
|
|
3167
|
+
window.addEventListener("popstate", updatePathname);
|
|
3168
|
+
return () => window.removeEventListener("popstate", updatePathname);
|
|
3169
|
+
}, []);
|
|
3170
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
3171
|
+
const nestedPagePath = pathname && pathname.startsWith(`${pagesPath}/`) ? pathname.slice(`${pagesPath}/`.length).split("/")[0] : "";
|
|
3172
|
+
if (nestedPagePath === "new") {
|
|
3173
|
+
return /* @__PURE__ */ jsx20(AdminStudioNewPageView, { ...props });
|
|
3174
|
+
}
|
|
3175
|
+
if (nestedPagePath) {
|
|
3176
|
+
return /* @__PURE__ */ jsx20(AdminStudioPageEditView, { ...props });
|
|
3177
|
+
}
|
|
3178
|
+
return /* @__PURE__ */ jsx20(AdminStudioPagesIndexView, { ...props, adminBasePath });
|
|
3179
|
+
}
|
|
3180
|
+
function AdminStudioPagesIndexView({
|
|
3181
|
+
adminBasePath,
|
|
3182
|
+
...props
|
|
3183
|
+
}) {
|
|
3184
|
+
const { user } = useAuth5();
|
|
3144
3185
|
const pagesCollectionSlug = getPropString5(props, "pagesCollectionSlug", "pages");
|
|
3145
|
-
const
|
|
3186
|
+
const newPagePath = resolveAdminPath(adminBasePath, "/pages/new");
|
|
3187
|
+
const [loading, setLoading] = useState10(true);
|
|
3146
3188
|
const [error, setError] = useState10(null);
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
slug,
|
|
3181
|
-
template,
|
|
3182
|
-
title
|
|
3183
|
-
}),
|
|
3184
|
-
credentials: "include",
|
|
3185
|
-
headers: {
|
|
3186
|
-
"Content-Type": "application/json"
|
|
3187
|
-
},
|
|
3188
|
-
method: "POST"
|
|
3189
|
-
});
|
|
3190
|
-
if (!response.ok) {
|
|
3191
|
-
throw new Error(`Failed to create page (${response.status}).`);
|
|
3192
|
-
}
|
|
3193
|
-
const payload = await response.json();
|
|
3194
|
-
const id = typeof payload.id === "string" || typeof payload.id === "number" ? String(payload.id) : "";
|
|
3195
|
-
if (!id) {
|
|
3196
|
-
throw new Error("Page created but no document ID was returned.");
|
|
3189
|
+
const [docs, setDocs] = useState10([]);
|
|
3190
|
+
const apiURL = useMemo5(() => {
|
|
3191
|
+
const params = new URLSearchParams({
|
|
3192
|
+
depth: "0",
|
|
3193
|
+
limit: "100",
|
|
3194
|
+
sort: "-updatedAt",
|
|
3195
|
+
draft: "true"
|
|
3196
|
+
});
|
|
3197
|
+
return `/api/${pagesCollectionSlug}?${params.toString()}`;
|
|
3198
|
+
}, [pagesCollectionSlug]);
|
|
3199
|
+
useEffect9(() => {
|
|
3200
|
+
let cancelled = false;
|
|
3201
|
+
const run = async () => {
|
|
3202
|
+
setLoading(true);
|
|
3203
|
+
setError(null);
|
|
3204
|
+
try {
|
|
3205
|
+
const res = await fetch(apiURL, { credentials: "include" });
|
|
3206
|
+
if (!res.ok) {
|
|
3207
|
+
const body = await res.text();
|
|
3208
|
+
throw new Error(body || "Failed to fetch pages");
|
|
3209
|
+
}
|
|
3210
|
+
const data = await res.json();
|
|
3211
|
+
if (!cancelled) {
|
|
3212
|
+
setDocs(Array.isArray(data.docs) ? data.docs : []);
|
|
3213
|
+
}
|
|
3214
|
+
} catch (err) {
|
|
3215
|
+
if (!cancelled) {
|
|
3216
|
+
setError(err instanceof Error ? err.message : "Failed to fetch pages");
|
|
3217
|
+
}
|
|
3218
|
+
} finally {
|
|
3219
|
+
if (!cancelled) {
|
|
3220
|
+
setLoading(false);
|
|
3221
|
+
}
|
|
3197
3222
|
}
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx20(
|
|
3223
|
+
};
|
|
3224
|
+
void run();
|
|
3225
|
+
return () => {
|
|
3226
|
+
cancelled = true;
|
|
3227
|
+
};
|
|
3228
|
+
}, [apiURL]);
|
|
3229
|
+
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs17(
|
|
3206
3230
|
AdminPage,
|
|
3207
3231
|
{
|
|
3232
|
+
actions: hasAdminAccess2(user) ? /* @__PURE__ */ jsx20(Link2, { className: "orion-admin-action-button", href: newPagePath, children: "New Page" }) : null,
|
|
3208
3233
|
breadcrumbs: [
|
|
3209
3234
|
{ label: "Dashboard", href: adminBasePath },
|
|
3210
|
-
{ label: "Pages"
|
|
3211
|
-
{ label: "New Page" }
|
|
3235
|
+
{ label: "Pages" }
|
|
3212
3236
|
],
|
|
3213
|
-
description: "
|
|
3214
|
-
title: "
|
|
3215
|
-
children:
|
|
3237
|
+
description: "Open a page to edit it in the inline custom builder.",
|
|
3238
|
+
title: "Pages",
|
|
3239
|
+
children: [
|
|
3240
|
+
loading ? /* @__PURE__ */ jsx20("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
3216
3241
|
error ? /* @__PURE__ */ jsx20("div", { className: "orion-admin-error", children: error }) : null,
|
|
3217
|
-
/* @__PURE__ */ jsxs17("
|
|
3218
|
-
"
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
/* @__PURE__ */ jsx20("button", { disabled: submitting, type: "submit", children: submitting ? "Creating..." : "Create Page" })
|
|
3235
|
-
] })
|
|
3242
|
+
/* @__PURE__ */ jsxs17("div", { className: "orion-admin-list", children: [
|
|
3243
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ jsxs17("div", { className: "orion-admin-card", children: [
|
|
3244
|
+
/* @__PURE__ */ jsx20("strong", { children: "No pages yet" }),
|
|
3245
|
+
/* @__PURE__ */ jsx20("span", { children: "Create the first page to start building content." })
|
|
3246
|
+
] }) : null,
|
|
3247
|
+
docs.map((doc) => {
|
|
3248
|
+
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
3249
|
+
if (!id) return null;
|
|
3250
|
+
const title = typeof doc.title === "string" ? doc.title : "Untitled Page";
|
|
3251
|
+
const status = typeof doc._status === "string" ? doc._status : "draft";
|
|
3252
|
+
return /* @__PURE__ */ jsxs17(Link2, { className: "orion-admin-list-item", href: resolveAdminPath(adminBasePath, `/pages/${id}`), children: [
|
|
3253
|
+
/* @__PURE__ */ jsx20("div", { children: /* @__PURE__ */ jsx20("strong", { children: title }) }),
|
|
3254
|
+
/* @__PURE__ */ jsx20("span", { className: "orion-admin-pill", children: status })
|
|
3255
|
+
] }, id);
|
|
3256
|
+
})
|
|
3257
|
+
] })
|
|
3258
|
+
]
|
|
3236
3259
|
}
|
|
3237
3260
|
) });
|
|
3238
3261
|
}
|
package/dist/admin/index.js
CHANGED
|
@@ -407,6 +407,7 @@ function configureAdmin(config) {
|
|
|
407
407
|
},
|
|
408
408
|
...studioEnabled ? {
|
|
409
409
|
studioGlobals: {
|
|
410
|
+
exact: true,
|
|
410
411
|
path: globalsBasePath,
|
|
411
412
|
Component: {
|
|
412
413
|
exportName: "AdminStudioGlobalsView",
|
|
@@ -418,10 +419,11 @@ function configureAdmin(config) {
|
|
|
418
419
|
}
|
|
419
420
|
}
|
|
420
421
|
},
|
|
421
|
-
|
|
422
|
-
|
|
422
|
+
studioPageNew: {
|
|
423
|
+
exact: true,
|
|
424
|
+
path: `${pagesBasePath}/new`,
|
|
423
425
|
Component: {
|
|
424
|
-
exportName: "
|
|
426
|
+
exportName: "AdminStudioNewPageView",
|
|
425
427
|
path: clientPath,
|
|
426
428
|
clientProps: {
|
|
427
429
|
...studioNavClientProps,
|
|
@@ -430,6 +432,7 @@ function configureAdmin(config) {
|
|
|
430
432
|
}
|
|
431
433
|
},
|
|
432
434
|
studioPageEditor: {
|
|
435
|
+
exact: true,
|
|
433
436
|
path: `${pagesBasePath}/:id`,
|
|
434
437
|
Component: {
|
|
435
438
|
exportName: "AdminStudioPageEditView",
|
|
@@ -440,10 +443,11 @@ function configureAdmin(config) {
|
|
|
440
443
|
}
|
|
441
444
|
}
|
|
442
445
|
},
|
|
443
|
-
|
|
444
|
-
|
|
446
|
+
studioPages: {
|
|
447
|
+
exact: true,
|
|
448
|
+
path: pagesBasePath,
|
|
445
449
|
Component: {
|
|
446
|
-
exportName: "
|
|
450
|
+
exportName: "AdminStudioPagesListView",
|
|
447
451
|
path: clientPath,
|
|
448
452
|
clientProps: {
|
|
449
453
|
...studioNavClientProps,
|
|
@@ -452,6 +456,7 @@ function configureAdmin(config) {
|
|
|
452
456
|
}
|
|
453
457
|
},
|
|
454
458
|
studioContactForm: {
|
|
459
|
+
exact: true,
|
|
455
460
|
path: contactFormStudioPath,
|
|
456
461
|
Component: {
|
|
457
462
|
exportName: "AdminStudioContactFormView",
|
|
@@ -464,20 +469,8 @@ function configureAdmin(config) {
|
|
|
464
469
|
}
|
|
465
470
|
},
|
|
466
471
|
...formsEnabled ? {
|
|
467
|
-
studioForms: {
|
|
468
|
-
path: formsBasePath,
|
|
469
|
-
Component: {
|
|
470
|
-
exportName: "AdminStudioFormsView",
|
|
471
|
-
path: clientPath,
|
|
472
|
-
clientProps: {
|
|
473
|
-
...studioNavClientProps,
|
|
474
|
-
formsCollectionSlug,
|
|
475
|
-
formSubmissionsCollectionSlug,
|
|
476
|
-
formUploadsCollectionSlug
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
},
|
|
480
472
|
studioFormSubmission: {
|
|
473
|
+
exact: true,
|
|
481
474
|
path: `${formsBasePath}/submissions/:id`,
|
|
482
475
|
Component: {
|
|
483
476
|
exportName: "AdminStudioFormSubmissionView",
|
|
@@ -491,6 +484,7 @@ function configureAdmin(config) {
|
|
|
491
484
|
}
|
|
492
485
|
},
|
|
493
486
|
studioFormUpload: {
|
|
487
|
+
exact: true,
|
|
494
488
|
path: `${formsBasePath}/uploads/:id`,
|
|
495
489
|
Component: {
|
|
496
490
|
exportName: "AdminStudioFormUploadView",
|
|
@@ -502,6 +496,7 @@ function configureAdmin(config) {
|
|
|
502
496
|
}
|
|
503
497
|
},
|
|
504
498
|
studioFormDetail: {
|
|
499
|
+
exact: true,
|
|
505
500
|
path: `${formsBasePath}/:id`,
|
|
506
501
|
Component: {
|
|
507
502
|
exportName: "AdminStudioFormDetailView",
|
|
@@ -512,12 +507,27 @@ function configureAdmin(config) {
|
|
|
512
507
|
formSubmissionsCollectionSlug
|
|
513
508
|
}
|
|
514
509
|
}
|
|
510
|
+
},
|
|
511
|
+
studioForms: {
|
|
512
|
+
exact: true,
|
|
513
|
+
path: formsBasePath,
|
|
514
|
+
Component: {
|
|
515
|
+
exportName: "AdminStudioFormsView",
|
|
516
|
+
path: clientPath,
|
|
517
|
+
clientProps: {
|
|
518
|
+
...studioNavClientProps,
|
|
519
|
+
formsCollectionSlug,
|
|
520
|
+
formSubmissionsCollectionSlug,
|
|
521
|
+
formUploadsCollectionSlug
|
|
522
|
+
}
|
|
523
|
+
}
|
|
515
524
|
}
|
|
516
525
|
} : {},
|
|
517
|
-
|
|
518
|
-
|
|
526
|
+
studioMediaItem: {
|
|
527
|
+
exact: true,
|
|
528
|
+
path: `${mediaBasePath}/:id`,
|
|
519
529
|
Component: {
|
|
520
|
-
exportName: "
|
|
530
|
+
exportName: "AdminStudioMediaItemView",
|
|
521
531
|
path: clientPath,
|
|
522
532
|
clientProps: {
|
|
523
533
|
...studioNavClientProps,
|
|
@@ -525,10 +535,11 @@ function configureAdmin(config) {
|
|
|
525
535
|
}
|
|
526
536
|
}
|
|
527
537
|
},
|
|
528
|
-
|
|
529
|
-
|
|
538
|
+
studioMedia: {
|
|
539
|
+
exact: true,
|
|
540
|
+
path: mediaBasePath,
|
|
530
541
|
Component: {
|
|
531
|
-
exportName: "
|
|
542
|
+
exportName: "AdminStudioMediaView",
|
|
532
543
|
path: clientPath,
|
|
533
544
|
clientProps: {
|
|
534
545
|
...studioNavClientProps,
|
|
@@ -537,6 +548,7 @@ function configureAdmin(config) {
|
|
|
537
548
|
}
|
|
538
549
|
},
|
|
539
550
|
studioTools: {
|
|
551
|
+
exact: true,
|
|
540
552
|
path: toolsBasePath,
|
|
541
553
|
Component: {
|
|
542
554
|
exportName: "AdminStudioToolsView",
|
package/dist/admin/index.mjs
CHANGED