@orion-studios/payload-studio 0.5.0-beta.113 → 0.5.0-beta.114
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 +1915 -490
- package/dist/admin/client.mjs +1327 -445
- package/dist/admin/index.d.mts +2 -1
- package/dist/admin/index.d.ts +2 -1
- package/dist/admin/index.js +253 -50
- package/dist/admin/index.mjs +1 -1
- package/dist/admin-app/client.d.mts +1 -0
- package/dist/admin-app/client.d.ts +1 -0
- package/dist/admin-app/client.js +266 -105
- package/dist/admin-app/client.mjs +105 -456
- package/dist/admin-app/index.d.mts +2 -1
- package/dist/admin-app/index.d.ts +2 -1
- package/dist/admin-app/styles.css +351 -0
- package/dist/admin.css +9 -0
- package/dist/{chunk-DAIZDGHL.mjs → chunk-4YPHQYRR.mjs} +253 -50
- package/dist/chunk-6NE7GIVT.mjs +555 -0
- package/dist/{chunk-3T2P6SDM.mjs → chunk-XKUTZ7IU.mjs} +215 -6
- package/dist/{index-DUi_XND6.d.ts → index-Crx_MtPw.d.ts} +33 -3
- package/dist/{index-gLl_358v.d.mts → index-Cv-6qnrw.d.mts} +33 -3
- package/dist/index-D5yjivF7.d.ts +382 -0
- package/dist/index-DH9KGEZ8.d.mts +382 -0
- package/dist/{index-BzKOThsI.d.mts → index-DWmudwDm.d.mts} +1 -1
- package/dist/{index-BzKOThsI.d.ts → index-DWmudwDm.d.ts} +1 -1
- package/dist/{index-7lxTrxSG.d.mts → index-c5-qTRbH.d.mts} +7 -1
- package/dist/{index-7lxTrxSG.d.ts → index-yfpxsgUu.d.ts} +7 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +459 -56
- package/dist/index.mjs +9 -9
- package/dist/nextjs/index.mjs +2 -2
- package/dist/sitePreviewTypes-BECnq9xI.d.mts +41 -0
- package/dist/sitePreviewTypes-BECnq9xI.d.ts +41 -0
- package/dist/studio/index.d.mts +1 -1
- package/dist/studio/index.d.ts +1 -1
- package/dist/studio-pages/index.d.mts +3 -3
- package/dist/studio-pages/index.d.ts +3 -3
- package/dist/studio-pages/index.js +330 -7
- package/dist/studio-pages/index.mjs +10 -3
- package/package.json +1 -1
- package/dist/index-B7QvY3yF.d.mts +0 -245
- package/dist/index-BK03FiEM.d.ts +0 -245
- package/dist/{chunk-BET2YLAS.mjs → chunk-OTHERBGX.mjs} +3 -3
package/dist/admin/client.mjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
"use client";
|
|
3
|
+
import {
|
|
4
|
+
HeaderNavEditorWithPreview,
|
|
5
|
+
SiteFooterPreview,
|
|
6
|
+
buildAdminPageLinkOptions
|
|
7
|
+
} from "../chunk-6NE7GIVT.mjs";
|
|
3
8
|
import {
|
|
4
9
|
BlockPicker,
|
|
5
10
|
SectionTabs
|
|
@@ -1189,10 +1194,10 @@ var detectAdminBasePath = (pathname, fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
|
1189
1194
|
const normalizedPathname = normalizePath(pathname);
|
|
1190
1195
|
const normalizedFallback = normalizeAdminBasePath(fallback);
|
|
1191
1196
|
const markers = [
|
|
1192
|
-
"/
|
|
1193
|
-
"/studio-globals",
|
|
1197
|
+
"/contact-form",
|
|
1194
1198
|
"/collections/",
|
|
1195
1199
|
"/globals/",
|
|
1200
|
+
"/forms",
|
|
1196
1201
|
"/pages/",
|
|
1197
1202
|
"/tools",
|
|
1198
1203
|
"/media",
|
|
@@ -1247,109 +1252,66 @@ var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
|
1247
1252
|
return adminBasePath;
|
|
1248
1253
|
};
|
|
1249
1254
|
|
|
1250
|
-
// src/admin/components/studio/
|
|
1251
|
-
import {
|
|
1252
|
-
var cardStyle = {
|
|
1253
|
-
background: "var(--theme-elevation-0)",
|
|
1254
|
-
border: "1px solid var(--theme-elevation-150)",
|
|
1255
|
-
borderRadius: 16,
|
|
1256
|
-
color: "inherit",
|
|
1257
|
-
padding: "1rem",
|
|
1258
|
-
textDecoration: "none"
|
|
1259
|
-
};
|
|
1260
|
-
var getPropString = (props, key, fallback) => {
|
|
1261
|
-
if (!props || typeof props !== "object") return fallback;
|
|
1262
|
-
const direct = props[key];
|
|
1263
|
-
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
1264
|
-
const clientProps = props.clientProps;
|
|
1265
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1266
|
-
const nested = clientProps[key];
|
|
1267
|
-
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
1268
|
-
}
|
|
1269
|
-
return fallback;
|
|
1270
|
-
};
|
|
1271
|
-
var getPropBoolean = (props, key, fallback) => {
|
|
1272
|
-
if (!props || typeof props !== "object") return fallback;
|
|
1273
|
-
const direct = props[key];
|
|
1274
|
-
if (typeof direct === "boolean") return direct;
|
|
1275
|
-
const clientProps = props.clientProps;
|
|
1276
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1277
|
-
const nested = clientProps[key];
|
|
1278
|
-
if (typeof nested === "boolean") return nested;
|
|
1279
|
-
}
|
|
1280
|
-
return fallback;
|
|
1281
|
-
};
|
|
1282
|
-
var getPropSections = (props, key) => {
|
|
1283
|
-
if (!props || typeof props !== "object") return [];
|
|
1284
|
-
const direct = resolveStudioSections(props[key]);
|
|
1285
|
-
if (direct.length > 0) return direct;
|
|
1286
|
-
const clientProps = props.clientProps;
|
|
1287
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1288
|
-
return resolveStudioSections(clientProps[key]);
|
|
1289
|
-
}
|
|
1290
|
-
return [];
|
|
1291
|
-
};
|
|
1292
|
-
function AdminStudioDashboard(props) {
|
|
1293
|
-
const formsEnabled = getPropBoolean(props, "formsEnabled", false);
|
|
1294
|
-
const pagesCollectionSlug = getPropString(props, "pagesCollectionSlug", "pages");
|
|
1295
|
-
const mediaCollectionSlug = getPropString(props, "mediaCollectionSlug", "media");
|
|
1296
|
-
const globalsBasePath = getPropString(props, "globalsBasePath", "/studio-globals");
|
|
1297
|
-
const sections = getPropSections(props, "sections");
|
|
1298
|
-
const adminBasePath = useAdminBasePath();
|
|
1299
|
-
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
1300
|
-
const formsPath = resolveAdminPath(adminBasePath, "/studio-forms");
|
|
1301
|
-
const pagesPath = resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`);
|
|
1302
|
-
const mediaPath = resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`);
|
|
1303
|
-
const extensionCards = sections.filter((section) => section.card).map((section) => ({
|
|
1304
|
-
href: resolveAdminPath(adminBasePath, section.href),
|
|
1305
|
-
title: section.card?.title || section.label,
|
|
1306
|
-
description: section.card?.description || ""
|
|
1307
|
-
}));
|
|
1308
|
-
return /* @__PURE__ */ jsxs9("div", { style: { padding: "1.2rem 1.2rem 2.5rem" }, children: [
|
|
1309
|
-
/* @__PURE__ */ jsx10(SetStepNav, { nav: [{ label: "Dashboard", url: adminBasePath }] }),
|
|
1310
|
-
/* @__PURE__ */ jsx10("h1", { style: { fontSize: "1.6rem", margin: 0 }, children: "Studio" }),
|
|
1311
|
-
/* @__PURE__ */ jsx10("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Pick what you want to edit." }),
|
|
1312
|
-
/* @__PURE__ */ jsxs9(
|
|
1313
|
-
"div",
|
|
1314
|
-
{
|
|
1315
|
-
style: {
|
|
1316
|
-
display: "grid",
|
|
1317
|
-
gap: "0.85rem",
|
|
1318
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
|
|
1319
|
-
marginTop: "1.1rem"
|
|
1320
|
-
},
|
|
1321
|
-
children: [
|
|
1322
|
-
/* @__PURE__ */ jsxs9("a", { href: pagesPath, style: cardStyle, children: [
|
|
1323
|
-
/* @__PURE__ */ jsx10("div", { style: { fontWeight: 900 }, children: "Pages" }),
|
|
1324
|
-
/* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Edit your site pages with the custom editor." })
|
|
1325
|
-
] }),
|
|
1326
|
-
formsEnabled ? /* @__PURE__ */ jsxs9("a", { href: formsPath, style: cardStyle, children: [
|
|
1327
|
-
/* @__PURE__ */ jsx10("div", { style: { fontWeight: 900 }, children: "Forms" }),
|
|
1328
|
-
/* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Review forms, submissions, and uploaded files." })
|
|
1329
|
-
] }) : null,
|
|
1330
|
-
/* @__PURE__ */ jsxs9("a", { href: resolvedGlobalsBasePath, style: cardStyle, children: [
|
|
1331
|
-
/* @__PURE__ */ jsx10("div", { style: { fontWeight: 900 }, children: "Globals" }),
|
|
1332
|
-
/* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Site settings, header, footer." })
|
|
1333
|
-
] }),
|
|
1334
|
-
/* @__PURE__ */ jsxs9("a", { href: mediaPath, style: cardStyle, children: [
|
|
1335
|
-
/* @__PURE__ */ jsx10("div", { style: { fontWeight: 900 }, children: "Media" }),
|
|
1336
|
-
/* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Upload and manage images and files." })
|
|
1337
|
-
] }),
|
|
1338
|
-
extensionCards.map((card) => /* @__PURE__ */ jsxs9("a", { href: card.href, style: cardStyle, children: [
|
|
1339
|
-
/* @__PURE__ */ jsx10("div", { style: { fontWeight: 900 }, children: card.title }),
|
|
1340
|
-
/* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: card.description })
|
|
1341
|
-
] }, card.href))
|
|
1342
|
-
]
|
|
1343
|
-
}
|
|
1344
|
-
)
|
|
1345
|
-
] });
|
|
1346
|
-
}
|
|
1255
|
+
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
1256
|
+
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
1347
1257
|
|
|
1348
1258
|
// src/admin/components/studio/AdminStudioNav.tsx
|
|
1349
1259
|
import { useEffect as useEffect7, useMemo, useState as useState6 } from "react";
|
|
1350
1260
|
import { Logout, useAuth } from "@payloadcms/ui";
|
|
1351
|
-
import { Fragment as Fragment2, jsx as
|
|
1352
|
-
var
|
|
1261
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1262
|
+
var iconSize2 = 18;
|
|
1263
|
+
function NavIcon({ sectionID }) {
|
|
1264
|
+
const props = {
|
|
1265
|
+
fill: "none",
|
|
1266
|
+
height: iconSize2,
|
|
1267
|
+
stroke: "currentColor",
|
|
1268
|
+
strokeLinecap: "round",
|
|
1269
|
+
strokeLinejoin: "round",
|
|
1270
|
+
strokeWidth: 2,
|
|
1271
|
+
viewBox: "0 0 24 24",
|
|
1272
|
+
width: iconSize2
|
|
1273
|
+
};
|
|
1274
|
+
switch (sectionID) {
|
|
1275
|
+
case "dashboard":
|
|
1276
|
+
return /* @__PURE__ */ jsxs9("svg", { ...props, children: [
|
|
1277
|
+
/* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "7", height: "9", rx: "1" }),
|
|
1278
|
+
/* @__PURE__ */ jsx10("rect", { x: "14", y: "3", width: "7", height: "5", rx: "1" }),
|
|
1279
|
+
/* @__PURE__ */ jsx10("rect", { x: "14", y: "12", width: "7", height: "9", rx: "1" }),
|
|
1280
|
+
/* @__PURE__ */ jsx10("rect", { x: "3", y: "16", width: "7", height: "5", rx: "1" })
|
|
1281
|
+
] });
|
|
1282
|
+
case "pages":
|
|
1283
|
+
return /* @__PURE__ */ jsxs9("svg", { ...props, children: [
|
|
1284
|
+
/* @__PURE__ */ jsx10("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
|
|
1285
|
+
/* @__PURE__ */ jsx10("polyline", { points: "14 2 14 8 20 8" }),
|
|
1286
|
+
/* @__PURE__ */ jsx10("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
|
|
1287
|
+
/* @__PURE__ */ jsx10("line", { x1: "8", y1: "17", x2: "12", y2: "17" })
|
|
1288
|
+
] });
|
|
1289
|
+
case "forms":
|
|
1290
|
+
return /* @__PURE__ */ jsxs9("svg", { ...props, children: [
|
|
1291
|
+
/* @__PURE__ */ jsx10("path", { d: "M9 3h6" }),
|
|
1292
|
+
/* @__PURE__ */ jsx10("path", { d: "M12 3v18" }),
|
|
1293
|
+
/* @__PURE__ */ jsx10("path", { d: "M5 7h14a2 2 0 0 1 2 2v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a2 2 0 0 1 2-2Z" }),
|
|
1294
|
+
/* @__PURE__ */ jsx10("path", { d: "M7 11h10" }),
|
|
1295
|
+
/* @__PURE__ */ jsx10("path", { d: "M7 15h6" })
|
|
1296
|
+
] });
|
|
1297
|
+
case "globals":
|
|
1298
|
+
return /* @__PURE__ */ jsxs9("svg", { ...props, children: [
|
|
1299
|
+
/* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "3" }),
|
|
1300
|
+
/* @__PURE__ */ jsx10("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z" })
|
|
1301
|
+
] });
|
|
1302
|
+
case "media":
|
|
1303
|
+
return /* @__PURE__ */ jsxs9("svg", { ...props, children: [
|
|
1304
|
+
/* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
1305
|
+
/* @__PURE__ */ jsx10("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
1306
|
+
/* @__PURE__ */ jsx10("polyline", { points: "21 15 16 10 5 21" })
|
|
1307
|
+
] });
|
|
1308
|
+
case "admin-tools":
|
|
1309
|
+
return /* @__PURE__ */ jsx10("svg", { ...props, children: /* @__PURE__ */ jsx10("path", { d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76Z" }) });
|
|
1310
|
+
default:
|
|
1311
|
+
return null;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
var getPropString = (props, key, fallback) => {
|
|
1353
1315
|
if (!props || typeof props !== "object") return fallback;
|
|
1354
1316
|
const direct = props[key];
|
|
1355
1317
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -1360,7 +1322,7 @@ var getPropString2 = (props, key, fallback) => {
|
|
|
1360
1322
|
}
|
|
1361
1323
|
return fallback;
|
|
1362
1324
|
};
|
|
1363
|
-
var
|
|
1325
|
+
var getPropBoolean = (props, key, fallback) => {
|
|
1364
1326
|
if (!props || typeof props !== "object") return fallback;
|
|
1365
1327
|
const direct = props[key];
|
|
1366
1328
|
if (typeof direct === "boolean") return direct;
|
|
@@ -1383,7 +1345,7 @@ var getPropStringArray = (props, key, fallback) => {
|
|
|
1383
1345
|
}
|
|
1384
1346
|
return fallback;
|
|
1385
1347
|
};
|
|
1386
|
-
var
|
|
1348
|
+
var getPropSections = (props, key) => {
|
|
1387
1349
|
if (!props || typeof props !== "object") return [];
|
|
1388
1350
|
const direct = resolveStudioSections(props[key]);
|
|
1389
1351
|
if (direct.length > 0) return direct;
|
|
@@ -1411,16 +1373,21 @@ var readUserRole = (user) => {
|
|
|
1411
1373
|
};
|
|
1412
1374
|
function AdminStudioNav(props) {
|
|
1413
1375
|
const { user } = useAuth();
|
|
1414
|
-
const brandName =
|
|
1415
|
-
const logoUrl =
|
|
1416
|
-
const formsEnabled =
|
|
1417
|
-
const formsCollectionSlug =
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
|
|
1376
|
+
const brandName = getPropString(props, "brandName", "Orion Studio");
|
|
1377
|
+
const logoUrl = getPropString(props, "logoUrl", "");
|
|
1378
|
+
const formsEnabled = getPropBoolean(props, "formsEnabled", false);
|
|
1379
|
+
const formsCollectionSlug = getPropString(props, "formsCollectionSlug", "forms");
|
|
1380
|
+
const formSubmissionsCollectionSlug = getPropString(
|
|
1381
|
+
props,
|
|
1382
|
+
"formSubmissionsCollectionSlug",
|
|
1383
|
+
"form-submissions"
|
|
1384
|
+
);
|
|
1385
|
+
const formUploadsCollectionSlug = getPropString(props, "formUploadsCollectionSlug", "form-uploads");
|
|
1386
|
+
const mediaCollectionSlug = getPropString(props, "mediaCollectionSlug", "media");
|
|
1387
|
+
const globalsBasePath = getPropString(props, "globalsBasePath", "/globals");
|
|
1421
1388
|
const globalsExtraMatchPrefixes = getPropStringArray(props, "globalsExtraMatchPrefixes", []);
|
|
1422
|
-
const sections =
|
|
1423
|
-
const compact =
|
|
1389
|
+
const sections = getPropSections(props, "sections");
|
|
1390
|
+
const compact = getPropBoolean(props, "compact", false);
|
|
1424
1391
|
const adminBasePath = useAdminBasePath();
|
|
1425
1392
|
const branding = useSiteBranding(brandName, logoUrl || void 0);
|
|
1426
1393
|
const resolvedName = branding.siteName || brandName;
|
|
@@ -1431,10 +1398,10 @@ function AdminStudioNav(props) {
|
|
|
1431
1398
|
window.addEventListener("popstate", update);
|
|
1432
1399
|
return () => window.removeEventListener("popstate", update);
|
|
1433
1400
|
}, []);
|
|
1434
|
-
const pagesPath = resolveAdminPath(adminBasePath,
|
|
1435
|
-
const formsPath = resolveAdminPath(adminBasePath, "/
|
|
1436
|
-
const mediaPath = resolveAdminPath(adminBasePath,
|
|
1437
|
-
const usersPath = resolveAdminPath(adminBasePath, "/
|
|
1401
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1402
|
+
const formsPath = resolveAdminPath(adminBasePath, "/forms");
|
|
1403
|
+
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
1404
|
+
const usersPath = resolveAdminPath(adminBasePath, "/tools");
|
|
1438
1405
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
1439
1406
|
const resolvedGlobalsExtraMatchPrefixes = globalsExtraMatchPrefixes.map(
|
|
1440
1407
|
(prefix) => resolveAdminPath(adminBasePath, prefix)
|
|
@@ -1453,7 +1420,12 @@ function AdminStudioNav(props) {
|
|
|
1453
1420
|
label: "Forms",
|
|
1454
1421
|
matchPrefixes: [
|
|
1455
1422
|
formsPath,
|
|
1456
|
-
resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`)
|
|
1423
|
+
resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`),
|
|
1424
|
+
resolveAdminPath(
|
|
1425
|
+
adminBasePath,
|
|
1426
|
+
`/collections/${formSubmissionsCollectionSlug}`
|
|
1427
|
+
),
|
|
1428
|
+
resolveAdminPath(adminBasePath, `/collections/${formUploadsCollectionSlug}`)
|
|
1457
1429
|
]
|
|
1458
1430
|
}
|
|
1459
1431
|
] : [],
|
|
@@ -1467,12 +1439,17 @@ function AdminStudioNav(props) {
|
|
|
1467
1439
|
...resolvedGlobalsExtraMatchPrefixes
|
|
1468
1440
|
]
|
|
1469
1441
|
},
|
|
1470
|
-
{
|
|
1442
|
+
{
|
|
1443
|
+
id: "media",
|
|
1444
|
+
href: mediaPath,
|
|
1445
|
+
label: "Media",
|
|
1446
|
+
matchPrefixes: [mediaPath, resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`)]
|
|
1447
|
+
},
|
|
1471
1448
|
{
|
|
1472
1449
|
id: "admin-tools",
|
|
1473
1450
|
href: usersPath,
|
|
1474
1451
|
label: "Admin Tools",
|
|
1475
|
-
matchPrefixes: [usersPath],
|
|
1452
|
+
matchPrefixes: [usersPath, resolveAdminPath(adminBasePath, "/collections/users")],
|
|
1476
1453
|
roles: ["admin"]
|
|
1477
1454
|
}
|
|
1478
1455
|
];
|
|
@@ -1489,6 +1466,8 @@ function AdminStudioNav(props) {
|
|
|
1489
1466
|
formsCollectionSlug,
|
|
1490
1467
|
formsEnabled,
|
|
1491
1468
|
formsPath,
|
|
1469
|
+
formSubmissionsCollectionSlug,
|
|
1470
|
+
formUploadsCollectionSlug,
|
|
1492
1471
|
mediaPath,
|
|
1493
1472
|
pagesPath,
|
|
1494
1473
|
resolvedGlobalsBasePath,
|
|
@@ -1510,7 +1489,7 @@ function AdminStudioNav(props) {
|
|
|
1510
1489
|
padding: compact ? "0.6rem" : "0.6rem 0.75rem",
|
|
1511
1490
|
textDecoration: "none"
|
|
1512
1491
|
});
|
|
1513
|
-
return /* @__PURE__ */
|
|
1492
|
+
return /* @__PURE__ */ jsxs9(
|
|
1514
1493
|
"div",
|
|
1515
1494
|
{
|
|
1516
1495
|
style: {
|
|
@@ -1521,8 +1500,8 @@ function AdminStudioNav(props) {
|
|
|
1521
1500
|
padding: compact ? "0.8rem 0.5rem" : "1rem 0.85rem"
|
|
1522
1501
|
},
|
|
1523
1502
|
children: [
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
branding.logoUrl ? /* @__PURE__ */
|
|
1503
|
+
/* @__PURE__ */ jsxs9("div", { className: "admin-studio-brand", style: { padding: compact ? "0" : "0 0.35rem 0 2.4rem" }, children: [
|
|
1504
|
+
branding.logoUrl ? /* @__PURE__ */ jsx10(
|
|
1526
1505
|
"div",
|
|
1527
1506
|
{
|
|
1528
1507
|
style: {
|
|
@@ -1532,10 +1511,10 @@ function AdminStudioNav(props) {
|
|
|
1532
1511
|
overflow: "hidden",
|
|
1533
1512
|
width: compact ? 34 : 40
|
|
1534
1513
|
},
|
|
1535
|
-
children: /* @__PURE__ */
|
|
1514
|
+
children: /* @__PURE__ */ jsx10("img", { alt: `${resolvedName} logo`, src: branding.logoUrl, style: { height: "100%", objectFit: "cover", width: "100%" } })
|
|
1536
1515
|
}
|
|
1537
1516
|
) : null,
|
|
1538
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ jsx10(
|
|
1539
1518
|
"div",
|
|
1540
1519
|
{
|
|
1541
1520
|
style: {
|
|
@@ -1550,14 +1529,23 @@ function AdminStudioNav(props) {
|
|
|
1550
1529
|
children: compact ? resolvedName.slice(0, 1).toUpperCase() : resolvedName
|
|
1551
1530
|
}
|
|
1552
1531
|
),
|
|
1553
|
-
!compact ? /* @__PURE__ */
|
|
1532
|
+
!compact ? /* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.85rem" }, children: "Studio" }) : null
|
|
1554
1533
|
] }),
|
|
1555
|
-
/* @__PURE__ */
|
|
1534
|
+
/* @__PURE__ */ jsx10("nav", { style: { display: "grid", gap: "0.25rem" }, children: links.filter((link) => roleCanAccessSection(userRole, link)).map((link) => {
|
|
1556
1535
|
const active = link.href === dashboardPath ? pathname === dashboardPath : link.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
1557
|
-
return /* @__PURE__ */
|
|
1536
|
+
return /* @__PURE__ */ jsx10("a", { href: link.href, style: linkStyle(active), title: link.label, children: (() => {
|
|
1537
|
+
const icon = /* @__PURE__ */ jsx10(NavIcon, { sectionID: link.id });
|
|
1538
|
+
if (compact) {
|
|
1539
|
+
return icon || link.label.slice(0, 1);
|
|
1540
|
+
}
|
|
1541
|
+
return /* @__PURE__ */ jsxs9("span", { style: { alignItems: "center", display: "inline-flex", gap: "0.6rem" }, children: [
|
|
1542
|
+
icon,
|
|
1543
|
+
/* @__PURE__ */ jsx10("span", { children: link.label })
|
|
1544
|
+
] });
|
|
1545
|
+
})() }, link.href);
|
|
1558
1546
|
}) }),
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1547
|
+
/* @__PURE__ */ jsx10("div", { style: { flex: 1 } }),
|
|
1548
|
+
/* @__PURE__ */ jsxs9(
|
|
1561
1549
|
"div",
|
|
1562
1550
|
{
|
|
1563
1551
|
style: {
|
|
@@ -1566,11 +1554,11 @@ function AdminStudioNav(props) {
|
|
|
1566
1554
|
textAlign: compact ? "center" : "left"
|
|
1567
1555
|
},
|
|
1568
1556
|
children: [
|
|
1569
|
-
!compact ? /* @__PURE__ */
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1557
|
+
!compact ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
1558
|
+
/* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-700)", fontSize: "0.85rem" }, children: "Signed in as" }),
|
|
1559
|
+
/* @__PURE__ */ jsx10("div", { style: { fontWeight: 800, marginBottom: "0.55rem" }, children: typeof user?.email === "string" ? user.email : "User" })
|
|
1572
1560
|
] }) : null,
|
|
1573
|
-
/* @__PURE__ */
|
|
1561
|
+
/* @__PURE__ */ jsx10(Logout, {})
|
|
1574
1562
|
]
|
|
1575
1563
|
}
|
|
1576
1564
|
)
|
|
@@ -1579,10 +1567,171 @@ function AdminStudioNav(props) {
|
|
|
1579
1567
|
);
|
|
1580
1568
|
}
|
|
1581
1569
|
|
|
1570
|
+
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
1571
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1572
|
+
var STORAGE_KEY2 = "orion-studio-sidebar-collapsed";
|
|
1573
|
+
var ACTIVE_CLASS = "orion-studio-shell-active";
|
|
1574
|
+
function StudioSectionLayout({ children, navProps }) {
|
|
1575
|
+
const [collapsed, setCollapsed] = useState7(false);
|
|
1576
|
+
useEffect8(() => {
|
|
1577
|
+
try {
|
|
1578
|
+
const stored = window.localStorage.getItem(STORAGE_KEY2);
|
|
1579
|
+
if (stored === "1") {
|
|
1580
|
+
setCollapsed(true);
|
|
1581
|
+
}
|
|
1582
|
+
} catch {
|
|
1583
|
+
}
|
|
1584
|
+
}, []);
|
|
1585
|
+
useEffect8(() => {
|
|
1586
|
+
document.body.classList.add(ACTIVE_CLASS);
|
|
1587
|
+
return () => {
|
|
1588
|
+
document.body.classList.remove(ACTIVE_CLASS);
|
|
1589
|
+
};
|
|
1590
|
+
}, []);
|
|
1591
|
+
const toggle = () => {
|
|
1592
|
+
setCollapsed((prev) => {
|
|
1593
|
+
const next = !prev;
|
|
1594
|
+
try {
|
|
1595
|
+
window.localStorage.setItem(STORAGE_KEY2, next ? "1" : "0");
|
|
1596
|
+
} catch {
|
|
1597
|
+
}
|
|
1598
|
+
return next;
|
|
1599
|
+
});
|
|
1600
|
+
};
|
|
1601
|
+
return /* @__PURE__ */ jsxs10(
|
|
1602
|
+
"div",
|
|
1603
|
+
{
|
|
1604
|
+
className: `orion-studio-shell ${collapsed ? "is-collapsed" : ""}`,
|
|
1605
|
+
style: {
|
|
1606
|
+
display: "grid",
|
|
1607
|
+
gridTemplateColumns: collapsed ? "84px minmax(0, 1fr)" : "260px minmax(0, 1fr)",
|
|
1608
|
+
minHeight: "100vh"
|
|
1609
|
+
},
|
|
1610
|
+
children: [
|
|
1611
|
+
/* @__PURE__ */ jsxs10("aside", { className: "orion-studio-sidebar", children: [
|
|
1612
|
+
/* @__PURE__ */ jsx11(
|
|
1613
|
+
"button",
|
|
1614
|
+
{
|
|
1615
|
+
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
1616
|
+
className: "orion-studio-sidebar-toggle",
|
|
1617
|
+
onClick: toggle,
|
|
1618
|
+
type: "button",
|
|
1619
|
+
children: collapsed ? ">" : "<"
|
|
1620
|
+
}
|
|
1621
|
+
),
|
|
1622
|
+
/* @__PURE__ */ jsx11("div", { className: "orion-studio-sidebar-scroll", children: /* @__PURE__ */ jsx11(AdminStudioNav, { ...navProps, compact: collapsed }) })
|
|
1623
|
+
] }),
|
|
1624
|
+
/* @__PURE__ */ jsx11("main", { className: "orion-studio-main", children })
|
|
1625
|
+
]
|
|
1626
|
+
}
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
1631
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1632
|
+
var cardStyle = {
|
|
1633
|
+
background: "var(--theme-elevation-0)",
|
|
1634
|
+
border: "1px solid var(--theme-elevation-150)",
|
|
1635
|
+
borderRadius: 16,
|
|
1636
|
+
color: "inherit",
|
|
1637
|
+
padding: "1rem",
|
|
1638
|
+
textDecoration: "none"
|
|
1639
|
+
};
|
|
1640
|
+
var getPropString2 = (props, key, fallback) => {
|
|
1641
|
+
if (!props || typeof props !== "object") return fallback;
|
|
1642
|
+
const direct = props[key];
|
|
1643
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
1644
|
+
const clientProps = props.clientProps;
|
|
1645
|
+
if (clientProps && typeof clientProps === "object") {
|
|
1646
|
+
const nested = clientProps[key];
|
|
1647
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
1648
|
+
}
|
|
1649
|
+
return fallback;
|
|
1650
|
+
};
|
|
1651
|
+
var getPropBoolean2 = (props, key, fallback) => {
|
|
1652
|
+
if (!props || typeof props !== "object") return fallback;
|
|
1653
|
+
const direct = props[key];
|
|
1654
|
+
if (typeof direct === "boolean") return direct;
|
|
1655
|
+
const clientProps = props.clientProps;
|
|
1656
|
+
if (clientProps && typeof clientProps === "object") {
|
|
1657
|
+
const nested = clientProps[key];
|
|
1658
|
+
if (typeof nested === "boolean") return nested;
|
|
1659
|
+
}
|
|
1660
|
+
return fallback;
|
|
1661
|
+
};
|
|
1662
|
+
var getPropSections2 = (props, key) => {
|
|
1663
|
+
if (!props || typeof props !== "object") return [];
|
|
1664
|
+
const direct = resolveStudioSections(props[key]);
|
|
1665
|
+
if (direct.length > 0) return direct;
|
|
1666
|
+
const clientProps = props.clientProps;
|
|
1667
|
+
if (clientProps && typeof clientProps === "object") {
|
|
1668
|
+
return resolveStudioSections(clientProps[key]);
|
|
1669
|
+
}
|
|
1670
|
+
return [];
|
|
1671
|
+
};
|
|
1672
|
+
function AdminStudioDashboard(props) {
|
|
1673
|
+
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
1674
|
+
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
1675
|
+
const sections = getPropSections2(props, "sections");
|
|
1676
|
+
const adminBasePath = useAdminBasePath();
|
|
1677
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
1678
|
+
const formsPath = resolveAdminPath(adminBasePath, "/forms");
|
|
1679
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1680
|
+
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
1681
|
+
const toolsPath = resolveAdminPath(adminBasePath, "/tools");
|
|
1682
|
+
const extensionCards = sections.filter((section) => section.card).map((section) => ({
|
|
1683
|
+
href: resolveAdminPath(adminBasePath, section.href),
|
|
1684
|
+
title: section.card?.title || section.label,
|
|
1685
|
+
description: section.card?.description || ""
|
|
1686
|
+
}));
|
|
1687
|
+
return /* @__PURE__ */ jsx12(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs11("div", { style: { paddingBottom: "1.3rem" }, children: [
|
|
1688
|
+
/* @__PURE__ */ jsx12(SetStepNav, { nav: [{ label: "Dashboard", url: adminBasePath }] }),
|
|
1689
|
+
/* @__PURE__ */ jsx12("h1", { style: { fontSize: "1.6rem", margin: 0 }, children: "Studio" }),
|
|
1690
|
+
/* @__PURE__ */ jsx12("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Pick what you want to edit." }),
|
|
1691
|
+
/* @__PURE__ */ jsxs11(
|
|
1692
|
+
"div",
|
|
1693
|
+
{
|
|
1694
|
+
style: {
|
|
1695
|
+
display: "grid",
|
|
1696
|
+
gap: "0.85rem",
|
|
1697
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
|
|
1698
|
+
marginTop: "1.1rem"
|
|
1699
|
+
},
|
|
1700
|
+
children: [
|
|
1701
|
+
/* @__PURE__ */ jsxs11("a", { href: pagesPath, style: cardStyle, children: [
|
|
1702
|
+
/* @__PURE__ */ jsx12("div", { style: { fontWeight: 900 }, children: "Pages" }),
|
|
1703
|
+
/* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Edit your site pages with the custom editor." })
|
|
1704
|
+
] }),
|
|
1705
|
+
formsEnabled ? /* @__PURE__ */ jsxs11("a", { href: formsPath, style: cardStyle, children: [
|
|
1706
|
+
/* @__PURE__ */ jsx12("div", { style: { fontWeight: 900 }, children: "Forms" }),
|
|
1707
|
+
/* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Review forms, submissions, and uploaded files." })
|
|
1708
|
+
] }) : null,
|
|
1709
|
+
/* @__PURE__ */ jsxs11("a", { href: resolvedGlobalsBasePath, style: cardStyle, children: [
|
|
1710
|
+
/* @__PURE__ */ jsx12("div", { style: { fontWeight: 900 }, children: "Globals" }),
|
|
1711
|
+
/* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Site settings, header, footer." })
|
|
1712
|
+
] }),
|
|
1713
|
+
/* @__PURE__ */ jsxs11("a", { href: mediaPath, style: cardStyle, children: [
|
|
1714
|
+
/* @__PURE__ */ jsx12("div", { style: { fontWeight: 900 }, children: "Media" }),
|
|
1715
|
+
/* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Upload and manage images and files." })
|
|
1716
|
+
] }),
|
|
1717
|
+
/* @__PURE__ */ jsxs11("a", { href: toolsPath, style: cardStyle, children: [
|
|
1718
|
+
/* @__PURE__ */ jsx12("div", { style: { fontWeight: 900 }, children: "Admin Tools" }),
|
|
1719
|
+
/* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Open admin-only fallback links and user management." })
|
|
1720
|
+
] }),
|
|
1721
|
+
extensionCards.map((card) => /* @__PURE__ */ jsxs11("a", { href: card.href, style: cardStyle, children: [
|
|
1722
|
+
/* @__PURE__ */ jsx12("div", { style: { fontWeight: 900 }, children: card.title }),
|
|
1723
|
+
/* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: card.description })
|
|
1724
|
+
] }, card.href))
|
|
1725
|
+
]
|
|
1726
|
+
}
|
|
1727
|
+
)
|
|
1728
|
+
] }) });
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1582
1731
|
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
1583
|
-
import { useEffect as
|
|
1732
|
+
import { useEffect as useEffect9, useMemo as useMemo2, useState as useState8 } from "react";
|
|
1584
1733
|
import { SetStepNav as SetStepNav2, useAuth as useAuth2 } from "@payloadcms/ui";
|
|
1585
|
-
import { Fragment as Fragment3, jsx as
|
|
1734
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1586
1735
|
var isAdmin = (user) => {
|
|
1587
1736
|
if (!user || typeof user !== "object") return false;
|
|
1588
1737
|
const role = user.role;
|
|
@@ -1605,9 +1754,9 @@ function AdminStudioPagesListView(props) {
|
|
|
1605
1754
|
const adminBasePath = useAdminBasePath();
|
|
1606
1755
|
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1607
1756
|
const rawPagesCollectionPath = resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`);
|
|
1608
|
-
const [loading, setLoading] =
|
|
1609
|
-
const [error, setError] =
|
|
1610
|
-
const [docs, setDocs] =
|
|
1757
|
+
const [loading, setLoading] = useState8(true);
|
|
1758
|
+
const [error, setError] = useState8(null);
|
|
1759
|
+
const [docs, setDocs] = useState8([]);
|
|
1611
1760
|
const apiURL = useMemo2(() => {
|
|
1612
1761
|
const params = new URLSearchParams({
|
|
1613
1762
|
depth: "0",
|
|
@@ -1617,7 +1766,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1617
1766
|
});
|
|
1618
1767
|
return `/api/${pagesCollectionSlug}?${params.toString()}`;
|
|
1619
1768
|
}, [pagesCollectionSlug]);
|
|
1620
|
-
|
|
1769
|
+
useEffect9(() => {
|
|
1621
1770
|
let cancelled = false;
|
|
1622
1771
|
const run = async () => {
|
|
1623
1772
|
setLoading(true);
|
|
@@ -1642,14 +1791,14 @@ function AdminStudioPagesListView(props) {
|
|
|
1642
1791
|
cancelled = true;
|
|
1643
1792
|
};
|
|
1644
1793
|
}, [apiURL]);
|
|
1645
|
-
return /* @__PURE__ */
|
|
1646
|
-
/* @__PURE__ */
|
|
1647
|
-
/* @__PURE__ */
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
/* @__PURE__ */
|
|
1794
|
+
return /* @__PURE__ */ jsx13(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
1795
|
+
/* @__PURE__ */ jsx13(SetStepNav2, { nav: [{ label: "Pages", url: pagesPath }] }),
|
|
1796
|
+
/* @__PURE__ */ jsxs12("div", { style: { alignItems: "flex-end", display: "flex", gap: "0.75rem" }, children: [
|
|
1797
|
+
/* @__PURE__ */ jsxs12("div", { style: { flex: 1 }, children: [
|
|
1798
|
+
/* @__PURE__ */ jsx13("h1", { style: { margin: 0 }, children: "Pages" }),
|
|
1799
|
+
/* @__PURE__ */ jsx13("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Open a page to edit it in the custom editor." })
|
|
1651
1800
|
] }),
|
|
1652
|
-
isAdmin(user) ? /* @__PURE__ */
|
|
1801
|
+
isAdmin(user) ? /* @__PURE__ */ jsx13(
|
|
1653
1802
|
"a",
|
|
1654
1803
|
{
|
|
1655
1804
|
href: `${rawPagesCollectionPath}/create`,
|
|
@@ -1665,10 +1814,10 @@ function AdminStudioPagesListView(props) {
|
|
|
1665
1814
|
}
|
|
1666
1815
|
) : null
|
|
1667
1816
|
] }),
|
|
1668
|
-
loading ? /* @__PURE__ */
|
|
1669
|
-
error ? /* @__PURE__ */
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */
|
|
1817
|
+
loading ? /* @__PURE__ */ jsx13("div", { style: { color: "var(--theme-elevation-600)", marginTop: "1rem" }, children: "Loading..." }) : null,
|
|
1818
|
+
error ? /* @__PURE__ */ jsx13("div", { style: { color: "crimson", marginTop: "1rem" }, children: error }) : null,
|
|
1819
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: [
|
|
1820
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ jsx13(
|
|
1672
1821
|
"div",
|
|
1673
1822
|
{
|
|
1674
1823
|
style: {
|
|
@@ -1686,7 +1835,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1686
1835
|
const path = typeof doc.path === "string" ? doc.path : "/";
|
|
1687
1836
|
const status = typeof doc._status === "string" ? doc._status : "";
|
|
1688
1837
|
if (!id) return null;
|
|
1689
|
-
return /* @__PURE__ */
|
|
1838
|
+
return /* @__PURE__ */ jsxs12(
|
|
1690
1839
|
"a",
|
|
1691
1840
|
{
|
|
1692
1841
|
href: resolveAdminPath(adminBasePath, `/pages/${id}`),
|
|
@@ -1702,9 +1851,9 @@ function AdminStudioPagesListView(props) {
|
|
|
1702
1851
|
textDecoration: "none"
|
|
1703
1852
|
},
|
|
1704
1853
|
children: [
|
|
1705
|
-
/* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ jsxs12("div", { style: { minWidth: 0 }, children: [
|
|
1855
|
+
/* @__PURE__ */ jsx13("div", { style: { fontWeight: 900, overflow: "hidden", textOverflow: "ellipsis" }, children: title }),
|
|
1856
|
+
/* @__PURE__ */ jsx13(
|
|
1708
1857
|
"div",
|
|
1709
1858
|
{
|
|
1710
1859
|
style: {
|
|
@@ -1717,7 +1866,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1717
1866
|
}
|
|
1718
1867
|
)
|
|
1719
1868
|
] }),
|
|
1720
|
-
/* @__PURE__ */
|
|
1869
|
+
/* @__PURE__ */ jsxs12(
|
|
1721
1870
|
"div",
|
|
1722
1871
|
{
|
|
1723
1872
|
style: {
|
|
@@ -1727,7 +1876,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1727
1876
|
gap: "0.5rem"
|
|
1728
1877
|
},
|
|
1729
1878
|
children: [
|
|
1730
|
-
status ? /* @__PURE__ */
|
|
1879
|
+
status ? /* @__PURE__ */ jsx13(
|
|
1731
1880
|
"span",
|
|
1732
1881
|
{
|
|
1733
1882
|
style: {
|
|
@@ -1742,7 +1891,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1742
1891
|
children: status
|
|
1743
1892
|
}
|
|
1744
1893
|
) : null,
|
|
1745
|
-
/* @__PURE__ */
|
|
1894
|
+
/* @__PURE__ */ jsx13("span", { style: { color: "var(--theme-elevation-600)", fontWeight: 800 }, children: "Open" })
|
|
1746
1895
|
]
|
|
1747
1896
|
}
|
|
1748
1897
|
)
|
|
@@ -1752,13 +1901,13 @@ function AdminStudioPagesListView(props) {
|
|
|
1752
1901
|
);
|
|
1753
1902
|
})
|
|
1754
1903
|
] })
|
|
1755
|
-
] });
|
|
1904
|
+
] }) });
|
|
1756
1905
|
}
|
|
1757
1906
|
|
|
1758
1907
|
// src/admin/components/studio/AdminStudioPageEditView.tsx
|
|
1759
|
-
import { useEffect as
|
|
1908
|
+
import { useEffect as useEffect10, useMemo as useMemo3, useRef as useRef3, useState as useState9 } from "react";
|
|
1760
1909
|
import { SetStepNav as SetStepNav3, toast, useAuth as useAuth3 } from "@payloadcms/ui";
|
|
1761
|
-
import { Fragment as Fragment4, jsx as
|
|
1910
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1762
1911
|
var isAdmin2 = (user) => {
|
|
1763
1912
|
if (!user || typeof user !== "object") return false;
|
|
1764
1913
|
const role = user.role;
|
|
@@ -1799,17 +1948,17 @@ function AdminStudioPageEditView(props) {
|
|
|
1799
1948
|
const { user } = useAuth3();
|
|
1800
1949
|
const adminBasePath = useAdminBasePath();
|
|
1801
1950
|
const iframeRef = useRef3(null);
|
|
1802
|
-
const [saving, setSaving] =
|
|
1803
|
-
const [dirty, setDirty] =
|
|
1804
|
-
const [hasUnpublishedChanges, setHasUnpublishedChanges] =
|
|
1805
|
-
const [canUndo, setCanUndo] =
|
|
1806
|
-
const [canRedo, setCanRedo] =
|
|
1951
|
+
const [saving, setSaving] = useState9(null);
|
|
1952
|
+
const [dirty, setDirty] = useState9(false);
|
|
1953
|
+
const [hasUnpublishedChanges, setHasUnpublishedChanges] = useState9(false);
|
|
1954
|
+
const [canUndo, setCanUndo] = useState9(false);
|
|
1955
|
+
const [canRedo, setCanRedo] = useState9(false);
|
|
1807
1956
|
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
1808
1957
|
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1809
1958
|
const pageIDFromParams = useMemo3(() => getParam(props.params, "id"), [props.params]);
|
|
1810
|
-
const [pageID, setPageID] =
|
|
1811
|
-
const [didResolvePathFallback, setDidResolvePathFallback] =
|
|
1812
|
-
|
|
1959
|
+
const [pageID, setPageID] = useState9(pageIDFromParams);
|
|
1960
|
+
const [didResolvePathFallback, setDidResolvePathFallback] = useState9(false);
|
|
1961
|
+
useEffect10(() => {
|
|
1813
1962
|
if (pageIDFromParams) {
|
|
1814
1963
|
setPageID(pageIDFromParams);
|
|
1815
1964
|
setDidResolvePathFallback(true);
|
|
@@ -1853,7 +2002,7 @@ function AdminStudioPageEditView(props) {
|
|
|
1853
2002
|
} catch {
|
|
1854
2003
|
}
|
|
1855
2004
|
};
|
|
1856
|
-
|
|
2005
|
+
useEffect10(() => {
|
|
1857
2006
|
if (!pageID) {
|
|
1858
2007
|
return;
|
|
1859
2008
|
}
|
|
@@ -1876,7 +2025,7 @@ function AdminStudioPageEditView(props) {
|
|
|
1876
2025
|
}
|
|
1877
2026
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
1878
2027
|
};
|
|
1879
|
-
|
|
2028
|
+
useEffect10(() => {
|
|
1880
2029
|
const onMessage = (event) => {
|
|
1881
2030
|
const data = event.data;
|
|
1882
2031
|
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
@@ -1911,8 +2060,8 @@ function AdminStudioPageEditView(props) {
|
|
|
1911
2060
|
return () => window.removeEventListener("message", onMessage);
|
|
1912
2061
|
}, []);
|
|
1913
2062
|
if (!pageID && !didResolvePathFallback) {
|
|
1914
|
-
return /* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
2063
|
+
return /* @__PURE__ */ jsx14(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2064
|
+
/* @__PURE__ */ jsx14(
|
|
1916
2065
|
SetStepNav3,
|
|
1917
2066
|
{
|
|
1918
2067
|
nav: [
|
|
@@ -1921,13 +2070,13 @@ function AdminStudioPageEditView(props) {
|
|
|
1921
2070
|
]
|
|
1922
2071
|
}
|
|
1923
2072
|
),
|
|
1924
|
-
/* @__PURE__ */
|
|
1925
|
-
/* @__PURE__ */
|
|
1926
|
-
] });
|
|
2073
|
+
/* @__PURE__ */ jsx14("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
2074
|
+
/* @__PURE__ */ jsx14("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading page editor..." })
|
|
2075
|
+
] }) });
|
|
1927
2076
|
}
|
|
1928
2077
|
if (!pageID) {
|
|
1929
|
-
return /* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
2078
|
+
return /* @__PURE__ */ jsx14(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2079
|
+
/* @__PURE__ */ jsx14(
|
|
1931
2080
|
SetStepNav3,
|
|
1932
2081
|
{
|
|
1933
2082
|
nav: [
|
|
@@ -1936,12 +2085,12 @@ function AdminStudioPageEditView(props) {
|
|
|
1936
2085
|
]
|
|
1937
2086
|
}
|
|
1938
2087
|
),
|
|
1939
|
-
/* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
] });
|
|
2088
|
+
/* @__PURE__ */ jsx14("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
2089
|
+
/* @__PURE__ */ jsx14("p", { style: { color: "var(--theme-elevation-600)" }, children: "Missing page ID." })
|
|
2090
|
+
] }) });
|
|
1942
2091
|
}
|
|
1943
|
-
return /* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
2092
|
+
return /* @__PURE__ */ jsx14(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2093
|
+
/* @__PURE__ */ jsx14(
|
|
1945
2094
|
SetStepNav3,
|
|
1946
2095
|
{
|
|
1947
2096
|
nav: [
|
|
@@ -1950,8 +2099,8 @@ function AdminStudioPageEditView(props) {
|
|
|
1950
2099
|
]
|
|
1951
2100
|
}
|
|
1952
2101
|
),
|
|
1953
|
-
/* @__PURE__ */
|
|
1954
|
-
/* @__PURE__ */
|
|
2102
|
+
/* @__PURE__ */ jsxs13("div", { style: { display: "grid", gridTemplateRows: "auto 1fr", height: "calc(100vh - 120px)" }, children: [
|
|
2103
|
+
/* @__PURE__ */ jsxs13(
|
|
1955
2104
|
"div",
|
|
1956
2105
|
{
|
|
1957
2106
|
style: {
|
|
@@ -1967,9 +2116,9 @@ function AdminStudioPageEditView(props) {
|
|
|
1967
2116
|
zIndex: 20
|
|
1968
2117
|
},
|
|
1969
2118
|
children: [
|
|
1970
|
-
/* @__PURE__ */
|
|
1971
|
-
/* @__PURE__ */
|
|
1972
|
-
/* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ jsxs13("div", { style: { minWidth: 0 }, children: [
|
|
2120
|
+
/* @__PURE__ */ jsx14("div", { style: { fontWeight: 900 }, children: "Page Editor" }),
|
|
2121
|
+
/* @__PURE__ */ jsxs13(
|
|
1973
2122
|
"div",
|
|
1974
2123
|
{
|
|
1975
2124
|
style: {
|
|
@@ -1985,9 +2134,9 @@ function AdminStudioPageEditView(props) {
|
|
|
1985
2134
|
}
|
|
1986
2135
|
)
|
|
1987
2136
|
] }),
|
|
1988
|
-
/* @__PURE__ */
|
|
1989
|
-
/* @__PURE__ */
|
|
1990
|
-
/* @__PURE__ */
|
|
2137
|
+
/* @__PURE__ */ jsxs13("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
2138
|
+
/* @__PURE__ */ jsx14("div", { style: { color: dirty ? "var(--theme-elevation-900)" : "var(--theme-elevation-600)", fontSize: "0.85rem", fontWeight: 700 }, children: dirty ? "Unsaved changes" : "All changes saved" }),
|
|
2139
|
+
/* @__PURE__ */ jsx14(
|
|
1991
2140
|
"div",
|
|
1992
2141
|
{
|
|
1993
2142
|
style: {
|
|
@@ -2004,7 +2153,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2004
2153
|
children: hasUnpublishedChanges ? "Unpublished draft changes" : "Live is up to date"
|
|
2005
2154
|
}
|
|
2006
2155
|
),
|
|
2007
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ jsx14(
|
|
2008
2157
|
"button",
|
|
2009
2158
|
{
|
|
2010
2159
|
disabled: !canUndo,
|
|
@@ -2020,7 +2169,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2020
2169
|
children: "Undo"
|
|
2021
2170
|
}
|
|
2022
2171
|
),
|
|
2023
|
-
/* @__PURE__ */
|
|
2172
|
+
/* @__PURE__ */ jsx14(
|
|
2024
2173
|
"button",
|
|
2025
2174
|
{
|
|
2026
2175
|
disabled: !canRedo,
|
|
@@ -2036,7 +2185,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2036
2185
|
children: "Redo"
|
|
2037
2186
|
}
|
|
2038
2187
|
),
|
|
2039
|
-
/* @__PURE__ */
|
|
2188
|
+
/* @__PURE__ */ jsx14(
|
|
2040
2189
|
"button",
|
|
2041
2190
|
{
|
|
2042
2191
|
disabled: saving !== null,
|
|
@@ -2052,7 +2201,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2052
2201
|
children: saving === "draft" ? "Saving\u2026" : "Save Draft"
|
|
2053
2202
|
}
|
|
2054
2203
|
),
|
|
2055
|
-
/* @__PURE__ */
|
|
2204
|
+
/* @__PURE__ */ jsx14(
|
|
2056
2205
|
"button",
|
|
2057
2206
|
{
|
|
2058
2207
|
disabled: !canPublish || saving !== null,
|
|
@@ -2075,7 +2224,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2075
2224
|
]
|
|
2076
2225
|
}
|
|
2077
2226
|
),
|
|
2078
|
-
/* @__PURE__ */
|
|
2227
|
+
/* @__PURE__ */ jsx14(
|
|
2079
2228
|
"iframe",
|
|
2080
2229
|
{
|
|
2081
2230
|
ref: iframeRef,
|
|
@@ -2091,12 +2240,12 @@ function AdminStudioPageEditView(props) {
|
|
|
2091
2240
|
}
|
|
2092
2241
|
)
|
|
2093
2242
|
] })
|
|
2094
|
-
] });
|
|
2243
|
+
] }) });
|
|
2095
2244
|
}
|
|
2096
2245
|
|
|
2097
2246
|
// src/admin/components/studio/AdminStudioGlobalsView.tsx
|
|
2098
2247
|
import { SetStepNav as SetStepNav4 } from "@payloadcms/ui";
|
|
2099
|
-
import { Fragment as Fragment5, jsx as
|
|
2248
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2100
2249
|
var getPropGlobals = (props) => {
|
|
2101
2250
|
if (!props || typeof props !== "object") return null;
|
|
2102
2251
|
const direct = props.globals;
|
|
@@ -2120,25 +2269,25 @@ var getPropString5 = (props, key, fallback) => {
|
|
|
2120
2269
|
return fallback;
|
|
2121
2270
|
};
|
|
2122
2271
|
function AdminStudioGlobalsView(props) {
|
|
2123
|
-
const globalsBasePath = getPropString5(props, "globalsBasePath", "/
|
|
2272
|
+
const globalsBasePath = getPropString5(props, "globalsBasePath", "/globals");
|
|
2124
2273
|
const adminBasePath = useAdminBasePath();
|
|
2125
2274
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2126
2275
|
const globals = getPropGlobals(props) || [
|
|
2127
2276
|
{ slug: "site-settings", label: "Website Settings" },
|
|
2128
2277
|
{ slug: "header", label: "Header & Navigation" },
|
|
2129
2278
|
{ slug: "footer", label: "Footer" },
|
|
2130
|
-
{ slug: "
|
|
2279
|
+
{ slug: "social-media", label: "Social Media" }
|
|
2131
2280
|
];
|
|
2132
|
-
return /* @__PURE__ */
|
|
2133
|
-
/* @__PURE__ */
|
|
2134
|
-
/* @__PURE__ */
|
|
2135
|
-
/* @__PURE__ */
|
|
2136
|
-
/* @__PURE__ */
|
|
2281
|
+
return /* @__PURE__ */ jsx15(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
2282
|
+
/* @__PURE__ */ jsx15(SetStepNav4, { nav: [{ label: "Globals", url: resolvedGlobalsBasePath }] }),
|
|
2283
|
+
/* @__PURE__ */ jsx15("h1", { style: { margin: 0 }, children: "Globals" }),
|
|
2284
|
+
/* @__PURE__ */ jsx15("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Site-wide settings." }),
|
|
2285
|
+
/* @__PURE__ */ jsx15("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: globals.map((global) => {
|
|
2137
2286
|
const href = resolveAdminPath(
|
|
2138
2287
|
adminBasePath,
|
|
2139
2288
|
typeof global.href === "string" ? global.href : `/globals/${global.slug}`
|
|
2140
2289
|
);
|
|
2141
|
-
return /* @__PURE__ */
|
|
2290
|
+
return /* @__PURE__ */ jsxs14(
|
|
2142
2291
|
"a",
|
|
2143
2292
|
{
|
|
2144
2293
|
href,
|
|
@@ -2151,14 +2300,14 @@ function AdminStudioGlobalsView(props) {
|
|
|
2151
2300
|
textDecoration: "none"
|
|
2152
2301
|
},
|
|
2153
2302
|
children: [
|
|
2154
|
-
/* @__PURE__ */
|
|
2155
|
-
/* @__PURE__ */
|
|
2303
|
+
/* @__PURE__ */ jsx15("div", { style: { fontWeight: 900 }, children: global.label }),
|
|
2304
|
+
/* @__PURE__ */ jsx15("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: typeof global.description === "string" && global.description.length > 0 ? global.description : href })
|
|
2156
2305
|
]
|
|
2157
2306
|
},
|
|
2158
2307
|
global.slug
|
|
2159
2308
|
);
|
|
2160
2309
|
}) }),
|
|
2161
|
-
/* @__PURE__ */
|
|
2310
|
+
/* @__PURE__ */ jsx15("div", { style: { marginTop: "1rem" }, children: /* @__PURE__ */ jsx15(
|
|
2162
2311
|
"a",
|
|
2163
2312
|
{
|
|
2164
2313
|
href: resolvedGlobalsBasePath,
|
|
@@ -2166,27 +2315,120 @@ function AdminStudioGlobalsView(props) {
|
|
|
2166
2315
|
children: "Reload Globals view"
|
|
2167
2316
|
}
|
|
2168
2317
|
) })
|
|
2169
|
-
] });
|
|
2318
|
+
] }) });
|
|
2170
2319
|
}
|
|
2171
2320
|
|
|
2172
|
-
// src/admin/components/studio/
|
|
2173
|
-
import { useEffect as
|
|
2321
|
+
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
2322
|
+
import { useEffect as useEffect11, useMemo as useMemo4, useState as useState10 } from "react";
|
|
2174
2323
|
import { SetStepNav as SetStepNav5 } from "@payloadcms/ui";
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2324
|
+
|
|
2325
|
+
// src/shared/socialMedia.ts
|
|
2326
|
+
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
2327
|
+
facebook: "Facebook",
|
|
2328
|
+
instagram: "Instagram",
|
|
2329
|
+
x: "X (Twitter)",
|
|
2330
|
+
linkedin: "LinkedIn",
|
|
2331
|
+
youtube: "YouTube",
|
|
2332
|
+
tiktok: "TikTok",
|
|
2333
|
+
pinterest: "Pinterest",
|
|
2334
|
+
snapchat: "Snapchat"
|
|
2335
|
+
};
|
|
2336
|
+
var SOCIAL_MEDIA_PLATFORMS = [
|
|
2337
|
+
"facebook",
|
|
2338
|
+
"instagram",
|
|
2339
|
+
"x",
|
|
2340
|
+
"linkedin",
|
|
2341
|
+
"youtube",
|
|
2342
|
+
"tiktok",
|
|
2343
|
+
"pinterest",
|
|
2344
|
+
"snapchat"
|
|
2345
|
+
];
|
|
2346
|
+
var SOCIAL_MEDIA_ICON_OPTIONS = {
|
|
2347
|
+
facebook: [
|
|
2348
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
|
|
2349
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" },
|
|
2350
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-facebook" },
|
|
2351
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:facebook-fill" }
|
|
2186
2352
|
],
|
|
2187
|
-
|
|
2188
|
-
|
|
2353
|
+
instagram: [
|
|
2354
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
|
|
2355
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" },
|
|
2356
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-instagram" },
|
|
2357
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:instagram-fill" }
|
|
2358
|
+
],
|
|
2359
|
+
x: [
|
|
2360
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
|
|
2361
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" },
|
|
2362
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-x" },
|
|
2363
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:twitter-x-fill" }
|
|
2364
|
+
],
|
|
2365
|
+
linkedin: [
|
|
2366
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
|
|
2367
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" },
|
|
2368
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-linkedin" },
|
|
2369
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:linkedin-fill" }
|
|
2370
|
+
],
|
|
2371
|
+
youtube: [
|
|
2372
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
|
|
2373
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" },
|
|
2374
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-youtube" },
|
|
2375
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:youtube-fill" }
|
|
2376
|
+
],
|
|
2377
|
+
tiktok: [
|
|
2378
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
|
|
2379
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" },
|
|
2380
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-tiktok" },
|
|
2381
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:tiktok-fill" }
|
|
2382
|
+
],
|
|
2383
|
+
pinterest: [
|
|
2384
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
|
|
2385
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" },
|
|
2386
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-pinterest" },
|
|
2387
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:pinterest-fill" }
|
|
2388
|
+
],
|
|
2389
|
+
snapchat: [
|
|
2390
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
|
|
2391
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" },
|
|
2392
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-snapchat" },
|
|
2393
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:snapchat-fill" }
|
|
2394
|
+
]
|
|
2189
2395
|
};
|
|
2396
|
+
var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
2397
|
+
(acc, platform) => {
|
|
2398
|
+
acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
|
|
2399
|
+
return acc;
|
|
2400
|
+
},
|
|
2401
|
+
{}
|
|
2402
|
+
);
|
|
2403
|
+
|
|
2404
|
+
// src/nextjs/utilities/socialMedia.ts
|
|
2405
|
+
function resolveSocialMediaLinks(data) {
|
|
2406
|
+
const profiles = data?.profiles;
|
|
2407
|
+
if (!profiles || typeof profiles !== "object") {
|
|
2408
|
+
return [];
|
|
2409
|
+
}
|
|
2410
|
+
return SOCIAL_MEDIA_PLATFORMS.reduce((acc, platform) => {
|
|
2411
|
+
const profile = profiles[platform];
|
|
2412
|
+
if (!profile || typeof profile !== "object") {
|
|
2413
|
+
return acc;
|
|
2414
|
+
}
|
|
2415
|
+
const url = typeof profile.url === "string" ? profile.url.trim() : "";
|
|
2416
|
+
if (!url) {
|
|
2417
|
+
return acc;
|
|
2418
|
+
}
|
|
2419
|
+
const icon = typeof profile.icon === "string" && profile.icon.trim().length > 0 ? profile.icon.trim() : SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform];
|
|
2420
|
+
acc.push({
|
|
2421
|
+
icon,
|
|
2422
|
+
label: SOCIAL_MEDIA_PLATFORM_LABELS[platform],
|
|
2423
|
+
platform,
|
|
2424
|
+
url
|
|
2425
|
+
});
|
|
2426
|
+
return acc;
|
|
2427
|
+
}, []);
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
2431
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2190
2432
|
var getPropString6 = (props, key, fallback) => {
|
|
2191
2433
|
if (!props || typeof props !== "object") return fallback;
|
|
2192
2434
|
const direct = props[key];
|
|
@@ -2198,16 +2440,648 @@ var getPropString6 = (props, key, fallback) => {
|
|
|
2198
2440
|
}
|
|
2199
2441
|
return fallback;
|
|
2200
2442
|
};
|
|
2201
|
-
var
|
|
2202
|
-
if (!
|
|
2203
|
-
const
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2443
|
+
var getPropLocationSummary = (props, key) => {
|
|
2444
|
+
if (!props || typeof props !== "object") return void 0;
|
|
2445
|
+
const read = (value) => {
|
|
2446
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
2447
|
+
return void 0;
|
|
2448
|
+
}
|
|
2449
|
+
const record = value;
|
|
2450
|
+
return {
|
|
2451
|
+
...typeof record.address === "string" ? { address: record.address } : {},
|
|
2452
|
+
...typeof record.hours === "string" ? { hours: record.hours } : {},
|
|
2453
|
+
...typeof record.phone === "string" ? { phone: record.phone } : {}
|
|
2454
|
+
};
|
|
2455
|
+
};
|
|
2456
|
+
const direct = read(props[key]);
|
|
2457
|
+
if (direct) return direct;
|
|
2458
|
+
const clientProps = props.clientProps;
|
|
2459
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2460
|
+
return read(clientProps[key]);
|
|
2461
|
+
}
|
|
2462
|
+
return void 0;
|
|
2463
|
+
};
|
|
2464
|
+
var normalizeNavItems = (value) => {
|
|
2465
|
+
if (!Array.isArray(value)) {
|
|
2466
|
+
return [];
|
|
2467
|
+
}
|
|
2468
|
+
return value.filter((item) => Boolean(item) && typeof item === "object").map((item) => ({
|
|
2469
|
+
href: typeof item.href === "string" ? item.href.trim() : "",
|
|
2470
|
+
label: typeof item.label === "string" ? item.label.trim() : "",
|
|
2471
|
+
parentHref: typeof item.parentHref === "string" ? item.parentHref.trim() : ""
|
|
2472
|
+
})).filter((item) => item.href.length > 0 && item.label.length > 0).map((item) => item.parentHref ? item : { href: item.href, label: item.label });
|
|
2473
|
+
};
|
|
2474
|
+
var resolveMediaURL = (value) => {
|
|
2475
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
2476
|
+
return "";
|
|
2477
|
+
}
|
|
2478
|
+
const record = value;
|
|
2479
|
+
if (typeof record.url === "string" && record.url.length > 0) {
|
|
2480
|
+
return record.url;
|
|
2481
|
+
}
|
|
2482
|
+
if (typeof record.filename === "string" && record.filename.length > 0) {
|
|
2483
|
+
return `/api/media/file/${encodeURIComponent(record.filename)}`;
|
|
2484
|
+
}
|
|
2485
|
+
return "";
|
|
2486
|
+
};
|
|
2487
|
+
function AdminStudioHeaderGlobalView(props) {
|
|
2488
|
+
const globalSlug = getPropString6(props, "globalSlug", "header");
|
|
2489
|
+
const globalsBasePath = getPropString6(props, "globalsBasePath", "/globals");
|
|
2490
|
+
const pagesCollectionSlug = getPropString6(props, "pagesCollectionSlug", "pages");
|
|
2491
|
+
const actionHref = getPropString6(props, "actionHref", "/contact");
|
|
2492
|
+
const actionLabel = getPropString6(props, "actionLabel", "Visit Today");
|
|
2493
|
+
const locationSummary = getPropLocationSummary(props, "locationSummary");
|
|
2494
|
+
const adminBasePath = useAdminBasePath();
|
|
2495
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2496
|
+
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
2497
|
+
const [loading, setLoading] = useState10(true);
|
|
2498
|
+
const [saving, setSaving] = useState10(false);
|
|
2499
|
+
const [error, setError] = useState10(null);
|
|
2500
|
+
const [savedMessage, setSavedMessage] = useState10(null);
|
|
2501
|
+
const [initialItems, setInitialItems] = useState10([]);
|
|
2502
|
+
const [liveItems, setLiveItems] = useState10([]);
|
|
2503
|
+
const [pages, setPages] = useState10([]);
|
|
2504
|
+
const [siteSettings, setSiteSettings] = useState10({});
|
|
2505
|
+
const [socialMedia, setSocialMedia] = useState10({});
|
|
2506
|
+
useEffect11(() => {
|
|
2507
|
+
let cancelled = false;
|
|
2508
|
+
const run = async () => {
|
|
2509
|
+
setLoading(true);
|
|
2510
|
+
setError(null);
|
|
2511
|
+
setSavedMessage(null);
|
|
2512
|
+
try {
|
|
2513
|
+
const pageParams = new URLSearchParams({
|
|
2514
|
+
depth: "0",
|
|
2515
|
+
draft: "true",
|
|
2516
|
+
limit: "200",
|
|
2517
|
+
sort: "path"
|
|
2518
|
+
});
|
|
2519
|
+
const [headerRes, siteSettingsRes, socialMediaRes, pagesRes] = await Promise.all([
|
|
2520
|
+
fetch(`/api/globals/${globalSlug}?depth=1&draft=true`, { credentials: "same-origin" }),
|
|
2521
|
+
fetch("/api/globals/site-settings?depth=1&draft=true", { credentials: "same-origin" }),
|
|
2522
|
+
fetch("/api/globals/social-media?depth=1&draft=true", { credentials: "same-origin" }),
|
|
2523
|
+
fetch(`/api/${pagesCollectionSlug}?${pageParams.toString()}`, {
|
|
2524
|
+
credentials: "same-origin"
|
|
2525
|
+
})
|
|
2526
|
+
]);
|
|
2527
|
+
if (!headerRes.ok) throw new Error(`Failed to load ${globalSlug} (${headerRes.status}).`);
|
|
2528
|
+
if (!siteSettingsRes.ok) {
|
|
2529
|
+
throw new Error(`Failed to load site settings (${siteSettingsRes.status}).`);
|
|
2530
|
+
}
|
|
2531
|
+
if (!socialMediaRes.ok) {
|
|
2532
|
+
throw new Error(`Failed to load social media (${socialMediaRes.status}).`);
|
|
2533
|
+
}
|
|
2534
|
+
if (!pagesRes.ok) throw new Error(`Failed to load pages (${pagesRes.status}).`);
|
|
2535
|
+
const [headerJson, siteSettingsJson, socialMediaJson, pagesJson] = await Promise.all([
|
|
2536
|
+
headerRes.json(),
|
|
2537
|
+
siteSettingsRes.json(),
|
|
2538
|
+
socialMediaRes.json(),
|
|
2539
|
+
pagesRes.json()
|
|
2540
|
+
]);
|
|
2541
|
+
if (cancelled) return;
|
|
2542
|
+
const nextInitialItems = normalizeNavItems(headerJson.navItems);
|
|
2543
|
+
setInitialItems(nextInitialItems);
|
|
2544
|
+
setLiveItems(nextInitialItems);
|
|
2545
|
+
setSiteSettings(
|
|
2546
|
+
siteSettingsJson && typeof siteSettingsJson === "object" && !Array.isArray(siteSettingsJson) ? siteSettingsJson : {}
|
|
2547
|
+
);
|
|
2548
|
+
setSocialMedia(
|
|
2549
|
+
socialMediaJson && typeof socialMediaJson === "object" && !Array.isArray(socialMediaJson) ? socialMediaJson : {}
|
|
2550
|
+
);
|
|
2551
|
+
setPages(
|
|
2552
|
+
Array.isArray(pagesJson.docs) ? pagesJson.docs : []
|
|
2553
|
+
);
|
|
2554
|
+
} catch (loadError) {
|
|
2555
|
+
if (!cancelled) {
|
|
2556
|
+
setError(loadError instanceof Error ? loadError.message : "Failed to load header settings.");
|
|
2557
|
+
}
|
|
2558
|
+
} finally {
|
|
2559
|
+
if (!cancelled) {
|
|
2560
|
+
setLoading(false);
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
};
|
|
2564
|
+
void run();
|
|
2565
|
+
return () => {
|
|
2566
|
+
cancelled = true;
|
|
2567
|
+
};
|
|
2568
|
+
}, [globalSlug, pagesCollectionSlug]);
|
|
2569
|
+
const pageOptions = useMemo4(() => buildAdminPageLinkOptions(pages), [pages]);
|
|
2570
|
+
const previewSocialLinks = useMemo4(
|
|
2571
|
+
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
2572
|
+
label: item.label,
|
|
2573
|
+
platform: item.platform,
|
|
2574
|
+
url: item.url
|
|
2575
|
+
})),
|
|
2576
|
+
[socialMedia]
|
|
2577
|
+
);
|
|
2578
|
+
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
2579
|
+
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
2580
|
+
const previewLogoUrl = resolveMediaURL(siteSettings.logo);
|
|
2581
|
+
const editorKey = useMemo4(() => JSON.stringify(initialItems), [initialItems]);
|
|
2582
|
+
const save = async () => {
|
|
2583
|
+
setSaving(true);
|
|
2584
|
+
setError(null);
|
|
2585
|
+
setSavedMessage(null);
|
|
2586
|
+
try {
|
|
2587
|
+
const response = await fetch(`/api/globals/${globalSlug}`, {
|
|
2588
|
+
body: JSON.stringify({
|
|
2589
|
+
navItems: liveItems.map((item) => ({
|
|
2590
|
+
href: item.href,
|
|
2591
|
+
label: item.label,
|
|
2592
|
+
...item.parentHref ? { parentHref: item.parentHref } : {}
|
|
2593
|
+
}))
|
|
2594
|
+
}),
|
|
2595
|
+
credentials: "same-origin",
|
|
2596
|
+
headers: {
|
|
2597
|
+
"Content-Type": "application/json"
|
|
2598
|
+
},
|
|
2599
|
+
method: "PATCH"
|
|
2600
|
+
});
|
|
2601
|
+
if (!response.ok) {
|
|
2602
|
+
throw new Error(`Failed to save ${globalSlug} (${response.status}).`);
|
|
2603
|
+
}
|
|
2604
|
+
const json = await response.json();
|
|
2605
|
+
const nextItems = normalizeNavItems(json.navItems);
|
|
2606
|
+
setInitialItems(nextItems);
|
|
2607
|
+
setLiveItems(nextItems);
|
|
2608
|
+
setSavedMessage("Saved.");
|
|
2609
|
+
} catch (saveError) {
|
|
2610
|
+
setError(saveError instanceof Error ? saveError.message : "Failed to save header settings.");
|
|
2611
|
+
} finally {
|
|
2612
|
+
setSaving(false);
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
return /* @__PURE__ */ jsx16(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs15("div", { style: { paddingBottom: "2rem" }, children: [
|
|
2616
|
+
/* @__PURE__ */ jsx16(
|
|
2617
|
+
SetStepNav5,
|
|
2618
|
+
{
|
|
2619
|
+
nav: [
|
|
2620
|
+
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
2621
|
+
{ label: "Header & Navigation", url: rawGlobalPath }
|
|
2622
|
+
]
|
|
2623
|
+
}
|
|
2624
|
+
),
|
|
2625
|
+
/* @__PURE__ */ jsx16("h1", { style: { margin: 0 }, children: "Header & Navigation" }),
|
|
2626
|
+
/* @__PURE__ */ jsx16("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage the main website navigation and preview it in place." }),
|
|
2627
|
+
loading ? /* @__PURE__ */ jsx16("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading header settings\u2026" }) : null,
|
|
2628
|
+
error ? /* @__PURE__ */ jsx16("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
2629
|
+
savedMessage ? /* @__PURE__ */ jsx16("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
2630
|
+
!loading ? /* @__PURE__ */ jsxs15("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
2631
|
+
/* @__PURE__ */ jsx16(
|
|
2632
|
+
HeaderNavEditorWithPreview,
|
|
2633
|
+
{
|
|
2634
|
+
actionHref,
|
|
2635
|
+
actionLabel,
|
|
2636
|
+
activePath: "/",
|
|
2637
|
+
brandName: previewSiteName,
|
|
2638
|
+
initialItems,
|
|
2639
|
+
locationSummary,
|
|
2640
|
+
logoUrl: previewLogoUrl || void 0,
|
|
2641
|
+
onItemsChange: setLiveItems,
|
|
2642
|
+
pageOptions,
|
|
2643
|
+
socialLinks: previewSocialLinks,
|
|
2644
|
+
tagline: previewTagline
|
|
2645
|
+
},
|
|
2646
|
+
editorKey
|
|
2647
|
+
),
|
|
2648
|
+
/* @__PURE__ */ jsx16("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ jsx16(
|
|
2649
|
+
"button",
|
|
2650
|
+
{
|
|
2651
|
+
disabled: saving,
|
|
2652
|
+
onClick: () => void save(),
|
|
2653
|
+
style: {
|
|
2654
|
+
background: "var(--theme-elevation-900)",
|
|
2655
|
+
border: "none",
|
|
2656
|
+
borderRadius: 12,
|
|
2657
|
+
color: "var(--theme-elevation-0)",
|
|
2658
|
+
cursor: saving ? "not-allowed" : "pointer",
|
|
2659
|
+
fontWeight: 900,
|
|
2660
|
+
minHeight: 42,
|
|
2661
|
+
padding: "0 0.9rem"
|
|
2662
|
+
},
|
|
2663
|
+
type: "button",
|
|
2664
|
+
children: saving ? "Saving\u2026" : "Save Navigation"
|
|
2665
|
+
}
|
|
2666
|
+
) })
|
|
2667
|
+
] }) : null
|
|
2668
|
+
] }) });
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
// src/admin/components/studio/AdminStudioFooterGlobalView.tsx
|
|
2672
|
+
import { useEffect as useEffect12, useMemo as useMemo5, useState as useState11 } from "react";
|
|
2673
|
+
import { SetStepNav as SetStepNav6 } from "@payloadcms/ui";
|
|
2674
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2675
|
+
var getPropString7 = (props, key, fallback) => {
|
|
2676
|
+
if (!props || typeof props !== "object") return fallback;
|
|
2677
|
+
const direct = props[key];
|
|
2678
|
+
if (typeof direct === "string") return direct;
|
|
2679
|
+
const clientProps = props.clientProps;
|
|
2680
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2681
|
+
const nested = clientProps[key];
|
|
2682
|
+
if (typeof nested === "string") return nested;
|
|
2683
|
+
}
|
|
2684
|
+
return fallback;
|
|
2685
|
+
};
|
|
2686
|
+
var getPropStringArray2 = (props, key) => {
|
|
2687
|
+
if (!props || typeof props !== "object") return [];
|
|
2688
|
+
const read = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.trim().length > 0) : [];
|
|
2689
|
+
const direct = read(props[key]);
|
|
2690
|
+
if (direct.length > 0) return direct;
|
|
2691
|
+
const clientProps = props.clientProps;
|
|
2692
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2693
|
+
return read(clientProps[key]);
|
|
2694
|
+
}
|
|
2695
|
+
return [];
|
|
2696
|
+
};
|
|
2697
|
+
var getPropLinks = (props, key) => {
|
|
2698
|
+
if (!props || typeof props !== "object") return [];
|
|
2699
|
+
const read = (value) => Array.isArray(value) ? value.filter((item) => Boolean(item) && typeof item === "object").map((item) => ({
|
|
2700
|
+
href: typeof item.href === "string" ? item.href.trim() : "",
|
|
2701
|
+
label: typeof item.label === "string" ? item.label.trim() : ""
|
|
2702
|
+
})).filter((item) => item.href.length > 0 && item.label.length > 0) : [];
|
|
2703
|
+
const direct = read(props[key]);
|
|
2704
|
+
if (direct.length > 0) return direct;
|
|
2705
|
+
const clientProps = props.clientProps;
|
|
2706
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2707
|
+
return read(clientProps[key]);
|
|
2708
|
+
}
|
|
2709
|
+
return [];
|
|
2710
|
+
};
|
|
2711
|
+
var getPropLocationSummary2 = (props, key) => {
|
|
2712
|
+
if (!props || typeof props !== "object") return void 0;
|
|
2713
|
+
const read = (value) => {
|
|
2714
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
2715
|
+
return void 0;
|
|
2716
|
+
}
|
|
2717
|
+
const record = value;
|
|
2718
|
+
return {
|
|
2719
|
+
...typeof record.address === "string" ? { address: record.address } : {},
|
|
2720
|
+
...typeof record.hours === "string" ? { hours: record.hours } : {},
|
|
2721
|
+
...typeof record.phone === "string" ? { phone: record.phone } : {}
|
|
2722
|
+
};
|
|
2723
|
+
};
|
|
2724
|
+
const direct = read(props[key]);
|
|
2725
|
+
if (direct) return direct;
|
|
2726
|
+
const clientProps = props.clientProps;
|
|
2727
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2728
|
+
return read(clientProps[key]);
|
|
2729
|
+
}
|
|
2730
|
+
return void 0;
|
|
2731
|
+
};
|
|
2732
|
+
var resolveMediaURL2 = (value) => {
|
|
2733
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
2734
|
+
return "";
|
|
2735
|
+
}
|
|
2736
|
+
const record = value;
|
|
2737
|
+
if (typeof record.url === "string" && record.url.length > 0) {
|
|
2738
|
+
return record.url;
|
|
2739
|
+
}
|
|
2740
|
+
if (typeof record.filename === "string" && record.filename.length > 0) {
|
|
2741
|
+
return `/api/media/file/${encodeURIComponent(record.filename)}`;
|
|
2742
|
+
}
|
|
2743
|
+
return "";
|
|
2744
|
+
};
|
|
2745
|
+
var deriveAddress = (siteSettings) => {
|
|
2746
|
+
const businessProfile = siteSettings.businessProfile && typeof siteSettings.businessProfile === "object" && !Array.isArray(siteSettings.businessProfile) ? siteSettings.businessProfile : {};
|
|
2747
|
+
const parts = [
|
|
2748
|
+
businessProfile.streetAddress,
|
|
2749
|
+
[businessProfile.addressLocality, businessProfile.addressRegion].filter(Boolean).join(", "),
|
|
2750
|
+
businessProfile.postalCode
|
|
2751
|
+
].filter((part) => typeof part === "string" && part.trim().length > 0).map((part) => part.trim());
|
|
2752
|
+
return parts.join(" ");
|
|
2753
|
+
};
|
|
2754
|
+
var deriveHours = (siteSettings) => {
|
|
2755
|
+
const businessProfile = siteSettings.businessProfile && typeof siteSettings.businessProfile === "object" && !Array.isArray(siteSettings.businessProfile) ? siteSettings.businessProfile : {};
|
|
2756
|
+
if (!Array.isArray(businessProfile.openingHours) || businessProfile.openingHours.length === 0) {
|
|
2757
|
+
return "";
|
|
2758
|
+
}
|
|
2759
|
+
const firstRow = businessProfile.openingHours[0] && typeof businessProfile.openingHours[0] === "object" && !Array.isArray(businessProfile.openingHours[0]) ? businessProfile.openingHours[0] : {};
|
|
2760
|
+
const dayOfWeek = typeof firstRow.dayOfWeek === "string" ? firstRow.dayOfWeek.trim() : "";
|
|
2761
|
+
const opens = typeof firstRow.opens === "string" ? firstRow.opens.trim() : "";
|
|
2762
|
+
const closes = typeof firstRow.closes === "string" ? firstRow.closes.trim() : "";
|
|
2763
|
+
if (!dayOfWeek || !opens || !closes) {
|
|
2764
|
+
return "";
|
|
2765
|
+
}
|
|
2766
|
+
return `${dayOfWeek} \u2022 ${opens} - ${closes}`;
|
|
2767
|
+
};
|
|
2768
|
+
function AdminStudioFooterGlobalView(props) {
|
|
2769
|
+
const globalSlug = getPropString7(props, "globalSlug", "footer");
|
|
2770
|
+
const globalsBasePath = getPropString7(props, "globalsBasePath", "/globals");
|
|
2771
|
+
const builtByHref = getPropString7(props, "builtByHref", "");
|
|
2772
|
+
const builtByLabel = getPropString7(props, "builtByLabel", "");
|
|
2773
|
+
const description = getPropString7(props, "description", "");
|
|
2774
|
+
const footerCategories = getPropStringArray2(props, "footerCategories");
|
|
2775
|
+
const footerLinks = getPropLinks(props, "footerLinks");
|
|
2776
|
+
const configuredLocationSummary = getPropLocationSummary2(props, "locationSummary");
|
|
2777
|
+
const adminBasePath = useAdminBasePath();
|
|
2778
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2779
|
+
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
2780
|
+
const [loading, setLoading] = useState11(true);
|
|
2781
|
+
const [saving, setSaving] = useState11(false);
|
|
2782
|
+
const [error, setError] = useState11(null);
|
|
2783
|
+
const [savedMessage, setSavedMessage] = useState11(null);
|
|
2784
|
+
const [doc, setDoc] = useState11({
|
|
2785
|
+
contactEmail: "",
|
|
2786
|
+
contactPhone: "",
|
|
2787
|
+
copyright: ""
|
|
2788
|
+
});
|
|
2789
|
+
const [siteSettings, setSiteSettings] = useState11({});
|
|
2790
|
+
const [socialMedia, setSocialMedia] = useState11({});
|
|
2791
|
+
useEffect12(() => {
|
|
2792
|
+
let cancelled = false;
|
|
2793
|
+
const run = async () => {
|
|
2794
|
+
setLoading(true);
|
|
2795
|
+
setError(null);
|
|
2796
|
+
setSavedMessage(null);
|
|
2797
|
+
try {
|
|
2798
|
+
const [footerRes, siteSettingsRes, socialMediaRes] = await Promise.all([
|
|
2799
|
+
fetch(`/api/globals/${globalSlug}?depth=1&draft=true`, { credentials: "same-origin" }),
|
|
2800
|
+
fetch("/api/globals/site-settings?depth=1&draft=true", { credentials: "same-origin" }),
|
|
2801
|
+
fetch("/api/globals/social-media?depth=1&draft=true", { credentials: "same-origin" })
|
|
2802
|
+
]);
|
|
2803
|
+
if (!footerRes.ok) throw new Error(`Failed to load ${globalSlug} (${footerRes.status}).`);
|
|
2804
|
+
if (!siteSettingsRes.ok) {
|
|
2805
|
+
throw new Error(`Failed to load site settings (${siteSettingsRes.status}).`);
|
|
2806
|
+
}
|
|
2807
|
+
if (!socialMediaRes.ok) {
|
|
2808
|
+
throw new Error(`Failed to load social media (${socialMediaRes.status}).`);
|
|
2809
|
+
}
|
|
2810
|
+
const [footerJson, siteSettingsJson, socialMediaJson] = await Promise.all([
|
|
2811
|
+
footerRes.json(),
|
|
2812
|
+
siteSettingsRes.json(),
|
|
2813
|
+
socialMediaRes.json()
|
|
2814
|
+
]);
|
|
2815
|
+
if (cancelled) return;
|
|
2816
|
+
const footerRecord = footerJson && typeof footerJson === "object" && !Array.isArray(footerJson) ? footerJson : {};
|
|
2817
|
+
setDoc({
|
|
2818
|
+
contactEmail: typeof footerRecord.contactEmail === "string" ? footerRecord.contactEmail : "",
|
|
2819
|
+
contactPhone: typeof footerRecord.contactPhone === "string" ? footerRecord.contactPhone : "",
|
|
2820
|
+
copyright: typeof footerRecord.copyright === "string" ? footerRecord.copyright : ""
|
|
2821
|
+
});
|
|
2822
|
+
setSiteSettings(
|
|
2823
|
+
siteSettingsJson && typeof siteSettingsJson === "object" && !Array.isArray(siteSettingsJson) ? siteSettingsJson : {}
|
|
2824
|
+
);
|
|
2825
|
+
setSocialMedia(
|
|
2826
|
+
socialMediaJson && typeof socialMediaJson === "object" && !Array.isArray(socialMediaJson) ? socialMediaJson : {}
|
|
2827
|
+
);
|
|
2828
|
+
} catch (loadError) {
|
|
2829
|
+
if (!cancelled) {
|
|
2830
|
+
setError(loadError instanceof Error ? loadError.message : "Failed to load footer settings.");
|
|
2831
|
+
}
|
|
2832
|
+
} finally {
|
|
2833
|
+
if (!cancelled) {
|
|
2834
|
+
setLoading(false);
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
};
|
|
2838
|
+
void run();
|
|
2839
|
+
return () => {
|
|
2840
|
+
cancelled = true;
|
|
2841
|
+
};
|
|
2842
|
+
}, [globalSlug]);
|
|
2843
|
+
const previewSocialLinks = useMemo5(
|
|
2844
|
+
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
2845
|
+
label: item.label,
|
|
2846
|
+
platform: item.platform,
|
|
2847
|
+
url: item.url
|
|
2848
|
+
})),
|
|
2849
|
+
[socialMedia]
|
|
2850
|
+
);
|
|
2851
|
+
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
2852
|
+
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
2853
|
+
const previewLogoUrl = resolveMediaURL2(siteSettings.logo);
|
|
2854
|
+
const previewLocationSummary = {
|
|
2855
|
+
address: configuredLocationSummary?.address || deriveAddress(siteSettings),
|
|
2856
|
+
hours: configuredLocationSummary?.hours || deriveHours(siteSettings),
|
|
2857
|
+
phone: doc.contactPhone
|
|
2858
|
+
};
|
|
2859
|
+
const save = async () => {
|
|
2860
|
+
setSaving(true);
|
|
2861
|
+
setError(null);
|
|
2862
|
+
setSavedMessage(null);
|
|
2863
|
+
try {
|
|
2864
|
+
const response = await fetch(`/api/globals/${globalSlug}`, {
|
|
2865
|
+
body: JSON.stringify(doc),
|
|
2866
|
+
credentials: "same-origin",
|
|
2867
|
+
headers: {
|
|
2868
|
+
"Content-Type": "application/json"
|
|
2869
|
+
},
|
|
2870
|
+
method: "PATCH"
|
|
2871
|
+
});
|
|
2872
|
+
if (!response.ok) {
|
|
2873
|
+
throw new Error(`Failed to save ${globalSlug} (${response.status}).`);
|
|
2874
|
+
}
|
|
2875
|
+
const json = await response.json();
|
|
2876
|
+
setDoc({
|
|
2877
|
+
contactEmail: typeof json.contactEmail === "string" ? json.contactEmail : "",
|
|
2878
|
+
contactPhone: typeof json.contactPhone === "string" ? json.contactPhone : "",
|
|
2879
|
+
copyright: typeof json.copyright === "string" ? json.copyright : ""
|
|
2880
|
+
});
|
|
2881
|
+
setSavedMessage("Saved.");
|
|
2882
|
+
} catch (saveError) {
|
|
2883
|
+
setError(saveError instanceof Error ? saveError.message : "Failed to save footer settings.");
|
|
2884
|
+
} finally {
|
|
2885
|
+
setSaving(false);
|
|
2886
|
+
}
|
|
2887
|
+
};
|
|
2888
|
+
return /* @__PURE__ */ jsx17(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16("div", { style: { paddingBottom: "2rem" }, children: [
|
|
2889
|
+
/* @__PURE__ */ jsx17(
|
|
2890
|
+
SetStepNav6,
|
|
2891
|
+
{
|
|
2892
|
+
nav: [
|
|
2893
|
+
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
2894
|
+
{ label: "Footer", url: rawGlobalPath }
|
|
2895
|
+
]
|
|
2896
|
+
}
|
|
2897
|
+
),
|
|
2898
|
+
/* @__PURE__ */ jsx17("h1", { style: { margin: 0 }, children: "Footer" }),
|
|
2899
|
+
/* @__PURE__ */ jsx17("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage footer contact details and preview the package footer in place." }),
|
|
2900
|
+
loading ? /* @__PURE__ */ jsx17("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading footer settings\u2026" }) : null,
|
|
2901
|
+
error ? /* @__PURE__ */ jsx17("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
2902
|
+
savedMessage ? /* @__PURE__ */ jsx17("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
2903
|
+
!loading ? /* @__PURE__ */ jsxs16("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
2904
|
+
/* @__PURE__ */ jsxs16(
|
|
2905
|
+
"label",
|
|
2906
|
+
{
|
|
2907
|
+
style: {
|
|
2908
|
+
color: "var(--theme-elevation-800)",
|
|
2909
|
+
display: "grid",
|
|
2910
|
+
fontSize: "0.88rem",
|
|
2911
|
+
fontWeight: 700,
|
|
2912
|
+
gap: "0.35rem"
|
|
2913
|
+
},
|
|
2914
|
+
children: [
|
|
2915
|
+
"Copyright",
|
|
2916
|
+
/* @__PURE__ */ jsx17(
|
|
2917
|
+
"input",
|
|
2918
|
+
{
|
|
2919
|
+
onChange: (event) => setDoc((current) => ({ ...current, copyright: event.target.value })),
|
|
2920
|
+
style: {
|
|
2921
|
+
background: "var(--theme-elevation-0)",
|
|
2922
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
2923
|
+
borderRadius: 10,
|
|
2924
|
+
color: "inherit",
|
|
2925
|
+
fontSize: "0.95rem",
|
|
2926
|
+
minHeight: 42,
|
|
2927
|
+
padding: "0.55rem 0.65rem",
|
|
2928
|
+
width: "100%"
|
|
2929
|
+
},
|
|
2930
|
+
type: "text",
|
|
2931
|
+
value: doc.copyright
|
|
2932
|
+
}
|
|
2933
|
+
)
|
|
2934
|
+
]
|
|
2935
|
+
}
|
|
2936
|
+
),
|
|
2937
|
+
/* @__PURE__ */ jsxs16(
|
|
2938
|
+
"label",
|
|
2939
|
+
{
|
|
2940
|
+
style: {
|
|
2941
|
+
color: "var(--theme-elevation-800)",
|
|
2942
|
+
display: "grid",
|
|
2943
|
+
fontSize: "0.88rem",
|
|
2944
|
+
fontWeight: 700,
|
|
2945
|
+
gap: "0.35rem"
|
|
2946
|
+
},
|
|
2947
|
+
children: [
|
|
2948
|
+
"Contact Email",
|
|
2949
|
+
/* @__PURE__ */ jsx17(
|
|
2950
|
+
"input",
|
|
2951
|
+
{
|
|
2952
|
+
onChange: (event) => setDoc((current) => ({ ...current, contactEmail: event.target.value })),
|
|
2953
|
+
style: {
|
|
2954
|
+
background: "var(--theme-elevation-0)",
|
|
2955
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
2956
|
+
borderRadius: 10,
|
|
2957
|
+
color: "inherit",
|
|
2958
|
+
fontSize: "0.95rem",
|
|
2959
|
+
minHeight: 42,
|
|
2960
|
+
padding: "0.55rem 0.65rem",
|
|
2961
|
+
width: "100%"
|
|
2962
|
+
},
|
|
2963
|
+
type: "email",
|
|
2964
|
+
value: doc.contactEmail
|
|
2965
|
+
}
|
|
2966
|
+
)
|
|
2967
|
+
]
|
|
2968
|
+
}
|
|
2969
|
+
),
|
|
2970
|
+
/* @__PURE__ */ jsxs16(
|
|
2971
|
+
"label",
|
|
2972
|
+
{
|
|
2973
|
+
style: {
|
|
2974
|
+
color: "var(--theme-elevation-800)",
|
|
2975
|
+
display: "grid",
|
|
2976
|
+
fontSize: "0.88rem",
|
|
2977
|
+
fontWeight: 700,
|
|
2978
|
+
gap: "0.35rem"
|
|
2979
|
+
},
|
|
2980
|
+
children: [
|
|
2981
|
+
"Contact Phone",
|
|
2982
|
+
/* @__PURE__ */ jsx17(
|
|
2983
|
+
"input",
|
|
2984
|
+
{
|
|
2985
|
+
onChange: (event) => setDoc((current) => ({ ...current, contactPhone: event.target.value })),
|
|
2986
|
+
style: {
|
|
2987
|
+
background: "var(--theme-elevation-0)",
|
|
2988
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
2989
|
+
borderRadius: 10,
|
|
2990
|
+
color: "inherit",
|
|
2991
|
+
fontSize: "0.95rem",
|
|
2992
|
+
minHeight: 42,
|
|
2993
|
+
padding: "0.55rem 0.65rem",
|
|
2994
|
+
width: "100%"
|
|
2995
|
+
},
|
|
2996
|
+
type: "text",
|
|
2997
|
+
value: doc.contactPhone
|
|
2998
|
+
}
|
|
2999
|
+
)
|
|
3000
|
+
]
|
|
3001
|
+
}
|
|
3002
|
+
),
|
|
3003
|
+
/* @__PURE__ */ jsx17("div", { className: "orion-admin-preview-label", children: "Footer Preview" }),
|
|
3004
|
+
/* @__PURE__ */ jsx17("div", { className: "orion-admin-preview-frame", children: /* @__PURE__ */ jsx17("div", { className: "orion-admin-preview-surface", children: /* @__PURE__ */ jsx17(
|
|
3005
|
+
SiteFooterPreview,
|
|
3006
|
+
{
|
|
3007
|
+
site: {
|
|
3008
|
+
...builtByHref ? { builtByHref } : {},
|
|
3009
|
+
...builtByLabel ? { builtByLabel } : {},
|
|
3010
|
+
contactEmail: doc.contactEmail || "hello@example.com",
|
|
3011
|
+
copyright: doc.copyright || `\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} ${previewSiteName}`,
|
|
3012
|
+
...description ? { description } : {},
|
|
3013
|
+
footerCategories,
|
|
3014
|
+
footerLinks,
|
|
3015
|
+
locationSummary: previewLocationSummary,
|
|
3016
|
+
logoUrl: previewLogoUrl || void 0,
|
|
3017
|
+
siteName: previewSiteName,
|
|
3018
|
+
socialLinks: previewSocialLinks,
|
|
3019
|
+
tagline: previewTagline
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
) }) }),
|
|
3023
|
+
/* @__PURE__ */ jsx17("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ jsx17(
|
|
3024
|
+
"button",
|
|
3025
|
+
{
|
|
3026
|
+
disabled: saving,
|
|
3027
|
+
onClick: () => void save(),
|
|
3028
|
+
style: {
|
|
3029
|
+
background: "var(--theme-elevation-900)",
|
|
3030
|
+
border: "none",
|
|
3031
|
+
borderRadius: 12,
|
|
3032
|
+
color: "var(--theme-elevation-0)",
|
|
3033
|
+
cursor: saving ? "not-allowed" : "pointer",
|
|
3034
|
+
fontWeight: 900,
|
|
3035
|
+
minHeight: 42,
|
|
3036
|
+
padding: "0 0.9rem"
|
|
3037
|
+
},
|
|
3038
|
+
type: "button",
|
|
3039
|
+
children: saving ? "Saving\u2026" : "Save Footer"
|
|
3040
|
+
}
|
|
3041
|
+
) })
|
|
3042
|
+
] }) : null
|
|
3043
|
+
] }) });
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
// src/admin/components/studio/AdminStudioContactFormView.tsx
|
|
3047
|
+
import { useEffect as useEffect13, useMemo as useMemo6, useState as useState12 } from "react";
|
|
3048
|
+
import { SetStepNav as SetStepNav7 } from "@payloadcms/ui";
|
|
3049
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3050
|
+
var defaultDoc = {
|
|
3051
|
+
disabledMessage: "This form is temporarily unavailable. Please call us for immediate service.",
|
|
3052
|
+
enabled: true,
|
|
3053
|
+
errorMessage: "Submission failed. Please call us at (512) 555-0149.",
|
|
3054
|
+
notificationEmail: "",
|
|
3055
|
+
serviceOptions: [
|
|
3056
|
+
{ label: "Tree Trimming" },
|
|
3057
|
+
{ label: "Tree Removal" },
|
|
3058
|
+
{ label: "Stump Grinding" },
|
|
3059
|
+
{ label: "Storm Cleanup" }
|
|
3060
|
+
],
|
|
3061
|
+
submitButtonLabel: "Send Request",
|
|
3062
|
+
successMessage: "Thanks, your request has been received. We will follow up shortly."
|
|
3063
|
+
};
|
|
3064
|
+
var getPropString8 = (props, key, fallback) => {
|
|
3065
|
+
if (!props || typeof props !== "object") return fallback;
|
|
3066
|
+
const direct = props[key];
|
|
3067
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
3068
|
+
const clientProps = props.clientProps;
|
|
3069
|
+
if (clientProps && typeof clientProps === "object") {
|
|
3070
|
+
const nested = clientProps[key];
|
|
3071
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
3072
|
+
}
|
|
3073
|
+
return fallback;
|
|
3074
|
+
};
|
|
3075
|
+
var normalizeOption = (value) => {
|
|
3076
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
3077
|
+
const label = value.label;
|
|
3078
|
+
if (typeof label !== "string") return null;
|
|
3079
|
+
const trimmed = label.trim();
|
|
3080
|
+
if (!trimmed) return null;
|
|
3081
|
+
return { label: trimmed };
|
|
3082
|
+
};
|
|
3083
|
+
var normalizeDoc = (value) => {
|
|
3084
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
2211
3085
|
return defaultDoc;
|
|
2212
3086
|
}
|
|
2213
3087
|
const record = value;
|
|
@@ -2256,17 +3130,17 @@ var ghostButtonStyle = {
|
|
|
2256
3130
|
color: "var(--theme-elevation-900)"
|
|
2257
3131
|
};
|
|
2258
3132
|
function AdminStudioContactFormView(props) {
|
|
2259
|
-
const globalSlug =
|
|
2260
|
-
const globalsBasePath =
|
|
3133
|
+
const globalSlug = getPropString8(props, "globalSlug", "contact-form");
|
|
3134
|
+
const globalsBasePath = getPropString8(props, "globalsBasePath", "/globals");
|
|
2261
3135
|
const adminBasePath = useAdminBasePath();
|
|
2262
3136
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2263
3137
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
2264
|
-
const [doc, setDoc] =
|
|
2265
|
-
const [error, setError] =
|
|
2266
|
-
const [isLoading, setIsLoading] =
|
|
2267
|
-
const [isSaving, setIsSaving] =
|
|
2268
|
-
const [savedMessage, setSavedMessage] =
|
|
2269
|
-
|
|
3138
|
+
const [doc, setDoc] = useState12(defaultDoc);
|
|
3139
|
+
const [error, setError] = useState12(null);
|
|
3140
|
+
const [isLoading, setIsLoading] = useState12(true);
|
|
3141
|
+
const [isSaving, setIsSaving] = useState12(false);
|
|
3142
|
+
const [savedMessage, setSavedMessage] = useState12(null);
|
|
3143
|
+
useEffect13(() => {
|
|
2270
3144
|
let mounted = true;
|
|
2271
3145
|
const load = async () => {
|
|
2272
3146
|
setIsLoading(true);
|
|
@@ -2296,7 +3170,7 @@ function AdminStudioContactFormView(props) {
|
|
|
2296
3170
|
mounted = false;
|
|
2297
3171
|
};
|
|
2298
3172
|
}, [globalSlug]);
|
|
2299
|
-
const payload =
|
|
3173
|
+
const payload = useMemo6(
|
|
2300
3174
|
() => ({
|
|
2301
3175
|
disabledMessage: doc.disabledMessage,
|
|
2302
3176
|
enabled: doc.enabled,
|
|
@@ -2333,9 +3207,9 @@ function AdminStudioContactFormView(props) {
|
|
|
2333
3207
|
setIsSaving(false);
|
|
2334
3208
|
}
|
|
2335
3209
|
};
|
|
2336
|
-
return /* @__PURE__ */
|
|
2337
|
-
/* @__PURE__ */
|
|
2338
|
-
|
|
3210
|
+
return /* @__PURE__ */ jsx18(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs17("div", { style: { paddingBottom: "2rem" }, children: [
|
|
3211
|
+
/* @__PURE__ */ jsx18(
|
|
3212
|
+
SetStepNav7,
|
|
2339
3213
|
{
|
|
2340
3214
|
nav: [
|
|
2341
3215
|
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
@@ -2343,14 +3217,14 @@ function AdminStudioContactFormView(props) {
|
|
|
2343
3217
|
]
|
|
2344
3218
|
}
|
|
2345
3219
|
),
|
|
2346
|
-
/* @__PURE__ */
|
|
2347
|
-
/* @__PURE__ */
|
|
2348
|
-
isLoading ? /* @__PURE__ */
|
|
2349
|
-
error ? /* @__PURE__ */
|
|
2350
|
-
savedMessage ? /* @__PURE__ */
|
|
2351
|
-
!isLoading ? /* @__PURE__ */
|
|
2352
|
-
/* @__PURE__ */
|
|
2353
|
-
/* @__PURE__ */
|
|
3220
|
+
/* @__PURE__ */ jsx18("h1", { style: { margin: 0 }, children: "Contact Form" }),
|
|
3221
|
+
/* @__PURE__ */ jsx18("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Edit form behavior and submission messaging without leaving Studio." }),
|
|
3222
|
+
isLoading ? /* @__PURE__ */ jsx18("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading form settings\u2026" }) : null,
|
|
3223
|
+
error ? /* @__PURE__ */ jsx18("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
3224
|
+
savedMessage ? /* @__PURE__ */ jsx18("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
3225
|
+
!isLoading ? /* @__PURE__ */ jsxs17("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem", maxWidth: 900 }, children: [
|
|
3226
|
+
/* @__PURE__ */ jsxs17("label", { style: { ...fieldLabelStyle, alignItems: "center", display: "flex", gap: "0.6rem" }, children: [
|
|
3227
|
+
/* @__PURE__ */ jsx18(
|
|
2354
3228
|
"input",
|
|
2355
3229
|
{
|
|
2356
3230
|
checked: doc.enabled,
|
|
@@ -2360,9 +3234,9 @@ function AdminStudioContactFormView(props) {
|
|
|
2360
3234
|
),
|
|
2361
3235
|
"Form enabled"
|
|
2362
3236
|
] }),
|
|
2363
|
-
/* @__PURE__ */
|
|
3237
|
+
/* @__PURE__ */ jsxs17("label", { style: fieldLabelStyle, children: [
|
|
2364
3238
|
"Notification Email",
|
|
2365
|
-
/* @__PURE__ */
|
|
3239
|
+
/* @__PURE__ */ jsx18(
|
|
2366
3240
|
"input",
|
|
2367
3241
|
{
|
|
2368
3242
|
onChange: (event) => setDoc((prev) => ({ ...prev, notificationEmail: event.target.value })),
|
|
@@ -2372,9 +3246,9 @@ function AdminStudioContactFormView(props) {
|
|
|
2372
3246
|
}
|
|
2373
3247
|
)
|
|
2374
3248
|
] }),
|
|
2375
|
-
/* @__PURE__ */
|
|
3249
|
+
/* @__PURE__ */ jsxs17("label", { style: fieldLabelStyle, children: [
|
|
2376
3250
|
"Submit Button Label",
|
|
2377
|
-
/* @__PURE__ */
|
|
3251
|
+
/* @__PURE__ */ jsx18(
|
|
2378
3252
|
"input",
|
|
2379
3253
|
{
|
|
2380
3254
|
onChange: (event) => setDoc((prev) => ({ ...prev, submitButtonLabel: event.target.value })),
|
|
@@ -2384,9 +3258,9 @@ function AdminStudioContactFormView(props) {
|
|
|
2384
3258
|
}
|
|
2385
3259
|
)
|
|
2386
3260
|
] }),
|
|
2387
|
-
/* @__PURE__ */
|
|
3261
|
+
/* @__PURE__ */ jsxs17("label", { style: fieldLabelStyle, children: [
|
|
2388
3262
|
"Success Message",
|
|
2389
|
-
/* @__PURE__ */
|
|
3263
|
+
/* @__PURE__ */ jsx18(
|
|
2390
3264
|
"input",
|
|
2391
3265
|
{
|
|
2392
3266
|
onChange: (event) => setDoc((prev) => ({ ...prev, successMessage: event.target.value })),
|
|
@@ -2396,9 +3270,9 @@ function AdminStudioContactFormView(props) {
|
|
|
2396
3270
|
}
|
|
2397
3271
|
)
|
|
2398
3272
|
] }),
|
|
2399
|
-
/* @__PURE__ */
|
|
3273
|
+
/* @__PURE__ */ jsxs17("label", { style: fieldLabelStyle, children: [
|
|
2400
3274
|
"Error Message",
|
|
2401
|
-
/* @__PURE__ */
|
|
3275
|
+
/* @__PURE__ */ jsx18(
|
|
2402
3276
|
"input",
|
|
2403
3277
|
{
|
|
2404
3278
|
onChange: (event) => setDoc((prev) => ({ ...prev, errorMessage: event.target.value })),
|
|
@@ -2408,9 +3282,9 @@ function AdminStudioContactFormView(props) {
|
|
|
2408
3282
|
}
|
|
2409
3283
|
)
|
|
2410
3284
|
] }),
|
|
2411
|
-
/* @__PURE__ */
|
|
3285
|
+
/* @__PURE__ */ jsxs17("label", { style: fieldLabelStyle, children: [
|
|
2412
3286
|
"Disabled Message",
|
|
2413
|
-
/* @__PURE__ */
|
|
3287
|
+
/* @__PURE__ */ jsx18(
|
|
2414
3288
|
"input",
|
|
2415
3289
|
{
|
|
2416
3290
|
onChange: (event) => setDoc((prev) => ({ ...prev, disabledMessage: event.target.value })),
|
|
@@ -2420,7 +3294,7 @@ function AdminStudioContactFormView(props) {
|
|
|
2420
3294
|
}
|
|
2421
3295
|
)
|
|
2422
3296
|
] }),
|
|
2423
|
-
/* @__PURE__ */
|
|
3297
|
+
/* @__PURE__ */ jsxs17(
|
|
2424
3298
|
"div",
|
|
2425
3299
|
{
|
|
2426
3300
|
style: {
|
|
@@ -2430,9 +3304,9 @@ function AdminStudioContactFormView(props) {
|
|
|
2430
3304
|
padding: "0.85rem"
|
|
2431
3305
|
},
|
|
2432
3306
|
children: [
|
|
2433
|
-
/* @__PURE__ */
|
|
2434
|
-
/* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
3307
|
+
/* @__PURE__ */ jsx18("div", { style: { fontWeight: 900, marginBottom: "0.65rem" }, children: "Service Options" }),
|
|
3308
|
+
/* @__PURE__ */ jsx18("div", { style: { display: "grid", gap: "0.55rem" }, children: doc.serviceOptions.map((option, index) => /* @__PURE__ */ jsxs17("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
3309
|
+
/* @__PURE__ */ jsx18(
|
|
2436
3310
|
"input",
|
|
2437
3311
|
{
|
|
2438
3312
|
onChange: (event) => setDoc((prev) => ({
|
|
@@ -2446,7 +3320,7 @@ function AdminStudioContactFormView(props) {
|
|
|
2446
3320
|
value: option.label
|
|
2447
3321
|
}
|
|
2448
3322
|
),
|
|
2449
|
-
/* @__PURE__ */
|
|
3323
|
+
/* @__PURE__ */ jsx18(
|
|
2450
3324
|
"button",
|
|
2451
3325
|
{
|
|
2452
3326
|
onClick: () => setDoc((prev) => ({
|
|
@@ -2459,7 +3333,7 @@ function AdminStudioContactFormView(props) {
|
|
|
2459
3333
|
}
|
|
2460
3334
|
)
|
|
2461
3335
|
] }, `${index}-${option.label}`)) }),
|
|
2462
|
-
/* @__PURE__ */
|
|
3336
|
+
/* @__PURE__ */ jsx18(
|
|
2463
3337
|
"button",
|
|
2464
3338
|
{
|
|
2465
3339
|
onClick: () => setDoc((prev) => ({
|
|
@@ -2474,9 +3348,9 @@ function AdminStudioContactFormView(props) {
|
|
|
2474
3348
|
]
|
|
2475
3349
|
}
|
|
2476
3350
|
),
|
|
2477
|
-
/* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
3351
|
+
/* @__PURE__ */ jsxs17("div", { style: { display: "flex", gap: "0.6rem" }, children: [
|
|
3352
|
+
/* @__PURE__ */ jsx18("button", { disabled: isSaving, onClick: () => void save(), style: buttonStyle, type: "button", children: isSaving ? "Saving\u2026" : "Save Form Settings" }),
|
|
3353
|
+
/* @__PURE__ */ jsx18(
|
|
2480
3354
|
"a",
|
|
2481
3355
|
{
|
|
2482
3356
|
href: rawGlobalPath,
|
|
@@ -2492,13 +3366,13 @@ function AdminStudioContactFormView(props) {
|
|
|
2492
3366
|
)
|
|
2493
3367
|
] })
|
|
2494
3368
|
] }) : null
|
|
2495
|
-
] });
|
|
3369
|
+
] }) });
|
|
2496
3370
|
}
|
|
2497
3371
|
|
|
2498
3372
|
// src/admin/components/studio/AdminStudioMediaView.tsx
|
|
2499
|
-
import { SetStepNav as
|
|
2500
|
-
import { Fragment as Fragment6, jsx as
|
|
2501
|
-
var
|
|
3373
|
+
import { SetStepNav as SetStepNav8 } from "@payloadcms/ui";
|
|
3374
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3375
|
+
var getPropString9 = (props, key, fallback) => {
|
|
2502
3376
|
if (!props || typeof props !== "object") return fallback;
|
|
2503
3377
|
const direct = props[key];
|
|
2504
3378
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -2510,15 +3384,15 @@ var getPropString7 = (props, key, fallback) => {
|
|
|
2510
3384
|
return fallback;
|
|
2511
3385
|
};
|
|
2512
3386
|
function AdminStudioMediaView(props) {
|
|
2513
|
-
const mediaCollectionSlug =
|
|
3387
|
+
const mediaCollectionSlug = getPropString9(props, "mediaCollectionSlug", "media");
|
|
2514
3388
|
const adminBasePath = useAdminBasePath();
|
|
2515
3389
|
const mediaPath = resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`);
|
|
2516
3390
|
const mediaViewPath = resolveAdminPath(adminBasePath, "/media");
|
|
2517
|
-
return /* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
3391
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
3392
|
+
/* @__PURE__ */ jsx19(SetStepNav8, { nav: [{ label: "Media", url: mediaViewPath }] }),
|
|
3393
|
+
/* @__PURE__ */ jsx19("h1", { style: { margin: 0 }, children: "Media" }),
|
|
3394
|
+
/* @__PURE__ */ jsx19("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Media management is currently using Payload's library." }),
|
|
3395
|
+
/* @__PURE__ */ jsx19("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: /* @__PURE__ */ jsxs18(
|
|
2522
3396
|
"a",
|
|
2523
3397
|
{
|
|
2524
3398
|
href: mediaPath,
|
|
@@ -2531,18 +3405,18 @@ function AdminStudioMediaView(props) {
|
|
|
2531
3405
|
textDecoration: "none"
|
|
2532
3406
|
},
|
|
2533
3407
|
children: [
|
|
2534
|
-
/* @__PURE__ */
|
|
2535
|
-
/* @__PURE__ */
|
|
3408
|
+
/* @__PURE__ */ jsx19("div", { style: { fontWeight: 900 }, children: "Open Media Library" }),
|
|
3409
|
+
/* @__PURE__ */ jsx19("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: mediaPath })
|
|
2536
3410
|
]
|
|
2537
3411
|
}
|
|
2538
3412
|
) })
|
|
2539
|
-
] });
|
|
3413
|
+
] }) });
|
|
2540
3414
|
}
|
|
2541
3415
|
|
|
2542
3416
|
// src/admin/components/studio/AdminStudioFormsView.tsx
|
|
2543
|
-
import { useEffect as
|
|
2544
|
-
import { SetStepNav as
|
|
2545
|
-
import { Fragment as Fragment7, jsx as
|
|
3417
|
+
import { useEffect as useEffect14, useMemo as useMemo7, useState as useState13 } from "react";
|
|
3418
|
+
import { SetStepNav as SetStepNav9, useAuth as useAuth4 } from "@payloadcms/ui";
|
|
3419
|
+
import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2546
3420
|
var isAdmin3 = (user) => {
|
|
2547
3421
|
if (!user || typeof user !== "object") return false;
|
|
2548
3422
|
const role = user.role;
|
|
@@ -2554,7 +3428,7 @@ var isEditor2 = (user) => {
|
|
|
2554
3428
|
return typeof role === "string" && role === "editor";
|
|
2555
3429
|
};
|
|
2556
3430
|
var canReviewForms = (user) => isAdmin3(user) || isEditor2(user);
|
|
2557
|
-
var
|
|
3431
|
+
var getPropString10 = (props, key, fallback) => {
|
|
2558
3432
|
if (!props || typeof props !== "object") return fallback;
|
|
2559
3433
|
const direct = props[key];
|
|
2560
3434
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -2604,14 +3478,14 @@ var getSubmissionIdentity = (value) => {
|
|
|
2604
3478
|
};
|
|
2605
3479
|
var renderValue = (value) => {
|
|
2606
3480
|
if (value === null || value === void 0 || value === "") {
|
|
2607
|
-
return /* @__PURE__ */
|
|
3481
|
+
return /* @__PURE__ */ jsx20("span", { style: { color: "var(--theme-elevation-500)" }, children: "\u2014" });
|
|
2608
3482
|
}
|
|
2609
3483
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
2610
3484
|
return String(value);
|
|
2611
3485
|
}
|
|
2612
3486
|
if (Array.isArray(value)) {
|
|
2613
3487
|
if (value.length === 0) {
|
|
2614
|
-
return /* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ jsx20("span", { style: { color: "var(--theme-elevation-500)" }, children: "\u2014" });
|
|
2615
3489
|
}
|
|
2616
3490
|
const primitiveValues = value.every(
|
|
2617
3491
|
(entry) => typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean" || entry === null
|
|
@@ -2619,7 +3493,7 @@ var renderValue = (value) => {
|
|
|
2619
3493
|
if (primitiveValues) {
|
|
2620
3494
|
return value.map((entry) => String(entry)).join(", ");
|
|
2621
3495
|
}
|
|
2622
|
-
return /* @__PURE__ */
|
|
3496
|
+
return /* @__PURE__ */ jsx20(
|
|
2623
3497
|
"pre",
|
|
2624
3498
|
{
|
|
2625
3499
|
style: {
|
|
@@ -2633,7 +3507,7 @@ var renderValue = (value) => {
|
|
|
2633
3507
|
);
|
|
2634
3508
|
}
|
|
2635
3509
|
if (typeof value === "object") {
|
|
2636
|
-
return /* @__PURE__ */
|
|
3510
|
+
return /* @__PURE__ */ jsx20(
|
|
2637
3511
|
"pre",
|
|
2638
3512
|
{
|
|
2639
3513
|
style: {
|
|
@@ -2681,36 +3555,36 @@ var panelStyle = {
|
|
|
2681
3555
|
};
|
|
2682
3556
|
function AdminStudioFormsView(props) {
|
|
2683
3557
|
const { user } = useAuth4();
|
|
2684
|
-
const formsCollectionSlug =
|
|
2685
|
-
const formSubmissionsCollectionSlug =
|
|
3558
|
+
const formsCollectionSlug = getPropString10(props, "formsCollectionSlug", "forms");
|
|
3559
|
+
const formSubmissionsCollectionSlug = getPropString10(
|
|
2686
3560
|
props,
|
|
2687
3561
|
"formSubmissionsCollectionSlug",
|
|
2688
3562
|
"form-submissions"
|
|
2689
3563
|
);
|
|
2690
|
-
const formUploadsCollectionSlug =
|
|
3564
|
+
const formUploadsCollectionSlug = getPropString10(props, "formUploadsCollectionSlug", "form-uploads");
|
|
2691
3565
|
const adminBasePath = useAdminBasePath();
|
|
2692
|
-
const formsViewPath = resolveAdminPath(adminBasePath, "/
|
|
3566
|
+
const formsViewPath = resolveAdminPath(adminBasePath, "/forms");
|
|
2693
3567
|
const rawFormsPath = resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`);
|
|
2694
3568
|
const rawSubmissionsPath = resolveAdminPath(
|
|
2695
3569
|
adminBasePath,
|
|
2696
3570
|
`/collections/${formSubmissionsCollectionSlug}`
|
|
2697
3571
|
);
|
|
2698
3572
|
const rawUploadsPath = resolveAdminPath(adminBasePath, `/collections/${formUploadsCollectionSlug}`);
|
|
2699
|
-
const [selectedFormID, setSelectedFormID] =
|
|
2700
|
-
const [forms, setForms] =
|
|
2701
|
-
const [submissions, setSubmissions] =
|
|
2702
|
-
const [formsLoading, setFormsLoading] =
|
|
2703
|
-
const [submissionsLoading, setSubmissionsLoading] =
|
|
2704
|
-
const [formsError, setFormsError] =
|
|
2705
|
-
const [submissionsError, setSubmissionsError] =
|
|
2706
|
-
const selectedForm =
|
|
3573
|
+
const [selectedFormID, setSelectedFormID] = useState13("");
|
|
3574
|
+
const [forms, setForms] = useState13([]);
|
|
3575
|
+
const [submissions, setSubmissions] = useState13([]);
|
|
3576
|
+
const [formsLoading, setFormsLoading] = useState13(true);
|
|
3577
|
+
const [submissionsLoading, setSubmissionsLoading] = useState13(false);
|
|
3578
|
+
const [formsError, setFormsError] = useState13(null);
|
|
3579
|
+
const [submissionsError, setSubmissionsError] = useState13(null);
|
|
3580
|
+
const selectedForm = useMemo7(
|
|
2707
3581
|
() => forms.find((form) => {
|
|
2708
3582
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
2709
3583
|
return selectedFormID.length > 0 && id === selectedFormID;
|
|
2710
3584
|
}) || null,
|
|
2711
3585
|
[forms, selectedFormID]
|
|
2712
3586
|
);
|
|
2713
|
-
|
|
3587
|
+
useEffect14(() => {
|
|
2714
3588
|
if (typeof window === "undefined") {
|
|
2715
3589
|
return;
|
|
2716
3590
|
}
|
|
@@ -2720,7 +3594,7 @@ function AdminStudioFormsView(props) {
|
|
|
2720
3594
|
setSelectedFormID(formID);
|
|
2721
3595
|
}
|
|
2722
3596
|
}, []);
|
|
2723
|
-
|
|
3597
|
+
useEffect14(() => {
|
|
2724
3598
|
if (!canReviewForms(user)) {
|
|
2725
3599
|
return;
|
|
2726
3600
|
}
|
|
@@ -2774,7 +3648,7 @@ function AdminStudioFormsView(props) {
|
|
|
2774
3648
|
cancelled = true;
|
|
2775
3649
|
};
|
|
2776
3650
|
}, [formsCollectionSlug, user]);
|
|
2777
|
-
|
|
3651
|
+
useEffect14(() => {
|
|
2778
3652
|
if (!selectedFormID || !canReviewForms(user)) {
|
|
2779
3653
|
setSubmissions([]);
|
|
2780
3654
|
return;
|
|
@@ -2818,7 +3692,7 @@ function AdminStudioFormsView(props) {
|
|
|
2818
3692
|
cancelled = true;
|
|
2819
3693
|
};
|
|
2820
3694
|
}, [formSubmissionsCollectionSlug, selectedFormID, user]);
|
|
2821
|
-
|
|
3695
|
+
useEffect14(() => {
|
|
2822
3696
|
if (typeof window === "undefined" || !selectedFormID) {
|
|
2823
3697
|
return;
|
|
2824
3698
|
}
|
|
@@ -2827,11 +3701,11 @@ function AdminStudioFormsView(props) {
|
|
|
2827
3701
|
window.history.replaceState({}, "", url.toString());
|
|
2828
3702
|
}, [selectedFormID]);
|
|
2829
3703
|
if (!canReviewForms(user)) {
|
|
2830
|
-
return /* @__PURE__ */
|
|
2831
|
-
/* @__PURE__ */
|
|
2832
|
-
/* @__PURE__ */
|
|
2833
|
-
/* @__PURE__ */
|
|
2834
|
-
] });
|
|
3704
|
+
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs19(Fragment7, { children: [
|
|
3705
|
+
/* @__PURE__ */ jsx20(SetStepNav9, { nav: [{ label: "Forms", url: formsViewPath }] }),
|
|
3706
|
+
/* @__PURE__ */ jsx20("h1", { style: { margin: 0 }, children: "Forms" }),
|
|
3707
|
+
/* @__PURE__ */ jsx20("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "You do not have access to this page." })
|
|
3708
|
+
] }) });
|
|
2835
3709
|
}
|
|
2836
3710
|
const selectedTitle = selectedForm && typeof selectedForm.title === "string" && selectedForm.title || "Forms";
|
|
2837
3711
|
const selectedSlug = selectedForm && typeof selectedForm.slug === "string" && selectedForm.slug || null;
|
|
@@ -2841,15 +3715,15 @@ function AdminStudioFormsView(props) {
|
|
|
2841
3715
|
const fields = step.fields;
|
|
2842
3716
|
return count + (Array.isArray(fields) ? fields.length : 0);
|
|
2843
3717
|
}, 0) : 0;
|
|
2844
|
-
return /* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
2847
|
-
/* @__PURE__ */
|
|
2848
|
-
/* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
3718
|
+
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs19(Fragment7, { children: [
|
|
3719
|
+
/* @__PURE__ */ jsx20(SetStepNav9, { nav: [{ label: "Forms", url: formsViewPath }] }),
|
|
3720
|
+
/* @__PURE__ */ jsxs19("div", { style: { alignItems: "flex-end", display: "flex", flexWrap: "wrap", gap: "0.75rem" }, children: [
|
|
3721
|
+
/* @__PURE__ */ jsxs19("div", { style: { flex: 1, minWidth: 240 }, children: [
|
|
3722
|
+
/* @__PURE__ */ jsx20("h1", { style: { margin: 0 }, children: "Forms" }),
|
|
3723
|
+
/* @__PURE__ */ jsx20("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Review your forms, responses, and any uploaded files in one place." })
|
|
2850
3724
|
] }),
|
|
2851
|
-
/* @__PURE__ */
|
|
2852
|
-
/* @__PURE__ */
|
|
3725
|
+
/* @__PURE__ */ jsxs19("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
|
|
3726
|
+
/* @__PURE__ */ jsx20(
|
|
2853
3727
|
"a",
|
|
2854
3728
|
{
|
|
2855
3729
|
href: rawFormsPath,
|
|
@@ -2864,7 +3738,7 @@ function AdminStudioFormsView(props) {
|
|
|
2864
3738
|
children: "Open Forms Collection"
|
|
2865
3739
|
}
|
|
2866
3740
|
),
|
|
2867
|
-
/* @__PURE__ */
|
|
3741
|
+
/* @__PURE__ */ jsx20(
|
|
2868
3742
|
"a",
|
|
2869
3743
|
{
|
|
2870
3744
|
href: rawSubmissionsPath,
|
|
@@ -2879,7 +3753,7 @@ function AdminStudioFormsView(props) {
|
|
|
2879
3753
|
children: "Open Submissions"
|
|
2880
3754
|
}
|
|
2881
3755
|
),
|
|
2882
|
-
/* @__PURE__ */
|
|
3756
|
+
/* @__PURE__ */ jsx20(
|
|
2883
3757
|
"a",
|
|
2884
3758
|
{
|
|
2885
3759
|
href: rawUploadsPath,
|
|
@@ -2896,7 +3770,7 @@ function AdminStudioFormsView(props) {
|
|
|
2896
3770
|
)
|
|
2897
3771
|
] })
|
|
2898
3772
|
] }),
|
|
2899
|
-
/* @__PURE__ */
|
|
3773
|
+
/* @__PURE__ */ jsxs19(
|
|
2900
3774
|
"div",
|
|
2901
3775
|
{
|
|
2902
3776
|
style: {
|
|
@@ -2906,11 +3780,11 @@ function AdminStudioFormsView(props) {
|
|
|
2906
3780
|
marginTop: "1rem"
|
|
2907
3781
|
},
|
|
2908
3782
|
children: [
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
formsLoading ? /* @__PURE__ */
|
|
2912
|
-
formsError ? /* @__PURE__ */
|
|
2913
|
-
!formsLoading && !formsError && forms.length === 0 ? /* @__PURE__ */
|
|
3783
|
+
/* @__PURE__ */ jsxs19("section", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
3784
|
+
/* @__PURE__ */ jsx20("div", { style: { fontSize: "0.82rem", fontWeight: 900, letterSpacing: "0.08em", textTransform: "uppercase" }, children: "Site forms" }),
|
|
3785
|
+
formsLoading ? /* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.85rem" }, children: "Loading forms\u2026" }) : null,
|
|
3786
|
+
formsError ? /* @__PURE__ */ jsx20("div", { style: { color: "crimson", marginTop: "0.85rem" }, children: formsError }) : null,
|
|
3787
|
+
!formsLoading && !formsError && forms.length === 0 ? /* @__PURE__ */ jsx20(
|
|
2914
3788
|
"div",
|
|
2915
3789
|
{
|
|
2916
3790
|
style: {
|
|
@@ -2923,13 +3797,13 @@ function AdminStudioFormsView(props) {
|
|
|
2923
3797
|
children: "No forms found."
|
|
2924
3798
|
}
|
|
2925
3799
|
) : null,
|
|
2926
|
-
/* @__PURE__ */
|
|
3800
|
+
/* @__PURE__ */ jsx20("div", { style: { display: "grid", gap: "0.55rem", marginTop: "0.85rem" }, children: forms.map((form) => {
|
|
2927
3801
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
2928
3802
|
if (!id) return null;
|
|
2929
3803
|
const title = typeof form.title === "string" ? form.title : "Untitled Form";
|
|
2930
3804
|
const slug = typeof form.slug === "string" ? form.slug : "";
|
|
2931
3805
|
const isSelected = id === selectedFormID;
|
|
2932
|
-
return /* @__PURE__ */
|
|
3806
|
+
return /* @__PURE__ */ jsxs19(
|
|
2933
3807
|
"button",
|
|
2934
3808
|
{
|
|
2935
3809
|
onClick: () => setSelectedFormID(id),
|
|
@@ -2943,8 +3817,8 @@ function AdminStudioFormsView(props) {
|
|
|
2943
3817
|
},
|
|
2944
3818
|
type: "button",
|
|
2945
3819
|
children: [
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
slug ? /* @__PURE__ */
|
|
3820
|
+
/* @__PURE__ */ jsx20("div", { style: { fontWeight: 900 }, children: title }),
|
|
3821
|
+
slug ? /* @__PURE__ */ jsx20(
|
|
2948
3822
|
"div",
|
|
2949
3823
|
{
|
|
2950
3824
|
style: {
|
|
@@ -2961,9 +3835,9 @@ function AdminStudioFormsView(props) {
|
|
|
2961
3835
|
);
|
|
2962
3836
|
}) })
|
|
2963
3837
|
] }),
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
2966
|
-
/* @__PURE__ */
|
|
3838
|
+
/* @__PURE__ */ jsxs19("section", { style: { display: "grid", gap: "1rem" }, children: [
|
|
3839
|
+
/* @__PURE__ */ jsxs19("div", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
3840
|
+
/* @__PURE__ */ jsxs19(
|
|
2967
3841
|
"div",
|
|
2968
3842
|
{
|
|
2969
3843
|
style: {
|
|
@@ -2974,8 +3848,8 @@ function AdminStudioFormsView(props) {
|
|
|
2974
3848
|
justifyContent: "space-between"
|
|
2975
3849
|
},
|
|
2976
3850
|
children: [
|
|
2977
|
-
/* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
3851
|
+
/* @__PURE__ */ jsxs19("div", { children: [
|
|
3852
|
+
/* @__PURE__ */ jsx20(
|
|
2979
3853
|
"div",
|
|
2980
3854
|
{
|
|
2981
3855
|
style: {
|
|
@@ -2988,10 +3862,10 @@ function AdminStudioFormsView(props) {
|
|
|
2988
3862
|
children: "Selected form"
|
|
2989
3863
|
}
|
|
2990
3864
|
),
|
|
2991
|
-
/* @__PURE__ */
|
|
2992
|
-
selectedSlug ? /* @__PURE__ */
|
|
3865
|
+
/* @__PURE__ */ jsx20("h2", { style: { margin: "0.2rem 0 0", fontSize: "1.45rem" }, children: selectedTitle }),
|
|
3866
|
+
selectedSlug ? /* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.2rem" }, children: selectedSlug }) : null
|
|
2993
3867
|
] }),
|
|
2994
|
-
selectedFormID ? /* @__PURE__ */
|
|
3868
|
+
selectedFormID ? /* @__PURE__ */ jsx20(
|
|
2995
3869
|
"a",
|
|
2996
3870
|
{
|
|
2997
3871
|
href: `${rawFormsPath}/${selectedFormID}`,
|
|
@@ -3009,7 +3883,7 @@ function AdminStudioFormsView(props) {
|
|
|
3009
3883
|
]
|
|
3010
3884
|
}
|
|
3011
3885
|
),
|
|
3012
|
-
selectedForm ? /* @__PURE__ */
|
|
3886
|
+
selectedForm ? /* @__PURE__ */ jsxs19(
|
|
3013
3887
|
"div",
|
|
3014
3888
|
{
|
|
3015
3889
|
style: {
|
|
@@ -3019,28 +3893,28 @@ function AdminStudioFormsView(props) {
|
|
|
3019
3893
|
marginTop: "1rem"
|
|
3020
3894
|
},
|
|
3021
3895
|
children: [
|
|
3022
|
-
/* @__PURE__ */
|
|
3023
|
-
/* @__PURE__ */
|
|
3024
|
-
/* @__PURE__ */
|
|
3896
|
+
/* @__PURE__ */ jsxs19("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
3897
|
+
/* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Steps" }),
|
|
3898
|
+
/* @__PURE__ */ jsx20("div", { style: { fontSize: "1.35rem", fontWeight: 900, marginTop: "0.2rem" }, children: selectedStepCount })
|
|
3025
3899
|
] }),
|
|
3026
|
-
/* @__PURE__ */
|
|
3027
|
-
/* @__PURE__ */
|
|
3028
|
-
/* @__PURE__ */
|
|
3900
|
+
/* @__PURE__ */ jsxs19("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
3901
|
+
/* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Fields" }),
|
|
3902
|
+
/* @__PURE__ */ jsx20("div", { style: { fontSize: "1.35rem", fontWeight: 900, marginTop: "0.2rem" }, children: selectedFieldCount })
|
|
3029
3903
|
] }),
|
|
3030
|
-
/* @__PURE__ */
|
|
3031
|
-
/* @__PURE__ */
|
|
3032
|
-
/* @__PURE__ */
|
|
3904
|
+
/* @__PURE__ */ jsxs19("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
3905
|
+
/* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Submit label" }),
|
|
3906
|
+
/* @__PURE__ */ jsx20("div", { style: { fontSize: "1rem", fontWeight: 900, marginTop: "0.2rem" }, children: typeof selectedForm.submitLabel === "string" && selectedForm.submitLabel.length > 0 ? selectedForm.submitLabel : "Submit" })
|
|
3033
3907
|
] }),
|
|
3034
|
-
/* @__PURE__ */
|
|
3035
|
-
/* @__PURE__ */
|
|
3036
|
-
/* @__PURE__ */
|
|
3908
|
+
/* @__PURE__ */ jsxs19("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
3909
|
+
/* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Updated" }),
|
|
3910
|
+
/* @__PURE__ */ jsx20("div", { style: { fontSize: "1rem", fontWeight: 900, marginTop: "0.2rem" }, children: formatDate(selectedForm.updatedAt) })
|
|
3037
3911
|
] })
|
|
3038
3912
|
]
|
|
3039
3913
|
}
|
|
3040
|
-
) : /* @__PURE__ */
|
|
3914
|
+
) : /* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", marginTop: "1rem" }, children: "Pick a form to review its responses." })
|
|
3041
3915
|
] }),
|
|
3042
|
-
/* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3916
|
+
/* @__PURE__ */ jsxs19("div", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
3917
|
+
/* @__PURE__ */ jsxs19(
|
|
3044
3918
|
"div",
|
|
3045
3919
|
{
|
|
3046
3920
|
style: {
|
|
@@ -3051,11 +3925,11 @@ function AdminStudioFormsView(props) {
|
|
|
3051
3925
|
justifyContent: "space-between"
|
|
3052
3926
|
},
|
|
3053
3927
|
children: [
|
|
3054
|
-
/* @__PURE__ */
|
|
3055
|
-
/* @__PURE__ */
|
|
3056
|
-
/* @__PURE__ */
|
|
3928
|
+
/* @__PURE__ */ jsxs19("div", { children: [
|
|
3929
|
+
/* @__PURE__ */ jsx20("h2", { style: { fontSize: "1.2rem", margin: 0 }, children: "Responses" }),
|
|
3930
|
+
/* @__PURE__ */ jsx20("p", { style: { color: "var(--theme-elevation-600)", margin: "0.25rem 0 0" }, children: "Latest submissions and any files they uploaded." })
|
|
3057
3931
|
] }),
|
|
3058
|
-
selectedFormID ? /* @__PURE__ */
|
|
3932
|
+
selectedFormID ? /* @__PURE__ */ jsx20(
|
|
3059
3933
|
"a",
|
|
3060
3934
|
{
|
|
3061
3935
|
href: rawSubmissionsPath,
|
|
@@ -3073,9 +3947,9 @@ function AdminStudioFormsView(props) {
|
|
|
3073
3947
|
]
|
|
3074
3948
|
}
|
|
3075
3949
|
),
|
|
3076
|
-
submissionsLoading ? /* @__PURE__ */
|
|
3077
|
-
submissionsError ? /* @__PURE__ */
|
|
3078
|
-
!submissionsLoading && !submissionsError && selectedFormID && submissions.length === 0 ? /* @__PURE__ */
|
|
3950
|
+
submissionsLoading ? /* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", marginTop: "1rem" }, children: "Loading responses\u2026" }) : null,
|
|
3951
|
+
submissionsError ? /* @__PURE__ */ jsx20("div", { style: { color: "crimson", marginTop: "1rem" }, children: submissionsError }) : null,
|
|
3952
|
+
!submissionsLoading && !submissionsError && selectedFormID && submissions.length === 0 ? /* @__PURE__ */ jsx20(
|
|
3079
3953
|
"div",
|
|
3080
3954
|
{
|
|
3081
3955
|
style: {
|
|
@@ -3088,7 +3962,7 @@ function AdminStudioFormsView(props) {
|
|
|
3088
3962
|
children: "No responses yet for this form."
|
|
3089
3963
|
}
|
|
3090
3964
|
) : null,
|
|
3091
|
-
/* @__PURE__ */
|
|
3965
|
+
/* @__PURE__ */ jsx20("div", { style: { display: "grid", gap: "0.9rem", marginTop: "1rem" }, children: submissions.map((submission) => {
|
|
3092
3966
|
const id = typeof submission.id === "string" || typeof submission.id === "number" ? String(submission.id) : "";
|
|
3093
3967
|
if (!id) return null;
|
|
3094
3968
|
const submissionData = submission.data;
|
|
@@ -3096,8 +3970,8 @@ function AdminStudioFormsView(props) {
|
|
|
3096
3970
|
const uploads = getUploads(submission.files);
|
|
3097
3971
|
const formSlug = getString(submission.formSlug);
|
|
3098
3972
|
const submissionFormID = getFormID(submission.form);
|
|
3099
|
-
return /* @__PURE__ */
|
|
3100
|
-
/* @__PURE__ */
|
|
3973
|
+
return /* @__PURE__ */ jsxs19("article", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
3974
|
+
/* @__PURE__ */ jsxs19(
|
|
3101
3975
|
"div",
|
|
3102
3976
|
{
|
|
3103
3977
|
style: {
|
|
@@ -3108,15 +3982,15 @@ function AdminStudioFormsView(props) {
|
|
|
3108
3982
|
justifyContent: "space-between"
|
|
3109
3983
|
},
|
|
3110
3984
|
children: [
|
|
3111
|
-
/* @__PURE__ */
|
|
3112
|
-
/* @__PURE__ */
|
|
3113
|
-
/* @__PURE__ */
|
|
3985
|
+
/* @__PURE__ */ jsxs19("div", { children: [
|
|
3986
|
+
/* @__PURE__ */ jsx20("div", { style: { fontWeight: 900 }, children: identity.name || identity.email || "Submission" }),
|
|
3987
|
+
/* @__PURE__ */ jsxs19("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.2rem" }, children: [
|
|
3114
3988
|
formatDate(submission.submittedAt),
|
|
3115
3989
|
formSlug ? ` \xB7 ${formSlug}` : ""
|
|
3116
3990
|
] })
|
|
3117
3991
|
] }),
|
|
3118
|
-
/* @__PURE__ */
|
|
3119
|
-
submissionFormID ? /* @__PURE__ */
|
|
3992
|
+
/* @__PURE__ */ jsxs19("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
|
|
3993
|
+
submissionFormID ? /* @__PURE__ */ jsx20(
|
|
3120
3994
|
"a",
|
|
3121
3995
|
{
|
|
3122
3996
|
href: `${rawFormsPath}/${submissionFormID}`,
|
|
@@ -3132,7 +4006,7 @@ function AdminStudioFormsView(props) {
|
|
|
3132
4006
|
children: "Form"
|
|
3133
4007
|
}
|
|
3134
4008
|
) : null,
|
|
3135
|
-
/* @__PURE__ */
|
|
4009
|
+
/* @__PURE__ */ jsx20(
|
|
3136
4010
|
"a",
|
|
3137
4011
|
{
|
|
3138
4012
|
href: `${rawSubmissionsPath}/${id}`,
|
|
@@ -3152,7 +4026,7 @@ function AdminStudioFormsView(props) {
|
|
|
3152
4026
|
]
|
|
3153
4027
|
}
|
|
3154
4028
|
),
|
|
3155
|
-
identity.name || identity.email ? /* @__PURE__ */
|
|
4029
|
+
identity.name || identity.email ? /* @__PURE__ */ jsxs19(
|
|
3156
4030
|
"div",
|
|
3157
4031
|
{
|
|
3158
4032
|
style: {
|
|
@@ -3162,19 +4036,19 @@ function AdminStudioFormsView(props) {
|
|
|
3162
4036
|
marginTop: "0.9rem"
|
|
3163
4037
|
},
|
|
3164
4038
|
children: [
|
|
3165
|
-
identity.name ? /* @__PURE__ */
|
|
3166
|
-
/* @__PURE__ */
|
|
3167
|
-
/* @__PURE__ */
|
|
4039
|
+
identity.name ? /* @__PURE__ */ jsxs19("div", { style: { ...panelStyle, padding: "0.75rem 0.85rem" }, children: [
|
|
4040
|
+
/* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Name" }),
|
|
4041
|
+
/* @__PURE__ */ jsx20("div", { style: { fontWeight: 900, marginTop: "0.2rem" }, children: identity.name })
|
|
3168
4042
|
] }) : null,
|
|
3169
|
-
identity.email ? /* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
4043
|
+
identity.email ? /* @__PURE__ */ jsxs19("div", { style: { ...panelStyle, padding: "0.75rem 0.85rem" }, children: [
|
|
4044
|
+
/* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Email" }),
|
|
4045
|
+
/* @__PURE__ */ jsx20("div", { style: { fontWeight: 900, marginTop: "0.2rem" }, children: identity.email })
|
|
3172
4046
|
] }) : null
|
|
3173
4047
|
]
|
|
3174
4048
|
}
|
|
3175
4049
|
) : null,
|
|
3176
|
-
/* @__PURE__ */
|
|
3177
|
-
/* @__PURE__ */
|
|
4050
|
+
/* @__PURE__ */ jsxs19("div", { style: { marginTop: "1rem" }, children: [
|
|
4051
|
+
/* @__PURE__ */ jsx20(
|
|
3178
4052
|
"div",
|
|
3179
4053
|
{
|
|
3180
4054
|
style: {
|
|
@@ -3188,7 +4062,7 @@ function AdminStudioFormsView(props) {
|
|
|
3188
4062
|
children: "Response data"
|
|
3189
4063
|
}
|
|
3190
4064
|
),
|
|
3191
|
-
/* @__PURE__ */
|
|
4065
|
+
/* @__PURE__ */ jsx20("div", { style: { display: "grid", gap: "0.55rem" }, children: getFieldEntries(submissionData).map(([key, value]) => /* @__PURE__ */ jsxs19(
|
|
3192
4066
|
"div",
|
|
3193
4067
|
{
|
|
3194
4068
|
style: {
|
|
@@ -3199,7 +4073,7 @@ function AdminStudioFormsView(props) {
|
|
|
3199
4073
|
padding: "0.8rem 0.9rem"
|
|
3200
4074
|
},
|
|
3201
4075
|
children: [
|
|
3202
|
-
/* @__PURE__ */
|
|
4076
|
+
/* @__PURE__ */ jsx20(
|
|
3203
4077
|
"div",
|
|
3204
4078
|
{
|
|
3205
4079
|
style: {
|
|
@@ -3211,14 +4085,14 @@ function AdminStudioFormsView(props) {
|
|
|
3211
4085
|
children: key
|
|
3212
4086
|
}
|
|
3213
4087
|
),
|
|
3214
|
-
/* @__PURE__ */
|
|
4088
|
+
/* @__PURE__ */ jsx20("div", { style: { overflowWrap: "anywhere" }, children: renderValue(value) })
|
|
3215
4089
|
]
|
|
3216
4090
|
},
|
|
3217
4091
|
key
|
|
3218
4092
|
)) })
|
|
3219
4093
|
] }),
|
|
3220
|
-
/* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
4094
|
+
/* @__PURE__ */ jsxs19("div", { style: { marginTop: "1rem" }, children: [
|
|
4095
|
+
/* @__PURE__ */ jsx20(
|
|
3222
4096
|
"div",
|
|
3223
4097
|
{
|
|
3224
4098
|
style: {
|
|
@@ -3232,7 +4106,7 @@ function AdminStudioFormsView(props) {
|
|
|
3232
4106
|
children: "Uploads"
|
|
3233
4107
|
}
|
|
3234
4108
|
),
|
|
3235
|
-
uploads.length === 0 ? /* @__PURE__ */
|
|
4109
|
+
uploads.length === 0 ? /* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)" }, children: "No files attached." }) : /* @__PURE__ */ jsx20("div", { style: { display: "grid", gap: "0.55rem" }, children: uploads.map((upload, index) => {
|
|
3236
4110
|
const uploadID = typeof upload.id === "string" || typeof upload.id === "number" ? String(upload.id) : "";
|
|
3237
4111
|
if (!uploadID) return null;
|
|
3238
4112
|
const label = typeof upload.filename === "string" && upload.filename || `Upload ${index + 1}`;
|
|
@@ -3240,7 +4114,7 @@ function AdminStudioFormsView(props) {
|
|
|
3240
4114
|
typeof upload.mimeType === "string" ? upload.mimeType : null,
|
|
3241
4115
|
formatFileSize(upload.filesize)
|
|
3242
4116
|
].filter(Boolean);
|
|
3243
|
-
return /* @__PURE__ */
|
|
4117
|
+
return /* @__PURE__ */ jsxs19(
|
|
3244
4118
|
"a",
|
|
3245
4119
|
{
|
|
3246
4120
|
href: `${rawUploadsPath}/${uploadID}`,
|
|
@@ -3254,9 +4128,9 @@ function AdminStudioFormsView(props) {
|
|
|
3254
4128
|
textDecoration: "none"
|
|
3255
4129
|
},
|
|
3256
4130
|
children: [
|
|
3257
|
-
/* @__PURE__ */
|
|
3258
|
-
/* @__PURE__ */
|
|
3259
|
-
meta.length > 0 ? /* @__PURE__ */
|
|
4131
|
+
/* @__PURE__ */ jsxs19("div", { children: [
|
|
4132
|
+
/* @__PURE__ */ jsx20("div", { style: { fontWeight: 900 }, children: label }),
|
|
4133
|
+
meta.length > 0 ? /* @__PURE__ */ jsx20(
|
|
3260
4134
|
"div",
|
|
3261
4135
|
{
|
|
3262
4136
|
style: {
|
|
@@ -3268,7 +4142,7 @@ function AdminStudioFormsView(props) {
|
|
|
3268
4142
|
}
|
|
3269
4143
|
) : null
|
|
3270
4144
|
] }),
|
|
3271
|
-
/* @__PURE__ */
|
|
4145
|
+
/* @__PURE__ */ jsx20("div", { style: { color: "var(--theme-elevation-600)", fontWeight: 800 }, children: "Open" })
|
|
3272
4146
|
]
|
|
3273
4147
|
},
|
|
3274
4148
|
uploadID
|
|
@@ -3282,18 +4156,18 @@ function AdminStudioFormsView(props) {
|
|
|
3282
4156
|
]
|
|
3283
4157
|
}
|
|
3284
4158
|
)
|
|
3285
|
-
] });
|
|
4159
|
+
] }) });
|
|
3286
4160
|
}
|
|
3287
4161
|
|
|
3288
4162
|
// src/admin/components/studio/AdminStudioToolsView.tsx
|
|
3289
|
-
import { SetStepNav as
|
|
3290
|
-
import { Fragment as Fragment8, jsx as
|
|
4163
|
+
import { SetStepNav as SetStepNav10, useAuth as useAuth5 } from "@payloadcms/ui";
|
|
4164
|
+
import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3291
4165
|
var isAdmin4 = (user) => {
|
|
3292
4166
|
if (!user || typeof user !== "object") return false;
|
|
3293
4167
|
const role = user.role;
|
|
3294
4168
|
return typeof role === "string" && role === "admin";
|
|
3295
4169
|
};
|
|
3296
|
-
var
|
|
4170
|
+
var getPropString11 = (props, key, fallback) => {
|
|
3297
4171
|
if (!props || typeof props !== "object") return fallback;
|
|
3298
4172
|
const direct = props[key];
|
|
3299
4173
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3309,14 +4183,14 @@ function AdminStudioToolsView(props) {
|
|
|
3309
4183
|
const adminBasePath = useAdminBasePath();
|
|
3310
4184
|
const toolsPath = resolveAdminPath(adminBasePath, "/tools");
|
|
3311
4185
|
if (!isAdmin4(user)) {
|
|
3312
|
-
return /* @__PURE__ */
|
|
3313
|
-
/* @__PURE__ */
|
|
3314
|
-
/* @__PURE__ */
|
|
3315
|
-
/* @__PURE__ */
|
|
3316
|
-
] });
|
|
4186
|
+
return /* @__PURE__ */ jsx21(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs20(Fragment8, { children: [
|
|
4187
|
+
/* @__PURE__ */ jsx21(SetStepNav10, { nav: [{ label: "Admin Tools", url: toolsPath }] }),
|
|
4188
|
+
/* @__PURE__ */ jsx21("h1", { style: { margin: 0 }, children: "Admin Tools" }),
|
|
4189
|
+
/* @__PURE__ */ jsx21("p", { style: { color: "var(--theme-elevation-600)" }, children: "You do not have access to this page." })
|
|
4190
|
+
] }) });
|
|
3317
4191
|
}
|
|
3318
|
-
const pagesCollectionSlug =
|
|
3319
|
-
const mediaCollectionSlug =
|
|
4192
|
+
const pagesCollectionSlug = getPropString11(props, "pagesCollectionSlug", "pages");
|
|
4193
|
+
const mediaCollectionSlug = getPropString11(props, "mediaCollectionSlug", "media");
|
|
3320
4194
|
const links = [
|
|
3321
4195
|
{ href: resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`), label: "Raw Pages Collection" },
|
|
3322
4196
|
{ href: resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`), label: "Raw Media Collection" },
|
|
@@ -3325,11 +4199,11 @@ function AdminStudioToolsView(props) {
|
|
|
3325
4199
|
{ href: resolveAdminPath(adminBasePath, "/globals/footer"), label: "Raw Footer Global" },
|
|
3326
4200
|
{ href: resolveAdminPath(adminBasePath, "/collections/users"), label: "Users / Roles" }
|
|
3327
4201
|
];
|
|
3328
|
-
return /* @__PURE__ */
|
|
3329
|
-
/* @__PURE__ */
|
|
3330
|
-
/* @__PURE__ */
|
|
3331
|
-
/* @__PURE__ */
|
|
3332
|
-
/* @__PURE__ */
|
|
4202
|
+
return /* @__PURE__ */ jsx21(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs20(Fragment8, { children: [
|
|
4203
|
+
/* @__PURE__ */ jsx21(SetStepNav10, { nav: [{ label: "Admin Tools", url: toolsPath }] }),
|
|
4204
|
+
/* @__PURE__ */ jsx21("h1", { style: { margin: 0 }, children: "Admin Tools" }),
|
|
4205
|
+
/* @__PURE__ */ jsx21("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Hidden fallback links for administrators." }),
|
|
4206
|
+
/* @__PURE__ */ jsx21("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: links.map((link) => /* @__PURE__ */ jsxs20(
|
|
3333
4207
|
"a",
|
|
3334
4208
|
{
|
|
3335
4209
|
href: link.href,
|
|
@@ -3342,25 +4216,25 @@ function AdminStudioToolsView(props) {
|
|
|
3342
4216
|
textDecoration: "none"
|
|
3343
4217
|
},
|
|
3344
4218
|
children: [
|
|
3345
|
-
/* @__PURE__ */
|
|
3346
|
-
/* @__PURE__ */
|
|
4219
|
+
/* @__PURE__ */ jsx21("div", { style: { fontWeight: 900 }, children: link.label }),
|
|
4220
|
+
/* @__PURE__ */ jsx21("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: link.href })
|
|
3347
4221
|
]
|
|
3348
4222
|
},
|
|
3349
4223
|
link.href
|
|
3350
4224
|
)) })
|
|
3351
|
-
] });
|
|
4225
|
+
] }) });
|
|
3352
4226
|
}
|
|
3353
4227
|
|
|
3354
4228
|
// src/admin/components/studio/OpenInStudioMenuItem.tsx
|
|
3355
4229
|
import { useDocumentInfo } from "@payloadcms/ui";
|
|
3356
|
-
import { jsx as
|
|
3357
|
-
function OpenInStudioMenuItem({ pagesPathBase = "/
|
|
4230
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
4231
|
+
function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
3358
4232
|
const documentInfo = useDocumentInfo();
|
|
3359
4233
|
const id = documentInfo?.id;
|
|
3360
4234
|
if (!id) {
|
|
3361
4235
|
return null;
|
|
3362
4236
|
}
|
|
3363
|
-
return /* @__PURE__ */
|
|
4237
|
+
return /* @__PURE__ */ jsx22(
|
|
3364
4238
|
"a",
|
|
3365
4239
|
{
|
|
3366
4240
|
href: `${pagesPathBase}/${id}`,
|
|
@@ -3379,19 +4253,19 @@ function OpenInStudioMenuItem({ pagesPathBase = "/studio/pages" }) {
|
|
|
3379
4253
|
}
|
|
3380
4254
|
|
|
3381
4255
|
// src/admin/components/studio/PageEditRedirectToStudio.tsx
|
|
3382
|
-
import { useEffect as
|
|
4256
|
+
import { useEffect as useEffect15 } from "react";
|
|
3383
4257
|
import { useDocumentInfo as useDocumentInfo2 } from "@payloadcms/ui";
|
|
3384
|
-
import { jsx as
|
|
3385
|
-
function PageEditRedirectToStudio({ pagesPathBase = "/
|
|
4258
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4259
|
+
function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
3386
4260
|
const documentInfo = useDocumentInfo2();
|
|
3387
4261
|
const id = documentInfo?.id;
|
|
3388
|
-
|
|
4262
|
+
useEffect15(() => {
|
|
3389
4263
|
if (!id) {
|
|
3390
4264
|
return;
|
|
3391
4265
|
}
|
|
3392
4266
|
window.location.replace(`${pagesPathBase}/${id}`);
|
|
3393
4267
|
}, [id, pagesPathBase]);
|
|
3394
|
-
return /* @__PURE__ */
|
|
4268
|
+
return /* @__PURE__ */ jsxs21(
|
|
3395
4269
|
"div",
|
|
3396
4270
|
{
|
|
3397
4271
|
style: {
|
|
@@ -3403,49 +4277,55 @@ function PageEditRedirectToStudio({ pagesPathBase = "/studio/pages" }) {
|
|
|
3403
4277
|
minHeight: "50vh"
|
|
3404
4278
|
},
|
|
3405
4279
|
children: [
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3408
|
-
id ? /* @__PURE__ */
|
|
4280
|
+
/* @__PURE__ */ jsx23("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
|
|
4281
|
+
/* @__PURE__ */ jsx23("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
|
|
4282
|
+
id ? /* @__PURE__ */ jsx23("a", { href: `${pagesPathBase}/${id}`, children: "Continue to Editor" }) : /* @__PURE__ */ jsx23("a", { href: pagesPathBase, children: "Open Pages" })
|
|
3409
4283
|
]
|
|
3410
4284
|
}
|
|
3411
4285
|
);
|
|
3412
4286
|
}
|
|
3413
4287
|
|
|
3414
4288
|
// src/admin/components/studio/StudioBackBreadcrumb.tsx
|
|
3415
|
-
import { useEffect as
|
|
3416
|
-
import { SetStepNav as
|
|
3417
|
-
import { jsx as
|
|
4289
|
+
import { useEffect as useEffect16, useState as useState14 } from "react";
|
|
4290
|
+
import { SetStepNav as SetStepNav11 } from "@payloadcms/ui";
|
|
4291
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3418
4292
|
var toTitle = (slug) => slug.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
3419
4293
|
var buildNav = (pathname, adminBasePath) => {
|
|
3420
4294
|
if (pathname.includes("/globals/")) {
|
|
3421
4295
|
const slug = pathname.split("/globals/")[1]?.split("/")[0] || "";
|
|
3422
4296
|
const currentLabel = slug === "site-settings" ? "Website Settings" : toTitle(slug) || "Global";
|
|
3423
4297
|
return [
|
|
3424
|
-
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/
|
|
4298
|
+
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/globals") },
|
|
3425
4299
|
{ label: currentLabel }
|
|
3426
4300
|
];
|
|
3427
4301
|
}
|
|
3428
|
-
if (pathname.includes("/
|
|
4302
|
+
if (pathname.includes("/contact-form")) {
|
|
3429
4303
|
return [
|
|
3430
|
-
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/
|
|
4304
|
+
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/globals") },
|
|
3431
4305
|
{ label: "Contact Form" }
|
|
3432
4306
|
];
|
|
3433
4307
|
}
|
|
3434
4308
|
if (pathname.includes("/collections/pages") || pathname.includes("/pages/")) {
|
|
3435
4309
|
return [
|
|
3436
|
-
{ label: "Pages", url: resolveAdminPath(adminBasePath, "/
|
|
4310
|
+
{ label: "Pages", url: resolveAdminPath(adminBasePath, "/pages") },
|
|
3437
4311
|
{ label: "Page" }
|
|
3438
4312
|
];
|
|
3439
4313
|
}
|
|
4314
|
+
if (pathname.includes("/collections/forms") || pathname.includes("/collections/form-submissions") || pathname.includes("/collections/form-uploads")) {
|
|
4315
|
+
return [
|
|
4316
|
+
{ label: "Forms", url: resolveAdminPath(adminBasePath, "/forms") },
|
|
4317
|
+
{ label: "Form" }
|
|
4318
|
+
];
|
|
4319
|
+
}
|
|
3440
4320
|
if (pathname.includes("/collections/media")) {
|
|
3441
4321
|
return [
|
|
3442
|
-
{ label: "Media", url: resolveAdminPath(adminBasePath, "/
|
|
4322
|
+
{ label: "Media", url: resolveAdminPath(adminBasePath, "/media") },
|
|
3443
4323
|
{ label: "Media Item" }
|
|
3444
4324
|
];
|
|
3445
4325
|
}
|
|
3446
4326
|
if (pathname.includes("/tools") || pathname.includes("/collections/users")) {
|
|
3447
4327
|
return [
|
|
3448
|
-
{ label: "Admin Tools", url: resolveAdminPath(adminBasePath, "/
|
|
4328
|
+
{ label: "Admin Tools", url: resolveAdminPath(adminBasePath, "/tools") },
|
|
3449
4329
|
{ label: "Tool" }
|
|
3450
4330
|
];
|
|
3451
4331
|
}
|
|
@@ -3453,8 +4333,8 @@ var buildNav = (pathname, adminBasePath) => {
|
|
|
3453
4333
|
};
|
|
3454
4334
|
function StudioBackBreadcrumb() {
|
|
3455
4335
|
const adminBasePath = useAdminBasePath();
|
|
3456
|
-
const [pathname, setPathname] =
|
|
3457
|
-
|
|
4336
|
+
const [pathname, setPathname] = useState14("");
|
|
4337
|
+
useEffect16(() => {
|
|
3458
4338
|
const update = () => setPathname(window.location.pathname);
|
|
3459
4339
|
update();
|
|
3460
4340
|
window.addEventListener("popstate", update);
|
|
@@ -3462,13 +4342,13 @@ function StudioBackBreadcrumb() {
|
|
|
3462
4342
|
}, []);
|
|
3463
4343
|
const nav = buildNav(pathname, adminBasePath);
|
|
3464
4344
|
if (!nav) return null;
|
|
3465
|
-
return /* @__PURE__ */
|
|
4345
|
+
return /* @__PURE__ */ jsx24(SetStepNav11, { nav });
|
|
3466
4346
|
}
|
|
3467
4347
|
|
|
3468
4348
|
// src/admin/components/studio/StudioContactFormRedirect.tsx
|
|
3469
|
-
import { useEffect as
|
|
3470
|
-
import { jsx as
|
|
3471
|
-
var
|
|
4349
|
+
import { useEffect as useEffect17 } from "react";
|
|
4350
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4351
|
+
var getPropString12 = (props, key, fallback) => {
|
|
3472
4352
|
if (!props || typeof props !== "object") return fallback;
|
|
3473
4353
|
const direct = props[key];
|
|
3474
4354
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3481,13 +4361,13 @@ var getPropString10 = (props, key, fallback) => {
|
|
|
3481
4361
|
};
|
|
3482
4362
|
function StudioContactFormRedirect(props) {
|
|
3483
4363
|
const adminBasePath = useAdminBasePath();
|
|
3484
|
-
const studioContactFormPath =
|
|
4364
|
+
const studioContactFormPath = getPropString12(props, "studioContactFormPath", "/contact-form");
|
|
3485
4365
|
const targetPath = resolveAdminPath(adminBasePath, studioContactFormPath);
|
|
3486
|
-
|
|
4366
|
+
useEffect17(() => {
|
|
3487
4367
|
if (window.location.pathname === targetPath) return;
|
|
3488
4368
|
window.location.replace(targetPath);
|
|
3489
4369
|
}, [targetPath]);
|
|
3490
|
-
return /* @__PURE__ */
|
|
4370
|
+
return /* @__PURE__ */ jsxs22(
|
|
3491
4371
|
"div",
|
|
3492
4372
|
{
|
|
3493
4373
|
style: {
|
|
@@ -3500,8 +4380,8 @@ function StudioContactFormRedirect(props) {
|
|
|
3500
4380
|
minHeight: "40vh"
|
|
3501
4381
|
},
|
|
3502
4382
|
children: [
|
|
3503
|
-
/* @__PURE__ */
|
|
3504
|
-
/* @__PURE__ */
|
|
4383
|
+
/* @__PURE__ */ jsx25("h2", { style: { margin: 0 }, children: "Opening Contact Form Editor..." }),
|
|
4384
|
+
/* @__PURE__ */ jsx25("a", { href: targetPath, children: "Continue" })
|
|
3505
4385
|
]
|
|
3506
4386
|
}
|
|
3507
4387
|
);
|
|
@@ -3509,8 +4389,10 @@ function StudioContactFormRedirect(props) {
|
|
|
3509
4389
|
export {
|
|
3510
4390
|
AdminStudioContactFormView,
|
|
3511
4391
|
AdminStudioDashboard,
|
|
4392
|
+
AdminStudioFooterGlobalView,
|
|
3512
4393
|
AdminStudioFormsView,
|
|
3513
4394
|
AdminStudioGlobalsView,
|
|
4395
|
+
AdminStudioHeaderGlobalView,
|
|
3514
4396
|
AdminStudioMediaView,
|
|
3515
4397
|
AdminStudioNav,
|
|
3516
4398
|
AdminStudioPageEditView,
|