@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.js
CHANGED
|
@@ -4040,15 +4040,15 @@ function AdminStudioDashboard(rawProps) {
|
|
|
4040
4040
|
}
|
|
4041
4041
|
|
|
4042
4042
|
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
4043
|
-
var
|
|
4043
|
+
var import_react19 = require("react");
|
|
4044
4044
|
var import_link2 = __toESM(require("next/link"));
|
|
4045
|
+
var import_ui7 = require("@payloadcms/ui");
|
|
4046
|
+
|
|
4047
|
+
// src/admin/components/studio/AdminStudioNewPageView.tsx
|
|
4048
|
+
var import_react17 = require("react");
|
|
4045
4049
|
var import_ui5 = require("@payloadcms/ui");
|
|
4046
4050
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4047
|
-
var
|
|
4048
|
-
if (!user || typeof user !== "object") return false;
|
|
4049
|
-
const role = user.role;
|
|
4050
|
-
return typeof role === "string" && (role === "admin" || role === "developer");
|
|
4051
|
-
};
|
|
4051
|
+
var pageTemplates = ["standard", "landing", "services", "contact"];
|
|
4052
4052
|
var getPropString3 = (props, key, fallback) => {
|
|
4053
4053
|
if (!props || typeof props !== "object") return fallback;
|
|
4054
4054
|
const direct = props[key];
|
|
@@ -4060,83 +4060,107 @@ var getPropString3 = (props, key, fallback) => {
|
|
|
4060
4060
|
}
|
|
4061
4061
|
return fallback;
|
|
4062
4062
|
};
|
|
4063
|
-
|
|
4063
|
+
var canManagePages = (user) => {
|
|
4064
|
+
if (!user || typeof user !== "object") return false;
|
|
4065
|
+
const role = user.role;
|
|
4066
|
+
return role === "admin" || role === "developer" || role === "editor";
|
|
4067
|
+
};
|
|
4068
|
+
var slugify = (value) => value.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
4069
|
+
function AdminStudioNewPageView(props) {
|
|
4064
4070
|
const { user } = (0, import_ui5.useAuth)();
|
|
4065
|
-
const pagesCollectionSlug = getPropString3(props, "pagesCollectionSlug", "pages");
|
|
4066
4071
|
const adminBasePath = useAdminBasePath();
|
|
4067
|
-
const
|
|
4068
|
-
const [
|
|
4072
|
+
const pagesCollectionSlug = getPropString3(props, "pagesCollectionSlug", "pages");
|
|
4073
|
+
const [submitting, setSubmitting] = (0, import_react17.useState)(false);
|
|
4069
4074
|
const [error, setError] = (0, import_react17.useState)(null);
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
try {
|
|
4086
|
-
const res = await fetch(apiURL, { credentials: "include" });
|
|
4087
|
-
if (!res.ok) {
|
|
4088
|
-
const body = await res.text();
|
|
4089
|
-
throw new Error(body || "Failed to fetch pages");
|
|
4090
|
-
}
|
|
4091
|
-
const data = await res.json();
|
|
4092
|
-
if (!cancelled) {
|
|
4093
|
-
setDocs(Array.isArray(data.docs) ? data.docs : []);
|
|
4094
|
-
}
|
|
4095
|
-
} catch (err) {
|
|
4096
|
-
if (!cancelled) {
|
|
4097
|
-
setError(err instanceof Error ? err.message : "Failed to fetch pages");
|
|
4098
|
-
}
|
|
4099
|
-
} finally {
|
|
4100
|
-
if (!cancelled) {
|
|
4101
|
-
setLoading(false);
|
|
4102
|
-
}
|
|
4075
|
+
if (!canManagePages(user)) {
|
|
4076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4077
|
+
AdminPage,
|
|
4078
|
+
{
|
|
4079
|
+
breadcrumbs: [
|
|
4080
|
+
{ label: "Dashboard", href: adminBasePath },
|
|
4081
|
+
{ label: "Pages", href: resolveAdminPath(adminBasePath, "/pages") },
|
|
4082
|
+
{ label: "New Page" }
|
|
4083
|
+
],
|
|
4084
|
+
description: "You do not have access to create pages.",
|
|
4085
|
+
title: "New Page",
|
|
4086
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "orion-admin-card", children: [
|
|
4087
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("strong", { children: "Access denied" }),
|
|
4088
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "This section is restricted to administrator, developer, and editor accounts." })
|
|
4089
|
+
] })
|
|
4103
4090
|
}
|
|
4104
|
-
};
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4091
|
+
) });
|
|
4092
|
+
}
|
|
4093
|
+
const createPage = async (event) => {
|
|
4094
|
+
event.preventDefault();
|
|
4095
|
+
setSubmitting(true);
|
|
4096
|
+
setError(null);
|
|
4097
|
+
try {
|
|
4098
|
+
const formData = new FormData(event.currentTarget);
|
|
4099
|
+
const titleValue = String(formData.get("title") || "").trim();
|
|
4100
|
+
const slugValue = String(formData.get("slug") || "").trim();
|
|
4101
|
+
const templateValue = String(formData.get("template") || "standard").trim();
|
|
4102
|
+
const template = pageTemplates.includes(templateValue) ? templateValue : "standard";
|
|
4103
|
+
const title = titleValue || "Untitled Page";
|
|
4104
|
+
const slug = slugValue || slugify(title) || "untitled-page";
|
|
4105
|
+
const response = await fetch(`/api/${pagesCollectionSlug}`, {
|
|
4106
|
+
body: JSON.stringify({
|
|
4107
|
+
_status: "draft",
|
|
4108
|
+
slug,
|
|
4109
|
+
template,
|
|
4110
|
+
title
|
|
4111
|
+
}),
|
|
4112
|
+
credentials: "include",
|
|
4113
|
+
headers: {
|
|
4114
|
+
"Content-Type": "application/json"
|
|
4115
|
+
},
|
|
4116
|
+
method: "POST"
|
|
4117
|
+
});
|
|
4118
|
+
if (!response.ok) {
|
|
4119
|
+
throw new Error(`Failed to create page (${response.status}).`);
|
|
4120
|
+
}
|
|
4121
|
+
const payload = await response.json();
|
|
4122
|
+
const id = typeof payload.id === "string" || typeof payload.id === "number" ? String(payload.id) : "";
|
|
4123
|
+
if (!id) {
|
|
4124
|
+
throw new Error("Page created but no document ID was returned.");
|
|
4125
|
+
}
|
|
4126
|
+
window.location.assign(resolveAdminPath(adminBasePath, `/pages/${id}`));
|
|
4127
|
+
} catch (createError) {
|
|
4128
|
+
setError(createError instanceof Error ? createError.message : "Failed to create page.");
|
|
4129
|
+
} finally {
|
|
4130
|
+
setSubmitting(false);
|
|
4131
|
+
}
|
|
4132
|
+
};
|
|
4133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4111
4134
|
AdminPage,
|
|
4112
4135
|
{
|
|
4113
|
-
actions: hasAdminAccess(user) ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_link2.default, { className: "orion-admin-action-button", href: newPagePath, children: "New Page" }) : null,
|
|
4114
4136
|
breadcrumbs: [
|
|
4115
4137
|
{ label: "Dashboard", href: adminBasePath },
|
|
4116
|
-
{ label: "Pages" }
|
|
4138
|
+
{ label: "Pages", href: resolveAdminPath(adminBasePath, "/pages") },
|
|
4139
|
+
{ label: "New Page" }
|
|
4117
4140
|
],
|
|
4118
|
-
description: "
|
|
4119
|
-
title: "
|
|
4120
|
-
children: [
|
|
4121
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
4141
|
+
description: "Create a new page and open it in the custom editor.",
|
|
4142
|
+
title: "New Page",
|
|
4143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("form", { className: "orion-admin-form", onSubmit: createPage, children: [
|
|
4122
4144
|
error ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "orion-admin-error", children: error }) : null,
|
|
4123
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4145
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { children: [
|
|
4146
|
+
"Title",
|
|
4147
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { name: "title", placeholder: "Services", required: true, type: "text" })
|
|
4148
|
+
] }),
|
|
4149
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { children: [
|
|
4150
|
+
"Slug",
|
|
4151
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { name: "slug", placeholder: "services", type: "text" })
|
|
4152
|
+
] }),
|
|
4153
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { children: [
|
|
4154
|
+
"Template",
|
|
4155
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("select", { defaultValue: "standard", name: "template", children: [
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "standard", children: "Standard" }),
|
|
4157
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "landing", children: "Landing" }),
|
|
4158
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "contact", children: "Contact" }),
|
|
4159
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "services", children: "Services" })
|
|
4160
|
+
] })
|
|
4161
|
+
] }),
|
|
4162
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { disabled: submitting, type: "submit", children: submitting ? "Creating..." : "Create Page" })
|
|
4163
|
+
] })
|
|
4140
4164
|
}
|
|
4141
4165
|
) });
|
|
4142
4166
|
}
|
|
@@ -4145,7 +4169,7 @@ function AdminStudioPagesListView(props) {
|
|
|
4145
4169
|
var import_react18 = require("react");
|
|
4146
4170
|
var import_ui6 = require("@payloadcms/ui");
|
|
4147
4171
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4148
|
-
var
|
|
4172
|
+
var hasAdminAccess = (user) => {
|
|
4149
4173
|
if (!user || typeof user !== "object") return false;
|
|
4150
4174
|
const role = user.role;
|
|
4151
4175
|
return typeof role === "string" && (role === "admin" || role === "developer");
|
|
@@ -4206,7 +4230,7 @@ function AdminStudioPageEditView(props) {
|
|
|
4206
4230
|
}
|
|
4207
4231
|
setDidResolvePathFallback(true);
|
|
4208
4232
|
}, [pageIDFromParams]);
|
|
4209
|
-
const canPublish =
|
|
4233
|
+
const canPublish = hasAdminAccess(user) || isEditor(user);
|
|
4210
4234
|
const refreshUnpublishedState = async (id) => {
|
|
4211
4235
|
try {
|
|
4212
4236
|
const response = await fetch(
|
|
@@ -4489,11 +4513,13 @@ function AdminStudioPageEditView(props) {
|
|
|
4489
4513
|
] }) });
|
|
4490
4514
|
}
|
|
4491
4515
|
|
|
4492
|
-
// src/admin/components/studio/
|
|
4493
|
-
var import_react19 = require("react");
|
|
4494
|
-
var import_ui7 = require("@payloadcms/ui");
|
|
4516
|
+
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
4495
4517
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4496
|
-
var
|
|
4518
|
+
var hasAdminAccess2 = (user) => {
|
|
4519
|
+
if (!user || typeof user !== "object") return false;
|
|
4520
|
+
const role = user.role;
|
|
4521
|
+
return typeof role === "string" && (role === "admin" || role === "developer");
|
|
4522
|
+
};
|
|
4497
4523
|
var getPropString5 = (props, key, fallback) => {
|
|
4498
4524
|
if (!props || typeof props !== "object") return fallback;
|
|
4499
4525
|
const direct = props[key];
|
|
@@ -4505,107 +4531,104 @@ var getPropString5 = (props, key, fallback) => {
|
|
|
4505
4531
|
}
|
|
4506
4532
|
return fallback;
|
|
4507
4533
|
};
|
|
4508
|
-
|
|
4509
|
-
if (!user || typeof user !== "object") return false;
|
|
4510
|
-
const role = user.role;
|
|
4511
|
-
return role === "admin" || role === "developer" || role === "editor";
|
|
4512
|
-
};
|
|
4513
|
-
var slugify = (value) => value.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
4514
|
-
function AdminStudioNewPageView(props) {
|
|
4515
|
-
const { user } = (0, import_ui7.useAuth)();
|
|
4534
|
+
function AdminStudioPagesListView(props) {
|
|
4516
4535
|
const adminBasePath = useAdminBasePath();
|
|
4536
|
+
const [pathname, setPathname] = (0, import_react19.useState)(null);
|
|
4537
|
+
(0, import_react19.useEffect)(() => {
|
|
4538
|
+
const updatePathname = () => setPathname(window.location.pathname);
|
|
4539
|
+
updatePathname();
|
|
4540
|
+
window.addEventListener("popstate", updatePathname);
|
|
4541
|
+
return () => window.removeEventListener("popstate", updatePathname);
|
|
4542
|
+
}, []);
|
|
4543
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
4544
|
+
const nestedPagePath = pathname && pathname.startsWith(`${pagesPath}/`) ? pathname.slice(`${pagesPath}/`.length).split("/")[0] : "";
|
|
4545
|
+
if (nestedPagePath === "new") {
|
|
4546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AdminStudioNewPageView, { ...props });
|
|
4547
|
+
}
|
|
4548
|
+
if (nestedPagePath) {
|
|
4549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AdminStudioPageEditView, { ...props });
|
|
4550
|
+
}
|
|
4551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AdminStudioPagesIndexView, { ...props, adminBasePath });
|
|
4552
|
+
}
|
|
4553
|
+
function AdminStudioPagesIndexView({
|
|
4554
|
+
adminBasePath,
|
|
4555
|
+
...props
|
|
4556
|
+
}) {
|
|
4557
|
+
const { user } = (0, import_ui7.useAuth)();
|
|
4517
4558
|
const pagesCollectionSlug = getPropString5(props, "pagesCollectionSlug", "pages");
|
|
4518
|
-
const
|
|
4559
|
+
const newPagePath = resolveAdminPath(adminBasePath, "/pages/new");
|
|
4560
|
+
const [loading, setLoading] = (0, import_react19.useState)(true);
|
|
4519
4561
|
const [error, setError] = (0, import_react19.useState)(null);
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
slug,
|
|
4554
|
-
template,
|
|
4555
|
-
title
|
|
4556
|
-
}),
|
|
4557
|
-
credentials: "include",
|
|
4558
|
-
headers: {
|
|
4559
|
-
"Content-Type": "application/json"
|
|
4560
|
-
},
|
|
4561
|
-
method: "POST"
|
|
4562
|
-
});
|
|
4563
|
-
if (!response.ok) {
|
|
4564
|
-
throw new Error(`Failed to create page (${response.status}).`);
|
|
4565
|
-
}
|
|
4566
|
-
const payload = await response.json();
|
|
4567
|
-
const id = typeof payload.id === "string" || typeof payload.id === "number" ? String(payload.id) : "";
|
|
4568
|
-
if (!id) {
|
|
4569
|
-
throw new Error("Page created but no document ID was returned.");
|
|
4562
|
+
const [docs, setDocs] = (0, import_react19.useState)([]);
|
|
4563
|
+
const apiURL = (0, import_react19.useMemo)(() => {
|
|
4564
|
+
const params = new URLSearchParams({
|
|
4565
|
+
depth: "0",
|
|
4566
|
+
limit: "100",
|
|
4567
|
+
sort: "-updatedAt",
|
|
4568
|
+
draft: "true"
|
|
4569
|
+
});
|
|
4570
|
+
return `/api/${pagesCollectionSlug}?${params.toString()}`;
|
|
4571
|
+
}, [pagesCollectionSlug]);
|
|
4572
|
+
(0, import_react19.useEffect)(() => {
|
|
4573
|
+
let cancelled = false;
|
|
4574
|
+
const run = async () => {
|
|
4575
|
+
setLoading(true);
|
|
4576
|
+
setError(null);
|
|
4577
|
+
try {
|
|
4578
|
+
const res = await fetch(apiURL, { credentials: "include" });
|
|
4579
|
+
if (!res.ok) {
|
|
4580
|
+
const body = await res.text();
|
|
4581
|
+
throw new Error(body || "Failed to fetch pages");
|
|
4582
|
+
}
|
|
4583
|
+
const data = await res.json();
|
|
4584
|
+
if (!cancelled) {
|
|
4585
|
+
setDocs(Array.isArray(data.docs) ? data.docs : []);
|
|
4586
|
+
}
|
|
4587
|
+
} catch (err) {
|
|
4588
|
+
if (!cancelled) {
|
|
4589
|
+
setError(err instanceof Error ? err.message : "Failed to fetch pages");
|
|
4590
|
+
}
|
|
4591
|
+
} finally {
|
|
4592
|
+
if (!cancelled) {
|
|
4593
|
+
setLoading(false);
|
|
4594
|
+
}
|
|
4570
4595
|
}
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4596
|
+
};
|
|
4597
|
+
void run();
|
|
4598
|
+
return () => {
|
|
4599
|
+
cancelled = true;
|
|
4600
|
+
};
|
|
4601
|
+
}, [apiURL]);
|
|
4602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4579
4603
|
AdminPage,
|
|
4580
4604
|
{
|
|
4605
|
+
actions: hasAdminAccess2(user) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_link2.default, { className: "orion-admin-action-button", href: newPagePath, children: "New Page" }) : null,
|
|
4581
4606
|
breadcrumbs: [
|
|
4582
4607
|
{ label: "Dashboard", href: adminBasePath },
|
|
4583
|
-
{ label: "Pages"
|
|
4584
|
-
{ label: "New Page" }
|
|
4608
|
+
{ label: "Pages" }
|
|
4585
4609
|
],
|
|
4586
|
-
description: "
|
|
4587
|
-
title: "
|
|
4588
|
-
children:
|
|
4610
|
+
description: "Open a page to edit it in the inline custom builder.",
|
|
4611
|
+
title: "Pages",
|
|
4612
|
+
children: [
|
|
4613
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
4589
4614
|
error ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "orion-admin-error", children: error }) : null,
|
|
4590
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("
|
|
4591
|
-
"
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { disabled: submitting, type: "submit", children: submitting ? "Creating..." : "Create Page" })
|
|
4608
|
-
] })
|
|
4615
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "orion-admin-list", children: [
|
|
4616
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "orion-admin-card", children: [
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("strong", { children: "No pages yet" }),
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Create the first page to start building content." })
|
|
4619
|
+
] }) : null,
|
|
4620
|
+
docs.map((doc) => {
|
|
4621
|
+
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
4622
|
+
if (!id) return null;
|
|
4623
|
+
const title = typeof doc.title === "string" ? doc.title : "Untitled Page";
|
|
4624
|
+
const status = typeof doc._status === "string" ? doc._status : "draft";
|
|
4625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_link2.default, { className: "orion-admin-list-item", href: resolveAdminPath(adminBasePath, `/pages/${id}`), children: [
|
|
4626
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("strong", { children: title }) }),
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "orion-admin-pill", children: status })
|
|
4628
|
+
] }, id);
|
|
4629
|
+
})
|
|
4630
|
+
] })
|
|
4631
|
+
]
|
|
4609
4632
|
}
|
|
4610
4633
|
) });
|
|
4611
4634
|
}
|