@orion-studios/payload-studio 0.5.0-beta.112 → 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.js
CHANGED
|
@@ -490,7 +490,7 @@ function OrionRowActions(props) {
|
|
|
490
490
|
hasMaxRows,
|
|
491
491
|
isSortable,
|
|
492
492
|
labels,
|
|
493
|
-
moveRow,
|
|
493
|
+
moveRow: moveRow2,
|
|
494
494
|
pasteRow,
|
|
495
495
|
removeRow,
|
|
496
496
|
rowCount,
|
|
@@ -531,7 +531,7 @@ function OrionRowActions(props) {
|
|
|
531
531
|
hasMaxRows,
|
|
532
532
|
index: rowIndex,
|
|
533
533
|
isSortable,
|
|
534
|
-
moveRow,
|
|
534
|
+
moveRow: moveRow2,
|
|
535
535
|
pasteRow,
|
|
536
536
|
removeRow,
|
|
537
537
|
rowCount
|
|
@@ -556,7 +556,7 @@ function OrionBlockRow(props) {
|
|
|
556
556
|
Label,
|
|
557
557
|
labels,
|
|
558
558
|
listeners,
|
|
559
|
-
moveRow,
|
|
559
|
+
moveRow: moveRow2,
|
|
560
560
|
parentPath,
|
|
561
561
|
pasteRow,
|
|
562
562
|
path,
|
|
@@ -613,7 +613,7 @@ function OrionBlockRow(props) {
|
|
|
613
613
|
hasMaxRows,
|
|
614
614
|
isSortable,
|
|
615
615
|
labels,
|
|
616
|
-
moveRow,
|
|
616
|
+
moveRow: moveRow2,
|
|
617
617
|
pasteRow,
|
|
618
618
|
removeRow,
|
|
619
619
|
rowCount,
|
|
@@ -859,7 +859,7 @@ var init_OrionBlocksFieldImpl = __esm({
|
|
|
859
859
|
},
|
|
860
860
|
[removeFieldRow, safePath]
|
|
861
861
|
);
|
|
862
|
-
const
|
|
862
|
+
const moveRow2 = (0, import_react9.useCallback)(
|
|
863
863
|
(moveFromIndex, moveToIndex) => {
|
|
864
864
|
moveFieldRow({
|
|
865
865
|
moveFromIndex,
|
|
@@ -1057,7 +1057,7 @@ var init_OrionBlocksFieldImpl = __esm({
|
|
|
1057
1057
|
{
|
|
1058
1058
|
className: `${baseClass}__rows`,
|
|
1059
1059
|
ids: rows.map((row) => row.id),
|
|
1060
|
-
onDragEnd: ({ moveFromIndex, moveToIndex }) =>
|
|
1060
|
+
onDragEnd: ({ moveFromIndex, moveToIndex }) => moveRow2(moveFromIndex, moveToIndex),
|
|
1061
1061
|
children: [
|
|
1062
1062
|
rows.map((row, index) => {
|
|
1063
1063
|
const blockType = row.blockType;
|
|
@@ -1084,7 +1084,7 @@ var init_OrionBlocksFieldImpl = __esm({
|
|
|
1084
1084
|
isSortable,
|
|
1085
1085
|
Label: rows[index]?.customComponents?.RowLabel,
|
|
1086
1086
|
labels,
|
|
1087
|
-
moveRow,
|
|
1087
|
+
moveRow: moveRow2,
|
|
1088
1088
|
parentPath: safePath,
|
|
1089
1089
|
pasteRow,
|
|
1090
1090
|
path: rowPath,
|
|
@@ -1158,8 +1158,10 @@ var client_exports = {};
|
|
|
1158
1158
|
__export(client_exports, {
|
|
1159
1159
|
AdminStudioContactFormView: () => AdminStudioContactFormView,
|
|
1160
1160
|
AdminStudioDashboard: () => AdminStudioDashboard,
|
|
1161
|
+
AdminStudioFooterGlobalView: () => AdminStudioFooterGlobalView,
|
|
1161
1162
|
AdminStudioFormsView: () => AdminStudioFormsView,
|
|
1162
1163
|
AdminStudioGlobalsView: () => AdminStudioGlobalsView,
|
|
1164
|
+
AdminStudioHeaderGlobalView: () => AdminStudioHeaderGlobalView,
|
|
1163
1165
|
AdminStudioMediaView: () => AdminStudioMediaView,
|
|
1164
1166
|
AdminStudioNav: () => AdminStudioNav,
|
|
1165
1167
|
AdminStudioPageEditView: () => AdminStudioPageEditView,
|
|
@@ -2279,7 +2281,7 @@ function WelcomeHeader({
|
|
|
2279
2281
|
}
|
|
2280
2282
|
|
|
2281
2283
|
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
2282
|
-
var
|
|
2284
|
+
var import_ui4 = require("@payloadcms/ui");
|
|
2283
2285
|
|
|
2284
2286
|
// src/shared/studioSections.ts
|
|
2285
2287
|
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
@@ -2373,10 +2375,10 @@ var detectAdminBasePath = (pathname, fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
|
2373
2375
|
const normalizedPathname = normalizePath(pathname);
|
|
2374
2376
|
const normalizedFallback = normalizeAdminBasePath(fallback);
|
|
2375
2377
|
const markers = [
|
|
2376
|
-
"/
|
|
2377
|
-
"/studio-globals",
|
|
2378
|
+
"/contact-form",
|
|
2378
2379
|
"/collections/",
|
|
2379
2380
|
"/globals/",
|
|
2381
|
+
"/forms",
|
|
2380
2382
|
"/pages/",
|
|
2381
2383
|
"/tools",
|
|
2382
2384
|
"/media",
|
|
@@ -2431,109 +2433,66 @@ var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
|
2431
2433
|
return adminBasePath;
|
|
2432
2434
|
};
|
|
2433
2435
|
|
|
2434
|
-
// src/admin/components/studio/
|
|
2435
|
-
var
|
|
2436
|
-
var cardStyle = {
|
|
2437
|
-
background: "var(--theme-elevation-0)",
|
|
2438
|
-
border: "1px solid var(--theme-elevation-150)",
|
|
2439
|
-
borderRadius: 16,
|
|
2440
|
-
color: "inherit",
|
|
2441
|
-
padding: "1rem",
|
|
2442
|
-
textDecoration: "none"
|
|
2443
|
-
};
|
|
2444
|
-
var getPropString = (props, key, fallback) => {
|
|
2445
|
-
if (!props || typeof props !== "object") return fallback;
|
|
2446
|
-
const direct = props[key];
|
|
2447
|
-
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
2448
|
-
const clientProps = props.clientProps;
|
|
2449
|
-
if (clientProps && typeof clientProps === "object") {
|
|
2450
|
-
const nested = clientProps[key];
|
|
2451
|
-
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
2452
|
-
}
|
|
2453
|
-
return fallback;
|
|
2454
|
-
};
|
|
2455
|
-
var getPropBoolean = (props, key, fallback) => {
|
|
2456
|
-
if (!props || typeof props !== "object") return fallback;
|
|
2457
|
-
const direct = props[key];
|
|
2458
|
-
if (typeof direct === "boolean") return direct;
|
|
2459
|
-
const clientProps = props.clientProps;
|
|
2460
|
-
if (clientProps && typeof clientProps === "object") {
|
|
2461
|
-
const nested = clientProps[key];
|
|
2462
|
-
if (typeof nested === "boolean") return nested;
|
|
2463
|
-
}
|
|
2464
|
-
return fallback;
|
|
2465
|
-
};
|
|
2466
|
-
var getPropSections = (props, key) => {
|
|
2467
|
-
if (!props || typeof props !== "object") return [];
|
|
2468
|
-
const direct = resolveStudioSections(props[key]);
|
|
2469
|
-
if (direct.length > 0) return direct;
|
|
2470
|
-
const clientProps = props.clientProps;
|
|
2471
|
-
if (clientProps && typeof clientProps === "object") {
|
|
2472
|
-
return resolveStudioSections(clientProps[key]);
|
|
2473
|
-
}
|
|
2474
|
-
return [];
|
|
2475
|
-
};
|
|
2476
|
-
function AdminStudioDashboard(props) {
|
|
2477
|
-
const formsEnabled = getPropBoolean(props, "formsEnabled", false);
|
|
2478
|
-
const pagesCollectionSlug = getPropString(props, "pagesCollectionSlug", "pages");
|
|
2479
|
-
const mediaCollectionSlug = getPropString(props, "mediaCollectionSlug", "media");
|
|
2480
|
-
const globalsBasePath = getPropString(props, "globalsBasePath", "/studio-globals");
|
|
2481
|
-
const sections = getPropSections(props, "sections");
|
|
2482
|
-
const adminBasePath = useAdminBasePath();
|
|
2483
|
-
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2484
|
-
const formsPath = resolveAdminPath(adminBasePath, "/studio-forms");
|
|
2485
|
-
const pagesPath = resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`);
|
|
2486
|
-
const mediaPath = resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`);
|
|
2487
|
-
const extensionCards = sections.filter((section) => section.card).map((section) => ({
|
|
2488
|
-
href: resolveAdminPath(adminBasePath, section.href),
|
|
2489
|
-
title: section.card?.title || section.label,
|
|
2490
|
-
description: section.card?.description || ""
|
|
2491
|
-
}));
|
|
2492
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: "1.2rem 1.2rem 2.5rem" }, children: [
|
|
2493
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui3.SetStepNav, { nav: [{ label: "Dashboard", url: adminBasePath }] }),
|
|
2494
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { style: { fontSize: "1.6rem", margin: 0 }, children: "Studio" }),
|
|
2495
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Pick what you want to edit." }),
|
|
2496
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2497
|
-
"div",
|
|
2498
|
-
{
|
|
2499
|
-
style: {
|
|
2500
|
-
display: "grid",
|
|
2501
|
-
gap: "0.85rem",
|
|
2502
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
|
|
2503
|
-
marginTop: "1.1rem"
|
|
2504
|
-
},
|
|
2505
|
-
children: [
|
|
2506
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("a", { href: pagesPath, style: cardStyle, children: [
|
|
2507
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontWeight: 900 }, children: "Pages" }),
|
|
2508
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Edit your site pages with the custom editor." })
|
|
2509
|
-
] }),
|
|
2510
|
-
formsEnabled ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("a", { href: formsPath, style: cardStyle, children: [
|
|
2511
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontWeight: 900 }, children: "Forms" }),
|
|
2512
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Review forms, submissions, and uploaded files." })
|
|
2513
|
-
] }) : null,
|
|
2514
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("a", { href: resolvedGlobalsBasePath, style: cardStyle, children: [
|
|
2515
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontWeight: 900 }, children: "Globals" }),
|
|
2516
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Site settings, header, footer." })
|
|
2517
|
-
] }),
|
|
2518
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("a", { href: mediaPath, style: cardStyle, children: [
|
|
2519
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontWeight: 900 }, children: "Media" }),
|
|
2520
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Upload and manage images and files." })
|
|
2521
|
-
] }),
|
|
2522
|
-
extensionCards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("a", { href: card.href, style: cardStyle, children: [
|
|
2523
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontWeight: 900 }, children: card.title }),
|
|
2524
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: card.description })
|
|
2525
|
-
] }, card.href))
|
|
2526
|
-
]
|
|
2527
|
-
}
|
|
2528
|
-
)
|
|
2529
|
-
] });
|
|
2530
|
-
}
|
|
2436
|
+
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
2437
|
+
var import_react13 = require("react");
|
|
2531
2438
|
|
|
2532
2439
|
// src/admin/components/studio/AdminStudioNav.tsx
|
|
2533
2440
|
var import_react12 = require("react");
|
|
2534
|
-
var
|
|
2535
|
-
var
|
|
2536
|
-
var
|
|
2441
|
+
var import_ui3 = require("@payloadcms/ui");
|
|
2442
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2443
|
+
var iconSize2 = 18;
|
|
2444
|
+
function NavIcon({ sectionID }) {
|
|
2445
|
+
const props = {
|
|
2446
|
+
fill: "none",
|
|
2447
|
+
height: iconSize2,
|
|
2448
|
+
stroke: "currentColor",
|
|
2449
|
+
strokeLinecap: "round",
|
|
2450
|
+
strokeLinejoin: "round",
|
|
2451
|
+
strokeWidth: 2,
|
|
2452
|
+
viewBox: "0 0 24 24",
|
|
2453
|
+
width: iconSize2
|
|
2454
|
+
};
|
|
2455
|
+
switch (sectionID) {
|
|
2456
|
+
case "dashboard":
|
|
2457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { ...props, children: [
|
|
2458
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "7", height: "9", rx: "1" }),
|
|
2459
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "14", y: "3", width: "7", height: "5", rx: "1" }),
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "14", y: "12", width: "7", height: "9", rx: "1" }),
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "16", width: "7", height: "5", rx: "1" })
|
|
2462
|
+
] });
|
|
2463
|
+
case "pages":
|
|
2464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { ...props, children: [
|
|
2465
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("polyline", { points: "14 2 14 8 20 8" }),
|
|
2467
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
|
|
2468
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "8", y1: "17", x2: "12", y2: "17" })
|
|
2469
|
+
] });
|
|
2470
|
+
case "forms":
|
|
2471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { ...props, children: [
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 3h6" }),
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 3v18" }),
|
|
2474
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" }),
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M7 11h10" }),
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M7 15h6" })
|
|
2477
|
+
] });
|
|
2478
|
+
case "globals":
|
|
2479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { ...props, children: [
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "12", cy: "12", r: "3" }),
|
|
2481
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" })
|
|
2482
|
+
] });
|
|
2483
|
+
case "media":
|
|
2484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { ...props, children: [
|
|
2485
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
2486
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("polyline", { points: "21 15 16 10 5 21" })
|
|
2488
|
+
] });
|
|
2489
|
+
case "admin-tools":
|
|
2490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" }) });
|
|
2491
|
+
default:
|
|
2492
|
+
return null;
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
var getPropString = (props, key, fallback) => {
|
|
2537
2496
|
if (!props || typeof props !== "object") return fallback;
|
|
2538
2497
|
const direct = props[key];
|
|
2539
2498
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -2544,7 +2503,7 @@ var getPropString2 = (props, key, fallback) => {
|
|
|
2544
2503
|
}
|
|
2545
2504
|
return fallback;
|
|
2546
2505
|
};
|
|
2547
|
-
var
|
|
2506
|
+
var getPropBoolean = (props, key, fallback) => {
|
|
2548
2507
|
if (!props || typeof props !== "object") return fallback;
|
|
2549
2508
|
const direct = props[key];
|
|
2550
2509
|
if (typeof direct === "boolean") return direct;
|
|
@@ -2567,7 +2526,7 @@ var getPropStringArray = (props, key, fallback) => {
|
|
|
2567
2526
|
}
|
|
2568
2527
|
return fallback;
|
|
2569
2528
|
};
|
|
2570
|
-
var
|
|
2529
|
+
var getPropSections = (props, key) => {
|
|
2571
2530
|
if (!props || typeof props !== "object") return [];
|
|
2572
2531
|
const direct = resolveStudioSections(props[key]);
|
|
2573
2532
|
if (direct.length > 0) return direct;
|
|
@@ -2594,17 +2553,22 @@ var readUserRole = (user) => {
|
|
|
2594
2553
|
return typeof role === "string" ? role : void 0;
|
|
2595
2554
|
};
|
|
2596
2555
|
function AdminStudioNav(props) {
|
|
2597
|
-
const { user } = (0,
|
|
2598
|
-
const brandName =
|
|
2599
|
-
const logoUrl =
|
|
2600
|
-
const formsEnabled =
|
|
2601
|
-
const formsCollectionSlug =
|
|
2602
|
-
const
|
|
2603
|
-
|
|
2604
|
-
|
|
2556
|
+
const { user } = (0, import_ui3.useAuth)();
|
|
2557
|
+
const brandName = getPropString(props, "brandName", "Orion Studio");
|
|
2558
|
+
const logoUrl = getPropString(props, "logoUrl", "");
|
|
2559
|
+
const formsEnabled = getPropBoolean(props, "formsEnabled", false);
|
|
2560
|
+
const formsCollectionSlug = getPropString(props, "formsCollectionSlug", "forms");
|
|
2561
|
+
const formSubmissionsCollectionSlug = getPropString(
|
|
2562
|
+
props,
|
|
2563
|
+
"formSubmissionsCollectionSlug",
|
|
2564
|
+
"form-submissions"
|
|
2565
|
+
);
|
|
2566
|
+
const formUploadsCollectionSlug = getPropString(props, "formUploadsCollectionSlug", "form-uploads");
|
|
2567
|
+
const mediaCollectionSlug = getPropString(props, "mediaCollectionSlug", "media");
|
|
2568
|
+
const globalsBasePath = getPropString(props, "globalsBasePath", "/globals");
|
|
2605
2569
|
const globalsExtraMatchPrefixes = getPropStringArray(props, "globalsExtraMatchPrefixes", []);
|
|
2606
|
-
const sections =
|
|
2607
|
-
const compact =
|
|
2570
|
+
const sections = getPropSections(props, "sections");
|
|
2571
|
+
const compact = getPropBoolean(props, "compact", false);
|
|
2608
2572
|
const adminBasePath = useAdminBasePath();
|
|
2609
2573
|
const branding = useSiteBranding(brandName, logoUrl || void 0);
|
|
2610
2574
|
const resolvedName = branding.siteName || brandName;
|
|
@@ -2615,10 +2579,10 @@ function AdminStudioNav(props) {
|
|
|
2615
2579
|
window.addEventListener("popstate", update);
|
|
2616
2580
|
return () => window.removeEventListener("popstate", update);
|
|
2617
2581
|
}, []);
|
|
2618
|
-
const pagesPath = resolveAdminPath(adminBasePath,
|
|
2619
|
-
const formsPath = resolveAdminPath(adminBasePath, "/
|
|
2620
|
-
const mediaPath = resolveAdminPath(adminBasePath,
|
|
2621
|
-
const usersPath = resolveAdminPath(adminBasePath, "/
|
|
2582
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
2583
|
+
const formsPath = resolveAdminPath(adminBasePath, "/forms");
|
|
2584
|
+
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
2585
|
+
const usersPath = resolveAdminPath(adminBasePath, "/tools");
|
|
2622
2586
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2623
2587
|
const resolvedGlobalsExtraMatchPrefixes = globalsExtraMatchPrefixes.map(
|
|
2624
2588
|
(prefix) => resolveAdminPath(adminBasePath, prefix)
|
|
@@ -2637,7 +2601,12 @@ function AdminStudioNav(props) {
|
|
|
2637
2601
|
label: "Forms",
|
|
2638
2602
|
matchPrefixes: [
|
|
2639
2603
|
formsPath,
|
|
2640
|
-
resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`)
|
|
2604
|
+
resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`),
|
|
2605
|
+
resolveAdminPath(
|
|
2606
|
+
adminBasePath,
|
|
2607
|
+
`/collections/${formSubmissionsCollectionSlug}`
|
|
2608
|
+
),
|
|
2609
|
+
resolveAdminPath(adminBasePath, `/collections/${formUploadsCollectionSlug}`)
|
|
2641
2610
|
]
|
|
2642
2611
|
}
|
|
2643
2612
|
] : [],
|
|
@@ -2651,12 +2620,17 @@ function AdminStudioNav(props) {
|
|
|
2651
2620
|
...resolvedGlobalsExtraMatchPrefixes
|
|
2652
2621
|
]
|
|
2653
2622
|
},
|
|
2654
|
-
{
|
|
2623
|
+
{
|
|
2624
|
+
id: "media",
|
|
2625
|
+
href: mediaPath,
|
|
2626
|
+
label: "Media",
|
|
2627
|
+
matchPrefixes: [mediaPath, resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`)]
|
|
2628
|
+
},
|
|
2655
2629
|
{
|
|
2656
2630
|
id: "admin-tools",
|
|
2657
2631
|
href: usersPath,
|
|
2658
2632
|
label: "Admin Tools",
|
|
2659
|
-
matchPrefixes: [usersPath],
|
|
2633
|
+
matchPrefixes: [usersPath, resolveAdminPath(adminBasePath, "/collections/users")],
|
|
2660
2634
|
roles: ["admin"]
|
|
2661
2635
|
}
|
|
2662
2636
|
];
|
|
@@ -2673,6 +2647,8 @@ function AdminStudioNav(props) {
|
|
|
2673
2647
|
formsCollectionSlug,
|
|
2674
2648
|
formsEnabled,
|
|
2675
2649
|
formsPath,
|
|
2650
|
+
formSubmissionsCollectionSlug,
|
|
2651
|
+
formUploadsCollectionSlug,
|
|
2676
2652
|
mediaPath,
|
|
2677
2653
|
pagesPath,
|
|
2678
2654
|
resolvedGlobalsBasePath,
|
|
@@ -2694,7 +2670,7 @@ function AdminStudioNav(props) {
|
|
|
2694
2670
|
padding: compact ? "0.6rem" : "0.6rem 0.75rem",
|
|
2695
2671
|
textDecoration: "none"
|
|
2696
2672
|
});
|
|
2697
|
-
return /* @__PURE__ */ (0,
|
|
2673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2698
2674
|
"div",
|
|
2699
2675
|
{
|
|
2700
2676
|
style: {
|
|
@@ -2705,8 +2681,8 @@ function AdminStudioNav(props) {
|
|
|
2705
2681
|
padding: compact ? "0.8rem 0.5rem" : "1rem 0.85rem"
|
|
2706
2682
|
},
|
|
2707
2683
|
children: [
|
|
2708
|
-
/* @__PURE__ */ (0,
|
|
2709
|
-
branding.logoUrl ? /* @__PURE__ */ (0,
|
|
2684
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "admin-studio-brand", style: { padding: compact ? "0" : "0 0.35rem 0 2.4rem" }, children: [
|
|
2685
|
+
branding.logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2710
2686
|
"div",
|
|
2711
2687
|
{
|
|
2712
2688
|
style: {
|
|
@@ -2716,10 +2692,10 @@ function AdminStudioNav(props) {
|
|
|
2716
2692
|
overflow: "hidden",
|
|
2717
2693
|
width: compact ? 34 : 40
|
|
2718
2694
|
},
|
|
2719
|
-
children: /* @__PURE__ */ (0,
|
|
2695
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { alt: `${resolvedName} logo`, src: branding.logoUrl, style: { height: "100%", objectFit: "cover", width: "100%" } })
|
|
2720
2696
|
}
|
|
2721
2697
|
) : null,
|
|
2722
|
-
/* @__PURE__ */ (0,
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2723
2699
|
"div",
|
|
2724
2700
|
{
|
|
2725
2701
|
style: {
|
|
@@ -2734,14 +2710,23 @@ function AdminStudioNav(props) {
|
|
|
2734
2710
|
children: compact ? resolvedName.slice(0, 1).toUpperCase() : resolvedName
|
|
2735
2711
|
}
|
|
2736
2712
|
),
|
|
2737
|
-
!compact ? /* @__PURE__ */ (0,
|
|
2713
|
+
!compact ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.85rem" }, children: "Studio" }) : null
|
|
2738
2714
|
] }),
|
|
2739
|
-
/* @__PURE__ */ (0,
|
|
2715
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("nav", { style: { display: "grid", gap: "0.25rem" }, children: links.filter((link) => roleCanAccessSection(userRole, link)).map((link) => {
|
|
2740
2716
|
const active = link.href === dashboardPath ? pathname === dashboardPath : link.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
2741
|
-
return /* @__PURE__ */ (0,
|
|
2717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { href: link.href, style: linkStyle(active), title: link.label, children: (() => {
|
|
2718
|
+
const icon = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NavIcon, { sectionID: link.id });
|
|
2719
|
+
if (compact) {
|
|
2720
|
+
return icon || link.label.slice(0, 1);
|
|
2721
|
+
}
|
|
2722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { style: { alignItems: "center", display: "inline-flex", gap: "0.6rem" }, children: [
|
|
2723
|
+
icon,
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: link.label })
|
|
2725
|
+
] });
|
|
2726
|
+
})() }, link.href);
|
|
2742
2727
|
}) }),
|
|
2743
|
-
/* @__PURE__ */ (0,
|
|
2744
|
-
/* @__PURE__ */ (0,
|
|
2728
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { flex: 1 } }),
|
|
2729
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2745
2730
|
"div",
|
|
2746
2731
|
{
|
|
2747
2732
|
style: {
|
|
@@ -2750,11 +2735,11 @@ function AdminStudioNav(props) {
|
|
|
2750
2735
|
textAlign: compact ? "center" : "left"
|
|
2751
2736
|
},
|
|
2752
2737
|
children: [
|
|
2753
|
-
!compact ? /* @__PURE__ */ (0,
|
|
2754
|
-
/* @__PURE__ */ (0,
|
|
2755
|
-
/* @__PURE__ */ (0,
|
|
2738
|
+
!compact ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2739
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { color: "var(--theme-elevation-700)", fontSize: "0.85rem" }, children: "Signed in as" }),
|
|
2740
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontWeight: 800, marginBottom: "0.55rem" }, children: typeof user?.email === "string" ? user.email : "User" })
|
|
2756
2741
|
] }) : null,
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui3.Logout, {})
|
|
2758
2743
|
]
|
|
2759
2744
|
}
|
|
2760
2745
|
)
|
|
@@ -2763,10 +2748,171 @@ function AdminStudioNav(props) {
|
|
|
2763
2748
|
);
|
|
2764
2749
|
}
|
|
2765
2750
|
|
|
2751
|
+
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
2752
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2753
|
+
var STORAGE_KEY2 = "orion-studio-sidebar-collapsed";
|
|
2754
|
+
var ACTIVE_CLASS = "orion-studio-shell-active";
|
|
2755
|
+
function StudioSectionLayout({ children, navProps }) {
|
|
2756
|
+
const [collapsed, setCollapsed] = (0, import_react13.useState)(false);
|
|
2757
|
+
(0, import_react13.useEffect)(() => {
|
|
2758
|
+
try {
|
|
2759
|
+
const stored = window.localStorage.getItem(STORAGE_KEY2);
|
|
2760
|
+
if (stored === "1") {
|
|
2761
|
+
setCollapsed(true);
|
|
2762
|
+
}
|
|
2763
|
+
} catch {
|
|
2764
|
+
}
|
|
2765
|
+
}, []);
|
|
2766
|
+
(0, import_react13.useEffect)(() => {
|
|
2767
|
+
document.body.classList.add(ACTIVE_CLASS);
|
|
2768
|
+
return () => {
|
|
2769
|
+
document.body.classList.remove(ACTIVE_CLASS);
|
|
2770
|
+
};
|
|
2771
|
+
}, []);
|
|
2772
|
+
const toggle = () => {
|
|
2773
|
+
setCollapsed((prev) => {
|
|
2774
|
+
const next = !prev;
|
|
2775
|
+
try {
|
|
2776
|
+
window.localStorage.setItem(STORAGE_KEY2, next ? "1" : "0");
|
|
2777
|
+
} catch {
|
|
2778
|
+
}
|
|
2779
|
+
return next;
|
|
2780
|
+
});
|
|
2781
|
+
};
|
|
2782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2783
|
+
"div",
|
|
2784
|
+
{
|
|
2785
|
+
className: `orion-studio-shell ${collapsed ? "is-collapsed" : ""}`,
|
|
2786
|
+
style: {
|
|
2787
|
+
display: "grid",
|
|
2788
|
+
gridTemplateColumns: collapsed ? "84px minmax(0, 1fr)" : "260px minmax(0, 1fr)",
|
|
2789
|
+
minHeight: "100vh"
|
|
2790
|
+
},
|
|
2791
|
+
children: [
|
|
2792
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("aside", { className: "orion-studio-sidebar", children: [
|
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2794
|
+
"button",
|
|
2795
|
+
{
|
|
2796
|
+
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
2797
|
+
className: "orion-studio-sidebar-toggle",
|
|
2798
|
+
onClick: toggle,
|
|
2799
|
+
type: "button",
|
|
2800
|
+
children: collapsed ? ">" : "<"
|
|
2801
|
+
}
|
|
2802
|
+
),
|
|
2803
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "orion-studio-sidebar-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AdminStudioNav, { ...navProps, compact: collapsed }) })
|
|
2804
|
+
] }),
|
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("main", { className: "orion-studio-main", children })
|
|
2806
|
+
]
|
|
2807
|
+
}
|
|
2808
|
+
);
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
2812
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2813
|
+
var cardStyle = {
|
|
2814
|
+
background: "var(--theme-elevation-0)",
|
|
2815
|
+
border: "1px solid var(--theme-elevation-150)",
|
|
2816
|
+
borderRadius: 16,
|
|
2817
|
+
color: "inherit",
|
|
2818
|
+
padding: "1rem",
|
|
2819
|
+
textDecoration: "none"
|
|
2820
|
+
};
|
|
2821
|
+
var getPropString2 = (props, key, fallback) => {
|
|
2822
|
+
if (!props || typeof props !== "object") return fallback;
|
|
2823
|
+
const direct = props[key];
|
|
2824
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
2825
|
+
const clientProps = props.clientProps;
|
|
2826
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2827
|
+
const nested = clientProps[key];
|
|
2828
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
2829
|
+
}
|
|
2830
|
+
return fallback;
|
|
2831
|
+
};
|
|
2832
|
+
var getPropBoolean2 = (props, key, fallback) => {
|
|
2833
|
+
if (!props || typeof props !== "object") return fallback;
|
|
2834
|
+
const direct = props[key];
|
|
2835
|
+
if (typeof direct === "boolean") return direct;
|
|
2836
|
+
const clientProps = props.clientProps;
|
|
2837
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2838
|
+
const nested = clientProps[key];
|
|
2839
|
+
if (typeof nested === "boolean") return nested;
|
|
2840
|
+
}
|
|
2841
|
+
return fallback;
|
|
2842
|
+
};
|
|
2843
|
+
var getPropSections2 = (props, key) => {
|
|
2844
|
+
if (!props || typeof props !== "object") return [];
|
|
2845
|
+
const direct = resolveStudioSections(props[key]);
|
|
2846
|
+
if (direct.length > 0) return direct;
|
|
2847
|
+
const clientProps = props.clientProps;
|
|
2848
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2849
|
+
return resolveStudioSections(clientProps[key]);
|
|
2850
|
+
}
|
|
2851
|
+
return [];
|
|
2852
|
+
};
|
|
2853
|
+
function AdminStudioDashboard(props) {
|
|
2854
|
+
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
2855
|
+
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
2856
|
+
const sections = getPropSections2(props, "sections");
|
|
2857
|
+
const adminBasePath = useAdminBasePath();
|
|
2858
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2859
|
+
const formsPath = resolveAdminPath(adminBasePath, "/forms");
|
|
2860
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
2861
|
+
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
2862
|
+
const toolsPath = resolveAdminPath(adminBasePath, "/tools");
|
|
2863
|
+
const extensionCards = sections.filter((section) => section.card).map((section) => ({
|
|
2864
|
+
href: resolveAdminPath(adminBasePath, section.href),
|
|
2865
|
+
title: section.card?.title || section.label,
|
|
2866
|
+
description: section.card?.description || ""
|
|
2867
|
+
}));
|
|
2868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { paddingBottom: "1.3rem" }, children: [
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_ui4.SetStepNav, { nav: [{ label: "Dashboard", url: adminBasePath }] }),
|
|
2870
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h1", { style: { fontSize: "1.6rem", margin: 0 }, children: "Studio" }),
|
|
2871
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Pick what you want to edit." }),
|
|
2872
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2873
|
+
"div",
|
|
2874
|
+
{
|
|
2875
|
+
style: {
|
|
2876
|
+
display: "grid",
|
|
2877
|
+
gap: "0.85rem",
|
|
2878
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
|
|
2879
|
+
marginTop: "1.1rem"
|
|
2880
|
+
},
|
|
2881
|
+
children: [
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("a", { href: pagesPath, style: cardStyle, children: [
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontWeight: 900 }, children: "Pages" }),
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Edit your site pages with the custom editor." })
|
|
2885
|
+
] }),
|
|
2886
|
+
formsEnabled ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("a", { href: formsPath, style: cardStyle, children: [
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontWeight: 900 }, children: "Forms" }),
|
|
2888
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Review forms, submissions, and uploaded files." })
|
|
2889
|
+
] }) : null,
|
|
2890
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("a", { href: resolvedGlobalsBasePath, style: cardStyle, children: [
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontWeight: 900 }, children: "Globals" }),
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Site settings, header, footer." })
|
|
2893
|
+
] }),
|
|
2894
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("a", { href: mediaPath, style: cardStyle, children: [
|
|
2895
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontWeight: 900 }, children: "Media" }),
|
|
2896
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Upload and manage images and files." })
|
|
2897
|
+
] }),
|
|
2898
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("a", { href: toolsPath, style: cardStyle, children: [
|
|
2899
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontWeight: 900 }, children: "Admin Tools" }),
|
|
2900
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Open admin-only fallback links and user management." })
|
|
2901
|
+
] }),
|
|
2902
|
+
extensionCards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("a", { href: card.href, style: cardStyle, children: [
|
|
2903
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontWeight: 900 }, children: card.title }),
|
|
2904
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: card.description })
|
|
2905
|
+
] }, card.href))
|
|
2906
|
+
]
|
|
2907
|
+
}
|
|
2908
|
+
)
|
|
2909
|
+
] }) });
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2766
2912
|
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
2767
|
-
var
|
|
2913
|
+
var import_react14 = require("react");
|
|
2768
2914
|
var import_ui5 = require("@payloadcms/ui");
|
|
2769
|
-
var
|
|
2915
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2770
2916
|
var isAdmin = (user) => {
|
|
2771
2917
|
if (!user || typeof user !== "object") return false;
|
|
2772
2918
|
const role = user.role;
|
|
@@ -2789,10 +2935,10 @@ function AdminStudioPagesListView(props) {
|
|
|
2789
2935
|
const adminBasePath = useAdminBasePath();
|
|
2790
2936
|
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
2791
2937
|
const rawPagesCollectionPath = resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`);
|
|
2792
|
-
const [loading, setLoading] = (0,
|
|
2793
|
-
const [error, setError] = (0,
|
|
2794
|
-
const [docs, setDocs] = (0,
|
|
2795
|
-
const apiURL = (0,
|
|
2938
|
+
const [loading, setLoading] = (0, import_react14.useState)(true);
|
|
2939
|
+
const [error, setError] = (0, import_react14.useState)(null);
|
|
2940
|
+
const [docs, setDocs] = (0, import_react14.useState)([]);
|
|
2941
|
+
const apiURL = (0, import_react14.useMemo)(() => {
|
|
2796
2942
|
const params = new URLSearchParams({
|
|
2797
2943
|
depth: "0",
|
|
2798
2944
|
limit: "100",
|
|
@@ -2801,7 +2947,7 @@ function AdminStudioPagesListView(props) {
|
|
|
2801
2947
|
});
|
|
2802
2948
|
return `/api/${pagesCollectionSlug}?${params.toString()}`;
|
|
2803
2949
|
}, [pagesCollectionSlug]);
|
|
2804
|
-
(0,
|
|
2950
|
+
(0, import_react14.useEffect)(() => {
|
|
2805
2951
|
let cancelled = false;
|
|
2806
2952
|
const run = async () => {
|
|
2807
2953
|
setLoading(true);
|
|
@@ -2826,14 +2972,14 @@ function AdminStudioPagesListView(props) {
|
|
|
2826
2972
|
cancelled = true;
|
|
2827
2973
|
};
|
|
2828
2974
|
}, [apiURL]);
|
|
2829
|
-
return /* @__PURE__ */ (0,
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
2831
|
-
/* @__PURE__ */ (0,
|
|
2832
|
-
/* @__PURE__ */ (0,
|
|
2833
|
-
/* @__PURE__ */ (0,
|
|
2834
|
-
/* @__PURE__ */ (0,
|
|
2975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui5.SetStepNav, { nav: [{ label: "Pages", url: pagesPath }] }),
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { alignItems: "flex-end", display: "flex", gap: "0.75rem" }, children: [
|
|
2978
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1 }, children: [
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { style: { margin: 0 }, children: "Pages" }),
|
|
2980
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Open a page to edit it in the custom editor." })
|
|
2835
2981
|
] }),
|
|
2836
|
-
isAdmin(user) ? /* @__PURE__ */ (0,
|
|
2982
|
+
isAdmin(user) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2837
2983
|
"a",
|
|
2838
2984
|
{
|
|
2839
2985
|
href: `${rawPagesCollectionPath}/create`,
|
|
@@ -2849,10 +2995,10 @@ function AdminStudioPagesListView(props) {
|
|
|
2849
2995
|
}
|
|
2850
2996
|
) : null
|
|
2851
2997
|
] }),
|
|
2852
|
-
loading ? /* @__PURE__ */ (0,
|
|
2853
|
-
error ? /* @__PURE__ */ (0,
|
|
2854
|
-
/* @__PURE__ */ (0,
|
|
2855
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */ (0,
|
|
2998
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "1rem" }, children: "Loading..." }) : null,
|
|
2999
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { color: "crimson", marginTop: "1rem" }, children: error }) : null,
|
|
3000
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: [
|
|
3001
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2856
3002
|
"div",
|
|
2857
3003
|
{
|
|
2858
3004
|
style: {
|
|
@@ -2870,7 +3016,7 @@ function AdminStudioPagesListView(props) {
|
|
|
2870
3016
|
const path = typeof doc.path === "string" ? doc.path : "/";
|
|
2871
3017
|
const status = typeof doc._status === "string" ? doc._status : "";
|
|
2872
3018
|
if (!id) return null;
|
|
2873
|
-
return /* @__PURE__ */ (0,
|
|
3019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2874
3020
|
"a",
|
|
2875
3021
|
{
|
|
2876
3022
|
href: resolveAdminPath(adminBasePath, `/pages/${id}`),
|
|
@@ -2886,9 +3032,9 @@ function AdminStudioPagesListView(props) {
|
|
|
2886
3032
|
textDecoration: "none"
|
|
2887
3033
|
},
|
|
2888
3034
|
children: [
|
|
2889
|
-
/* @__PURE__ */ (0,
|
|
2890
|
-
/* @__PURE__ */ (0,
|
|
2891
|
-
/* @__PURE__ */ (0,
|
|
3035
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
3036
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { fontWeight: 900, overflow: "hidden", textOverflow: "ellipsis" }, children: title }),
|
|
3037
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2892
3038
|
"div",
|
|
2893
3039
|
{
|
|
2894
3040
|
style: {
|
|
@@ -2901,7 +3047,7 @@ function AdminStudioPagesListView(props) {
|
|
|
2901
3047
|
}
|
|
2902
3048
|
)
|
|
2903
3049
|
] }),
|
|
2904
|
-
/* @__PURE__ */ (0,
|
|
3050
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2905
3051
|
"div",
|
|
2906
3052
|
{
|
|
2907
3053
|
style: {
|
|
@@ -2911,7 +3057,7 @@ function AdminStudioPagesListView(props) {
|
|
|
2911
3057
|
gap: "0.5rem"
|
|
2912
3058
|
},
|
|
2913
3059
|
children: [
|
|
2914
|
-
status ? /* @__PURE__ */ (0,
|
|
3060
|
+
status ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2915
3061
|
"span",
|
|
2916
3062
|
{
|
|
2917
3063
|
style: {
|
|
@@ -2926,7 +3072,7 @@ function AdminStudioPagesListView(props) {
|
|
|
2926
3072
|
children: status
|
|
2927
3073
|
}
|
|
2928
3074
|
) : null,
|
|
2929
|
-
/* @__PURE__ */ (0,
|
|
3075
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { color: "var(--theme-elevation-600)", fontWeight: 800 }, children: "Open" })
|
|
2930
3076
|
]
|
|
2931
3077
|
}
|
|
2932
3078
|
)
|
|
@@ -2936,13 +3082,13 @@ function AdminStudioPagesListView(props) {
|
|
|
2936
3082
|
);
|
|
2937
3083
|
})
|
|
2938
3084
|
] })
|
|
2939
|
-
] });
|
|
3085
|
+
] }) });
|
|
2940
3086
|
}
|
|
2941
3087
|
|
|
2942
3088
|
// src/admin/components/studio/AdminStudioPageEditView.tsx
|
|
2943
|
-
var
|
|
3089
|
+
var import_react15 = require("react");
|
|
2944
3090
|
var import_ui6 = require("@payloadcms/ui");
|
|
2945
|
-
var
|
|
3091
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2946
3092
|
var isAdmin2 = (user) => {
|
|
2947
3093
|
if (!user || typeof user !== "object") return false;
|
|
2948
3094
|
const role = user.role;
|
|
@@ -2982,18 +3128,18 @@ var getPageIDFromPathname = (pathname) => {
|
|
|
2982
3128
|
function AdminStudioPageEditView(props) {
|
|
2983
3129
|
const { user } = (0, import_ui6.useAuth)();
|
|
2984
3130
|
const adminBasePath = useAdminBasePath();
|
|
2985
|
-
const iframeRef = (0,
|
|
2986
|
-
const [saving, setSaving] = (0,
|
|
2987
|
-
const [dirty, setDirty] = (0,
|
|
2988
|
-
const [hasUnpublishedChanges, setHasUnpublishedChanges] = (0,
|
|
2989
|
-
const [canUndo, setCanUndo] = (0,
|
|
2990
|
-
const [canRedo, setCanRedo] = (0,
|
|
3131
|
+
const iframeRef = (0, import_react15.useRef)(null);
|
|
3132
|
+
const [saving, setSaving] = (0, import_react15.useState)(null);
|
|
3133
|
+
const [dirty, setDirty] = (0, import_react15.useState)(false);
|
|
3134
|
+
const [hasUnpublishedChanges, setHasUnpublishedChanges] = (0, import_react15.useState)(false);
|
|
3135
|
+
const [canUndo, setCanUndo] = (0, import_react15.useState)(false);
|
|
3136
|
+
const [canRedo, setCanRedo] = (0, import_react15.useState)(false);
|
|
2991
3137
|
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
2992
3138
|
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
2993
|
-
const pageIDFromParams = (0,
|
|
2994
|
-
const [pageID, setPageID] = (0,
|
|
2995
|
-
const [didResolvePathFallback, setDidResolvePathFallback] = (0,
|
|
2996
|
-
(0,
|
|
3139
|
+
const pageIDFromParams = (0, import_react15.useMemo)(() => getParam(props.params, "id"), [props.params]);
|
|
3140
|
+
const [pageID, setPageID] = (0, import_react15.useState)(pageIDFromParams);
|
|
3141
|
+
const [didResolvePathFallback, setDidResolvePathFallback] = (0, import_react15.useState)(false);
|
|
3142
|
+
(0, import_react15.useEffect)(() => {
|
|
2997
3143
|
if (pageIDFromParams) {
|
|
2998
3144
|
setPageID(pageIDFromParams);
|
|
2999
3145
|
setDidResolvePathFallback(true);
|
|
@@ -3037,7 +3183,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3037
3183
|
} catch {
|
|
3038
3184
|
}
|
|
3039
3185
|
};
|
|
3040
|
-
(0,
|
|
3186
|
+
(0, import_react15.useEffect)(() => {
|
|
3041
3187
|
if (!pageID) {
|
|
3042
3188
|
return;
|
|
3043
3189
|
}
|
|
@@ -3060,7 +3206,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3060
3206
|
}
|
|
3061
3207
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
3062
3208
|
};
|
|
3063
|
-
(0,
|
|
3209
|
+
(0, import_react15.useEffect)(() => {
|
|
3064
3210
|
const onMessage = (event) => {
|
|
3065
3211
|
const data = event.data;
|
|
3066
3212
|
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
@@ -3095,8 +3241,8 @@ function AdminStudioPageEditView(props) {
|
|
|
3095
3241
|
return () => window.removeEventListener("message", onMessage);
|
|
3096
3242
|
}, []);
|
|
3097
3243
|
if (!pageID && !didResolvePathFallback) {
|
|
3098
|
-
return /* @__PURE__ */ (0,
|
|
3099
|
-
/* @__PURE__ */ (0,
|
|
3244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3245
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3100
3246
|
import_ui6.SetStepNav,
|
|
3101
3247
|
{
|
|
3102
3248
|
nav: [
|
|
@@ -3105,13 +3251,13 @@ function AdminStudioPageEditView(props) {
|
|
|
3105
3251
|
]
|
|
3106
3252
|
}
|
|
3107
3253
|
),
|
|
3108
|
-
/* @__PURE__ */ (0,
|
|
3109
|
-
/* @__PURE__ */ (0,
|
|
3110
|
-
] });
|
|
3254
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
3255
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading page editor..." })
|
|
3256
|
+
] }) });
|
|
3111
3257
|
}
|
|
3112
3258
|
if (!pageID) {
|
|
3113
|
-
return /* @__PURE__ */ (0,
|
|
3114
|
-
/* @__PURE__ */ (0,
|
|
3259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3260
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3115
3261
|
import_ui6.SetStepNav,
|
|
3116
3262
|
{
|
|
3117
3263
|
nav: [
|
|
@@ -3120,12 +3266,12 @@ function AdminStudioPageEditView(props) {
|
|
|
3120
3266
|
]
|
|
3121
3267
|
}
|
|
3122
3268
|
),
|
|
3123
|
-
/* @__PURE__ */ (0,
|
|
3124
|
-
/* @__PURE__ */ (0,
|
|
3125
|
-
] });
|
|
3269
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
3270
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Missing page ID." })
|
|
3271
|
+
] }) });
|
|
3126
3272
|
}
|
|
3127
|
-
return /* @__PURE__ */ (0,
|
|
3128
|
-
/* @__PURE__ */ (0,
|
|
3273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3274
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3129
3275
|
import_ui6.SetStepNav,
|
|
3130
3276
|
{
|
|
3131
3277
|
nav: [
|
|
@@ -3134,8 +3280,8 @@ function AdminStudioPageEditView(props) {
|
|
|
3134
3280
|
]
|
|
3135
3281
|
}
|
|
3136
3282
|
),
|
|
3137
|
-
/* @__PURE__ */ (0,
|
|
3138
|
-
/* @__PURE__ */ (0,
|
|
3283
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "grid", gridTemplateRows: "auto 1fr", height: "calc(100vh - 120px)" }, children: [
|
|
3284
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3139
3285
|
"div",
|
|
3140
3286
|
{
|
|
3141
3287
|
style: {
|
|
@@ -3151,9 +3297,9 @@ function AdminStudioPageEditView(props) {
|
|
|
3151
3297
|
zIndex: 20
|
|
3152
3298
|
},
|
|
3153
3299
|
children: [
|
|
3154
|
-
/* @__PURE__ */ (0,
|
|
3155
|
-
/* @__PURE__ */ (0,
|
|
3156
|
-
/* @__PURE__ */ (0,
|
|
3300
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
3301
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontWeight: 900 }, children: "Page Editor" }),
|
|
3302
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3157
3303
|
"div",
|
|
3158
3304
|
{
|
|
3159
3305
|
style: {
|
|
@@ -3169,9 +3315,9 @@ function AdminStudioPageEditView(props) {
|
|
|
3169
3315
|
}
|
|
3170
3316
|
)
|
|
3171
3317
|
] }),
|
|
3172
|
-
/* @__PURE__ */ (0,
|
|
3173
|
-
/* @__PURE__ */ (0,
|
|
3174
|
-
/* @__PURE__ */ (0,
|
|
3318
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
3319
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { color: dirty ? "var(--theme-elevation-900)" : "var(--theme-elevation-600)", fontSize: "0.85rem", fontWeight: 700 }, children: dirty ? "Unsaved changes" : "All changes saved" }),
|
|
3320
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3175
3321
|
"div",
|
|
3176
3322
|
{
|
|
3177
3323
|
style: {
|
|
@@ -3188,7 +3334,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3188
3334
|
children: hasUnpublishedChanges ? "Unpublished draft changes" : "Live is up to date"
|
|
3189
3335
|
}
|
|
3190
3336
|
),
|
|
3191
|
-
/* @__PURE__ */ (0,
|
|
3337
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3192
3338
|
"button",
|
|
3193
3339
|
{
|
|
3194
3340
|
disabled: !canUndo,
|
|
@@ -3204,7 +3350,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3204
3350
|
children: "Undo"
|
|
3205
3351
|
}
|
|
3206
3352
|
),
|
|
3207
|
-
/* @__PURE__ */ (0,
|
|
3353
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3208
3354
|
"button",
|
|
3209
3355
|
{
|
|
3210
3356
|
disabled: !canRedo,
|
|
@@ -3220,7 +3366,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3220
3366
|
children: "Redo"
|
|
3221
3367
|
}
|
|
3222
3368
|
),
|
|
3223
|
-
/* @__PURE__ */ (0,
|
|
3369
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3224
3370
|
"button",
|
|
3225
3371
|
{
|
|
3226
3372
|
disabled: saving !== null,
|
|
@@ -3236,7 +3382,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3236
3382
|
children: saving === "draft" ? "Saving\u2026" : "Save Draft"
|
|
3237
3383
|
}
|
|
3238
3384
|
),
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3385
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3240
3386
|
"button",
|
|
3241
3387
|
{
|
|
3242
3388
|
disabled: !canPublish || saving !== null,
|
|
@@ -3259,7 +3405,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3259
3405
|
]
|
|
3260
3406
|
}
|
|
3261
3407
|
),
|
|
3262
|
-
/* @__PURE__ */ (0,
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3263
3409
|
"iframe",
|
|
3264
3410
|
{
|
|
3265
3411
|
ref: iframeRef,
|
|
@@ -3273,90 +3419,1361 @@ function AdminStudioPageEditView(props) {
|
|
|
3273
3419
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "history-check-request" }, "*");
|
|
3274
3420
|
}
|
|
3275
3421
|
}
|
|
3276
|
-
)
|
|
3277
|
-
] })
|
|
3278
|
-
] });
|
|
3422
|
+
)
|
|
3423
|
+
] })
|
|
3424
|
+
] }) });
|
|
3425
|
+
}
|
|
3426
|
+
|
|
3427
|
+
// src/admin/components/studio/AdminStudioGlobalsView.tsx
|
|
3428
|
+
var import_ui7 = require("@payloadcms/ui");
|
|
3429
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3430
|
+
var getPropGlobals = (props) => {
|
|
3431
|
+
if (!props || typeof props !== "object") return null;
|
|
3432
|
+
const direct = props.globals;
|
|
3433
|
+
if (Array.isArray(direct)) return direct;
|
|
3434
|
+
const clientProps = props.clientProps;
|
|
3435
|
+
if (clientProps && typeof clientProps === "object") {
|
|
3436
|
+
const nested = clientProps.globals;
|
|
3437
|
+
if (Array.isArray(nested)) return nested;
|
|
3438
|
+
}
|
|
3439
|
+
return null;
|
|
3440
|
+
};
|
|
3441
|
+
var getPropString5 = (props, key, fallback) => {
|
|
3442
|
+
if (!props || typeof props !== "object") return fallback;
|
|
3443
|
+
const direct = props[key];
|
|
3444
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
3445
|
+
const clientProps = props.clientProps;
|
|
3446
|
+
if (clientProps && typeof clientProps === "object") {
|
|
3447
|
+
const nested = clientProps[key];
|
|
3448
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
3449
|
+
}
|
|
3450
|
+
return fallback;
|
|
3451
|
+
};
|
|
3452
|
+
function AdminStudioGlobalsView(props) {
|
|
3453
|
+
const globalsBasePath = getPropString5(props, "globalsBasePath", "/globals");
|
|
3454
|
+
const adminBasePath = useAdminBasePath();
|
|
3455
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3456
|
+
const globals = getPropGlobals(props) || [
|
|
3457
|
+
{ slug: "site-settings", label: "Website Settings" },
|
|
3458
|
+
{ slug: "header", label: "Header & Navigation" },
|
|
3459
|
+
{ slug: "footer", label: "Footer" },
|
|
3460
|
+
{ slug: "social-media", label: "Social Media" }
|
|
3461
|
+
];
|
|
3462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_ui7.SetStepNav, { nav: [{ label: "Globals", url: resolvedGlobalsBasePath }] }),
|
|
3464
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h1", { style: { margin: 0 }, children: "Globals" }),
|
|
3465
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Site-wide settings." }),
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: globals.map((global) => {
|
|
3467
|
+
const href = resolveAdminPath(
|
|
3468
|
+
adminBasePath,
|
|
3469
|
+
typeof global.href === "string" ? global.href : `/globals/${global.slug}`
|
|
3470
|
+
);
|
|
3471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3472
|
+
"a",
|
|
3473
|
+
{
|
|
3474
|
+
href,
|
|
3475
|
+
style: {
|
|
3476
|
+
background: "var(--theme-elevation-0)",
|
|
3477
|
+
border: "1px solid var(--theme-elevation-150)",
|
|
3478
|
+
borderRadius: 16,
|
|
3479
|
+
color: "inherit",
|
|
3480
|
+
padding: "0.85rem 1rem",
|
|
3481
|
+
textDecoration: "none"
|
|
3482
|
+
},
|
|
3483
|
+
children: [
|
|
3484
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { fontWeight: 900 }, children: global.label }),
|
|
3485
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: typeof global.description === "string" && global.description.length > 0 ? global.description : href })
|
|
3486
|
+
]
|
|
3487
|
+
},
|
|
3488
|
+
global.slug
|
|
3489
|
+
);
|
|
3490
|
+
}) }),
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { marginTop: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3492
|
+
"a",
|
|
3493
|
+
{
|
|
3494
|
+
href: resolvedGlobalsBasePath,
|
|
3495
|
+
style: { color: "var(--theme-elevation-700)", fontSize: "0.85rem", textDecoration: "none" },
|
|
3496
|
+
children: "Reload Globals view"
|
|
3497
|
+
}
|
|
3498
|
+
) })
|
|
3499
|
+
] }) });
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3502
|
+
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
3503
|
+
var import_react18 = require("react");
|
|
3504
|
+
var import_ui8 = require("@payloadcms/ui");
|
|
3505
|
+
|
|
3506
|
+
// src/admin-app/components/HeaderNavEditorWithPreview.tsx
|
|
3507
|
+
var import_react17 = require("react");
|
|
3508
|
+
|
|
3509
|
+
// src/admin-app/nestedNavigation.ts
|
|
3510
|
+
var normalizeNestedNavItems = (items) => {
|
|
3511
|
+
const deduped = [];
|
|
3512
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3513
|
+
for (const item of items) {
|
|
3514
|
+
const href = typeof item.href === "string" ? item.href.trim() : "";
|
|
3515
|
+
const label = typeof item.label === "string" ? item.label.trim() : "";
|
|
3516
|
+
const parentHref = typeof item.parentHref === "string" ? item.parentHref.trim() : "";
|
|
3517
|
+
if (!href || !label || seen.has(href)) {
|
|
3518
|
+
continue;
|
|
3519
|
+
}
|
|
3520
|
+
seen.add(href);
|
|
3521
|
+
deduped.push({
|
|
3522
|
+
href,
|
|
3523
|
+
label,
|
|
3524
|
+
...parentHref ? { parentHref } : {}
|
|
3525
|
+
});
|
|
3526
|
+
}
|
|
3527
|
+
const hrefs = new Set(deduped.map((item) => item.href));
|
|
3528
|
+
return deduped.map((item) => ({
|
|
3529
|
+
href: item.href,
|
|
3530
|
+
label: item.label,
|
|
3531
|
+
...item.parentHref && item.parentHref !== item.href && hrefs.has(item.parentHref) ? { parentHref: item.parentHref } : {}
|
|
3532
|
+
}));
|
|
3533
|
+
};
|
|
3534
|
+
var buildNestedNavTree = (items) => {
|
|
3535
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
3536
|
+
const topLevel = [];
|
|
3537
|
+
for (const item of items) {
|
|
3538
|
+
if (!item.parentHref) {
|
|
3539
|
+
topLevel.push(item);
|
|
3540
|
+
continue;
|
|
3541
|
+
}
|
|
3542
|
+
const children = childrenByParent.get(item.parentHref) || [];
|
|
3543
|
+
children.push(item);
|
|
3544
|
+
childrenByParent.set(item.parentHref, children);
|
|
3545
|
+
}
|
|
3546
|
+
if (topLevel.length === 0 && items.length > 0) {
|
|
3547
|
+
return {
|
|
3548
|
+
topLevel: items.map((item) => ({ href: item.href, label: item.label })),
|
|
3549
|
+
childrenByParent: /* @__PURE__ */ new Map()
|
|
3550
|
+
};
|
|
3551
|
+
}
|
|
3552
|
+
return { childrenByParent, topLevel };
|
|
3553
|
+
};
|
|
3554
|
+
|
|
3555
|
+
// src/admin-app/components/HeaderNavItemsEditor.tsx
|
|
3556
|
+
var import_react16 = require("react");
|
|
3557
|
+
|
|
3558
|
+
// src/admin-app/navigationLinks.ts
|
|
3559
|
+
var fallbackHomeOption = {
|
|
3560
|
+
href: "/",
|
|
3561
|
+
label: "Home",
|
|
3562
|
+
title: "Home"
|
|
3563
|
+
};
|
|
3564
|
+
var buildAdminPageLinkOptions = (pages) => {
|
|
3565
|
+
const options = pages.map((page) => {
|
|
3566
|
+
const href = typeof page.path === "string" ? page.path.trim() : "";
|
|
3567
|
+
const title = typeof page.title === "string" && page.title.trim().length > 0 ? page.title.trim() : "Untitled Page";
|
|
3568
|
+
if (!href) {
|
|
3569
|
+
return null;
|
|
3570
|
+
}
|
|
3571
|
+
const depth = href === "/" ? 0 : href.split("/").filter(Boolean).length;
|
|
3572
|
+
const indentLevel = Math.max(depth - 1, 0);
|
|
3573
|
+
const indent = indentLevel > 0 ? `${"\u21B3 ".repeat(indentLevel)}` : "";
|
|
3574
|
+
return {
|
|
3575
|
+
href,
|
|
3576
|
+
label: `${indent}${title}`,
|
|
3577
|
+
title
|
|
3578
|
+
};
|
|
3579
|
+
}).filter((option) => option !== null).sort((a, b) => {
|
|
3580
|
+
if (a.href === "/" && b.href !== "/") return -1;
|
|
3581
|
+
if (b.href === "/" && a.href !== "/") return 1;
|
|
3582
|
+
return a.href.localeCompare(b.href);
|
|
3583
|
+
});
|
|
3584
|
+
if (options.length === 0) {
|
|
3585
|
+
return [fallbackHomeOption];
|
|
3586
|
+
}
|
|
3587
|
+
return options;
|
|
3588
|
+
};
|
|
3589
|
+
var normalizeAdminNavInputs = (rows, pageOptions) => {
|
|
3590
|
+
const allowedLinks = new Map(pageOptions.map((option) => [option.href, option.title]));
|
|
3591
|
+
const deduped = [];
|
|
3592
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3593
|
+
for (const row of rows) {
|
|
3594
|
+
const href = typeof row.href === "string" ? row.href.trim() : "";
|
|
3595
|
+
const defaultLabel = allowedLinks.get(href);
|
|
3596
|
+
const explicitLabel = typeof row.label === "string" ? row.label.trim() : "";
|
|
3597
|
+
const parentHref = typeof row.parentHref === "string" ? row.parentHref.trim() : "";
|
|
3598
|
+
if (!href || !defaultLabel || seen.has(href)) {
|
|
3599
|
+
continue;
|
|
3600
|
+
}
|
|
3601
|
+
seen.add(href);
|
|
3602
|
+
deduped.push({
|
|
3603
|
+
href,
|
|
3604
|
+
label: explicitLabel.length > 0 ? explicitLabel : defaultLabel,
|
|
3605
|
+
...parentHref.length > 0 ? { parentHref } : {}
|
|
3606
|
+
});
|
|
3607
|
+
}
|
|
3608
|
+
const hrefs = new Set(deduped.map((item) => item.href));
|
|
3609
|
+
const parentByHref = new Map(deduped.map((item) => [item.href, item.parentHref || ""]));
|
|
3610
|
+
const createsCycle = (href, parentHref) => {
|
|
3611
|
+
const visited = /* @__PURE__ */ new Set([href]);
|
|
3612
|
+
let current = parentHref;
|
|
3613
|
+
while (current) {
|
|
3614
|
+
if (visited.has(current)) {
|
|
3615
|
+
return true;
|
|
3616
|
+
}
|
|
3617
|
+
visited.add(current);
|
|
3618
|
+
current = parentByHref.get(current) || "";
|
|
3619
|
+
}
|
|
3620
|
+
return false;
|
|
3621
|
+
};
|
|
3622
|
+
return deduped.map((item) => {
|
|
3623
|
+
const parentHref = item.parentHref;
|
|
3624
|
+
if (!parentHref || parentHref === item.href || !hrefs.has(parentHref) || createsCycle(item.href, parentHref)) {
|
|
3625
|
+
return {
|
|
3626
|
+
href: item.href,
|
|
3627
|
+
label: item.label
|
|
3628
|
+
};
|
|
3629
|
+
}
|
|
3630
|
+
return item;
|
|
3631
|
+
});
|
|
3632
|
+
};
|
|
3633
|
+
|
|
3634
|
+
// src/admin-app/components/HeaderNavItemsEditor.tsx
|
|
3635
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3636
|
+
var toRow = (item, index) => ({
|
|
3637
|
+
id: `row-${index}-${item.href || "empty"}`,
|
|
3638
|
+
href: item.href || "",
|
|
3639
|
+
label: item.label || "",
|
|
3640
|
+
parentHref: item.parentHref || ""
|
|
3641
|
+
});
|
|
3642
|
+
var moveRow = (rows, fromIndex, toIndex) => {
|
|
3643
|
+
if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= rows.length || toIndex >= rows.length) {
|
|
3644
|
+
return rows;
|
|
3645
|
+
}
|
|
3646
|
+
const next = [...rows];
|
|
3647
|
+
const [moved] = next.splice(fromIndex, 1);
|
|
3648
|
+
if (!moved) {
|
|
3649
|
+
return rows;
|
|
3650
|
+
}
|
|
3651
|
+
next.splice(toIndex, 0, moved);
|
|
3652
|
+
return next;
|
|
3653
|
+
};
|
|
3654
|
+
function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
3655
|
+
const [rows, setRows] = (0, import_react16.useState)(() => initialItems.map(toRow));
|
|
3656
|
+
const [nextRowID, setNextRowID] = (0, import_react16.useState)(initialItems.length);
|
|
3657
|
+
const [draggingRowID, setDraggingRowID] = (0, import_react16.useState)(null);
|
|
3658
|
+
const [dragOverRowID, setDragOverRowID] = (0, import_react16.useState)(null);
|
|
3659
|
+
const pageOptionByHref = (0, import_react16.useMemo)(() => new Map(pageOptions.map((option) => [option.href, option])), [pageOptions]);
|
|
3660
|
+
const serializedState = (0, import_react16.useMemo)(
|
|
3661
|
+
() => JSON.stringify(
|
|
3662
|
+
rows.map((row) => ({
|
|
3663
|
+
href: row.href.trim(),
|
|
3664
|
+
label: row.label.trim(),
|
|
3665
|
+
parentHref: row.parentHref.trim() || void 0
|
|
3666
|
+
}))
|
|
3667
|
+
),
|
|
3668
|
+
[rows]
|
|
3669
|
+
);
|
|
3670
|
+
const normalizedItems = (0, import_react16.useMemo)(() => {
|
|
3671
|
+
const inputs = rows.map((row) => ({
|
|
3672
|
+
href: row.href,
|
|
3673
|
+
label: row.label,
|
|
3674
|
+
parentHref: row.parentHref
|
|
3675
|
+
}));
|
|
3676
|
+
return normalizeAdminNavInputs(inputs, pageOptions);
|
|
3677
|
+
}, [rows, pageOptions]);
|
|
3678
|
+
(0, import_react16.useEffect)(() => {
|
|
3679
|
+
onItemsChange?.(normalizedItems);
|
|
3680
|
+
}, [normalizedItems, onItemsChange]);
|
|
3681
|
+
const setRowValue = (rowID, changes) => {
|
|
3682
|
+
setRows(
|
|
3683
|
+
(currentRows) => currentRows.map((row) => {
|
|
3684
|
+
if (row.id !== rowID) {
|
|
3685
|
+
return row;
|
|
3686
|
+
}
|
|
3687
|
+
const nextRow = { ...row, ...changes };
|
|
3688
|
+
if (nextRow.parentHref === nextRow.href) {
|
|
3689
|
+
nextRow.parentHref = "";
|
|
3690
|
+
}
|
|
3691
|
+
return nextRow;
|
|
3692
|
+
})
|
|
3693
|
+
);
|
|
3694
|
+
};
|
|
3695
|
+
const removeRow = (rowID) => {
|
|
3696
|
+
setRows((currentRows) => {
|
|
3697
|
+
const removedRow = currentRows.find((candidate) => candidate.id === rowID);
|
|
3698
|
+
const removedHref = removedRow?.href || "";
|
|
3699
|
+
return currentRows.filter((row) => row.id !== rowID).map((row) => removedHref && row.parentHref === removedHref ? { ...row, parentHref: "" } : row);
|
|
3700
|
+
});
|
|
3701
|
+
};
|
|
3702
|
+
const addRow = () => {
|
|
3703
|
+
setRows((currentRows) => [
|
|
3704
|
+
...currentRows,
|
|
3705
|
+
{
|
|
3706
|
+
id: `row-new-${nextRowID}`,
|
|
3707
|
+
href: "",
|
|
3708
|
+
label: "",
|
|
3709
|
+
parentHref: ""
|
|
3710
|
+
}
|
|
3711
|
+
]);
|
|
3712
|
+
setNextRowID((current) => current + 1);
|
|
3713
|
+
};
|
|
3714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "orion-admin-nav-editor", children: [
|
|
3715
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { name: "navItemsState", readOnly: true, type: "hidden", value: serializedState }),
|
|
3716
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "orion-admin-nav-editor-head", children: [
|
|
3717
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "orion-admin-nav-editor-title", children: "Navigation Items" }),
|
|
3718
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "orion-admin-nav-editor-add", onClick: addRow, type: "button", children: "Add Item" })
|
|
3719
|
+
] }),
|
|
3720
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "orion-admin-nav-editor-help", children: "Add only links you want in the menu. Drag rows to reorder. Set a parent to create dropdown items." }),
|
|
3721
|
+
rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "orion-admin-nav-editor-empty", children: 'No navigation items yet. Click "Add Item" to start.' }) : null,
|
|
3722
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "orion-admin-nav-editor-list", children: rows.map((row, rowIndex) => {
|
|
3723
|
+
const parentCandidates = rows.filter((candidate) => candidate.id !== row.id && candidate.href.trim().length > 0).map((candidate) => {
|
|
3724
|
+
const resolved = pageOptionByHref.get(candidate.href);
|
|
3725
|
+
return {
|
|
3726
|
+
href: candidate.href,
|
|
3727
|
+
label: candidate.label.trim() || resolved?.title || candidate.href
|
|
3728
|
+
};
|
|
3729
|
+
});
|
|
3730
|
+
const selectedPage = pageOptionByHref.get(row.href);
|
|
3731
|
+
const labelPlaceholder = selectedPage?.title || "Navigation Label";
|
|
3732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3733
|
+
"div",
|
|
3734
|
+
{
|
|
3735
|
+
className: `orion-admin-nav-editor-row${draggingRowID === row.id ? " is-dragging" : ""}${dragOverRowID === row.id && draggingRowID !== row.id ? " is-drop-target" : ""}`,
|
|
3736
|
+
draggable: true,
|
|
3737
|
+
onDragEnd: () => {
|
|
3738
|
+
setDraggingRowID(null);
|
|
3739
|
+
setDragOverRowID(null);
|
|
3740
|
+
},
|
|
3741
|
+
onDragEnter: () => {
|
|
3742
|
+
if (draggingRowID && draggingRowID !== row.id) {
|
|
3743
|
+
setDragOverRowID(row.id);
|
|
3744
|
+
}
|
|
3745
|
+
},
|
|
3746
|
+
onDragLeave: () => {
|
|
3747
|
+
if (dragOverRowID === row.id) {
|
|
3748
|
+
setDragOverRowID(null);
|
|
3749
|
+
}
|
|
3750
|
+
},
|
|
3751
|
+
onDragOver: (event) => {
|
|
3752
|
+
event.preventDefault();
|
|
3753
|
+
if (draggingRowID && draggingRowID !== row.id && dragOverRowID !== row.id) {
|
|
3754
|
+
setDragOverRowID(row.id);
|
|
3755
|
+
}
|
|
3756
|
+
},
|
|
3757
|
+
onDragStart: (event) => {
|
|
3758
|
+
setDraggingRowID(row.id);
|
|
3759
|
+
event.dataTransfer.effectAllowed = "move";
|
|
3760
|
+
},
|
|
3761
|
+
onDrop: (event) => {
|
|
3762
|
+
event.preventDefault();
|
|
3763
|
+
if (!draggingRowID || draggingRowID === row.id) {
|
|
3764
|
+
return;
|
|
3765
|
+
}
|
|
3766
|
+
setRows((currentRows) => {
|
|
3767
|
+
const fromIndex = currentRows.findIndex((entry) => entry.id === draggingRowID);
|
|
3768
|
+
const toIndex = currentRows.findIndex((entry) => entry.id === row.id);
|
|
3769
|
+
return moveRow(currentRows, fromIndex, toIndex);
|
|
3770
|
+
});
|
|
3771
|
+
setDraggingRowID(null);
|
|
3772
|
+
setDragOverRowID(null);
|
|
3773
|
+
},
|
|
3774
|
+
children: [
|
|
3775
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "orion-admin-nav-editor-row-head", children: [
|
|
3776
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "orion-admin-nav-editor-drag", children: "Drag" }),
|
|
3777
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "orion-admin-nav-editor-row-index", children: [
|
|
3778
|
+
"#",
|
|
3779
|
+
rowIndex + 1
|
|
3780
|
+
] }),
|
|
3781
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "orion-admin-nav-editor-remove", onClick: () => removeRow(row.id), type: "button", children: "Remove" })
|
|
3782
|
+
] }),
|
|
3783
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "orion-admin-nav-editor-row-grid", children: [
|
|
3784
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { children: [
|
|
3785
|
+
"Label",
|
|
3786
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3787
|
+
"input",
|
|
3788
|
+
{
|
|
3789
|
+
name: `navLabel_${rowIndex}`,
|
|
3790
|
+
onChange: (event) => setRowValue(row.id, { label: event.target.value }),
|
|
3791
|
+
placeholder: labelPlaceholder,
|
|
3792
|
+
type: "text",
|
|
3793
|
+
value: row.label
|
|
3794
|
+
}
|
|
3795
|
+
)
|
|
3796
|
+
] }),
|
|
3797
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { children: [
|
|
3798
|
+
"Page",
|
|
3799
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3800
|
+
"select",
|
|
3801
|
+
{
|
|
3802
|
+
name: `navPage_${rowIndex}`,
|
|
3803
|
+
onChange: (event) => {
|
|
3804
|
+
const nextHref = event.target.value;
|
|
3805
|
+
const nextParent = row.parentHref && row.parentHref === nextHref ? "" : row.parentHref;
|
|
3806
|
+
setRowValue(row.id, { href: nextHref, parentHref: nextParent });
|
|
3807
|
+
},
|
|
3808
|
+
value: row.href,
|
|
3809
|
+
children: [
|
|
3810
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Select page..." }),
|
|
3811
|
+
pageOptions.map((pageOption) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: pageOption.href, children: pageOption.label }, `${pageOption.href}-${pageOption.title}`))
|
|
3812
|
+
]
|
|
3813
|
+
}
|
|
3814
|
+
)
|
|
3815
|
+
] }),
|
|
3816
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { children: [
|
|
3817
|
+
"Parent (dropdown under)",
|
|
3818
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3819
|
+
"select",
|
|
3820
|
+
{
|
|
3821
|
+
name: `navParentHref_${rowIndex}`,
|
|
3822
|
+
onChange: (event) => setRowValue(row.id, { parentHref: event.target.value }),
|
|
3823
|
+
value: row.parentHref,
|
|
3824
|
+
children: [
|
|
3825
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Top-level item" }),
|
|
3826
|
+
parentCandidates.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: candidate.href, children: candidate.label }, `${row.id}-parent-${candidate.href}`))
|
|
3827
|
+
]
|
|
3828
|
+
}
|
|
3829
|
+
)
|
|
3830
|
+
] })
|
|
3831
|
+
] })
|
|
3832
|
+
]
|
|
3833
|
+
},
|
|
3834
|
+
row.id
|
|
3835
|
+
);
|
|
3836
|
+
}) })
|
|
3837
|
+
] });
|
|
3838
|
+
}
|
|
3839
|
+
|
|
3840
|
+
// src/admin-app/components/SitePreview.tsx
|
|
3841
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3842
|
+
var fallbackHeaderNav = [{ href: "/", label: "Home" }];
|
|
3843
|
+
var socialGlyphByPlatform = {
|
|
3844
|
+
facebook: "f",
|
|
3845
|
+
instagram: "ig",
|
|
3846
|
+
linkedin: "in",
|
|
3847
|
+
pinterest: "p",
|
|
3848
|
+
snapchat: "sc",
|
|
3849
|
+
tiktok: "tt",
|
|
3850
|
+
x: "x",
|
|
3851
|
+
youtube: "yt"
|
|
3852
|
+
};
|
|
3853
|
+
var getInitials = (value) => {
|
|
3854
|
+
const initials = value.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((part) => part[0]?.toUpperCase() || "").join("");
|
|
3855
|
+
return initials || "OS";
|
|
3856
|
+
};
|
|
3857
|
+
var getSocialGlyph = (platform) => {
|
|
3858
|
+
const normalized = platform.trim().toLowerCase();
|
|
3859
|
+
return socialGlyphByPlatform[normalized] || normalized.slice(0, 2).toUpperCase() || "\u2022";
|
|
3860
|
+
};
|
|
3861
|
+
var getTaglineLines = (tagline) => {
|
|
3862
|
+
const parts = (tagline || "").split(".").map((part) => part.trim()).filter(Boolean);
|
|
3863
|
+
const first = parts[0] ? `${parts[0]}.` : "Warm Gifts.";
|
|
3864
|
+
const second = parts[1] ? `${parts[1]}.` : "Local Heart.";
|
|
3865
|
+
return [first, second];
|
|
3866
|
+
};
|
|
3867
|
+
function PreviewSocialLinks({
|
|
3868
|
+
links,
|
|
3869
|
+
variant
|
|
3870
|
+
}) {
|
|
3871
|
+
if (links.length === 0) {
|
|
3872
|
+
return null;
|
|
3873
|
+
}
|
|
3874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3875
|
+
"div",
|
|
3876
|
+
{
|
|
3877
|
+
className: variant === "header" ? "orion-admin-site-preview-social-list" : "orion-admin-site-preview-social-list orion-admin-site-preview-social-list--footer",
|
|
3878
|
+
children: links.map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3879
|
+
"a",
|
|
3880
|
+
{
|
|
3881
|
+
className: variant === "header" ? "orion-admin-site-preview-social-badge" : "orion-admin-site-preview-social-badge orion-admin-site-preview-social-badge--footer",
|
|
3882
|
+
href: item.url,
|
|
3883
|
+
tabIndex: -1,
|
|
3884
|
+
children: getSocialGlyph(item.platform)
|
|
3885
|
+
},
|
|
3886
|
+
`${item.platform}-${item.url}`
|
|
3887
|
+
))
|
|
3888
|
+
}
|
|
3889
|
+
);
|
|
3890
|
+
}
|
|
3891
|
+
function PreviewLogo({
|
|
3892
|
+
className,
|
|
3893
|
+
logoUrl,
|
|
3894
|
+
siteName
|
|
3895
|
+
}) {
|
|
3896
|
+
if (logoUrl && logoUrl.trim().length > 0) {
|
|
3897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { alt: `${siteName} logo`, className, src: logoUrl });
|
|
3898
|
+
}
|
|
3899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `${className} orion-admin-site-preview-logo-fallback`, children: getInitials(siteName) });
|
|
3900
|
+
}
|
|
3901
|
+
function SiteHeaderPreview({ site }) {
|
|
3902
|
+
const navItems = site.navItems.length > 0 ? site.navItems : fallbackHeaderNav;
|
|
3903
|
+
const [taglineLineOne, taglineLineTwo] = getTaglineLines(site.tagline);
|
|
3904
|
+
const socialLinks = site.socialLinks?.slice(0, 4) || [];
|
|
3905
|
+
const activePath = site.activePath || navItems[0]?.href || "/";
|
|
3906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { "aria-hidden": "true", className: "orion-admin-site-preview orion-admin-site-preview--header", children: [
|
|
3907
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-admin-site-preview-header-bar", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-shell orion-admin-site-preview-shell--utility", children: [
|
|
3908
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-utility-copy", children: site.locationSummary?.address?.trim() || "Neighborhood gift shop" }),
|
|
3909
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-utility-meta", children: [
|
|
3910
|
+
site.locationSummary?.hours?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-utility-copy", children: site.locationSummary.hours.trim() }) : null,
|
|
3911
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PreviewSocialLinks, { links: socialLinks, variant: "header" }),
|
|
3912
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { className: "orion-admin-site-preview-header-action", href: site.actionHref || "/contact", tabIndex: -1, children: site.actionLabel || "Visit Today" })
|
|
3913
|
+
] })
|
|
3914
|
+
] }) }),
|
|
3915
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-admin-site-preview-header-main", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-shell orion-admin-site-preview-shell--main", children: [
|
|
3916
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { className: "orion-admin-site-preview-brand", href: "/", tabIndex: -1, children: [
|
|
3917
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3918
|
+
PreviewLogo,
|
|
3919
|
+
{
|
|
3920
|
+
className: "orion-admin-site-preview-header-logo",
|
|
3921
|
+
logoUrl: site.logoUrl,
|
|
3922
|
+
siteName: site.siteName
|
|
3923
|
+
}
|
|
3924
|
+
),
|
|
3925
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-tagline", children: [
|
|
3926
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-tagline-line", children: taglineLineOne }),
|
|
3927
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-tagline-line", children: taglineLineTwo })
|
|
3928
|
+
] })
|
|
3929
|
+
] }),
|
|
3930
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("nav", { className: "orion-admin-site-preview-nav", children: navItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3931
|
+
"a",
|
|
3932
|
+
{
|
|
3933
|
+
className: item.href === activePath ? "is-active" : void 0,
|
|
3934
|
+
href: item.href,
|
|
3935
|
+
tabIndex: -1,
|
|
3936
|
+
children: item.label
|
|
3937
|
+
},
|
|
3938
|
+
`${item.href}-${item.label}`
|
|
3939
|
+
)) }),
|
|
3940
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-mobile-toggle", children: [
|
|
3941
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", {}),
|
|
3942
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", {}),
|
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", {})
|
|
3944
|
+
] })
|
|
3945
|
+
] }) })
|
|
3946
|
+
] });
|
|
3947
|
+
}
|
|
3948
|
+
function SiteFooterPreview({ site }) {
|
|
3949
|
+
const description = site.description?.trim() || site.tagline?.trim() || "Thoughtful gifts, warm local service, and a beautifully stocked neighborhood shop.";
|
|
3950
|
+
const socialLinks = site.socialLinks?.slice(0, 4) || [];
|
|
3951
|
+
const builtByLabel = site.builtByLabel || "Built by Orion Studios";
|
|
3952
|
+
const builtByHref = site.builtByHref || "https://orionstudios.dev";
|
|
3953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { "aria-hidden": "true", className: "orion-admin-site-preview orion-admin-site-preview--footer", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-footer-shell", children: [
|
|
3954
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-footer-grid", children: [
|
|
3955
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3956
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-footer-brand", children: [
|
|
3957
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3958
|
+
PreviewLogo,
|
|
3959
|
+
{
|
|
3960
|
+
className: "orion-admin-site-preview-footer-logo",
|
|
3961
|
+
logoUrl: site.logoUrl,
|
|
3962
|
+
siteName: site.siteName
|
|
3963
|
+
}
|
|
3964
|
+
),
|
|
3965
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-name", children: site.siteName })
|
|
3966
|
+
] }),
|
|
3967
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-description", children: description })
|
|
3968
|
+
] }),
|
|
3969
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3970
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-eyebrow", children: "Shop focus" }),
|
|
3971
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-admin-site-preview-footer-list", children: site.footerCategories.map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: item }, item)) })
|
|
3972
|
+
] }),
|
|
3973
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3974
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-eyebrow", children: "Explore" }),
|
|
3975
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-admin-site-preview-footer-list", children: site.footerLinks.map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: item.href, tabIndex: -1, children: item.label }, `${item.href}-${item.label}`)) })
|
|
3976
|
+
] }),
|
|
3977
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3978
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-eyebrow", children: "Visit" }),
|
|
3979
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-footer-contact", children: [
|
|
3980
|
+
site.locationSummary.address?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: site.locationSummary.address.trim() }) : null,
|
|
3981
|
+
site.locationSummary.hours?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: site.locationSummary.hours.trim() }) : null,
|
|
3982
|
+
site.locationSummary.phone?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: `tel:${site.locationSummary.phone.trim()}`, tabIndex: -1, children: site.locationSummary.phone.trim() }) : null,
|
|
3983
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: `mailto:${site.contactEmail}`, tabIndex: -1, children: site.contactEmail })
|
|
3984
|
+
] }),
|
|
3985
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PreviewSocialLinks, { links: socialLinks, variant: "footer" })
|
|
3986
|
+
] })
|
|
3987
|
+
] }),
|
|
3988
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-footer-meta", children: [
|
|
3989
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: site.copyright }),
|
|
3990
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: builtByHref, tabIndex: -1, children: builtByLabel })
|
|
3991
|
+
] })
|
|
3992
|
+
] }) });
|
|
3993
|
+
}
|
|
3994
|
+
|
|
3995
|
+
// src/admin-app/components/HeaderNavEditorWithPreview.tsx
|
|
3996
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3997
|
+
var fallbackNav = [{ href: "/", label: "Home" }];
|
|
3998
|
+
function HeaderNavEditorWithPreview({
|
|
3999
|
+
activePath,
|
|
4000
|
+
actionHref,
|
|
4001
|
+
actionLabel,
|
|
4002
|
+
brandName,
|
|
4003
|
+
initialItems,
|
|
4004
|
+
locationSummary,
|
|
4005
|
+
logoUrl,
|
|
4006
|
+
onItemsChange,
|
|
4007
|
+
pageOptions,
|
|
4008
|
+
socialLinks,
|
|
4009
|
+
tagline = ""
|
|
4010
|
+
}) {
|
|
4011
|
+
const [liveItems, setLiveItems] = (0, import_react17.useState)(initialItems);
|
|
4012
|
+
const previewItems = (0, import_react17.useMemo)(() => {
|
|
4013
|
+
const normalized = normalizeNestedNavItems(liveItems);
|
|
4014
|
+
const tree = buildNestedNavTree(normalized);
|
|
4015
|
+
return tree.topLevel.length > 0 ? tree : buildNestedNavTree(fallbackNav);
|
|
4016
|
+
}, [liveItems]);
|
|
4017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
4018
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4019
|
+
HeaderNavItemsEditor,
|
|
4020
|
+
{
|
|
4021
|
+
initialItems,
|
|
4022
|
+
onItemsChange: (items) => {
|
|
4023
|
+
setLiveItems(items);
|
|
4024
|
+
onItemsChange?.(items);
|
|
4025
|
+
},
|
|
4026
|
+
pageOptions
|
|
4027
|
+
}
|
|
4028
|
+
),
|
|
4029
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "orion-admin-preview-label", children: "Header Preview" }),
|
|
4030
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "orion-admin-preview-frame", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "orion-admin-preview-surface", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4031
|
+
SiteHeaderPreview,
|
|
4032
|
+
{
|
|
4033
|
+
site: {
|
|
4034
|
+
activePath,
|
|
4035
|
+
actionHref,
|
|
4036
|
+
actionLabel,
|
|
4037
|
+
locationSummary,
|
|
4038
|
+
logoUrl,
|
|
4039
|
+
navItems: previewItems.topLevel.map((item) => ({
|
|
4040
|
+
href: item.href,
|
|
4041
|
+
label: item.label
|
|
4042
|
+
})),
|
|
4043
|
+
siteName: brandName,
|
|
4044
|
+
socialLinks,
|
|
4045
|
+
tagline
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
) }) })
|
|
4049
|
+
] });
|
|
4050
|
+
}
|
|
4051
|
+
|
|
4052
|
+
// src/shared/socialMedia.ts
|
|
4053
|
+
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
4054
|
+
facebook: "Facebook",
|
|
4055
|
+
instagram: "Instagram",
|
|
4056
|
+
x: "X (Twitter)",
|
|
4057
|
+
linkedin: "LinkedIn",
|
|
4058
|
+
youtube: "YouTube",
|
|
4059
|
+
tiktok: "TikTok",
|
|
4060
|
+
pinterest: "Pinterest",
|
|
4061
|
+
snapchat: "Snapchat"
|
|
4062
|
+
};
|
|
4063
|
+
var SOCIAL_MEDIA_PLATFORMS = [
|
|
4064
|
+
"facebook",
|
|
4065
|
+
"instagram",
|
|
4066
|
+
"x",
|
|
4067
|
+
"linkedin",
|
|
4068
|
+
"youtube",
|
|
4069
|
+
"tiktok",
|
|
4070
|
+
"pinterest",
|
|
4071
|
+
"snapchat"
|
|
4072
|
+
];
|
|
4073
|
+
var SOCIAL_MEDIA_ICON_OPTIONS = {
|
|
4074
|
+
facebook: [
|
|
4075
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
|
|
4076
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" },
|
|
4077
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-facebook" },
|
|
4078
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:facebook-fill" }
|
|
4079
|
+
],
|
|
4080
|
+
instagram: [
|
|
4081
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
|
|
4082
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" },
|
|
4083
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-instagram" },
|
|
4084
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:instagram-fill" }
|
|
4085
|
+
],
|
|
4086
|
+
x: [
|
|
4087
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
|
|
4088
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" },
|
|
4089
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-x" },
|
|
4090
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:twitter-x-fill" }
|
|
4091
|
+
],
|
|
4092
|
+
linkedin: [
|
|
4093
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
|
|
4094
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" },
|
|
4095
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-linkedin" },
|
|
4096
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:linkedin-fill" }
|
|
4097
|
+
],
|
|
4098
|
+
youtube: [
|
|
4099
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
|
|
4100
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" },
|
|
4101
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-youtube" },
|
|
4102
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:youtube-fill" }
|
|
4103
|
+
],
|
|
4104
|
+
tiktok: [
|
|
4105
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
|
|
4106
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" },
|
|
4107
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-tiktok" },
|
|
4108
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:tiktok-fill" }
|
|
4109
|
+
],
|
|
4110
|
+
pinterest: [
|
|
4111
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
|
|
4112
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" },
|
|
4113
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-pinterest" },
|
|
4114
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:pinterest-fill" }
|
|
4115
|
+
],
|
|
4116
|
+
snapchat: [
|
|
4117
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
|
|
4118
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" },
|
|
4119
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-snapchat" },
|
|
4120
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:snapchat-fill" }
|
|
4121
|
+
]
|
|
4122
|
+
};
|
|
4123
|
+
var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
4124
|
+
(acc, platform) => {
|
|
4125
|
+
acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
|
|
4126
|
+
return acc;
|
|
4127
|
+
},
|
|
4128
|
+
{}
|
|
4129
|
+
);
|
|
4130
|
+
|
|
4131
|
+
// src/nextjs/utilities/socialMedia.ts
|
|
4132
|
+
function resolveSocialMediaLinks(data) {
|
|
4133
|
+
const profiles = data?.profiles;
|
|
4134
|
+
if (!profiles || typeof profiles !== "object") {
|
|
4135
|
+
return [];
|
|
4136
|
+
}
|
|
4137
|
+
return SOCIAL_MEDIA_PLATFORMS.reduce((acc, platform) => {
|
|
4138
|
+
const profile = profiles[platform];
|
|
4139
|
+
if (!profile || typeof profile !== "object") {
|
|
4140
|
+
return acc;
|
|
4141
|
+
}
|
|
4142
|
+
const url = typeof profile.url === "string" ? profile.url.trim() : "";
|
|
4143
|
+
if (!url) {
|
|
4144
|
+
return acc;
|
|
4145
|
+
}
|
|
4146
|
+
const icon = typeof profile.icon === "string" && profile.icon.trim().length > 0 ? profile.icon.trim() : SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform];
|
|
4147
|
+
acc.push({
|
|
4148
|
+
icon,
|
|
4149
|
+
label: SOCIAL_MEDIA_PLATFORM_LABELS[platform],
|
|
4150
|
+
platform,
|
|
4151
|
+
url
|
|
4152
|
+
});
|
|
4153
|
+
return acc;
|
|
4154
|
+
}, []);
|
|
4155
|
+
}
|
|
4156
|
+
|
|
4157
|
+
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
4158
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4159
|
+
var getPropString6 = (props, key, fallback) => {
|
|
4160
|
+
if (!props || typeof props !== "object") return fallback;
|
|
4161
|
+
const direct = props[key];
|
|
4162
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
4163
|
+
const clientProps = props.clientProps;
|
|
4164
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4165
|
+
const nested = clientProps[key];
|
|
4166
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
4167
|
+
}
|
|
4168
|
+
return fallback;
|
|
4169
|
+
};
|
|
4170
|
+
var getPropLocationSummary = (props, key) => {
|
|
4171
|
+
if (!props || typeof props !== "object") return void 0;
|
|
4172
|
+
const read = (value) => {
|
|
4173
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4174
|
+
return void 0;
|
|
4175
|
+
}
|
|
4176
|
+
const record = value;
|
|
4177
|
+
return {
|
|
4178
|
+
...typeof record.address === "string" ? { address: record.address } : {},
|
|
4179
|
+
...typeof record.hours === "string" ? { hours: record.hours } : {},
|
|
4180
|
+
...typeof record.phone === "string" ? { phone: record.phone } : {}
|
|
4181
|
+
};
|
|
4182
|
+
};
|
|
4183
|
+
const direct = read(props[key]);
|
|
4184
|
+
if (direct) return direct;
|
|
4185
|
+
const clientProps = props.clientProps;
|
|
4186
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4187
|
+
return read(clientProps[key]);
|
|
4188
|
+
}
|
|
4189
|
+
return void 0;
|
|
4190
|
+
};
|
|
4191
|
+
var normalizeNavItems = (value) => {
|
|
4192
|
+
if (!Array.isArray(value)) {
|
|
4193
|
+
return [];
|
|
4194
|
+
}
|
|
4195
|
+
return value.filter((item) => Boolean(item) && typeof item === "object").map((item) => ({
|
|
4196
|
+
href: typeof item.href === "string" ? item.href.trim() : "",
|
|
4197
|
+
label: typeof item.label === "string" ? item.label.trim() : "",
|
|
4198
|
+
parentHref: typeof item.parentHref === "string" ? item.parentHref.trim() : ""
|
|
4199
|
+
})).filter((item) => item.href.length > 0 && item.label.length > 0).map((item) => item.parentHref ? item : { href: item.href, label: item.label });
|
|
4200
|
+
};
|
|
4201
|
+
var resolveMediaURL = (value) => {
|
|
4202
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4203
|
+
return "";
|
|
4204
|
+
}
|
|
4205
|
+
const record = value;
|
|
4206
|
+
if (typeof record.url === "string" && record.url.length > 0) {
|
|
4207
|
+
return record.url;
|
|
4208
|
+
}
|
|
4209
|
+
if (typeof record.filename === "string" && record.filename.length > 0) {
|
|
4210
|
+
return `/api/media/file/${encodeURIComponent(record.filename)}`;
|
|
4211
|
+
}
|
|
4212
|
+
return "";
|
|
4213
|
+
};
|
|
4214
|
+
function AdminStudioHeaderGlobalView(props) {
|
|
4215
|
+
const globalSlug = getPropString6(props, "globalSlug", "header");
|
|
4216
|
+
const globalsBasePath = getPropString6(props, "globalsBasePath", "/globals");
|
|
4217
|
+
const pagesCollectionSlug = getPropString6(props, "pagesCollectionSlug", "pages");
|
|
4218
|
+
const actionHref = getPropString6(props, "actionHref", "/contact");
|
|
4219
|
+
const actionLabel = getPropString6(props, "actionLabel", "Visit Today");
|
|
4220
|
+
const locationSummary = getPropLocationSummary(props, "locationSummary");
|
|
4221
|
+
const adminBasePath = useAdminBasePath();
|
|
4222
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
4223
|
+
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
4224
|
+
const [loading, setLoading] = (0, import_react18.useState)(true);
|
|
4225
|
+
const [saving, setSaving] = (0, import_react18.useState)(false);
|
|
4226
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
4227
|
+
const [savedMessage, setSavedMessage] = (0, import_react18.useState)(null);
|
|
4228
|
+
const [initialItems, setInitialItems] = (0, import_react18.useState)([]);
|
|
4229
|
+
const [liveItems, setLiveItems] = (0, import_react18.useState)([]);
|
|
4230
|
+
const [pages, setPages] = (0, import_react18.useState)([]);
|
|
4231
|
+
const [siteSettings, setSiteSettings] = (0, import_react18.useState)({});
|
|
4232
|
+
const [socialMedia, setSocialMedia] = (0, import_react18.useState)({});
|
|
4233
|
+
(0, import_react18.useEffect)(() => {
|
|
4234
|
+
let cancelled = false;
|
|
4235
|
+
const run = async () => {
|
|
4236
|
+
setLoading(true);
|
|
4237
|
+
setError(null);
|
|
4238
|
+
setSavedMessage(null);
|
|
4239
|
+
try {
|
|
4240
|
+
const pageParams = new URLSearchParams({
|
|
4241
|
+
depth: "0",
|
|
4242
|
+
draft: "true",
|
|
4243
|
+
limit: "200",
|
|
4244
|
+
sort: "path"
|
|
4245
|
+
});
|
|
4246
|
+
const [headerRes, siteSettingsRes, socialMediaRes, pagesRes] = await Promise.all([
|
|
4247
|
+
fetch(`/api/globals/${globalSlug}?depth=1&draft=true`, { credentials: "same-origin" }),
|
|
4248
|
+
fetch("/api/globals/site-settings?depth=1&draft=true", { credentials: "same-origin" }),
|
|
4249
|
+
fetch("/api/globals/social-media?depth=1&draft=true", { credentials: "same-origin" }),
|
|
4250
|
+
fetch(`/api/${pagesCollectionSlug}?${pageParams.toString()}`, {
|
|
4251
|
+
credentials: "same-origin"
|
|
4252
|
+
})
|
|
4253
|
+
]);
|
|
4254
|
+
if (!headerRes.ok) throw new Error(`Failed to load ${globalSlug} (${headerRes.status}).`);
|
|
4255
|
+
if (!siteSettingsRes.ok) {
|
|
4256
|
+
throw new Error(`Failed to load site settings (${siteSettingsRes.status}).`);
|
|
4257
|
+
}
|
|
4258
|
+
if (!socialMediaRes.ok) {
|
|
4259
|
+
throw new Error(`Failed to load social media (${socialMediaRes.status}).`);
|
|
4260
|
+
}
|
|
4261
|
+
if (!pagesRes.ok) throw new Error(`Failed to load pages (${pagesRes.status}).`);
|
|
4262
|
+
const [headerJson, siteSettingsJson, socialMediaJson, pagesJson] = await Promise.all([
|
|
4263
|
+
headerRes.json(),
|
|
4264
|
+
siteSettingsRes.json(),
|
|
4265
|
+
socialMediaRes.json(),
|
|
4266
|
+
pagesRes.json()
|
|
4267
|
+
]);
|
|
4268
|
+
if (cancelled) return;
|
|
4269
|
+
const nextInitialItems = normalizeNavItems(headerJson.navItems);
|
|
4270
|
+
setInitialItems(nextInitialItems);
|
|
4271
|
+
setLiveItems(nextInitialItems);
|
|
4272
|
+
setSiteSettings(
|
|
4273
|
+
siteSettingsJson && typeof siteSettingsJson === "object" && !Array.isArray(siteSettingsJson) ? siteSettingsJson : {}
|
|
4274
|
+
);
|
|
4275
|
+
setSocialMedia(
|
|
4276
|
+
socialMediaJson && typeof socialMediaJson === "object" && !Array.isArray(socialMediaJson) ? socialMediaJson : {}
|
|
4277
|
+
);
|
|
4278
|
+
setPages(
|
|
4279
|
+
Array.isArray(pagesJson.docs) ? pagesJson.docs : []
|
|
4280
|
+
);
|
|
4281
|
+
} catch (loadError) {
|
|
4282
|
+
if (!cancelled) {
|
|
4283
|
+
setError(loadError instanceof Error ? loadError.message : "Failed to load header settings.");
|
|
4284
|
+
}
|
|
4285
|
+
} finally {
|
|
4286
|
+
if (!cancelled) {
|
|
4287
|
+
setLoading(false);
|
|
4288
|
+
}
|
|
4289
|
+
}
|
|
4290
|
+
};
|
|
4291
|
+
void run();
|
|
4292
|
+
return () => {
|
|
4293
|
+
cancelled = true;
|
|
4294
|
+
};
|
|
4295
|
+
}, [globalSlug, pagesCollectionSlug]);
|
|
4296
|
+
const pageOptions = (0, import_react18.useMemo)(() => buildAdminPageLinkOptions(pages), [pages]);
|
|
4297
|
+
const previewSocialLinks = (0, import_react18.useMemo)(
|
|
4298
|
+
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
4299
|
+
label: item.label,
|
|
4300
|
+
platform: item.platform,
|
|
4301
|
+
url: item.url
|
|
4302
|
+
})),
|
|
4303
|
+
[socialMedia]
|
|
4304
|
+
);
|
|
4305
|
+
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
4306
|
+
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
4307
|
+
const previewLogoUrl = resolveMediaURL(siteSettings.logo);
|
|
4308
|
+
const editorKey = (0, import_react18.useMemo)(() => JSON.stringify(initialItems), [initialItems]);
|
|
4309
|
+
const save = async () => {
|
|
4310
|
+
setSaving(true);
|
|
4311
|
+
setError(null);
|
|
4312
|
+
setSavedMessage(null);
|
|
4313
|
+
try {
|
|
4314
|
+
const response = await fetch(`/api/globals/${globalSlug}`, {
|
|
4315
|
+
body: JSON.stringify({
|
|
4316
|
+
navItems: liveItems.map((item) => ({
|
|
4317
|
+
href: item.href,
|
|
4318
|
+
label: item.label,
|
|
4319
|
+
...item.parentHref ? { parentHref: item.parentHref } : {}
|
|
4320
|
+
}))
|
|
4321
|
+
}),
|
|
4322
|
+
credentials: "same-origin",
|
|
4323
|
+
headers: {
|
|
4324
|
+
"Content-Type": "application/json"
|
|
4325
|
+
},
|
|
4326
|
+
method: "PATCH"
|
|
4327
|
+
});
|
|
4328
|
+
if (!response.ok) {
|
|
4329
|
+
throw new Error(`Failed to save ${globalSlug} (${response.status}).`);
|
|
4330
|
+
}
|
|
4331
|
+
const json = await response.json();
|
|
4332
|
+
const nextItems = normalizeNavItems(json.navItems);
|
|
4333
|
+
setInitialItems(nextItems);
|
|
4334
|
+
setLiveItems(nextItems);
|
|
4335
|
+
setSavedMessage("Saved.");
|
|
4336
|
+
} catch (saveError) {
|
|
4337
|
+
setError(saveError instanceof Error ? saveError.message : "Failed to save header settings.");
|
|
4338
|
+
} finally {
|
|
4339
|
+
setSaving(false);
|
|
4340
|
+
}
|
|
4341
|
+
};
|
|
4342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4343
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4344
|
+
import_ui8.SetStepNav,
|
|
4345
|
+
{
|
|
4346
|
+
nav: [
|
|
4347
|
+
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
4348
|
+
{ label: "Header & Navigation", url: rawGlobalPath }
|
|
4349
|
+
]
|
|
4350
|
+
}
|
|
4351
|
+
),
|
|
4352
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h1", { style: { margin: 0 }, children: "Header & Navigation" }),
|
|
4353
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage the main website navigation and preview it in place." }),
|
|
4354
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading header settings\u2026" }) : null,
|
|
4355
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4356
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4357
|
+
!loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4358
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4359
|
+
HeaderNavEditorWithPreview,
|
|
4360
|
+
{
|
|
4361
|
+
actionHref,
|
|
4362
|
+
actionLabel,
|
|
4363
|
+
activePath: "/",
|
|
4364
|
+
brandName: previewSiteName,
|
|
4365
|
+
initialItems,
|
|
4366
|
+
locationSummary,
|
|
4367
|
+
logoUrl: previewLogoUrl || void 0,
|
|
4368
|
+
onItemsChange: setLiveItems,
|
|
4369
|
+
pageOptions,
|
|
4370
|
+
socialLinks: previewSocialLinks,
|
|
4371
|
+
tagline: previewTagline
|
|
4372
|
+
},
|
|
4373
|
+
editorKey
|
|
4374
|
+
),
|
|
4375
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4376
|
+
"button",
|
|
4377
|
+
{
|
|
4378
|
+
disabled: saving,
|
|
4379
|
+
onClick: () => void save(),
|
|
4380
|
+
style: {
|
|
4381
|
+
background: "var(--theme-elevation-900)",
|
|
4382
|
+
border: "none",
|
|
4383
|
+
borderRadius: 12,
|
|
4384
|
+
color: "var(--theme-elevation-0)",
|
|
4385
|
+
cursor: saving ? "not-allowed" : "pointer",
|
|
4386
|
+
fontWeight: 900,
|
|
4387
|
+
minHeight: 42,
|
|
4388
|
+
padding: "0 0.9rem"
|
|
4389
|
+
},
|
|
4390
|
+
type: "button",
|
|
4391
|
+
children: saving ? "Saving\u2026" : "Save Navigation"
|
|
4392
|
+
}
|
|
4393
|
+
) })
|
|
4394
|
+
] }) : null
|
|
4395
|
+
] }) });
|
|
3279
4396
|
}
|
|
3280
4397
|
|
|
3281
|
-
// src/admin/components/studio/
|
|
3282
|
-
var
|
|
3283
|
-
var
|
|
3284
|
-
var
|
|
3285
|
-
|
|
3286
|
-
const direct = props.globals;
|
|
3287
|
-
if (Array.isArray(direct)) return direct;
|
|
3288
|
-
const clientProps = props.clientProps;
|
|
3289
|
-
if (clientProps && typeof clientProps === "object") {
|
|
3290
|
-
const nested = clientProps.globals;
|
|
3291
|
-
if (Array.isArray(nested)) return nested;
|
|
3292
|
-
}
|
|
3293
|
-
return null;
|
|
3294
|
-
};
|
|
3295
|
-
var getPropString5 = (props, key, fallback) => {
|
|
4398
|
+
// src/admin/components/studio/AdminStudioFooterGlobalView.tsx
|
|
4399
|
+
var import_react19 = require("react");
|
|
4400
|
+
var import_ui9 = require("@payloadcms/ui");
|
|
4401
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4402
|
+
var getPropString7 = (props, key, fallback) => {
|
|
3296
4403
|
if (!props || typeof props !== "object") return fallback;
|
|
3297
4404
|
const direct = props[key];
|
|
3298
|
-
if (typeof direct === "string"
|
|
4405
|
+
if (typeof direct === "string") return direct;
|
|
3299
4406
|
const clientProps = props.clientProps;
|
|
3300
4407
|
if (clientProps && typeof clientProps === "object") {
|
|
3301
4408
|
const nested = clientProps[key];
|
|
3302
|
-
if (typeof nested === "string"
|
|
4409
|
+
if (typeof nested === "string") return nested;
|
|
3303
4410
|
}
|
|
3304
4411
|
return fallback;
|
|
3305
4412
|
};
|
|
3306
|
-
|
|
3307
|
-
|
|
4413
|
+
var getPropStringArray2 = (props, key) => {
|
|
4414
|
+
if (!props || typeof props !== "object") return [];
|
|
4415
|
+
const read = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.trim().length > 0) : [];
|
|
4416
|
+
const direct = read(props[key]);
|
|
4417
|
+
if (direct.length > 0) return direct;
|
|
4418
|
+
const clientProps = props.clientProps;
|
|
4419
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4420
|
+
return read(clientProps[key]);
|
|
4421
|
+
}
|
|
4422
|
+
return [];
|
|
4423
|
+
};
|
|
4424
|
+
var getPropLinks = (props, key) => {
|
|
4425
|
+
if (!props || typeof props !== "object") return [];
|
|
4426
|
+
const read = (value) => Array.isArray(value) ? value.filter((item) => Boolean(item) && typeof item === "object").map((item) => ({
|
|
4427
|
+
href: typeof item.href === "string" ? item.href.trim() : "",
|
|
4428
|
+
label: typeof item.label === "string" ? item.label.trim() : ""
|
|
4429
|
+
})).filter((item) => item.href.length > 0 && item.label.length > 0) : [];
|
|
4430
|
+
const direct = read(props[key]);
|
|
4431
|
+
if (direct.length > 0) return direct;
|
|
4432
|
+
const clientProps = props.clientProps;
|
|
4433
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4434
|
+
return read(clientProps[key]);
|
|
4435
|
+
}
|
|
4436
|
+
return [];
|
|
4437
|
+
};
|
|
4438
|
+
var getPropLocationSummary2 = (props, key) => {
|
|
4439
|
+
if (!props || typeof props !== "object") return void 0;
|
|
4440
|
+
const read = (value) => {
|
|
4441
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4442
|
+
return void 0;
|
|
4443
|
+
}
|
|
4444
|
+
const record = value;
|
|
4445
|
+
return {
|
|
4446
|
+
...typeof record.address === "string" ? { address: record.address } : {},
|
|
4447
|
+
...typeof record.hours === "string" ? { hours: record.hours } : {},
|
|
4448
|
+
...typeof record.phone === "string" ? { phone: record.phone } : {}
|
|
4449
|
+
};
|
|
4450
|
+
};
|
|
4451
|
+
const direct = read(props[key]);
|
|
4452
|
+
if (direct) return direct;
|
|
4453
|
+
const clientProps = props.clientProps;
|
|
4454
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4455
|
+
return read(clientProps[key]);
|
|
4456
|
+
}
|
|
4457
|
+
return void 0;
|
|
4458
|
+
};
|
|
4459
|
+
var resolveMediaURL2 = (value) => {
|
|
4460
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4461
|
+
return "";
|
|
4462
|
+
}
|
|
4463
|
+
const record = value;
|
|
4464
|
+
if (typeof record.url === "string" && record.url.length > 0) {
|
|
4465
|
+
return record.url;
|
|
4466
|
+
}
|
|
4467
|
+
if (typeof record.filename === "string" && record.filename.length > 0) {
|
|
4468
|
+
return `/api/media/file/${encodeURIComponent(record.filename)}`;
|
|
4469
|
+
}
|
|
4470
|
+
return "";
|
|
4471
|
+
};
|
|
4472
|
+
var deriveAddress = (siteSettings) => {
|
|
4473
|
+
const businessProfile = siteSettings.businessProfile && typeof siteSettings.businessProfile === "object" && !Array.isArray(siteSettings.businessProfile) ? siteSettings.businessProfile : {};
|
|
4474
|
+
const parts = [
|
|
4475
|
+
businessProfile.streetAddress,
|
|
4476
|
+
[businessProfile.addressLocality, businessProfile.addressRegion].filter(Boolean).join(", "),
|
|
4477
|
+
businessProfile.postalCode
|
|
4478
|
+
].filter((part) => typeof part === "string" && part.trim().length > 0).map((part) => part.trim());
|
|
4479
|
+
return parts.join(" ");
|
|
4480
|
+
};
|
|
4481
|
+
var deriveHours = (siteSettings) => {
|
|
4482
|
+
const businessProfile = siteSettings.businessProfile && typeof siteSettings.businessProfile === "object" && !Array.isArray(siteSettings.businessProfile) ? siteSettings.businessProfile : {};
|
|
4483
|
+
if (!Array.isArray(businessProfile.openingHours) || businessProfile.openingHours.length === 0) {
|
|
4484
|
+
return "";
|
|
4485
|
+
}
|
|
4486
|
+
const firstRow = businessProfile.openingHours[0] && typeof businessProfile.openingHours[0] === "object" && !Array.isArray(businessProfile.openingHours[0]) ? businessProfile.openingHours[0] : {};
|
|
4487
|
+
const dayOfWeek = typeof firstRow.dayOfWeek === "string" ? firstRow.dayOfWeek.trim() : "";
|
|
4488
|
+
const opens = typeof firstRow.opens === "string" ? firstRow.opens.trim() : "";
|
|
4489
|
+
const closes = typeof firstRow.closes === "string" ? firstRow.closes.trim() : "";
|
|
4490
|
+
if (!dayOfWeek || !opens || !closes) {
|
|
4491
|
+
return "";
|
|
4492
|
+
}
|
|
4493
|
+
return `${dayOfWeek} \u2022 ${opens} - ${closes}`;
|
|
4494
|
+
};
|
|
4495
|
+
function AdminStudioFooterGlobalView(props) {
|
|
4496
|
+
const globalSlug = getPropString7(props, "globalSlug", "footer");
|
|
4497
|
+
const globalsBasePath = getPropString7(props, "globalsBasePath", "/globals");
|
|
4498
|
+
const builtByHref = getPropString7(props, "builtByHref", "");
|
|
4499
|
+
const builtByLabel = getPropString7(props, "builtByLabel", "");
|
|
4500
|
+
const description = getPropString7(props, "description", "");
|
|
4501
|
+
const footerCategories = getPropStringArray2(props, "footerCategories");
|
|
4502
|
+
const footerLinks = getPropLinks(props, "footerLinks");
|
|
4503
|
+
const configuredLocationSummary = getPropLocationSummary2(props, "locationSummary");
|
|
3308
4504
|
const adminBasePath = useAdminBasePath();
|
|
3309
4505
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3310
|
-
const
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
]
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
4506
|
+
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
4507
|
+
const [loading, setLoading] = (0, import_react19.useState)(true);
|
|
4508
|
+
const [saving, setSaving] = (0, import_react19.useState)(false);
|
|
4509
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
4510
|
+
const [savedMessage, setSavedMessage] = (0, import_react19.useState)(null);
|
|
4511
|
+
const [doc, setDoc] = (0, import_react19.useState)({
|
|
4512
|
+
contactEmail: "",
|
|
4513
|
+
contactPhone: "",
|
|
4514
|
+
copyright: ""
|
|
4515
|
+
});
|
|
4516
|
+
const [siteSettings, setSiteSettings] = (0, import_react19.useState)({});
|
|
4517
|
+
const [socialMedia, setSocialMedia] = (0, import_react19.useState)({});
|
|
4518
|
+
(0, import_react19.useEffect)(() => {
|
|
4519
|
+
let cancelled = false;
|
|
4520
|
+
const run = async () => {
|
|
4521
|
+
setLoading(true);
|
|
4522
|
+
setError(null);
|
|
4523
|
+
setSavedMessage(null);
|
|
4524
|
+
try {
|
|
4525
|
+
const [footerRes, siteSettingsRes, socialMediaRes] = await Promise.all([
|
|
4526
|
+
fetch(`/api/globals/${globalSlug}?depth=1&draft=true`, { credentials: "same-origin" }),
|
|
4527
|
+
fetch("/api/globals/site-settings?depth=1&draft=true", { credentials: "same-origin" }),
|
|
4528
|
+
fetch("/api/globals/social-media?depth=1&draft=true", { credentials: "same-origin" })
|
|
4529
|
+
]);
|
|
4530
|
+
if (!footerRes.ok) throw new Error(`Failed to load ${globalSlug} (${footerRes.status}).`);
|
|
4531
|
+
if (!siteSettingsRes.ok) {
|
|
4532
|
+
throw new Error(`Failed to load site settings (${siteSettingsRes.status}).`);
|
|
4533
|
+
}
|
|
4534
|
+
if (!socialMediaRes.ok) {
|
|
4535
|
+
throw new Error(`Failed to load social media (${socialMediaRes.status}).`);
|
|
4536
|
+
}
|
|
4537
|
+
const [footerJson, siteSettingsJson, socialMediaJson] = await Promise.all([
|
|
4538
|
+
footerRes.json(),
|
|
4539
|
+
siteSettingsRes.json(),
|
|
4540
|
+
socialMediaRes.json()
|
|
4541
|
+
]);
|
|
4542
|
+
if (cancelled) return;
|
|
4543
|
+
const footerRecord = footerJson && typeof footerJson === "object" && !Array.isArray(footerJson) ? footerJson : {};
|
|
4544
|
+
setDoc({
|
|
4545
|
+
contactEmail: typeof footerRecord.contactEmail === "string" ? footerRecord.contactEmail : "",
|
|
4546
|
+
contactPhone: typeof footerRecord.contactPhone === "string" ? footerRecord.contactPhone : "",
|
|
4547
|
+
copyright: typeof footerRecord.copyright === "string" ? footerRecord.copyright : ""
|
|
4548
|
+
});
|
|
4549
|
+
setSiteSettings(
|
|
4550
|
+
siteSettingsJson && typeof siteSettingsJson === "object" && !Array.isArray(siteSettingsJson) ? siteSettingsJson : {}
|
|
4551
|
+
);
|
|
4552
|
+
setSocialMedia(
|
|
4553
|
+
socialMediaJson && typeof socialMediaJson === "object" && !Array.isArray(socialMediaJson) ? socialMediaJson : {}
|
|
4554
|
+
);
|
|
4555
|
+
} catch (loadError) {
|
|
4556
|
+
if (!cancelled) {
|
|
4557
|
+
setError(loadError instanceof Error ? loadError.message : "Failed to load footer settings.");
|
|
4558
|
+
}
|
|
4559
|
+
} finally {
|
|
4560
|
+
if (!cancelled) {
|
|
4561
|
+
setLoading(false);
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
};
|
|
4565
|
+
void run();
|
|
4566
|
+
return () => {
|
|
4567
|
+
cancelled = true;
|
|
4568
|
+
};
|
|
4569
|
+
}, [globalSlug]);
|
|
4570
|
+
const previewSocialLinks = (0, import_react19.useMemo)(
|
|
4571
|
+
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
4572
|
+
label: item.label,
|
|
4573
|
+
platform: item.platform,
|
|
4574
|
+
url: item.url
|
|
4575
|
+
})),
|
|
4576
|
+
[socialMedia]
|
|
4577
|
+
);
|
|
4578
|
+
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
4579
|
+
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
4580
|
+
const previewLogoUrl = resolveMediaURL2(siteSettings.logo);
|
|
4581
|
+
const previewLocationSummary = {
|
|
4582
|
+
address: configuredLocationSummary?.address || deriveAddress(siteSettings),
|
|
4583
|
+
hours: configuredLocationSummary?.hours || deriveHours(siteSettings),
|
|
4584
|
+
phone: doc.contactPhone
|
|
4585
|
+
};
|
|
4586
|
+
const save = async () => {
|
|
4587
|
+
setSaving(true);
|
|
4588
|
+
setError(null);
|
|
4589
|
+
setSavedMessage(null);
|
|
4590
|
+
try {
|
|
4591
|
+
const response = await fetch(`/api/globals/${globalSlug}`, {
|
|
4592
|
+
body: JSON.stringify(doc),
|
|
4593
|
+
credentials: "same-origin",
|
|
4594
|
+
headers: {
|
|
4595
|
+
"Content-Type": "application/json"
|
|
4596
|
+
},
|
|
4597
|
+
method: "PATCH"
|
|
4598
|
+
});
|
|
4599
|
+
if (!response.ok) {
|
|
4600
|
+
throw new Error(`Failed to save ${globalSlug} (${response.status}).`);
|
|
4601
|
+
}
|
|
4602
|
+
const json = await response.json();
|
|
4603
|
+
setDoc({
|
|
4604
|
+
contactEmail: typeof json.contactEmail === "string" ? json.contactEmail : "",
|
|
4605
|
+
contactPhone: typeof json.contactPhone === "string" ? json.contactPhone : "",
|
|
4606
|
+
copyright: typeof json.copyright === "string" ? json.copyright : ""
|
|
4607
|
+
});
|
|
4608
|
+
setSavedMessage("Saved.");
|
|
4609
|
+
} catch (saveError) {
|
|
4610
|
+
setError(saveError instanceof Error ? saveError.message : "Failed to save footer settings.");
|
|
4611
|
+
} finally {
|
|
4612
|
+
setSaving(false);
|
|
4613
|
+
}
|
|
4614
|
+
};
|
|
4615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4616
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4617
|
+
import_ui9.SetStepNav,
|
|
4618
|
+
{
|
|
4619
|
+
nav: [
|
|
4620
|
+
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
4621
|
+
{ label: "Footer", url: rawGlobalPath }
|
|
4622
|
+
]
|
|
4623
|
+
}
|
|
4624
|
+
),
|
|
4625
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h1", { style: { margin: 0 }, children: "Footer" }),
|
|
4626
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage footer contact details and preview the package footer in place." }),
|
|
4627
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading footer settings\u2026" }) : null,
|
|
4628
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4629
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4630
|
+
!loading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4631
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4632
|
+
"label",
|
|
3327
4633
|
{
|
|
3328
|
-
href,
|
|
3329
4634
|
style: {
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
textDecoration: "none"
|
|
4635
|
+
color: "var(--theme-elevation-800)",
|
|
4636
|
+
display: "grid",
|
|
4637
|
+
fontSize: "0.88rem",
|
|
4638
|
+
fontWeight: 700,
|
|
4639
|
+
gap: "0.35rem"
|
|
3336
4640
|
},
|
|
3337
4641
|
children: [
|
|
3338
|
-
|
|
3339
|
-
/* @__PURE__ */ (0,
|
|
4642
|
+
"Copyright",
|
|
4643
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4644
|
+
"input",
|
|
4645
|
+
{
|
|
4646
|
+
onChange: (event) => setDoc((current) => ({ ...current, copyright: event.target.value })),
|
|
4647
|
+
style: {
|
|
4648
|
+
background: "var(--theme-elevation-0)",
|
|
4649
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
4650
|
+
borderRadius: 10,
|
|
4651
|
+
color: "inherit",
|
|
4652
|
+
fontSize: "0.95rem",
|
|
4653
|
+
minHeight: 42,
|
|
4654
|
+
padding: "0.55rem 0.65rem",
|
|
4655
|
+
width: "100%"
|
|
4656
|
+
},
|
|
4657
|
+
type: "text",
|
|
4658
|
+
value: doc.copyright
|
|
4659
|
+
}
|
|
4660
|
+
)
|
|
3340
4661
|
]
|
|
3341
|
-
}
|
|
3342
|
-
|
|
3343
|
-
)
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
4662
|
+
}
|
|
4663
|
+
),
|
|
4664
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4665
|
+
"label",
|
|
4666
|
+
{
|
|
4667
|
+
style: {
|
|
4668
|
+
color: "var(--theme-elevation-800)",
|
|
4669
|
+
display: "grid",
|
|
4670
|
+
fontSize: "0.88rem",
|
|
4671
|
+
fontWeight: 700,
|
|
4672
|
+
gap: "0.35rem"
|
|
4673
|
+
},
|
|
4674
|
+
children: [
|
|
4675
|
+
"Contact Email",
|
|
4676
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4677
|
+
"input",
|
|
4678
|
+
{
|
|
4679
|
+
onChange: (event) => setDoc((current) => ({ ...current, contactEmail: event.target.value })),
|
|
4680
|
+
style: {
|
|
4681
|
+
background: "var(--theme-elevation-0)",
|
|
4682
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
4683
|
+
borderRadius: 10,
|
|
4684
|
+
color: "inherit",
|
|
4685
|
+
fontSize: "0.95rem",
|
|
4686
|
+
minHeight: 42,
|
|
4687
|
+
padding: "0.55rem 0.65rem",
|
|
4688
|
+
width: "100%"
|
|
4689
|
+
},
|
|
4690
|
+
type: "email",
|
|
4691
|
+
value: doc.contactEmail
|
|
4692
|
+
}
|
|
4693
|
+
)
|
|
4694
|
+
]
|
|
4695
|
+
}
|
|
4696
|
+
),
|
|
4697
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4698
|
+
"label",
|
|
4699
|
+
{
|
|
4700
|
+
style: {
|
|
4701
|
+
color: "var(--theme-elevation-800)",
|
|
4702
|
+
display: "grid",
|
|
4703
|
+
fontSize: "0.88rem",
|
|
4704
|
+
fontWeight: 700,
|
|
4705
|
+
gap: "0.35rem"
|
|
4706
|
+
},
|
|
4707
|
+
children: [
|
|
4708
|
+
"Contact Phone",
|
|
4709
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4710
|
+
"input",
|
|
4711
|
+
{
|
|
4712
|
+
onChange: (event) => setDoc((current) => ({ ...current, contactPhone: event.target.value })),
|
|
4713
|
+
style: {
|
|
4714
|
+
background: "var(--theme-elevation-0)",
|
|
4715
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
4716
|
+
borderRadius: 10,
|
|
4717
|
+
color: "inherit",
|
|
4718
|
+
fontSize: "0.95rem",
|
|
4719
|
+
minHeight: 42,
|
|
4720
|
+
padding: "0.55rem 0.65rem",
|
|
4721
|
+
width: "100%"
|
|
4722
|
+
},
|
|
4723
|
+
type: "text",
|
|
4724
|
+
value: doc.contactPhone
|
|
4725
|
+
}
|
|
4726
|
+
)
|
|
4727
|
+
]
|
|
4728
|
+
}
|
|
4729
|
+
),
|
|
4730
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "orion-admin-preview-label", children: "Footer Preview" }),
|
|
4731
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "orion-admin-preview-frame", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "orion-admin-preview-surface", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4732
|
+
SiteFooterPreview,
|
|
4733
|
+
{
|
|
4734
|
+
site: {
|
|
4735
|
+
...builtByHref ? { builtByHref } : {},
|
|
4736
|
+
...builtByLabel ? { builtByLabel } : {},
|
|
4737
|
+
contactEmail: doc.contactEmail || "hello@example.com",
|
|
4738
|
+
copyright: doc.copyright || `\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} ${previewSiteName}`,
|
|
4739
|
+
...description ? { description } : {},
|
|
4740
|
+
footerCategories,
|
|
4741
|
+
footerLinks,
|
|
4742
|
+
locationSummary: previewLocationSummary,
|
|
4743
|
+
logoUrl: previewLogoUrl || void 0,
|
|
4744
|
+
siteName: previewSiteName,
|
|
4745
|
+
socialLinks: previewSocialLinks,
|
|
4746
|
+
tagline: previewTagline
|
|
4747
|
+
}
|
|
4748
|
+
}
|
|
4749
|
+
) }) }),
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4751
|
+
"button",
|
|
4752
|
+
{
|
|
4753
|
+
disabled: saving,
|
|
4754
|
+
onClick: () => void save(),
|
|
4755
|
+
style: {
|
|
4756
|
+
background: "var(--theme-elevation-900)",
|
|
4757
|
+
border: "none",
|
|
4758
|
+
borderRadius: 12,
|
|
4759
|
+
color: "var(--theme-elevation-0)",
|
|
4760
|
+
cursor: saving ? "not-allowed" : "pointer",
|
|
4761
|
+
fontWeight: 900,
|
|
4762
|
+
minHeight: 42,
|
|
4763
|
+
padding: "0 0.9rem"
|
|
4764
|
+
},
|
|
4765
|
+
type: "button",
|
|
4766
|
+
children: saving ? "Saving\u2026" : "Save Footer"
|
|
4767
|
+
}
|
|
4768
|
+
) })
|
|
4769
|
+
] }) : null
|
|
4770
|
+
] }) });
|
|
3354
4771
|
}
|
|
3355
4772
|
|
|
3356
4773
|
// src/admin/components/studio/AdminStudioContactFormView.tsx
|
|
3357
|
-
var
|
|
3358
|
-
var
|
|
3359
|
-
var
|
|
4774
|
+
var import_react20 = require("react");
|
|
4775
|
+
var import_ui10 = require("@payloadcms/ui");
|
|
4776
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3360
4777
|
var defaultDoc = {
|
|
3361
4778
|
disabledMessage: "This form is temporarily unavailable. Please call us for immediate service.",
|
|
3362
4779
|
enabled: true,
|
|
@@ -3371,7 +4788,7 @@ var defaultDoc = {
|
|
|
3371
4788
|
submitButtonLabel: "Send Request",
|
|
3372
4789
|
successMessage: "Thanks, your request has been received. We will follow up shortly."
|
|
3373
4790
|
};
|
|
3374
|
-
var
|
|
4791
|
+
var getPropString8 = (props, key, fallback) => {
|
|
3375
4792
|
if (!props || typeof props !== "object") return fallback;
|
|
3376
4793
|
const direct = props[key];
|
|
3377
4794
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3440,17 +4857,17 @@ var ghostButtonStyle = {
|
|
|
3440
4857
|
color: "var(--theme-elevation-900)"
|
|
3441
4858
|
};
|
|
3442
4859
|
function AdminStudioContactFormView(props) {
|
|
3443
|
-
const globalSlug =
|
|
3444
|
-
const globalsBasePath =
|
|
4860
|
+
const globalSlug = getPropString8(props, "globalSlug", "contact-form");
|
|
4861
|
+
const globalsBasePath = getPropString8(props, "globalsBasePath", "/globals");
|
|
3445
4862
|
const adminBasePath = useAdminBasePath();
|
|
3446
4863
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3447
4864
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
3448
|
-
const [doc, setDoc] = (0,
|
|
3449
|
-
const [error, setError] = (0,
|
|
3450
|
-
const [isLoading, setIsLoading] = (0,
|
|
3451
|
-
const [isSaving, setIsSaving] = (0,
|
|
3452
|
-
const [savedMessage, setSavedMessage] = (0,
|
|
3453
|
-
(0,
|
|
4865
|
+
const [doc, setDoc] = (0, import_react20.useState)(defaultDoc);
|
|
4866
|
+
const [error, setError] = (0, import_react20.useState)(null);
|
|
4867
|
+
const [isLoading, setIsLoading] = (0, import_react20.useState)(true);
|
|
4868
|
+
const [isSaving, setIsSaving] = (0, import_react20.useState)(false);
|
|
4869
|
+
const [savedMessage, setSavedMessage] = (0, import_react20.useState)(null);
|
|
4870
|
+
(0, import_react20.useEffect)(() => {
|
|
3454
4871
|
let mounted = true;
|
|
3455
4872
|
const load = async () => {
|
|
3456
4873
|
setIsLoading(true);
|
|
@@ -3480,7 +4897,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3480
4897
|
mounted = false;
|
|
3481
4898
|
};
|
|
3482
4899
|
}, [globalSlug]);
|
|
3483
|
-
const payload = (0,
|
|
4900
|
+
const payload = (0, import_react20.useMemo)(
|
|
3484
4901
|
() => ({
|
|
3485
4902
|
disabledMessage: doc.disabledMessage,
|
|
3486
4903
|
enabled: doc.enabled,
|
|
@@ -3517,9 +4934,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3517
4934
|
setIsSaving(false);
|
|
3518
4935
|
}
|
|
3519
4936
|
};
|
|
3520
|
-
return /* @__PURE__ */ (0,
|
|
3521
|
-
/* @__PURE__ */ (0,
|
|
3522
|
-
|
|
4937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4938
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4939
|
+
import_ui10.SetStepNav,
|
|
3523
4940
|
{
|
|
3524
4941
|
nav: [
|
|
3525
4942
|
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
@@ -3527,14 +4944,14 @@ function AdminStudioContactFormView(props) {
|
|
|
3527
4944
|
]
|
|
3528
4945
|
}
|
|
3529
4946
|
),
|
|
3530
|
-
/* @__PURE__ */ (0,
|
|
3531
|
-
/* @__PURE__ */ (0,
|
|
3532
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
3533
|
-
error ? /* @__PURE__ */ (0,
|
|
3534
|
-
savedMessage ? /* @__PURE__ */ (0,
|
|
3535
|
-
!isLoading ? /* @__PURE__ */ (0,
|
|
3536
|
-
/* @__PURE__ */ (0,
|
|
3537
|
-
/* @__PURE__ */ (0,
|
|
4947
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h1", { style: { margin: 0 }, children: "Contact Form" }),
|
|
4948
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Edit form behavior and submission messaging without leaving Studio." }),
|
|
4949
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading form settings\u2026" }) : null,
|
|
4950
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4951
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4952
|
+
!isLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem", maxWidth: 900 }, children: [
|
|
4953
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: { ...fieldLabelStyle, alignItems: "center", display: "flex", gap: "0.6rem" }, children: [
|
|
4954
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3538
4955
|
"input",
|
|
3539
4956
|
{
|
|
3540
4957
|
checked: doc.enabled,
|
|
@@ -3544,9 +4961,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3544
4961
|
),
|
|
3545
4962
|
"Form enabled"
|
|
3546
4963
|
] }),
|
|
3547
|
-
/* @__PURE__ */ (0,
|
|
4964
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
3548
4965
|
"Notification Email",
|
|
3549
|
-
/* @__PURE__ */ (0,
|
|
4966
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3550
4967
|
"input",
|
|
3551
4968
|
{
|
|
3552
4969
|
onChange: (event) => setDoc((prev) => ({ ...prev, notificationEmail: event.target.value })),
|
|
@@ -3556,9 +4973,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3556
4973
|
}
|
|
3557
4974
|
)
|
|
3558
4975
|
] }),
|
|
3559
|
-
/* @__PURE__ */ (0,
|
|
4976
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
3560
4977
|
"Submit Button Label",
|
|
3561
|
-
/* @__PURE__ */ (0,
|
|
4978
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3562
4979
|
"input",
|
|
3563
4980
|
{
|
|
3564
4981
|
onChange: (event) => setDoc((prev) => ({ ...prev, submitButtonLabel: event.target.value })),
|
|
@@ -3568,9 +4985,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3568
4985
|
}
|
|
3569
4986
|
)
|
|
3570
4987
|
] }),
|
|
3571
|
-
/* @__PURE__ */ (0,
|
|
4988
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
3572
4989
|
"Success Message",
|
|
3573
|
-
/* @__PURE__ */ (0,
|
|
4990
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3574
4991
|
"input",
|
|
3575
4992
|
{
|
|
3576
4993
|
onChange: (event) => setDoc((prev) => ({ ...prev, successMessage: event.target.value })),
|
|
@@ -3580,9 +4997,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3580
4997
|
}
|
|
3581
4998
|
)
|
|
3582
4999
|
] }),
|
|
3583
|
-
/* @__PURE__ */ (0,
|
|
5000
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
3584
5001
|
"Error Message",
|
|
3585
|
-
/* @__PURE__ */ (0,
|
|
5002
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3586
5003
|
"input",
|
|
3587
5004
|
{
|
|
3588
5005
|
onChange: (event) => setDoc((prev) => ({ ...prev, errorMessage: event.target.value })),
|
|
@@ -3592,9 +5009,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3592
5009
|
}
|
|
3593
5010
|
)
|
|
3594
5011
|
] }),
|
|
3595
|
-
/* @__PURE__ */ (0,
|
|
5012
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
3596
5013
|
"Disabled Message",
|
|
3597
|
-
/* @__PURE__ */ (0,
|
|
5014
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3598
5015
|
"input",
|
|
3599
5016
|
{
|
|
3600
5017
|
onChange: (event) => setDoc((prev) => ({ ...prev, disabledMessage: event.target.value })),
|
|
@@ -3604,7 +5021,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3604
5021
|
}
|
|
3605
5022
|
)
|
|
3606
5023
|
] }),
|
|
3607
|
-
/* @__PURE__ */ (0,
|
|
5024
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3608
5025
|
"div",
|
|
3609
5026
|
{
|
|
3610
5027
|
style: {
|
|
@@ -3614,9 +5031,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3614
5031
|
padding: "0.85rem"
|
|
3615
5032
|
},
|
|
3616
5033
|
children: [
|
|
3617
|
-
/* @__PURE__ */ (0,
|
|
3618
|
-
/* @__PURE__ */ (0,
|
|
3619
|
-
/* @__PURE__ */ (0,
|
|
5034
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { fontWeight: 900, marginBottom: "0.65rem" }, children: "Service Options" }),
|
|
5035
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { display: "grid", gap: "0.55rem" }, children: doc.serviceOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
5036
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3620
5037
|
"input",
|
|
3621
5038
|
{
|
|
3622
5039
|
onChange: (event) => setDoc((prev) => ({
|
|
@@ -3630,7 +5047,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3630
5047
|
value: option.label
|
|
3631
5048
|
}
|
|
3632
5049
|
),
|
|
3633
|
-
/* @__PURE__ */ (0,
|
|
5050
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3634
5051
|
"button",
|
|
3635
5052
|
{
|
|
3636
5053
|
onClick: () => setDoc((prev) => ({
|
|
@@ -3643,7 +5060,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3643
5060
|
}
|
|
3644
5061
|
)
|
|
3645
5062
|
] }, `${index}-${option.label}`)) }),
|
|
3646
|
-
/* @__PURE__ */ (0,
|
|
5063
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3647
5064
|
"button",
|
|
3648
5065
|
{
|
|
3649
5066
|
onClick: () => setDoc((prev) => ({
|
|
@@ -3658,9 +5075,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3658
5075
|
]
|
|
3659
5076
|
}
|
|
3660
5077
|
),
|
|
3661
|
-
/* @__PURE__ */ (0,
|
|
3662
|
-
/* @__PURE__ */ (0,
|
|
3663
|
-
/* @__PURE__ */ (0,
|
|
5078
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "0.6rem" }, children: [
|
|
5079
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { disabled: isSaving, onClick: () => void save(), style: buttonStyle, type: "button", children: isSaving ? "Saving\u2026" : "Save Form Settings" }),
|
|
5080
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3664
5081
|
"a",
|
|
3665
5082
|
{
|
|
3666
5083
|
href: rawGlobalPath,
|
|
@@ -3676,13 +5093,13 @@ function AdminStudioContactFormView(props) {
|
|
|
3676
5093
|
)
|
|
3677
5094
|
] })
|
|
3678
5095
|
] }) : null
|
|
3679
|
-
] });
|
|
5096
|
+
] }) });
|
|
3680
5097
|
}
|
|
3681
5098
|
|
|
3682
5099
|
// src/admin/components/studio/AdminStudioMediaView.tsx
|
|
3683
|
-
var
|
|
3684
|
-
var
|
|
3685
|
-
var
|
|
5100
|
+
var import_ui11 = require("@payloadcms/ui");
|
|
5101
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5102
|
+
var getPropString9 = (props, key, fallback) => {
|
|
3686
5103
|
if (!props || typeof props !== "object") return fallback;
|
|
3687
5104
|
const direct = props[key];
|
|
3688
5105
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3694,15 +5111,15 @@ var getPropString7 = (props, key, fallback) => {
|
|
|
3694
5111
|
return fallback;
|
|
3695
5112
|
};
|
|
3696
5113
|
function AdminStudioMediaView(props) {
|
|
3697
|
-
const mediaCollectionSlug =
|
|
5114
|
+
const mediaCollectionSlug = getPropString9(props, "mediaCollectionSlug", "media");
|
|
3698
5115
|
const adminBasePath = useAdminBasePath();
|
|
3699
5116
|
const mediaPath = resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`);
|
|
3700
5117
|
const mediaViewPath = resolveAdminPath(adminBasePath, "/media");
|
|
3701
|
-
return /* @__PURE__ */ (0,
|
|
3702
|
-
/* @__PURE__ */ (0,
|
|
3703
|
-
/* @__PURE__ */ (0,
|
|
3704
|
-
/* @__PURE__ */ (0,
|
|
3705
|
-
/* @__PURE__ */ (0,
|
|
5118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
5119
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui11.SetStepNav, { nav: [{ label: "Media", url: mediaViewPath }] }),
|
|
5120
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h1", { style: { margin: 0 }, children: "Media" }),
|
|
5121
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Media management is currently using Payload's library." }),
|
|
5122
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3706
5123
|
"a",
|
|
3707
5124
|
{
|
|
3708
5125
|
href: mediaPath,
|
|
@@ -3715,18 +5132,18 @@ function AdminStudioMediaView(props) {
|
|
|
3715
5132
|
textDecoration: "none"
|
|
3716
5133
|
},
|
|
3717
5134
|
children: [
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
5135
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { fontWeight: 900 }, children: "Open Media Library" }),
|
|
5136
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: mediaPath })
|
|
3720
5137
|
]
|
|
3721
5138
|
}
|
|
3722
5139
|
) })
|
|
3723
|
-
] });
|
|
5140
|
+
] }) });
|
|
3724
5141
|
}
|
|
3725
5142
|
|
|
3726
5143
|
// src/admin/components/studio/AdminStudioFormsView.tsx
|
|
3727
|
-
var
|
|
3728
|
-
var
|
|
3729
|
-
var
|
|
5144
|
+
var import_react21 = require("react");
|
|
5145
|
+
var import_ui12 = require("@payloadcms/ui");
|
|
5146
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3730
5147
|
var isAdmin3 = (user) => {
|
|
3731
5148
|
if (!user || typeof user !== "object") return false;
|
|
3732
5149
|
const role = user.role;
|
|
@@ -3738,7 +5155,7 @@ var isEditor2 = (user) => {
|
|
|
3738
5155
|
return typeof role === "string" && role === "editor";
|
|
3739
5156
|
};
|
|
3740
5157
|
var canReviewForms = (user) => isAdmin3(user) || isEditor2(user);
|
|
3741
|
-
var
|
|
5158
|
+
var getPropString10 = (props, key, fallback) => {
|
|
3742
5159
|
if (!props || typeof props !== "object") return fallback;
|
|
3743
5160
|
const direct = props[key];
|
|
3744
5161
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3788,14 +5205,14 @@ var getSubmissionIdentity = (value) => {
|
|
|
3788
5205
|
};
|
|
3789
5206
|
var renderValue = (value) => {
|
|
3790
5207
|
if (value === null || value === void 0 || value === "") {
|
|
3791
|
-
return /* @__PURE__ */ (0,
|
|
5208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { color: "var(--theme-elevation-500)" }, children: "\u2014" });
|
|
3792
5209
|
}
|
|
3793
5210
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
3794
5211
|
return String(value);
|
|
3795
5212
|
}
|
|
3796
5213
|
if (Array.isArray(value)) {
|
|
3797
5214
|
if (value.length === 0) {
|
|
3798
|
-
return /* @__PURE__ */ (0,
|
|
5215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { color: "var(--theme-elevation-500)" }, children: "\u2014" });
|
|
3799
5216
|
}
|
|
3800
5217
|
const primitiveValues = value.every(
|
|
3801
5218
|
(entry) => typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean" || entry === null
|
|
@@ -3803,7 +5220,7 @@ var renderValue = (value) => {
|
|
|
3803
5220
|
if (primitiveValues) {
|
|
3804
5221
|
return value.map((entry) => String(entry)).join(", ");
|
|
3805
5222
|
}
|
|
3806
|
-
return /* @__PURE__ */ (0,
|
|
5223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3807
5224
|
"pre",
|
|
3808
5225
|
{
|
|
3809
5226
|
style: {
|
|
@@ -3817,7 +5234,7 @@ var renderValue = (value) => {
|
|
|
3817
5234
|
);
|
|
3818
5235
|
}
|
|
3819
5236
|
if (typeof value === "object") {
|
|
3820
|
-
return /* @__PURE__ */ (0,
|
|
5237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3821
5238
|
"pre",
|
|
3822
5239
|
{
|
|
3823
5240
|
style: {
|
|
@@ -3864,37 +5281,37 @@ var panelStyle = {
|
|
|
3864
5281
|
borderRadius: 18
|
|
3865
5282
|
};
|
|
3866
5283
|
function AdminStudioFormsView(props) {
|
|
3867
|
-
const { user } = (0,
|
|
3868
|
-
const formsCollectionSlug =
|
|
3869
|
-
const formSubmissionsCollectionSlug =
|
|
5284
|
+
const { user } = (0, import_ui12.useAuth)();
|
|
5285
|
+
const formsCollectionSlug = getPropString10(props, "formsCollectionSlug", "forms");
|
|
5286
|
+
const formSubmissionsCollectionSlug = getPropString10(
|
|
3870
5287
|
props,
|
|
3871
5288
|
"formSubmissionsCollectionSlug",
|
|
3872
5289
|
"form-submissions"
|
|
3873
5290
|
);
|
|
3874
|
-
const formUploadsCollectionSlug =
|
|
5291
|
+
const formUploadsCollectionSlug = getPropString10(props, "formUploadsCollectionSlug", "form-uploads");
|
|
3875
5292
|
const adminBasePath = useAdminBasePath();
|
|
3876
|
-
const formsViewPath = resolveAdminPath(adminBasePath, "/
|
|
5293
|
+
const formsViewPath = resolveAdminPath(adminBasePath, "/forms");
|
|
3877
5294
|
const rawFormsPath = resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`);
|
|
3878
5295
|
const rawSubmissionsPath = resolveAdminPath(
|
|
3879
5296
|
adminBasePath,
|
|
3880
5297
|
`/collections/${formSubmissionsCollectionSlug}`
|
|
3881
5298
|
);
|
|
3882
5299
|
const rawUploadsPath = resolveAdminPath(adminBasePath, `/collections/${formUploadsCollectionSlug}`);
|
|
3883
|
-
const [selectedFormID, setSelectedFormID] = (0,
|
|
3884
|
-
const [forms, setForms] = (0,
|
|
3885
|
-
const [submissions, setSubmissions] = (0,
|
|
3886
|
-
const [formsLoading, setFormsLoading] = (0,
|
|
3887
|
-
const [submissionsLoading, setSubmissionsLoading] = (0,
|
|
3888
|
-
const [formsError, setFormsError] = (0,
|
|
3889
|
-
const [submissionsError, setSubmissionsError] = (0,
|
|
3890
|
-
const selectedForm = (0,
|
|
5300
|
+
const [selectedFormID, setSelectedFormID] = (0, import_react21.useState)("");
|
|
5301
|
+
const [forms, setForms] = (0, import_react21.useState)([]);
|
|
5302
|
+
const [submissions, setSubmissions] = (0, import_react21.useState)([]);
|
|
5303
|
+
const [formsLoading, setFormsLoading] = (0, import_react21.useState)(true);
|
|
5304
|
+
const [submissionsLoading, setSubmissionsLoading] = (0, import_react21.useState)(false);
|
|
5305
|
+
const [formsError, setFormsError] = (0, import_react21.useState)(null);
|
|
5306
|
+
const [submissionsError, setSubmissionsError] = (0, import_react21.useState)(null);
|
|
5307
|
+
const selectedForm = (0, import_react21.useMemo)(
|
|
3891
5308
|
() => forms.find((form) => {
|
|
3892
5309
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
3893
5310
|
return selectedFormID.length > 0 && id === selectedFormID;
|
|
3894
5311
|
}) || null,
|
|
3895
5312
|
[forms, selectedFormID]
|
|
3896
5313
|
);
|
|
3897
|
-
(0,
|
|
5314
|
+
(0, import_react21.useEffect)(() => {
|
|
3898
5315
|
if (typeof window === "undefined") {
|
|
3899
5316
|
return;
|
|
3900
5317
|
}
|
|
@@ -3904,7 +5321,7 @@ function AdminStudioFormsView(props) {
|
|
|
3904
5321
|
setSelectedFormID(formID);
|
|
3905
5322
|
}
|
|
3906
5323
|
}, []);
|
|
3907
|
-
(0,
|
|
5324
|
+
(0, import_react21.useEffect)(() => {
|
|
3908
5325
|
if (!canReviewForms(user)) {
|
|
3909
5326
|
return;
|
|
3910
5327
|
}
|
|
@@ -3958,7 +5375,7 @@ function AdminStudioFormsView(props) {
|
|
|
3958
5375
|
cancelled = true;
|
|
3959
5376
|
};
|
|
3960
5377
|
}, [formsCollectionSlug, user]);
|
|
3961
|
-
(0,
|
|
5378
|
+
(0, import_react21.useEffect)(() => {
|
|
3962
5379
|
if (!selectedFormID || !canReviewForms(user)) {
|
|
3963
5380
|
setSubmissions([]);
|
|
3964
5381
|
return;
|
|
@@ -4002,7 +5419,7 @@ function AdminStudioFormsView(props) {
|
|
|
4002
5419
|
cancelled = true;
|
|
4003
5420
|
};
|
|
4004
5421
|
}, [formSubmissionsCollectionSlug, selectedFormID, user]);
|
|
4005
|
-
(0,
|
|
5422
|
+
(0, import_react21.useEffect)(() => {
|
|
4006
5423
|
if (typeof window === "undefined" || !selectedFormID) {
|
|
4007
5424
|
return;
|
|
4008
5425
|
}
|
|
@@ -4011,11 +5428,11 @@ function AdminStudioFormsView(props) {
|
|
|
4011
5428
|
window.history.replaceState({}, "", url.toString());
|
|
4012
5429
|
}, [selectedFormID]);
|
|
4013
5430
|
if (!canReviewForms(user)) {
|
|
4014
|
-
return /* @__PURE__ */ (0,
|
|
4015
|
-
/* @__PURE__ */ (0,
|
|
4016
|
-
/* @__PURE__ */ (0,
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4018
|
-
] });
|
|
5431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5432
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui12.SetStepNav, { nav: [{ label: "Forms", url: formsViewPath }] }),
|
|
5433
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h1", { style: { margin: 0 }, children: "Forms" }),
|
|
5434
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "You do not have access to this page." })
|
|
5435
|
+
] }) });
|
|
4019
5436
|
}
|
|
4020
5437
|
const selectedTitle = selectedForm && typeof selectedForm.title === "string" && selectedForm.title || "Forms";
|
|
4021
5438
|
const selectedSlug = selectedForm && typeof selectedForm.slug === "string" && selectedForm.slug || null;
|
|
@@ -4025,15 +5442,15 @@ function AdminStudioFormsView(props) {
|
|
|
4025
5442
|
const fields = step.fields;
|
|
4026
5443
|
return count + (Array.isArray(fields) ? fields.length : 0);
|
|
4027
5444
|
}, 0) : 0;
|
|
4028
|
-
return /* @__PURE__ */ (0,
|
|
4029
|
-
/* @__PURE__ */ (0,
|
|
4030
|
-
/* @__PURE__ */ (0,
|
|
4031
|
-
/* @__PURE__ */ (0,
|
|
4032
|
-
/* @__PURE__ */ (0,
|
|
4033
|
-
/* @__PURE__ */ (0,
|
|
5445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5446
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui12.SetStepNav, { nav: [{ label: "Forms", url: formsViewPath }] }),
|
|
5447
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { alignItems: "flex-end", display: "flex", flexWrap: "wrap", gap: "0.75rem" }, children: [
|
|
5448
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { flex: 1, minWidth: 240 }, children: [
|
|
5449
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h1", { style: { margin: 0 }, children: "Forms" }),
|
|
5450
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Review your forms, responses, and any uploaded files in one place." })
|
|
4034
5451
|
] }),
|
|
4035
|
-
/* @__PURE__ */ (0,
|
|
4036
|
-
/* @__PURE__ */ (0,
|
|
5452
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
|
|
5453
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4037
5454
|
"a",
|
|
4038
5455
|
{
|
|
4039
5456
|
href: rawFormsPath,
|
|
@@ -4048,7 +5465,7 @@ function AdminStudioFormsView(props) {
|
|
|
4048
5465
|
children: "Open Forms Collection"
|
|
4049
5466
|
}
|
|
4050
5467
|
),
|
|
4051
|
-
/* @__PURE__ */ (0,
|
|
5468
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4052
5469
|
"a",
|
|
4053
5470
|
{
|
|
4054
5471
|
href: rawSubmissionsPath,
|
|
@@ -4063,7 +5480,7 @@ function AdminStudioFormsView(props) {
|
|
|
4063
5480
|
children: "Open Submissions"
|
|
4064
5481
|
}
|
|
4065
5482
|
),
|
|
4066
|
-
/* @__PURE__ */ (0,
|
|
5483
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4067
5484
|
"a",
|
|
4068
5485
|
{
|
|
4069
5486
|
href: rawUploadsPath,
|
|
@@ -4080,7 +5497,7 @@ function AdminStudioFormsView(props) {
|
|
|
4080
5497
|
)
|
|
4081
5498
|
] })
|
|
4082
5499
|
] }),
|
|
4083
|
-
/* @__PURE__ */ (0,
|
|
5500
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4084
5501
|
"div",
|
|
4085
5502
|
{
|
|
4086
5503
|
style: {
|
|
@@ -4090,11 +5507,11 @@ function AdminStudioFormsView(props) {
|
|
|
4090
5507
|
marginTop: "1rem"
|
|
4091
5508
|
},
|
|
4092
5509
|
children: [
|
|
4093
|
-
/* @__PURE__ */ (0,
|
|
4094
|
-
/* @__PURE__ */ (0,
|
|
4095
|
-
formsLoading ? /* @__PURE__ */ (0,
|
|
4096
|
-
formsError ? /* @__PURE__ */ (0,
|
|
4097
|
-
!formsLoading && !formsError && forms.length === 0 ? /* @__PURE__ */ (0,
|
|
5510
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
5511
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontSize: "0.82rem", fontWeight: 900, letterSpacing: "0.08em", textTransform: "uppercase" }, children: "Site forms" }),
|
|
5512
|
+
formsLoading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.85rem" }, children: "Loading forms\u2026" }) : null,
|
|
5513
|
+
formsError ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "crimson", marginTop: "0.85rem" }, children: formsError }) : null,
|
|
5514
|
+
!formsLoading && !formsError && forms.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4098
5515
|
"div",
|
|
4099
5516
|
{
|
|
4100
5517
|
style: {
|
|
@@ -4107,13 +5524,13 @@ function AdminStudioFormsView(props) {
|
|
|
4107
5524
|
children: "No forms found."
|
|
4108
5525
|
}
|
|
4109
5526
|
) : null,
|
|
4110
|
-
/* @__PURE__ */ (0,
|
|
5527
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "grid", gap: "0.55rem", marginTop: "0.85rem" }, children: forms.map((form) => {
|
|
4111
5528
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
4112
5529
|
if (!id) return null;
|
|
4113
5530
|
const title = typeof form.title === "string" ? form.title : "Untitled Form";
|
|
4114
5531
|
const slug = typeof form.slug === "string" ? form.slug : "";
|
|
4115
5532
|
const isSelected = id === selectedFormID;
|
|
4116
|
-
return /* @__PURE__ */ (0,
|
|
5533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4117
5534
|
"button",
|
|
4118
5535
|
{
|
|
4119
5536
|
onClick: () => setSelectedFormID(id),
|
|
@@ -4127,8 +5544,8 @@ function AdminStudioFormsView(props) {
|
|
|
4127
5544
|
},
|
|
4128
5545
|
type: "button",
|
|
4129
5546
|
children: [
|
|
4130
|
-
/* @__PURE__ */ (0,
|
|
4131
|
-
slug ? /* @__PURE__ */ (0,
|
|
5547
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900 }, children: title }),
|
|
5548
|
+
slug ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4132
5549
|
"div",
|
|
4133
5550
|
{
|
|
4134
5551
|
style: {
|
|
@@ -4145,9 +5562,9 @@ function AdminStudioFormsView(props) {
|
|
|
4145
5562
|
);
|
|
4146
5563
|
}) })
|
|
4147
5564
|
] }),
|
|
4148
|
-
/* @__PURE__ */ (0,
|
|
4149
|
-
/* @__PURE__ */ (0,
|
|
4150
|
-
/* @__PURE__ */ (0,
|
|
5565
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { style: { display: "grid", gap: "1rem" }, children: [
|
|
5566
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
5567
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4151
5568
|
"div",
|
|
4152
5569
|
{
|
|
4153
5570
|
style: {
|
|
@@ -4158,8 +5575,8 @@ function AdminStudioFormsView(props) {
|
|
|
4158
5575
|
justifyContent: "space-between"
|
|
4159
5576
|
},
|
|
4160
5577
|
children: [
|
|
4161
|
-
/* @__PURE__ */ (0,
|
|
4162
|
-
/* @__PURE__ */ (0,
|
|
5578
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5579
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4163
5580
|
"div",
|
|
4164
5581
|
{
|
|
4165
5582
|
style: {
|
|
@@ -4172,10 +5589,10 @@ function AdminStudioFormsView(props) {
|
|
|
4172
5589
|
children: "Selected form"
|
|
4173
5590
|
}
|
|
4174
5591
|
),
|
|
4175
|
-
/* @__PURE__ */ (0,
|
|
4176
|
-
selectedSlug ? /* @__PURE__ */ (0,
|
|
5592
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h2", { style: { margin: "0.2rem 0 0", fontSize: "1.45rem" }, children: selectedTitle }),
|
|
5593
|
+
selectedSlug ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.2rem" }, children: selectedSlug }) : null
|
|
4177
5594
|
] }),
|
|
4178
|
-
selectedFormID ? /* @__PURE__ */ (0,
|
|
5595
|
+
selectedFormID ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4179
5596
|
"a",
|
|
4180
5597
|
{
|
|
4181
5598
|
href: `${rawFormsPath}/${selectedFormID}`,
|
|
@@ -4193,7 +5610,7 @@ function AdminStudioFormsView(props) {
|
|
|
4193
5610
|
]
|
|
4194
5611
|
}
|
|
4195
5612
|
),
|
|
4196
|
-
selectedForm ? /* @__PURE__ */ (0,
|
|
5613
|
+
selectedForm ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4197
5614
|
"div",
|
|
4198
5615
|
{
|
|
4199
5616
|
style: {
|
|
@@ -4203,28 +5620,28 @@ function AdminStudioFormsView(props) {
|
|
|
4203
5620
|
marginTop: "1rem"
|
|
4204
5621
|
},
|
|
4205
5622
|
children: [
|
|
4206
|
-
/* @__PURE__ */ (0,
|
|
4207
|
-
/* @__PURE__ */ (0,
|
|
4208
|
-
/* @__PURE__ */ (0,
|
|
5623
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
5624
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Steps" }),
|
|
5625
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontSize: "1.35rem", fontWeight: 900, marginTop: "0.2rem" }, children: selectedStepCount })
|
|
4209
5626
|
] }),
|
|
4210
|
-
/* @__PURE__ */ (0,
|
|
4211
|
-
/* @__PURE__ */ (0,
|
|
4212
|
-
/* @__PURE__ */ (0,
|
|
5627
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
5628
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Fields" }),
|
|
5629
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontSize: "1.35rem", fontWeight: 900, marginTop: "0.2rem" }, children: selectedFieldCount })
|
|
4213
5630
|
] }),
|
|
4214
|
-
/* @__PURE__ */ (0,
|
|
4215
|
-
/* @__PURE__ */ (0,
|
|
4216
|
-
/* @__PURE__ */ (0,
|
|
5631
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
5632
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Submit label" }),
|
|
5633
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontSize: "1rem", fontWeight: 900, marginTop: "0.2rem" }, children: typeof selectedForm.submitLabel === "string" && selectedForm.submitLabel.length > 0 ? selectedForm.submitLabel : "Submit" })
|
|
4217
5634
|
] }),
|
|
4218
|
-
/* @__PURE__ */ (0,
|
|
4219
|
-
/* @__PURE__ */ (0,
|
|
4220
|
-
/* @__PURE__ */ (0,
|
|
5635
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
5636
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Updated" }),
|
|
5637
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontSize: "1rem", fontWeight: 900, marginTop: "0.2rem" }, children: formatDate(selectedForm.updatedAt) })
|
|
4221
5638
|
] })
|
|
4222
5639
|
]
|
|
4223
5640
|
}
|
|
4224
|
-
) : /* @__PURE__ */ (0,
|
|
5641
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "1rem" }, children: "Pick a form to review its responses." })
|
|
4225
5642
|
] }),
|
|
4226
|
-
/* @__PURE__ */ (0,
|
|
4227
|
-
/* @__PURE__ */ (0,
|
|
5643
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
5644
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4228
5645
|
"div",
|
|
4229
5646
|
{
|
|
4230
5647
|
style: {
|
|
@@ -4235,11 +5652,11 @@ function AdminStudioFormsView(props) {
|
|
|
4235
5652
|
justifyContent: "space-between"
|
|
4236
5653
|
},
|
|
4237
5654
|
children: [
|
|
4238
|
-
/* @__PURE__ */ (0,
|
|
4239
|
-
/* @__PURE__ */ (0,
|
|
4240
|
-
/* @__PURE__ */ (0,
|
|
5655
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5656
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h2", { style: { fontSize: "1.2rem", margin: 0 }, children: "Responses" }),
|
|
5657
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { style: { color: "var(--theme-elevation-600)", margin: "0.25rem 0 0" }, children: "Latest submissions and any files they uploaded." })
|
|
4241
5658
|
] }),
|
|
4242
|
-
selectedFormID ? /* @__PURE__ */ (0,
|
|
5659
|
+
selectedFormID ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4243
5660
|
"a",
|
|
4244
5661
|
{
|
|
4245
5662
|
href: rawSubmissionsPath,
|
|
@@ -4257,9 +5674,9 @@ function AdminStudioFormsView(props) {
|
|
|
4257
5674
|
]
|
|
4258
5675
|
}
|
|
4259
5676
|
),
|
|
4260
|
-
submissionsLoading ? /* @__PURE__ */ (0,
|
|
4261
|
-
submissionsError ? /* @__PURE__ */ (0,
|
|
4262
|
-
!submissionsLoading && !submissionsError && selectedFormID && submissions.length === 0 ? /* @__PURE__ */ (0,
|
|
5677
|
+
submissionsLoading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "1rem" }, children: "Loading responses\u2026" }) : null,
|
|
5678
|
+
submissionsError ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "crimson", marginTop: "1rem" }, children: submissionsError }) : null,
|
|
5679
|
+
!submissionsLoading && !submissionsError && selectedFormID && submissions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4263
5680
|
"div",
|
|
4264
5681
|
{
|
|
4265
5682
|
style: {
|
|
@@ -4272,7 +5689,7 @@ function AdminStudioFormsView(props) {
|
|
|
4272
5689
|
children: "No responses yet for this form."
|
|
4273
5690
|
}
|
|
4274
5691
|
) : null,
|
|
4275
|
-
/* @__PURE__ */ (0,
|
|
5692
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "grid", gap: "0.9rem", marginTop: "1rem" }, children: submissions.map((submission) => {
|
|
4276
5693
|
const id = typeof submission.id === "string" || typeof submission.id === "number" ? String(submission.id) : "";
|
|
4277
5694
|
if (!id) return null;
|
|
4278
5695
|
const submissionData = submission.data;
|
|
@@ -4280,8 +5697,8 @@ function AdminStudioFormsView(props) {
|
|
|
4280
5697
|
const uploads = getUploads(submission.files);
|
|
4281
5698
|
const formSlug = getString(submission.formSlug);
|
|
4282
5699
|
const submissionFormID = getFormID(submission.form);
|
|
4283
|
-
return /* @__PURE__ */ (0,
|
|
4284
|
-
/* @__PURE__ */ (0,
|
|
5700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("article", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
5701
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4285
5702
|
"div",
|
|
4286
5703
|
{
|
|
4287
5704
|
style: {
|
|
@@ -4292,15 +5709,15 @@ function AdminStudioFormsView(props) {
|
|
|
4292
5709
|
justifyContent: "space-between"
|
|
4293
5710
|
},
|
|
4294
5711
|
children: [
|
|
4295
|
-
/* @__PURE__ */ (0,
|
|
4296
|
-
/* @__PURE__ */ (0,
|
|
4297
|
-
/* @__PURE__ */ (0,
|
|
5712
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5713
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900 }, children: identity.name || identity.email || "Submission" }),
|
|
5714
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.2rem" }, children: [
|
|
4298
5715
|
formatDate(submission.submittedAt),
|
|
4299
5716
|
formSlug ? ` \xB7 ${formSlug}` : ""
|
|
4300
5717
|
] })
|
|
4301
5718
|
] }),
|
|
4302
|
-
/* @__PURE__ */ (0,
|
|
4303
|
-
submissionFormID ? /* @__PURE__ */ (0,
|
|
5719
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
|
|
5720
|
+
submissionFormID ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4304
5721
|
"a",
|
|
4305
5722
|
{
|
|
4306
5723
|
href: `${rawFormsPath}/${submissionFormID}`,
|
|
@@ -4316,7 +5733,7 @@ function AdminStudioFormsView(props) {
|
|
|
4316
5733
|
children: "Form"
|
|
4317
5734
|
}
|
|
4318
5735
|
) : null,
|
|
4319
|
-
/* @__PURE__ */ (0,
|
|
5736
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4320
5737
|
"a",
|
|
4321
5738
|
{
|
|
4322
5739
|
href: `${rawSubmissionsPath}/${id}`,
|
|
@@ -4336,7 +5753,7 @@ function AdminStudioFormsView(props) {
|
|
|
4336
5753
|
]
|
|
4337
5754
|
}
|
|
4338
5755
|
),
|
|
4339
|
-
identity.name || identity.email ? /* @__PURE__ */ (0,
|
|
5756
|
+
identity.name || identity.email ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4340
5757
|
"div",
|
|
4341
5758
|
{
|
|
4342
5759
|
style: {
|
|
@@ -4346,19 +5763,19 @@ function AdminStudioFormsView(props) {
|
|
|
4346
5763
|
marginTop: "0.9rem"
|
|
4347
5764
|
},
|
|
4348
5765
|
children: [
|
|
4349
|
-
identity.name ? /* @__PURE__ */ (0,
|
|
4350
|
-
/* @__PURE__ */ (0,
|
|
4351
|
-
/* @__PURE__ */ (0,
|
|
5766
|
+
identity.name ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.75rem 0.85rem" }, children: [
|
|
5767
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Name" }),
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900, marginTop: "0.2rem" }, children: identity.name })
|
|
4352
5769
|
] }) : null,
|
|
4353
|
-
identity.email ? /* @__PURE__ */ (0,
|
|
4354
|
-
/* @__PURE__ */ (0,
|
|
4355
|
-
/* @__PURE__ */ (0,
|
|
5770
|
+
identity.email ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.75rem 0.85rem" }, children: [
|
|
5771
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Email" }),
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900, marginTop: "0.2rem" }, children: identity.email })
|
|
4356
5773
|
] }) : null
|
|
4357
5774
|
]
|
|
4358
5775
|
}
|
|
4359
5776
|
) : null,
|
|
4360
|
-
/* @__PURE__ */ (0,
|
|
4361
|
-
/* @__PURE__ */ (0,
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { marginTop: "1rem" }, children: [
|
|
5778
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4362
5779
|
"div",
|
|
4363
5780
|
{
|
|
4364
5781
|
style: {
|
|
@@ -4372,7 +5789,7 @@ function AdminStudioFormsView(props) {
|
|
|
4372
5789
|
children: "Response data"
|
|
4373
5790
|
}
|
|
4374
5791
|
),
|
|
4375
|
-
/* @__PURE__ */ (0,
|
|
5792
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "grid", gap: "0.55rem" }, children: getFieldEntries(submissionData).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4376
5793
|
"div",
|
|
4377
5794
|
{
|
|
4378
5795
|
style: {
|
|
@@ -4383,7 +5800,7 @@ function AdminStudioFormsView(props) {
|
|
|
4383
5800
|
padding: "0.8rem 0.9rem"
|
|
4384
5801
|
},
|
|
4385
5802
|
children: [
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
5803
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4387
5804
|
"div",
|
|
4388
5805
|
{
|
|
4389
5806
|
style: {
|
|
@@ -4395,14 +5812,14 @@ function AdminStudioFormsView(props) {
|
|
|
4395
5812
|
children: key
|
|
4396
5813
|
}
|
|
4397
5814
|
),
|
|
4398
|
-
/* @__PURE__ */ (0,
|
|
5815
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { overflowWrap: "anywhere" }, children: renderValue(value) })
|
|
4399
5816
|
]
|
|
4400
5817
|
},
|
|
4401
5818
|
key
|
|
4402
5819
|
)) })
|
|
4403
5820
|
] }),
|
|
4404
|
-
/* @__PURE__ */ (0,
|
|
4405
|
-
/* @__PURE__ */ (0,
|
|
5821
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { marginTop: "1rem" }, children: [
|
|
5822
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4406
5823
|
"div",
|
|
4407
5824
|
{
|
|
4408
5825
|
style: {
|
|
@@ -4416,7 +5833,7 @@ function AdminStudioFormsView(props) {
|
|
|
4416
5833
|
children: "Uploads"
|
|
4417
5834
|
}
|
|
4418
5835
|
),
|
|
4419
|
-
uploads.length === 0 ? /* @__PURE__ */ (0,
|
|
5836
|
+
uploads.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)" }, children: "No files attached." }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "grid", gap: "0.55rem" }, children: uploads.map((upload, index) => {
|
|
4420
5837
|
const uploadID = typeof upload.id === "string" || typeof upload.id === "number" ? String(upload.id) : "";
|
|
4421
5838
|
if (!uploadID) return null;
|
|
4422
5839
|
const label = typeof upload.filename === "string" && upload.filename || `Upload ${index + 1}`;
|
|
@@ -4424,7 +5841,7 @@ function AdminStudioFormsView(props) {
|
|
|
4424
5841
|
typeof upload.mimeType === "string" ? upload.mimeType : null,
|
|
4425
5842
|
formatFileSize(upload.filesize)
|
|
4426
5843
|
].filter(Boolean);
|
|
4427
|
-
return /* @__PURE__ */ (0,
|
|
5844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4428
5845
|
"a",
|
|
4429
5846
|
{
|
|
4430
5847
|
href: `${rawUploadsPath}/${uploadID}`,
|
|
@@ -4438,9 +5855,9 @@ function AdminStudioFormsView(props) {
|
|
|
4438
5855
|
textDecoration: "none"
|
|
4439
5856
|
},
|
|
4440
5857
|
children: [
|
|
4441
|
-
/* @__PURE__ */ (0,
|
|
4442
|
-
/* @__PURE__ */ (0,
|
|
4443
|
-
meta.length > 0 ? /* @__PURE__ */ (0,
|
|
5858
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900 }, children: label }),
|
|
5860
|
+
meta.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4444
5861
|
"div",
|
|
4445
5862
|
{
|
|
4446
5863
|
style: {
|
|
@@ -4452,7 +5869,7 @@ function AdminStudioFormsView(props) {
|
|
|
4452
5869
|
}
|
|
4453
5870
|
) : null
|
|
4454
5871
|
] }),
|
|
4455
|
-
/* @__PURE__ */ (0,
|
|
5872
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontWeight: 800 }, children: "Open" })
|
|
4456
5873
|
]
|
|
4457
5874
|
},
|
|
4458
5875
|
uploadID
|
|
@@ -4466,18 +5883,18 @@ function AdminStudioFormsView(props) {
|
|
|
4466
5883
|
]
|
|
4467
5884
|
}
|
|
4468
5885
|
)
|
|
4469
|
-
] });
|
|
5886
|
+
] }) });
|
|
4470
5887
|
}
|
|
4471
5888
|
|
|
4472
5889
|
// src/admin/components/studio/AdminStudioToolsView.tsx
|
|
4473
|
-
var
|
|
4474
|
-
var
|
|
5890
|
+
var import_ui13 = require("@payloadcms/ui");
|
|
5891
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4475
5892
|
var isAdmin4 = (user) => {
|
|
4476
5893
|
if (!user || typeof user !== "object") return false;
|
|
4477
5894
|
const role = user.role;
|
|
4478
5895
|
return typeof role === "string" && role === "admin";
|
|
4479
5896
|
};
|
|
4480
|
-
var
|
|
5897
|
+
var getPropString11 = (props, key, fallback) => {
|
|
4481
5898
|
if (!props || typeof props !== "object") return fallback;
|
|
4482
5899
|
const direct = props[key];
|
|
4483
5900
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -4489,18 +5906,18 @@ var getPropString9 = (props, key, fallback) => {
|
|
|
4489
5906
|
return fallback;
|
|
4490
5907
|
};
|
|
4491
5908
|
function AdminStudioToolsView(props) {
|
|
4492
|
-
const { user } = (0,
|
|
5909
|
+
const { user } = (0, import_ui13.useAuth)();
|
|
4493
5910
|
const adminBasePath = useAdminBasePath();
|
|
4494
5911
|
const toolsPath = resolveAdminPath(adminBasePath, "/tools");
|
|
4495
5912
|
if (!isAdmin4(user)) {
|
|
4496
|
-
return /* @__PURE__ */ (0,
|
|
4497
|
-
/* @__PURE__ */ (0,
|
|
4498
|
-
/* @__PURE__ */ (0,
|
|
4499
|
-
/* @__PURE__ */ (0,
|
|
4500
|
-
] });
|
|
5913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ui13.SetStepNav, { nav: [{ label: "Admin Tools", url: toolsPath }] }),
|
|
5915
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h1", { style: { margin: 0 }, children: "Admin Tools" }),
|
|
5916
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "You do not have access to this page." })
|
|
5917
|
+
] }) });
|
|
4501
5918
|
}
|
|
4502
|
-
const pagesCollectionSlug =
|
|
4503
|
-
const mediaCollectionSlug =
|
|
5919
|
+
const pagesCollectionSlug = getPropString11(props, "pagesCollectionSlug", "pages");
|
|
5920
|
+
const mediaCollectionSlug = getPropString11(props, "mediaCollectionSlug", "media");
|
|
4504
5921
|
const links = [
|
|
4505
5922
|
{ href: resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`), label: "Raw Pages Collection" },
|
|
4506
5923
|
{ href: resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`), label: "Raw Media Collection" },
|
|
@@ -4509,11 +5926,11 @@ function AdminStudioToolsView(props) {
|
|
|
4509
5926
|
{ href: resolveAdminPath(adminBasePath, "/globals/footer"), label: "Raw Footer Global" },
|
|
4510
5927
|
{ href: resolveAdminPath(adminBasePath, "/collections/users"), label: "Users / Roles" }
|
|
4511
5928
|
];
|
|
4512
|
-
return /* @__PURE__ */ (0,
|
|
4513
|
-
/* @__PURE__ */ (0,
|
|
4514
|
-
/* @__PURE__ */ (0,
|
|
4515
|
-
/* @__PURE__ */ (0,
|
|
4516
|
-
/* @__PURE__ */ (0,
|
|
5929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5930
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ui13.SetStepNav, { nav: [{ label: "Admin Tools", url: toolsPath }] }),
|
|
5931
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h1", { style: { margin: 0 }, children: "Admin Tools" }),
|
|
5932
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Hidden fallback links for administrators." }),
|
|
5933
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4517
5934
|
"a",
|
|
4518
5935
|
{
|
|
4519
5936
|
href: link.href,
|
|
@@ -4526,25 +5943,25 @@ function AdminStudioToolsView(props) {
|
|
|
4526
5943
|
textDecoration: "none"
|
|
4527
5944
|
},
|
|
4528
5945
|
children: [
|
|
4529
|
-
/* @__PURE__ */ (0,
|
|
4530
|
-
/* @__PURE__ */ (0,
|
|
5946
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { fontWeight: 900 }, children: link.label }),
|
|
5947
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: link.href })
|
|
4531
5948
|
]
|
|
4532
5949
|
},
|
|
4533
5950
|
link.href
|
|
4534
5951
|
)) })
|
|
4535
|
-
] });
|
|
5952
|
+
] }) });
|
|
4536
5953
|
}
|
|
4537
5954
|
|
|
4538
5955
|
// src/admin/components/studio/OpenInStudioMenuItem.tsx
|
|
4539
|
-
var
|
|
4540
|
-
var
|
|
4541
|
-
function OpenInStudioMenuItem({ pagesPathBase = "/
|
|
4542
|
-
const documentInfo = (0,
|
|
5956
|
+
var import_ui14 = require("@payloadcms/ui");
|
|
5957
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5958
|
+
function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
5959
|
+
const documentInfo = (0, import_ui14.useDocumentInfo)();
|
|
4543
5960
|
const id = documentInfo?.id;
|
|
4544
5961
|
if (!id) {
|
|
4545
5962
|
return null;
|
|
4546
5963
|
}
|
|
4547
|
-
return /* @__PURE__ */ (0,
|
|
5964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4548
5965
|
"a",
|
|
4549
5966
|
{
|
|
4550
5967
|
href: `${pagesPathBase}/${id}`,
|
|
@@ -4563,19 +5980,19 @@ function OpenInStudioMenuItem({ pagesPathBase = "/studio/pages" }) {
|
|
|
4563
5980
|
}
|
|
4564
5981
|
|
|
4565
5982
|
// src/admin/components/studio/PageEditRedirectToStudio.tsx
|
|
4566
|
-
var
|
|
4567
|
-
var
|
|
4568
|
-
var
|
|
4569
|
-
function PageEditRedirectToStudio({ pagesPathBase = "/
|
|
4570
|
-
const documentInfo = (0,
|
|
5983
|
+
var import_react22 = require("react");
|
|
5984
|
+
var import_ui15 = require("@payloadcms/ui");
|
|
5985
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5986
|
+
function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
5987
|
+
const documentInfo = (0, import_ui15.useDocumentInfo)();
|
|
4571
5988
|
const id = documentInfo?.id;
|
|
4572
|
-
(0,
|
|
5989
|
+
(0, import_react22.useEffect)(() => {
|
|
4573
5990
|
if (!id) {
|
|
4574
5991
|
return;
|
|
4575
5992
|
}
|
|
4576
5993
|
window.location.replace(`${pagesPathBase}/${id}`);
|
|
4577
5994
|
}, [id, pagesPathBase]);
|
|
4578
|
-
return /* @__PURE__ */ (0,
|
|
5995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4579
5996
|
"div",
|
|
4580
5997
|
{
|
|
4581
5998
|
style: {
|
|
@@ -4587,49 +6004,55 @@ function PageEditRedirectToStudio({ pagesPathBase = "/studio/pages" }) {
|
|
|
4587
6004
|
minHeight: "50vh"
|
|
4588
6005
|
},
|
|
4589
6006
|
children: [
|
|
4590
|
-
/* @__PURE__ */ (0,
|
|
4591
|
-
/* @__PURE__ */ (0,
|
|
4592
|
-
id ? /* @__PURE__ */ (0,
|
|
6007
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
|
|
6008
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
|
|
6009
|
+
id ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: `${pagesPathBase}/${id}`, children: "Continue to Editor" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: pagesPathBase, children: "Open Pages" })
|
|
4593
6010
|
]
|
|
4594
6011
|
}
|
|
4595
6012
|
);
|
|
4596
6013
|
}
|
|
4597
6014
|
|
|
4598
6015
|
// src/admin/components/studio/StudioBackBreadcrumb.tsx
|
|
4599
|
-
var
|
|
4600
|
-
var
|
|
4601
|
-
var
|
|
6016
|
+
var import_react23 = require("react");
|
|
6017
|
+
var import_ui16 = require("@payloadcms/ui");
|
|
6018
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4602
6019
|
var toTitle = (slug) => slug.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
4603
6020
|
var buildNav = (pathname, adminBasePath) => {
|
|
4604
6021
|
if (pathname.includes("/globals/")) {
|
|
4605
6022
|
const slug = pathname.split("/globals/")[1]?.split("/")[0] || "";
|
|
4606
6023
|
const currentLabel = slug === "site-settings" ? "Website Settings" : toTitle(slug) || "Global";
|
|
4607
6024
|
return [
|
|
4608
|
-
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/
|
|
6025
|
+
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/globals") },
|
|
4609
6026
|
{ label: currentLabel }
|
|
4610
6027
|
];
|
|
4611
6028
|
}
|
|
4612
|
-
if (pathname.includes("/
|
|
6029
|
+
if (pathname.includes("/contact-form")) {
|
|
4613
6030
|
return [
|
|
4614
|
-
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/
|
|
6031
|
+
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/globals") },
|
|
4615
6032
|
{ label: "Contact Form" }
|
|
4616
6033
|
];
|
|
4617
6034
|
}
|
|
4618
6035
|
if (pathname.includes("/collections/pages") || pathname.includes("/pages/")) {
|
|
4619
6036
|
return [
|
|
4620
|
-
{ label: "Pages", url: resolveAdminPath(adminBasePath, "/
|
|
6037
|
+
{ label: "Pages", url: resolveAdminPath(adminBasePath, "/pages") },
|
|
4621
6038
|
{ label: "Page" }
|
|
4622
6039
|
];
|
|
4623
6040
|
}
|
|
6041
|
+
if (pathname.includes("/collections/forms") || pathname.includes("/collections/form-submissions") || pathname.includes("/collections/form-uploads")) {
|
|
6042
|
+
return [
|
|
6043
|
+
{ label: "Forms", url: resolveAdminPath(adminBasePath, "/forms") },
|
|
6044
|
+
{ label: "Form" }
|
|
6045
|
+
];
|
|
6046
|
+
}
|
|
4624
6047
|
if (pathname.includes("/collections/media")) {
|
|
4625
6048
|
return [
|
|
4626
|
-
{ label: "Media", url: resolveAdminPath(adminBasePath, "/
|
|
6049
|
+
{ label: "Media", url: resolveAdminPath(adminBasePath, "/media") },
|
|
4627
6050
|
{ label: "Media Item" }
|
|
4628
6051
|
];
|
|
4629
6052
|
}
|
|
4630
6053
|
if (pathname.includes("/tools") || pathname.includes("/collections/users")) {
|
|
4631
6054
|
return [
|
|
4632
|
-
{ label: "Admin Tools", url: resolveAdminPath(adminBasePath, "/
|
|
6055
|
+
{ label: "Admin Tools", url: resolveAdminPath(adminBasePath, "/tools") },
|
|
4633
6056
|
{ label: "Tool" }
|
|
4634
6057
|
];
|
|
4635
6058
|
}
|
|
@@ -4637,8 +6060,8 @@ var buildNav = (pathname, adminBasePath) => {
|
|
|
4637
6060
|
};
|
|
4638
6061
|
function StudioBackBreadcrumb() {
|
|
4639
6062
|
const adminBasePath = useAdminBasePath();
|
|
4640
|
-
const [pathname, setPathname] = (0,
|
|
4641
|
-
(0,
|
|
6063
|
+
const [pathname, setPathname] = (0, import_react23.useState)("");
|
|
6064
|
+
(0, import_react23.useEffect)(() => {
|
|
4642
6065
|
const update = () => setPathname(window.location.pathname);
|
|
4643
6066
|
update();
|
|
4644
6067
|
window.addEventListener("popstate", update);
|
|
@@ -4646,13 +6069,13 @@ function StudioBackBreadcrumb() {
|
|
|
4646
6069
|
}, []);
|
|
4647
6070
|
const nav = buildNav(pathname, adminBasePath);
|
|
4648
6071
|
if (!nav) return null;
|
|
4649
|
-
return /* @__PURE__ */ (0,
|
|
6072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui16.SetStepNav, { nav });
|
|
4650
6073
|
}
|
|
4651
6074
|
|
|
4652
6075
|
// src/admin/components/studio/StudioContactFormRedirect.tsx
|
|
4653
|
-
var
|
|
4654
|
-
var
|
|
4655
|
-
var
|
|
6076
|
+
var import_react24 = require("react");
|
|
6077
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6078
|
+
var getPropString12 = (props, key, fallback) => {
|
|
4656
6079
|
if (!props || typeof props !== "object") return fallback;
|
|
4657
6080
|
const direct = props[key];
|
|
4658
6081
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -4665,13 +6088,13 @@ var getPropString10 = (props, key, fallback) => {
|
|
|
4665
6088
|
};
|
|
4666
6089
|
function StudioContactFormRedirect(props) {
|
|
4667
6090
|
const adminBasePath = useAdminBasePath();
|
|
4668
|
-
const studioContactFormPath =
|
|
6091
|
+
const studioContactFormPath = getPropString12(props, "studioContactFormPath", "/contact-form");
|
|
4669
6092
|
const targetPath = resolveAdminPath(adminBasePath, studioContactFormPath);
|
|
4670
|
-
(0,
|
|
6093
|
+
(0, import_react24.useEffect)(() => {
|
|
4671
6094
|
if (window.location.pathname === targetPath) return;
|
|
4672
6095
|
window.location.replace(targetPath);
|
|
4673
6096
|
}, [targetPath]);
|
|
4674
|
-
return /* @__PURE__ */ (0,
|
|
6097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4675
6098
|
"div",
|
|
4676
6099
|
{
|
|
4677
6100
|
style: {
|
|
@@ -4684,8 +6107,8 @@ function StudioContactFormRedirect(props) {
|
|
|
4684
6107
|
minHeight: "40vh"
|
|
4685
6108
|
},
|
|
4686
6109
|
children: [
|
|
4687
|
-
/* @__PURE__ */ (0,
|
|
4688
|
-
/* @__PURE__ */ (0,
|
|
6110
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h2", { style: { margin: 0 }, children: "Opening Contact Form Editor..." }),
|
|
6111
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { href: targetPath, children: "Continue" })
|
|
4689
6112
|
]
|
|
4690
6113
|
}
|
|
4691
6114
|
);
|
|
@@ -4694,8 +6117,10 @@ function StudioContactFormRedirect(props) {
|
|
|
4694
6117
|
0 && (module.exports = {
|
|
4695
6118
|
AdminStudioContactFormView,
|
|
4696
6119
|
AdminStudioDashboard,
|
|
6120
|
+
AdminStudioFooterGlobalView,
|
|
4697
6121
|
AdminStudioFormsView,
|
|
4698
6122
|
AdminStudioGlobalsView,
|
|
6123
|
+
AdminStudioHeaderGlobalView,
|
|
4699
6124
|
AdminStudioMediaView,
|
|
4700
6125
|
AdminStudioNav,
|
|
4701
6126
|
AdminStudioPageEditView,
|