@orion-studios/payload-studio 0.5.0-beta.113 → 0.5.0-beta.115
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 +1880 -502
- package/dist/admin/client.mjs +1164 -329
- package/dist/admin/index.d.mts +2 -1
- package/dist/admin/index.d.ts +2 -1
- package/dist/admin/index.js +267 -59
- 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-6NE7GIVT.mjs +555 -0
- package/dist/{chunk-DAIZDGHL.mjs → chunk-T5PBXPES.mjs} +267 -59
- package/dist/{chunk-3T2P6SDM.mjs → chunk-XKUTZ7IU.mjs} +215 -6
- package/dist/index-3jBpt6ZT.d.ts +385 -0
- package/dist/index-C3FgxbEL.d.mts +385 -0
- 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-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 +473 -65
- package/dist/index.mjs +6 -6
- 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,
|
|
@@ -1563,7 +1565,13 @@ var buttonActive = {
|
|
|
1563
1565
|
borderColor: "var(--theme-success-500)",
|
|
1564
1566
|
color: "var(--theme-success-500)"
|
|
1565
1567
|
};
|
|
1566
|
-
function ThemeSwitcher({
|
|
1568
|
+
function ThemeSwitcher({
|
|
1569
|
+
allowThemePreference = false,
|
|
1570
|
+
defaultTheme = "brand-light"
|
|
1571
|
+
}) {
|
|
1572
|
+
if (!allowThemePreference) {
|
|
1573
|
+
return null;
|
|
1574
|
+
}
|
|
1567
1575
|
const { isDark, isBrand, hasMounted, toggleDarkMode, toggleBrandMode } = useTheme(defaultTheme);
|
|
1568
1576
|
const showDark = hasMounted && isDark;
|
|
1569
1577
|
const showBrand = hasMounted && isBrand;
|
|
@@ -1603,10 +1611,14 @@ function ThemeSwitcher({ defaultTheme = "brand-light" }) {
|
|
|
1603
1611
|
}
|
|
1604
1612
|
);
|
|
1605
1613
|
}
|
|
1606
|
-
function ThemeProvider({
|
|
1607
|
-
|
|
1614
|
+
function ThemeProvider({
|
|
1615
|
+
children,
|
|
1616
|
+
defaultTheme = "brand-light",
|
|
1617
|
+
allowThemePreference = false
|
|
1618
|
+
}) {
|
|
1619
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
1608
1620
|
try {
|
|
1609
|
-
const stored = localStorage.getItem("orion-admin-theme");
|
|
1621
|
+
const stored = allowThemePreference ? localStorage.getItem("orion-admin-theme") : null;
|
|
1610
1622
|
const html = document.documentElement;
|
|
1611
1623
|
const resolvedTheme = stored && ["light", "dark", "brand-light", "brand-dark"].includes(stored) ? stored : defaultTheme;
|
|
1612
1624
|
const isDark = resolvedTheme === "dark" || resolvedTheme === "brand-dark";
|
|
@@ -1624,7 +1636,7 @@ function ThemeProvider({ children, defaultTheme = "brand-light" }) {
|
|
|
1624
1636
|
localStorage.setItem("orion-admin-theme", resolvedTheme);
|
|
1625
1637
|
} catch {
|
|
1626
1638
|
}
|
|
1627
|
-
}, [defaultTheme]);
|
|
1639
|
+
}, [allowThemePreference, defaultTheme]);
|
|
1628
1640
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
|
|
1629
1641
|
}
|
|
1630
1642
|
|
|
@@ -2373,10 +2385,10 @@ var detectAdminBasePath = (pathname, fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
|
2373
2385
|
const normalizedPathname = normalizePath(pathname);
|
|
2374
2386
|
const normalizedFallback = normalizeAdminBasePath(fallback);
|
|
2375
2387
|
const markers = [
|
|
2376
|
-
"/
|
|
2377
|
-
"/studio-globals",
|
|
2388
|
+
"/contact-form",
|
|
2378
2389
|
"/collections/",
|
|
2379
2390
|
"/globals/",
|
|
2391
|
+
"/forms",
|
|
2380
2392
|
"/pages/",
|
|
2381
2393
|
"/tools",
|
|
2382
2394
|
"/media",
|
|
@@ -2431,8 +2443,14 @@ var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
|
2431
2443
|
return adminBasePath;
|
|
2432
2444
|
};
|
|
2433
2445
|
|
|
2434
|
-
// src/admin/components/studio/
|
|
2446
|
+
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
2435
2447
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2448
|
+
function StudioSectionLayout({ children, navProps: _navProps }) {
|
|
2449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
2453
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2436
2454
|
var cardStyle = {
|
|
2437
2455
|
background: "var(--theme-elevation-0)",
|
|
2438
2456
|
border: "1px solid var(--theme-elevation-150)",
|
|
@@ -2475,25 +2493,24 @@ var getPropSections = (props, key) => {
|
|
|
2475
2493
|
};
|
|
2476
2494
|
function AdminStudioDashboard(props) {
|
|
2477
2495
|
const formsEnabled = getPropBoolean(props, "formsEnabled", false);
|
|
2478
|
-
const
|
|
2479
|
-
const mediaCollectionSlug = getPropString(props, "mediaCollectionSlug", "media");
|
|
2480
|
-
const globalsBasePath = getPropString(props, "globalsBasePath", "/studio-globals");
|
|
2496
|
+
const globalsBasePath = getPropString(props, "globalsBasePath", "/globals");
|
|
2481
2497
|
const sections = getPropSections(props, "sections");
|
|
2482
2498
|
const adminBasePath = useAdminBasePath();
|
|
2483
2499
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2484
|
-
const formsPath = resolveAdminPath(adminBasePath, "/
|
|
2485
|
-
const pagesPath = resolveAdminPath(adminBasePath,
|
|
2486
|
-
const mediaPath = resolveAdminPath(adminBasePath,
|
|
2500
|
+
const formsPath = resolveAdminPath(adminBasePath, "/forms");
|
|
2501
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
2502
|
+
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
2503
|
+
const toolsPath = resolveAdminPath(adminBasePath, "/tools");
|
|
2487
2504
|
const extensionCards = sections.filter((section) => section.card).map((section) => ({
|
|
2488
2505
|
href: resolveAdminPath(adminBasePath, section.href),
|
|
2489
2506
|
title: section.card?.title || section.label,
|
|
2490
2507
|
description: section.card?.description || ""
|
|
2491
2508
|
}));
|
|
2492
|
-
return /* @__PURE__ */ (0,
|
|
2493
|
-
/* @__PURE__ */ (0,
|
|
2494
|
-
/* @__PURE__ */ (0,
|
|
2495
|
-
/* @__PURE__ */ (0,
|
|
2496
|
-
/* @__PURE__ */ (0,
|
|
2509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { paddingBottom: "1.3rem" }, children: [
|
|
2510
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui3.SetStepNav, { nav: [{ label: "Dashboard", url: adminBasePath }] }),
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h1", { style: { fontSize: "1.6rem", margin: 0 }, children: "Studio" }),
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Pick what you want to edit." }),
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2497
2514
|
"div",
|
|
2498
2515
|
{
|
|
2499
2516
|
style: {
|
|
@@ -2503,36 +2520,92 @@ function AdminStudioDashboard(props) {
|
|
|
2503
2520
|
marginTop: "1.1rem"
|
|
2504
2521
|
},
|
|
2505
2522
|
children: [
|
|
2506
|
-
/* @__PURE__ */ (0,
|
|
2507
|
-
/* @__PURE__ */ (0,
|
|
2508
|
-
/* @__PURE__ */ (0,
|
|
2523
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("a", { href: pagesPath, style: cardStyle, children: [
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontWeight: 900 }, children: "Pages" }),
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Edit your site pages with the custom editor." })
|
|
2509
2526
|
] }),
|
|
2510
|
-
formsEnabled ? /* @__PURE__ */ (0,
|
|
2511
|
-
/* @__PURE__ */ (0,
|
|
2512
|
-
/* @__PURE__ */ (0,
|
|
2527
|
+
formsEnabled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("a", { href: formsPath, style: cardStyle, children: [
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontWeight: 900 }, children: "Forms" }),
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Review forms, submissions, and uploaded files." })
|
|
2513
2530
|
] }) : null,
|
|
2514
|
-
/* @__PURE__ */ (0,
|
|
2515
|
-
/* @__PURE__ */ (0,
|
|
2516
|
-
/* @__PURE__ */ (0,
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("a", { href: resolvedGlobalsBasePath, style: cardStyle, children: [
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontWeight: 900 }, children: "Globals" }),
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Site settings, header, footer." })
|
|
2534
|
+
] }),
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("a", { href: mediaPath, style: cardStyle, children: [
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontWeight: 900 }, children: "Media" }),
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Upload and manage images and files." })
|
|
2517
2538
|
] }),
|
|
2518
|
-
/* @__PURE__ */ (0,
|
|
2519
|
-
/* @__PURE__ */ (0,
|
|
2520
|
-
/* @__PURE__ */ (0,
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("a", { href: toolsPath, style: cardStyle, children: [
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontWeight: 900 }, children: "Admin Tools" }),
|
|
2541
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Open admin-only fallback links and user management." })
|
|
2521
2542
|
] }),
|
|
2522
|
-
extensionCards.map((card) => /* @__PURE__ */ (0,
|
|
2523
|
-
/* @__PURE__ */ (0,
|
|
2524
|
-
/* @__PURE__ */ (0,
|
|
2543
|
+
extensionCards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("a", { href: card.href, style: cardStyle, children: [
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontWeight: 900 }, children: card.title }),
|
|
2545
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: card.description })
|
|
2525
2546
|
] }, card.href))
|
|
2526
2547
|
]
|
|
2527
2548
|
}
|
|
2528
2549
|
)
|
|
2529
|
-
] });
|
|
2550
|
+
] }) });
|
|
2530
2551
|
}
|
|
2531
2552
|
|
|
2532
2553
|
// src/admin/components/studio/AdminStudioNav.tsx
|
|
2533
2554
|
var import_react12 = require("react");
|
|
2534
2555
|
var import_ui4 = require("@payloadcms/ui");
|
|
2535
|
-
var
|
|
2556
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2557
|
+
var iconSize2 = 18;
|
|
2558
|
+
function NavIcon({ sectionID }) {
|
|
2559
|
+
const props = {
|
|
2560
|
+
fill: "none",
|
|
2561
|
+
height: iconSize2,
|
|
2562
|
+
stroke: "currentColor",
|
|
2563
|
+
strokeLinecap: "round",
|
|
2564
|
+
strokeLinejoin: "round",
|
|
2565
|
+
strokeWidth: 2,
|
|
2566
|
+
viewBox: "0 0 24 24",
|
|
2567
|
+
width: iconSize2
|
|
2568
|
+
};
|
|
2569
|
+
switch (sectionID) {
|
|
2570
|
+
case "dashboard":
|
|
2571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { ...props, children: [
|
|
2572
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "3", y: "3", width: "7", height: "9", rx: "1" }),
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "14", y: "3", width: "7", height: "5", rx: "1" }),
|
|
2574
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "14", y: "12", width: "7", height: "9", rx: "1" }),
|
|
2575
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "3", y: "16", width: "7", height: "5", rx: "1" })
|
|
2576
|
+
] });
|
|
2577
|
+
case "pages":
|
|
2578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { ...props, children: [
|
|
2579
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
|
|
2580
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("polyline", { points: "14 2 14 8 20 8" }),
|
|
2581
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("line", { x1: "8", y1: "17", x2: "12", y2: "17" })
|
|
2583
|
+
] });
|
|
2584
|
+
case "forms":
|
|
2585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { ...props, children: [
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9 3h6" }),
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M12 3v18" }),
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.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" }),
|
|
2589
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M7 11h10" }),
|
|
2590
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M7 15h6" })
|
|
2591
|
+
] });
|
|
2592
|
+
case "globals":
|
|
2593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { ...props, children: [
|
|
2594
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { cx: "12", cy: "12", r: "3" }),
|
|
2595
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.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" })
|
|
2596
|
+
] });
|
|
2597
|
+
case "media":
|
|
2598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { ...props, children: [
|
|
2599
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
2600
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
2601
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("polyline", { points: "21 15 16 10 5 21" })
|
|
2602
|
+
] });
|
|
2603
|
+
case "admin-tools":
|
|
2604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime16.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" }) });
|
|
2605
|
+
default:
|
|
2606
|
+
return null;
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2536
2609
|
var getPropString2 = (props, key, fallback) => {
|
|
2537
2610
|
if (!props || typeof props !== "object") return fallback;
|
|
2538
2611
|
const direct = props[key];
|
|
@@ -2599,9 +2672,14 @@ function AdminStudioNav(props) {
|
|
|
2599
2672
|
const logoUrl = getPropString2(props, "logoUrl", "");
|
|
2600
2673
|
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
2601
2674
|
const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
|
|
2602
|
-
const
|
|
2675
|
+
const formSubmissionsCollectionSlug = getPropString2(
|
|
2676
|
+
props,
|
|
2677
|
+
"formSubmissionsCollectionSlug",
|
|
2678
|
+
"form-submissions"
|
|
2679
|
+
);
|
|
2680
|
+
const formUploadsCollectionSlug = getPropString2(props, "formUploadsCollectionSlug", "form-uploads");
|
|
2603
2681
|
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
2604
|
-
const globalsBasePath = getPropString2(props, "globalsBasePath", "/
|
|
2682
|
+
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
2605
2683
|
const globalsExtraMatchPrefixes = getPropStringArray(props, "globalsExtraMatchPrefixes", []);
|
|
2606
2684
|
const sections = getPropSections2(props, "sections");
|
|
2607
2685
|
const compact = getPropBoolean2(props, "compact", false);
|
|
@@ -2615,10 +2693,10 @@ function AdminStudioNav(props) {
|
|
|
2615
2693
|
window.addEventListener("popstate", update);
|
|
2616
2694
|
return () => window.removeEventListener("popstate", update);
|
|
2617
2695
|
}, []);
|
|
2618
|
-
const pagesPath = resolveAdminPath(adminBasePath,
|
|
2619
|
-
const formsPath = resolveAdminPath(adminBasePath, "/
|
|
2620
|
-
const mediaPath = resolveAdminPath(adminBasePath,
|
|
2621
|
-
const usersPath = resolveAdminPath(adminBasePath, "/
|
|
2696
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
2697
|
+
const formsPath = resolveAdminPath(adminBasePath, "/forms");
|
|
2698
|
+
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
2699
|
+
const usersPath = resolveAdminPath(adminBasePath, "/tools");
|
|
2622
2700
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2623
2701
|
const resolvedGlobalsExtraMatchPrefixes = globalsExtraMatchPrefixes.map(
|
|
2624
2702
|
(prefix) => resolveAdminPath(adminBasePath, prefix)
|
|
@@ -2637,7 +2715,12 @@ function AdminStudioNav(props) {
|
|
|
2637
2715
|
label: "Forms",
|
|
2638
2716
|
matchPrefixes: [
|
|
2639
2717
|
formsPath,
|
|
2640
|
-
resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`)
|
|
2718
|
+
resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`),
|
|
2719
|
+
resolveAdminPath(
|
|
2720
|
+
adminBasePath,
|
|
2721
|
+
`/collections/${formSubmissionsCollectionSlug}`
|
|
2722
|
+
),
|
|
2723
|
+
resolveAdminPath(adminBasePath, `/collections/${formUploadsCollectionSlug}`)
|
|
2641
2724
|
]
|
|
2642
2725
|
}
|
|
2643
2726
|
] : [],
|
|
@@ -2651,12 +2734,17 @@ function AdminStudioNav(props) {
|
|
|
2651
2734
|
...resolvedGlobalsExtraMatchPrefixes
|
|
2652
2735
|
]
|
|
2653
2736
|
},
|
|
2654
|
-
{
|
|
2737
|
+
{
|
|
2738
|
+
id: "media",
|
|
2739
|
+
href: mediaPath,
|
|
2740
|
+
label: "Media",
|
|
2741
|
+
matchPrefixes: [mediaPath, resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`)]
|
|
2742
|
+
},
|
|
2655
2743
|
{
|
|
2656
2744
|
id: "admin-tools",
|
|
2657
2745
|
href: usersPath,
|
|
2658
2746
|
label: "Admin Tools",
|
|
2659
|
-
matchPrefixes: [usersPath],
|
|
2747
|
+
matchPrefixes: [usersPath, resolveAdminPath(adminBasePath, "/collections/users")],
|
|
2660
2748
|
roles: ["admin"]
|
|
2661
2749
|
}
|
|
2662
2750
|
];
|
|
@@ -2673,6 +2761,8 @@ function AdminStudioNav(props) {
|
|
|
2673
2761
|
formsCollectionSlug,
|
|
2674
2762
|
formsEnabled,
|
|
2675
2763
|
formsPath,
|
|
2764
|
+
formSubmissionsCollectionSlug,
|
|
2765
|
+
formUploadsCollectionSlug,
|
|
2676
2766
|
mediaPath,
|
|
2677
2767
|
pagesPath,
|
|
2678
2768
|
resolvedGlobalsBasePath,
|
|
@@ -2694,7 +2784,7 @@ function AdminStudioNav(props) {
|
|
|
2694
2784
|
padding: compact ? "0.6rem" : "0.6rem 0.75rem",
|
|
2695
2785
|
textDecoration: "none"
|
|
2696
2786
|
});
|
|
2697
|
-
return /* @__PURE__ */ (0,
|
|
2787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2698
2788
|
"div",
|
|
2699
2789
|
{
|
|
2700
2790
|
style: {
|
|
@@ -2705,8 +2795,8 @@ function AdminStudioNav(props) {
|
|
|
2705
2795
|
padding: compact ? "0.8rem 0.5rem" : "1rem 0.85rem"
|
|
2706
2796
|
},
|
|
2707
2797
|
children: [
|
|
2708
|
-
/* @__PURE__ */ (0,
|
|
2709
|
-
branding.logoUrl ? /* @__PURE__ */ (0,
|
|
2798
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "admin-studio-brand", style: { padding: compact ? "0" : "0 0.35rem 0 2.4rem" }, children: [
|
|
2799
|
+
branding.logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2710
2800
|
"div",
|
|
2711
2801
|
{
|
|
2712
2802
|
style: {
|
|
@@ -2716,10 +2806,10 @@ function AdminStudioNav(props) {
|
|
|
2716
2806
|
overflow: "hidden",
|
|
2717
2807
|
width: compact ? 34 : 40
|
|
2718
2808
|
},
|
|
2719
|
-
children: /* @__PURE__ */ (0,
|
|
2809
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { alt: `${resolvedName} logo`, src: branding.logoUrl, style: { height: "100%", objectFit: "cover", width: "100%" } })
|
|
2720
2810
|
}
|
|
2721
2811
|
) : null,
|
|
2722
|
-
/* @__PURE__ */ (0,
|
|
2812
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2723
2813
|
"div",
|
|
2724
2814
|
{
|
|
2725
2815
|
style: {
|
|
@@ -2734,14 +2824,23 @@ function AdminStudioNav(props) {
|
|
|
2734
2824
|
children: compact ? resolvedName.slice(0, 1).toUpperCase() : resolvedName
|
|
2735
2825
|
}
|
|
2736
2826
|
),
|
|
2737
|
-
!compact ? /* @__PURE__ */ (0,
|
|
2827
|
+
!compact ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.85rem" }, children: "Studio" }) : null
|
|
2738
2828
|
] }),
|
|
2739
|
-
/* @__PURE__ */ (0,
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("nav", { style: { display: "grid", gap: "0.25rem" }, children: links.filter((link) => roleCanAccessSection(userRole, link)).map((link) => {
|
|
2740
2830
|
const active = link.href === dashboardPath ? pathname === dashboardPath : link.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
2741
|
-
return /* @__PURE__ */ (0,
|
|
2831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("a", { href: link.href, style: linkStyle(active), title: link.label, children: (() => {
|
|
2832
|
+
const icon = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(NavIcon, { sectionID: link.id });
|
|
2833
|
+
if (compact) {
|
|
2834
|
+
return icon || link.label.slice(0, 1);
|
|
2835
|
+
}
|
|
2836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { style: { alignItems: "center", display: "inline-flex", gap: "0.6rem" }, children: [
|
|
2837
|
+
icon,
|
|
2838
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: link.label })
|
|
2839
|
+
] });
|
|
2840
|
+
})() }, link.href);
|
|
2742
2841
|
}) }),
|
|
2743
|
-
/* @__PURE__ */ (0,
|
|
2744
|
-
/* @__PURE__ */ (0,
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { flex: 1 } }),
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2745
2844
|
"div",
|
|
2746
2845
|
{
|
|
2747
2846
|
style: {
|
|
@@ -2750,11 +2849,11 @@ function AdminStudioNav(props) {
|
|
|
2750
2849
|
textAlign: compact ? "center" : "left"
|
|
2751
2850
|
},
|
|
2752
2851
|
children: [
|
|
2753
|
-
!compact ? /* @__PURE__ */ (0,
|
|
2754
|
-
/* @__PURE__ */ (0,
|
|
2755
|
-
/* @__PURE__ */ (0,
|
|
2852
|
+
!compact ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2853
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { color: "var(--theme-elevation-700)", fontSize: "0.85rem" }, children: "Signed in as" }),
|
|
2854
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontWeight: 800, marginBottom: "0.55rem" }, children: typeof user?.email === "string" ? user.email : "User" })
|
|
2756
2855
|
] }) : null,
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
2856
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_ui4.Logout, {})
|
|
2758
2857
|
]
|
|
2759
2858
|
}
|
|
2760
2859
|
)
|
|
@@ -2766,7 +2865,7 @@ function AdminStudioNav(props) {
|
|
|
2766
2865
|
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
2767
2866
|
var import_react13 = require("react");
|
|
2768
2867
|
var import_ui5 = require("@payloadcms/ui");
|
|
2769
|
-
var
|
|
2868
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2770
2869
|
var isAdmin = (user) => {
|
|
2771
2870
|
if (!user || typeof user !== "object") return false;
|
|
2772
2871
|
const role = user.role;
|
|
@@ -2826,14 +2925,14 @@ function AdminStudioPagesListView(props) {
|
|
|
2826
2925
|
cancelled = true;
|
|
2827
2926
|
};
|
|
2828
2927
|
}, [apiURL]);
|
|
2829
|
-
return /* @__PURE__ */ (0,
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
2831
|
-
/* @__PURE__ */ (0,
|
|
2832
|
-
/* @__PURE__ */ (0,
|
|
2833
|
-
/* @__PURE__ */ (0,
|
|
2834
|
-
/* @__PURE__ */ (0,
|
|
2928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2929
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui5.SetStepNav, { nav: [{ label: "Pages", url: pagesPath }] }),
|
|
2930
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { alignItems: "flex-end", display: "flex", gap: "0.75rem" }, children: [
|
|
2931
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1 }, children: [
|
|
2932
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { style: { margin: 0 }, children: "Pages" }),
|
|
2933
|
+
/* @__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
2934
|
] }),
|
|
2836
|
-
isAdmin(user) ? /* @__PURE__ */ (0,
|
|
2935
|
+
isAdmin(user) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2837
2936
|
"a",
|
|
2838
2937
|
{
|
|
2839
2938
|
href: `${rawPagesCollectionPath}/create`,
|
|
@@ -2849,10 +2948,10 @@ function AdminStudioPagesListView(props) {
|
|
|
2849
2948
|
}
|
|
2850
2949
|
) : null
|
|
2851
2950
|
] }),
|
|
2852
|
-
loading ? /* @__PURE__ */ (0,
|
|
2853
|
-
error ? /* @__PURE__ */ (0,
|
|
2854
|
-
/* @__PURE__ */ (0,
|
|
2855
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */ (0,
|
|
2951
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "1rem" }, children: "Loading..." }) : null,
|
|
2952
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { color: "crimson", marginTop: "1rem" }, children: error }) : null,
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: [
|
|
2954
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2856
2955
|
"div",
|
|
2857
2956
|
{
|
|
2858
2957
|
style: {
|
|
@@ -2870,7 +2969,7 @@ function AdminStudioPagesListView(props) {
|
|
|
2870
2969
|
const path = typeof doc.path === "string" ? doc.path : "/";
|
|
2871
2970
|
const status = typeof doc._status === "string" ? doc._status : "";
|
|
2872
2971
|
if (!id) return null;
|
|
2873
|
-
return /* @__PURE__ */ (0,
|
|
2972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2874
2973
|
"a",
|
|
2875
2974
|
{
|
|
2876
2975
|
href: resolveAdminPath(adminBasePath, `/pages/${id}`),
|
|
@@ -2886,9 +2985,9 @@ function AdminStudioPagesListView(props) {
|
|
|
2886
2985
|
textDecoration: "none"
|
|
2887
2986
|
},
|
|
2888
2987
|
children: [
|
|
2889
|
-
/* @__PURE__ */ (0,
|
|
2890
|
-
/* @__PURE__ */ (0,
|
|
2891
|
-
/* @__PURE__ */ (0,
|
|
2988
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { fontWeight: 900, overflow: "hidden", textOverflow: "ellipsis" }, children: title }),
|
|
2990
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2892
2991
|
"div",
|
|
2893
2992
|
{
|
|
2894
2993
|
style: {
|
|
@@ -2901,7 +3000,7 @@ function AdminStudioPagesListView(props) {
|
|
|
2901
3000
|
}
|
|
2902
3001
|
)
|
|
2903
3002
|
] }),
|
|
2904
|
-
/* @__PURE__ */ (0,
|
|
3003
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2905
3004
|
"div",
|
|
2906
3005
|
{
|
|
2907
3006
|
style: {
|
|
@@ -2911,7 +3010,7 @@ function AdminStudioPagesListView(props) {
|
|
|
2911
3010
|
gap: "0.5rem"
|
|
2912
3011
|
},
|
|
2913
3012
|
children: [
|
|
2914
|
-
status ? /* @__PURE__ */ (0,
|
|
3013
|
+
status ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2915
3014
|
"span",
|
|
2916
3015
|
{
|
|
2917
3016
|
style: {
|
|
@@ -2926,7 +3025,7 @@ function AdminStudioPagesListView(props) {
|
|
|
2926
3025
|
children: status
|
|
2927
3026
|
}
|
|
2928
3027
|
) : null,
|
|
2929
|
-
/* @__PURE__ */ (0,
|
|
3028
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { color: "var(--theme-elevation-600)", fontWeight: 800 }, children: "Open" })
|
|
2930
3029
|
]
|
|
2931
3030
|
}
|
|
2932
3031
|
)
|
|
@@ -2936,13 +3035,13 @@ function AdminStudioPagesListView(props) {
|
|
|
2936
3035
|
);
|
|
2937
3036
|
})
|
|
2938
3037
|
] })
|
|
2939
|
-
] });
|
|
3038
|
+
] }) });
|
|
2940
3039
|
}
|
|
2941
3040
|
|
|
2942
3041
|
// src/admin/components/studio/AdminStudioPageEditView.tsx
|
|
2943
3042
|
var import_react14 = require("react");
|
|
2944
3043
|
var import_ui6 = require("@payloadcms/ui");
|
|
2945
|
-
var
|
|
3044
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2946
3045
|
var isAdmin2 = (user) => {
|
|
2947
3046
|
if (!user || typeof user !== "object") return false;
|
|
2948
3047
|
const role = user.role;
|
|
@@ -3095,8 +3194,8 @@ function AdminStudioPageEditView(props) {
|
|
|
3095
3194
|
return () => window.removeEventListener("message", onMessage);
|
|
3096
3195
|
}, []);
|
|
3097
3196
|
if (!pageID && !didResolvePathFallback) {
|
|
3098
|
-
return /* @__PURE__ */ (0,
|
|
3099
|
-
/* @__PURE__ */ (0,
|
|
3197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3198
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3100
3199
|
import_ui6.SetStepNav,
|
|
3101
3200
|
{
|
|
3102
3201
|
nav: [
|
|
@@ -3105,13 +3204,13 @@ function AdminStudioPageEditView(props) {
|
|
|
3105
3204
|
]
|
|
3106
3205
|
}
|
|
3107
3206
|
),
|
|
3108
|
-
/* @__PURE__ */ (0,
|
|
3109
|
-
/* @__PURE__ */ (0,
|
|
3110
|
-
] });
|
|
3207
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
3208
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading page editor..." })
|
|
3209
|
+
] }) });
|
|
3111
3210
|
}
|
|
3112
3211
|
if (!pageID) {
|
|
3113
|
-
return /* @__PURE__ */ (0,
|
|
3114
|
-
/* @__PURE__ */ (0,
|
|
3212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3115
3214
|
import_ui6.SetStepNav,
|
|
3116
3215
|
{
|
|
3117
3216
|
nav: [
|
|
@@ -3120,12 +3219,12 @@ function AdminStudioPageEditView(props) {
|
|
|
3120
3219
|
]
|
|
3121
3220
|
}
|
|
3122
3221
|
),
|
|
3123
|
-
/* @__PURE__ */ (0,
|
|
3124
|
-
/* @__PURE__ */ (0,
|
|
3125
|
-
] });
|
|
3222
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
3223
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Missing page ID." })
|
|
3224
|
+
] }) });
|
|
3126
3225
|
}
|
|
3127
|
-
return /* @__PURE__ */ (0,
|
|
3128
|
-
/* @__PURE__ */ (0,
|
|
3226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3227
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3129
3228
|
import_ui6.SetStepNav,
|
|
3130
3229
|
{
|
|
3131
3230
|
nav: [
|
|
@@ -3134,8 +3233,8 @@ function AdminStudioPageEditView(props) {
|
|
|
3134
3233
|
]
|
|
3135
3234
|
}
|
|
3136
3235
|
),
|
|
3137
|
-
/* @__PURE__ */ (0,
|
|
3138
|
-
/* @__PURE__ */ (0,
|
|
3236
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "grid", gridTemplateRows: "auto 1fr", height: "calc(100vh - 120px)" }, children: [
|
|
3237
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3139
3238
|
"div",
|
|
3140
3239
|
{
|
|
3141
3240
|
style: {
|
|
@@ -3151,9 +3250,9 @@ function AdminStudioPageEditView(props) {
|
|
|
3151
3250
|
zIndex: 20
|
|
3152
3251
|
},
|
|
3153
3252
|
children: [
|
|
3154
|
-
/* @__PURE__ */ (0,
|
|
3155
|
-
/* @__PURE__ */ (0,
|
|
3156
|
-
/* @__PURE__ */ (0,
|
|
3253
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
3254
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontWeight: 900 }, children: "Page Editor" }),
|
|
3255
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3157
3256
|
"div",
|
|
3158
3257
|
{
|
|
3159
3258
|
style: {
|
|
@@ -3169,9 +3268,9 @@ function AdminStudioPageEditView(props) {
|
|
|
3169
3268
|
}
|
|
3170
3269
|
)
|
|
3171
3270
|
] }),
|
|
3172
|
-
/* @__PURE__ */ (0,
|
|
3173
|
-
/* @__PURE__ */ (0,
|
|
3174
|
-
/* @__PURE__ */ (0,
|
|
3271
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
3272
|
+
/* @__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" }),
|
|
3273
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3175
3274
|
"div",
|
|
3176
3275
|
{
|
|
3177
3276
|
style: {
|
|
@@ -3188,7 +3287,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3188
3287
|
children: hasUnpublishedChanges ? "Unpublished draft changes" : "Live is up to date"
|
|
3189
3288
|
}
|
|
3190
3289
|
),
|
|
3191
|
-
/* @__PURE__ */ (0,
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3192
3291
|
"button",
|
|
3193
3292
|
{
|
|
3194
3293
|
disabled: !canUndo,
|
|
@@ -3204,7 +3303,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3204
3303
|
children: "Undo"
|
|
3205
3304
|
}
|
|
3206
3305
|
),
|
|
3207
|
-
/* @__PURE__ */ (0,
|
|
3306
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3208
3307
|
"button",
|
|
3209
3308
|
{
|
|
3210
3309
|
disabled: !canRedo,
|
|
@@ -3220,7 +3319,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3220
3319
|
children: "Redo"
|
|
3221
3320
|
}
|
|
3222
3321
|
),
|
|
3223
|
-
/* @__PURE__ */ (0,
|
|
3322
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3224
3323
|
"button",
|
|
3225
3324
|
{
|
|
3226
3325
|
disabled: saving !== null,
|
|
@@ -3236,7 +3335,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3236
3335
|
children: saving === "draft" ? "Saving\u2026" : "Save Draft"
|
|
3237
3336
|
}
|
|
3238
3337
|
),
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3240
3339
|
"button",
|
|
3241
3340
|
{
|
|
3242
3341
|
disabled: !canPublish || saving !== null,
|
|
@@ -3259,7 +3358,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3259
3358
|
]
|
|
3260
3359
|
}
|
|
3261
3360
|
),
|
|
3262
|
-
/* @__PURE__ */ (0,
|
|
3361
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3263
3362
|
"iframe",
|
|
3264
3363
|
{
|
|
3265
3364
|
ref: iframeRef,
|
|
@@ -3275,12 +3374,12 @@ function AdminStudioPageEditView(props) {
|
|
|
3275
3374
|
}
|
|
3276
3375
|
)
|
|
3277
3376
|
] })
|
|
3278
|
-
] });
|
|
3377
|
+
] }) });
|
|
3279
3378
|
}
|
|
3280
3379
|
|
|
3281
3380
|
// src/admin/components/studio/AdminStudioGlobalsView.tsx
|
|
3282
3381
|
var import_ui7 = require("@payloadcms/ui");
|
|
3283
|
-
var
|
|
3382
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3284
3383
|
var getPropGlobals = (props) => {
|
|
3285
3384
|
if (!props || typeof props !== "object") return null;
|
|
3286
3385
|
const direct = props.globals;
|
|
@@ -3304,25 +3403,25 @@ var getPropString5 = (props, key, fallback) => {
|
|
|
3304
3403
|
return fallback;
|
|
3305
3404
|
};
|
|
3306
3405
|
function AdminStudioGlobalsView(props) {
|
|
3307
|
-
const globalsBasePath = getPropString5(props, "globalsBasePath", "/
|
|
3406
|
+
const globalsBasePath = getPropString5(props, "globalsBasePath", "/globals");
|
|
3308
3407
|
const adminBasePath = useAdminBasePath();
|
|
3309
3408
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3310
3409
|
const globals = getPropGlobals(props) || [
|
|
3311
3410
|
{ slug: "site-settings", label: "Website Settings" },
|
|
3312
3411
|
{ slug: "header", label: "Header & Navigation" },
|
|
3313
3412
|
{ slug: "footer", label: "Footer" },
|
|
3314
|
-
{ slug: "
|
|
3413
|
+
{ slug: "social-media", label: "Social Media" }
|
|
3315
3414
|
];
|
|
3316
|
-
return /* @__PURE__ */ (0,
|
|
3317
|
-
/* @__PURE__ */ (0,
|
|
3318
|
-
/* @__PURE__ */ (0,
|
|
3319
|
-
/* @__PURE__ */ (0,
|
|
3320
|
-
/* @__PURE__ */ (0,
|
|
3415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_ui7.SetStepNav, { nav: [{ label: "Globals", url: resolvedGlobalsBasePath }] }),
|
|
3417
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h1", { style: { margin: 0 }, children: "Globals" }),
|
|
3418
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Site-wide settings." }),
|
|
3419
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: globals.map((global) => {
|
|
3321
3420
|
const href = resolveAdminPath(
|
|
3322
3421
|
adminBasePath,
|
|
3323
3422
|
typeof global.href === "string" ? global.href : `/globals/${global.slug}`
|
|
3324
3423
|
);
|
|
3325
|
-
return /* @__PURE__ */ (0,
|
|
3424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3326
3425
|
"a",
|
|
3327
3426
|
{
|
|
3328
3427
|
href,
|
|
@@ -3335,14 +3434,14 @@ function AdminStudioGlobalsView(props) {
|
|
|
3335
3434
|
textDecoration: "none"
|
|
3336
3435
|
},
|
|
3337
3436
|
children: [
|
|
3338
|
-
/* @__PURE__ */ (0,
|
|
3339
|
-
/* @__PURE__ */ (0,
|
|
3437
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { fontWeight: 900 }, children: global.label }),
|
|
3438
|
+
/* @__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 })
|
|
3340
3439
|
]
|
|
3341
3440
|
},
|
|
3342
3441
|
global.slug
|
|
3343
3442
|
);
|
|
3344
3443
|
}) }),
|
|
3345
|
-
/* @__PURE__ */ (0,
|
|
3444
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { marginTop: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3346
3445
|
"a",
|
|
3347
3446
|
{
|
|
3348
3447
|
href: resolvedGlobalsBasePath,
|
|
@@ -3350,205 +3449,1476 @@ function AdminStudioGlobalsView(props) {
|
|
|
3350
3449
|
children: "Reload Globals view"
|
|
3351
3450
|
}
|
|
3352
3451
|
) })
|
|
3353
|
-
] });
|
|
3452
|
+
] }) });
|
|
3354
3453
|
}
|
|
3355
3454
|
|
|
3356
|
-
// src/admin/components/studio/
|
|
3357
|
-
var
|
|
3455
|
+
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
3456
|
+
var import_react17 = require("react");
|
|
3358
3457
|
var import_ui8 = require("@payloadcms/ui");
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
}
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
const nested = clientProps[key];
|
|
3381
|
-
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
3458
|
+
|
|
3459
|
+
// src/admin-app/components/HeaderNavEditorWithPreview.tsx
|
|
3460
|
+
var import_react16 = require("react");
|
|
3461
|
+
|
|
3462
|
+
// src/admin-app/nestedNavigation.ts
|
|
3463
|
+
var normalizeNestedNavItems = (items) => {
|
|
3464
|
+
const deduped = [];
|
|
3465
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3466
|
+
for (const item of items) {
|
|
3467
|
+
const href = typeof item.href === "string" ? item.href.trim() : "";
|
|
3468
|
+
const label = typeof item.label === "string" ? item.label.trim() : "";
|
|
3469
|
+
const parentHref = typeof item.parentHref === "string" ? item.parentHref.trim() : "";
|
|
3470
|
+
if (!href || !label || seen.has(href)) {
|
|
3471
|
+
continue;
|
|
3472
|
+
}
|
|
3473
|
+
seen.add(href);
|
|
3474
|
+
deduped.push({
|
|
3475
|
+
href,
|
|
3476
|
+
label,
|
|
3477
|
+
...parentHref ? { parentHref } : {}
|
|
3478
|
+
});
|
|
3382
3479
|
}
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
const trimmed = label.trim();
|
|
3390
|
-
if (!trimmed) return null;
|
|
3391
|
-
return { label: trimmed };
|
|
3480
|
+
const hrefs = new Set(deduped.map((item) => item.href));
|
|
3481
|
+
return deduped.map((item) => ({
|
|
3482
|
+
href: item.href,
|
|
3483
|
+
label: item.label,
|
|
3484
|
+
...item.parentHref && item.parentHref !== item.href && hrefs.has(item.parentHref) ? { parentHref: item.parentHref } : {}
|
|
3485
|
+
}));
|
|
3392
3486
|
};
|
|
3393
|
-
var
|
|
3394
|
-
|
|
3395
|
-
|
|
3487
|
+
var buildNestedNavTree = (items) => {
|
|
3488
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
3489
|
+
const topLevel = [];
|
|
3490
|
+
for (const item of items) {
|
|
3491
|
+
if (!item.parentHref) {
|
|
3492
|
+
topLevel.push(item);
|
|
3493
|
+
continue;
|
|
3494
|
+
}
|
|
3495
|
+
const children = childrenByParent.get(item.parentHref) || [];
|
|
3496
|
+
children.push(item);
|
|
3497
|
+
childrenByParent.set(item.parentHref, children);
|
|
3396
3498
|
}
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
serviceOptions: options.length > 0 ? options : defaultDoc.serviceOptions,
|
|
3405
|
-
submitButtonLabel: typeof record.submitButtonLabel === "string" && record.submitButtonLabel.length > 0 ? record.submitButtonLabel : defaultDoc.submitButtonLabel,
|
|
3406
|
-
successMessage: typeof record.successMessage === "string" && record.successMessage.length > 0 ? record.successMessage : defaultDoc.successMessage
|
|
3407
|
-
};
|
|
3499
|
+
if (topLevel.length === 0 && items.length > 0) {
|
|
3500
|
+
return {
|
|
3501
|
+
topLevel: items.map((item) => ({ href: item.href, label: item.label })),
|
|
3502
|
+
childrenByParent: /* @__PURE__ */ new Map()
|
|
3503
|
+
};
|
|
3504
|
+
}
|
|
3505
|
+
return { childrenByParent, topLevel };
|
|
3408
3506
|
};
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3507
|
+
|
|
3508
|
+
// src/admin-app/components/HeaderNavItemsEditor.tsx
|
|
3509
|
+
var import_react15 = require("react");
|
|
3510
|
+
|
|
3511
|
+
// src/admin-app/navigationLinks.ts
|
|
3512
|
+
var fallbackHomeOption = {
|
|
3513
|
+
href: "/",
|
|
3514
|
+
label: "Home",
|
|
3515
|
+
title: "Home"
|
|
3418
3516
|
};
|
|
3419
|
-
var
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3517
|
+
var buildAdminPageLinkOptions = (pages) => {
|
|
3518
|
+
const options = pages.map((page) => {
|
|
3519
|
+
const href = typeof page.path === "string" ? page.path.trim() : "";
|
|
3520
|
+
const title = typeof page.title === "string" && page.title.trim().length > 0 ? page.title.trim() : "Untitled Page";
|
|
3521
|
+
if (!href) {
|
|
3522
|
+
return null;
|
|
3523
|
+
}
|
|
3524
|
+
const depth = href === "/" ? 0 : href.split("/").filter(Boolean).length;
|
|
3525
|
+
const indentLevel = Math.max(depth - 1, 0);
|
|
3526
|
+
const indent = indentLevel > 0 ? `${"\u21B3 ".repeat(indentLevel)}` : "";
|
|
3527
|
+
return {
|
|
3528
|
+
href,
|
|
3529
|
+
label: `${indent}${title}`,
|
|
3530
|
+
title
|
|
3531
|
+
};
|
|
3532
|
+
}).filter((option) => option !== null).sort((a, b) => {
|
|
3533
|
+
if (a.href === "/" && b.href !== "/") return -1;
|
|
3534
|
+
if (b.href === "/" && a.href !== "/") return 1;
|
|
3535
|
+
return a.href.localeCompare(b.href);
|
|
3536
|
+
});
|
|
3537
|
+
if (options.length === 0) {
|
|
3538
|
+
return [fallbackHomeOption];
|
|
3539
|
+
}
|
|
3540
|
+
return options;
|
|
3425
3541
|
};
|
|
3426
|
-
var
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3542
|
+
var normalizeAdminNavInputs = (rows, pageOptions) => {
|
|
3543
|
+
const allowedLinks = new Map(pageOptions.map((option) => [option.href, option.title]));
|
|
3544
|
+
const deduped = [];
|
|
3545
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3546
|
+
for (const row of rows) {
|
|
3547
|
+
const href = typeof row.href === "string" ? row.href.trim() : "";
|
|
3548
|
+
const defaultLabel = allowedLinks.get(href);
|
|
3549
|
+
const explicitLabel = typeof row.label === "string" ? row.label.trim() : "";
|
|
3550
|
+
const parentHref = typeof row.parentHref === "string" ? row.parentHref.trim() : "";
|
|
3551
|
+
if (!href || !defaultLabel || seen.has(href)) {
|
|
3552
|
+
continue;
|
|
3553
|
+
}
|
|
3554
|
+
seen.add(href);
|
|
3555
|
+
deduped.push({
|
|
3556
|
+
href,
|
|
3557
|
+
label: explicitLabel.length > 0 ? explicitLabel : defaultLabel,
|
|
3558
|
+
...parentHref.length > 0 ? { parentHref } : {}
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
const hrefs = new Set(deduped.map((item) => item.href));
|
|
3562
|
+
const parentByHref = new Map(deduped.map((item) => [item.href, item.parentHref || ""]));
|
|
3563
|
+
const createsCycle = (href, parentHref) => {
|
|
3564
|
+
const visited = /* @__PURE__ */ new Set([href]);
|
|
3565
|
+
let current = parentHref;
|
|
3566
|
+
while (current) {
|
|
3567
|
+
if (visited.has(current)) {
|
|
3568
|
+
return true;
|
|
3569
|
+
}
|
|
3570
|
+
visited.add(current);
|
|
3571
|
+
current = parentByHref.get(current) || "";
|
|
3572
|
+
}
|
|
3573
|
+
return false;
|
|
3574
|
+
};
|
|
3575
|
+
return deduped.map((item) => {
|
|
3576
|
+
const parentHref = item.parentHref;
|
|
3577
|
+
if (!parentHref || parentHref === item.href || !hrefs.has(parentHref) || createsCycle(item.href, parentHref)) {
|
|
3578
|
+
return {
|
|
3579
|
+
href: item.href,
|
|
3580
|
+
label: item.label
|
|
3581
|
+
};
|
|
3582
|
+
}
|
|
3583
|
+
return item;
|
|
3584
|
+
});
|
|
3436
3585
|
};
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3586
|
+
|
|
3587
|
+
// src/admin-app/components/HeaderNavItemsEditor.tsx
|
|
3588
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3589
|
+
var toRow = (item, index) => ({
|
|
3590
|
+
id: `row-${index}-${item.href || "empty"}`,
|
|
3591
|
+
href: item.href || "",
|
|
3592
|
+
label: item.label || "",
|
|
3593
|
+
parentHref: item.parentHref || ""
|
|
3594
|
+
});
|
|
3595
|
+
var moveRow = (rows, fromIndex, toIndex) => {
|
|
3596
|
+
if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= rows.length || toIndex >= rows.length) {
|
|
3597
|
+
return rows;
|
|
3598
|
+
}
|
|
3599
|
+
const next = [...rows];
|
|
3600
|
+
const [moved] = next.splice(fromIndex, 1);
|
|
3601
|
+
if (!moved) {
|
|
3602
|
+
return rows;
|
|
3603
|
+
}
|
|
3604
|
+
next.splice(toIndex, 0, moved);
|
|
3605
|
+
return next;
|
|
3441
3606
|
};
|
|
3442
|
-
function
|
|
3443
|
-
const
|
|
3444
|
-
const
|
|
3445
|
-
const
|
|
3446
|
-
const
|
|
3447
|
-
const
|
|
3448
|
-
const
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3607
|
+
function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
3608
|
+
const [rows, setRows] = (0, import_react15.useState)(() => initialItems.map(toRow));
|
|
3609
|
+
const [nextRowID, setNextRowID] = (0, import_react15.useState)(initialItems.length);
|
|
3610
|
+
const [draggingRowID, setDraggingRowID] = (0, import_react15.useState)(null);
|
|
3611
|
+
const [dragOverRowID, setDragOverRowID] = (0, import_react15.useState)(null);
|
|
3612
|
+
const pageOptionByHref = (0, import_react15.useMemo)(() => new Map(pageOptions.map((option) => [option.href, option])), [pageOptions]);
|
|
3613
|
+
const serializedState = (0, import_react15.useMemo)(
|
|
3614
|
+
() => JSON.stringify(
|
|
3615
|
+
rows.map((row) => ({
|
|
3616
|
+
href: row.href.trim(),
|
|
3617
|
+
label: row.label.trim(),
|
|
3618
|
+
parentHref: row.parentHref.trim() || void 0
|
|
3619
|
+
}))
|
|
3620
|
+
),
|
|
3621
|
+
[rows]
|
|
3622
|
+
);
|
|
3623
|
+
const normalizedItems = (0, import_react15.useMemo)(() => {
|
|
3624
|
+
const inputs = rows.map((row) => ({
|
|
3625
|
+
href: row.href,
|
|
3626
|
+
label: row.label,
|
|
3627
|
+
parentHref: row.parentHref
|
|
3628
|
+
}));
|
|
3629
|
+
return normalizeAdminNavInputs(inputs, pageOptions);
|
|
3630
|
+
}, [rows, pageOptions]);
|
|
3453
3631
|
(0, import_react15.useEffect)(() => {
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
credentials: "same-origin"
|
|
3462
|
-
});
|
|
3463
|
-
if (!response.ok) {
|
|
3464
|
-
throw new Error(`Failed to load global (${response.status}).`);
|
|
3632
|
+
onItemsChange?.(normalizedItems);
|
|
3633
|
+
}, [normalizedItems, onItemsChange]);
|
|
3634
|
+
const setRowValue = (rowID, changes) => {
|
|
3635
|
+
setRows(
|
|
3636
|
+
(currentRows) => currentRows.map((row) => {
|
|
3637
|
+
if (row.id !== rowID) {
|
|
3638
|
+
return row;
|
|
3465
3639
|
}
|
|
3466
|
-
const
|
|
3467
|
-
if (
|
|
3468
|
-
|
|
3469
|
-
} catch (loadError) {
|
|
3470
|
-
if (!mounted) return;
|
|
3471
|
-
setError(loadError instanceof Error ? loadError.message : "Failed to load contact form settings.");
|
|
3472
|
-
} finally {
|
|
3473
|
-
if (mounted) {
|
|
3474
|
-
setIsLoading(false);
|
|
3640
|
+
const nextRow = { ...row, ...changes };
|
|
3641
|
+
if (nextRow.parentHref === nextRow.href) {
|
|
3642
|
+
nextRow.parentHref = "";
|
|
3475
3643
|
}
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
return () => {
|
|
3480
|
-
mounted = false;
|
|
3481
|
-
};
|
|
3482
|
-
}, [globalSlug]);
|
|
3483
|
-
const payload = (0, import_react15.useMemo)(
|
|
3484
|
-
() => ({
|
|
3485
|
-
disabledMessage: doc.disabledMessage,
|
|
3486
|
-
enabled: doc.enabled,
|
|
3487
|
-
errorMessage: doc.errorMessage,
|
|
3488
|
-
notificationEmail: doc.notificationEmail.trim(),
|
|
3489
|
-
serviceOptions: doc.serviceOptions.map((option) => ({ label: option.label.trim() })).filter((option) => option.label.length > 0),
|
|
3490
|
-
submitButtonLabel: doc.submitButtonLabel,
|
|
3491
|
-
successMessage: doc.successMessage
|
|
3492
|
-
}),
|
|
3493
|
-
[doc]
|
|
3494
|
-
);
|
|
3495
|
-
const save = async () => {
|
|
3496
|
-
setIsSaving(true);
|
|
3497
|
-
setError(null);
|
|
3498
|
-
setSavedMessage(null);
|
|
3499
|
-
try {
|
|
3500
|
-
const response = await fetch(`/api/globals/${globalSlug}`, {
|
|
3501
|
-
body: JSON.stringify(payload),
|
|
3502
|
-
credentials: "same-origin",
|
|
3503
|
-
headers: {
|
|
3504
|
-
"Content-Type": "application/json"
|
|
3505
|
-
},
|
|
3506
|
-
method: "PATCH"
|
|
3507
|
-
});
|
|
3508
|
-
if (!response.ok) {
|
|
3509
|
-
throw new Error(`Failed to save settings (${response.status}).`);
|
|
3510
|
-
}
|
|
3511
|
-
const json = await response.json();
|
|
3512
|
-
setDoc(normalizeDoc(json));
|
|
3513
|
-
setSavedMessage("Saved.");
|
|
3514
|
-
} catch (saveError) {
|
|
3515
|
-
setError(saveError instanceof Error ? saveError.message : "Failed to save contact form settings.");
|
|
3516
|
-
} finally {
|
|
3517
|
-
setIsSaving(false);
|
|
3518
|
-
}
|
|
3644
|
+
return nextRow;
|
|
3645
|
+
})
|
|
3646
|
+
);
|
|
3519
3647
|
};
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3648
|
+
const removeRow = (rowID) => {
|
|
3649
|
+
setRows((currentRows) => {
|
|
3650
|
+
const removedRow = currentRows.find((candidate) => candidate.id === rowID);
|
|
3651
|
+
const removedHref = removedRow?.href || "";
|
|
3652
|
+
return currentRows.filter((row) => row.id !== rowID).map((row) => removedHref && row.parentHref === removedHref ? { ...row, parentHref: "" } : row);
|
|
3653
|
+
});
|
|
3654
|
+
};
|
|
3655
|
+
const addRow = () => {
|
|
3656
|
+
setRows((currentRows) => [
|
|
3657
|
+
...currentRows,
|
|
3523
3658
|
{
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3659
|
+
id: `row-new-${nextRowID}`,
|
|
3660
|
+
href: "",
|
|
3661
|
+
label: "",
|
|
3662
|
+
parentHref: ""
|
|
3528
3663
|
}
|
|
3529
|
-
)
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
/* @__PURE__ */ (0,
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3664
|
+
]);
|
|
3665
|
+
setNextRowID((current) => current + 1);
|
|
3666
|
+
};
|
|
3667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "orion-admin-nav-editor", children: [
|
|
3668
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { name: "navItemsState", readOnly: true, type: "hidden", value: serializedState }),
|
|
3669
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "orion-admin-nav-editor-head", children: [
|
|
3670
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "orion-admin-nav-editor-title", children: "Navigation Items" }),
|
|
3671
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "orion-admin-nav-editor-add", onClick: addRow, type: "button", children: "Add Item" })
|
|
3672
|
+
] }),
|
|
3673
|
+
/* @__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." }),
|
|
3674
|
+
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,
|
|
3675
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "orion-admin-nav-editor-list", children: rows.map((row, rowIndex) => {
|
|
3676
|
+
const parentCandidates = rows.filter((candidate) => candidate.id !== row.id && candidate.href.trim().length > 0).map((candidate) => {
|
|
3677
|
+
const resolved = pageOptionByHref.get(candidate.href);
|
|
3678
|
+
return {
|
|
3679
|
+
href: candidate.href,
|
|
3680
|
+
label: candidate.label.trim() || resolved?.title || candidate.href
|
|
3681
|
+
};
|
|
3682
|
+
});
|
|
3683
|
+
const selectedPage = pageOptionByHref.get(row.href);
|
|
3684
|
+
const labelPlaceholder = selectedPage?.title || "Navigation Label";
|
|
3685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3686
|
+
"div",
|
|
3687
|
+
{
|
|
3688
|
+
className: `orion-admin-nav-editor-row${draggingRowID === row.id ? " is-dragging" : ""}${dragOverRowID === row.id && draggingRowID !== row.id ? " is-drop-target" : ""}`,
|
|
3689
|
+
draggable: true,
|
|
3690
|
+
onDragEnd: () => {
|
|
3691
|
+
setDraggingRowID(null);
|
|
3692
|
+
setDragOverRowID(null);
|
|
3693
|
+
},
|
|
3694
|
+
onDragEnter: () => {
|
|
3695
|
+
if (draggingRowID && draggingRowID !== row.id) {
|
|
3696
|
+
setDragOverRowID(row.id);
|
|
3697
|
+
}
|
|
3698
|
+
},
|
|
3699
|
+
onDragLeave: () => {
|
|
3700
|
+
if (dragOverRowID === row.id) {
|
|
3701
|
+
setDragOverRowID(null);
|
|
3702
|
+
}
|
|
3703
|
+
},
|
|
3704
|
+
onDragOver: (event) => {
|
|
3705
|
+
event.preventDefault();
|
|
3706
|
+
if (draggingRowID && draggingRowID !== row.id && dragOverRowID !== row.id) {
|
|
3707
|
+
setDragOverRowID(row.id);
|
|
3708
|
+
}
|
|
3709
|
+
},
|
|
3710
|
+
onDragStart: (event) => {
|
|
3711
|
+
setDraggingRowID(row.id);
|
|
3712
|
+
event.dataTransfer.effectAllowed = "move";
|
|
3713
|
+
},
|
|
3714
|
+
onDrop: (event) => {
|
|
3715
|
+
event.preventDefault();
|
|
3716
|
+
if (!draggingRowID || draggingRowID === row.id) {
|
|
3717
|
+
return;
|
|
3718
|
+
}
|
|
3719
|
+
setRows((currentRows) => {
|
|
3720
|
+
const fromIndex = currentRows.findIndex((entry) => entry.id === draggingRowID);
|
|
3721
|
+
const toIndex = currentRows.findIndex((entry) => entry.id === row.id);
|
|
3722
|
+
return moveRow(currentRows, fromIndex, toIndex);
|
|
3723
|
+
});
|
|
3724
|
+
setDraggingRowID(null);
|
|
3725
|
+
setDragOverRowID(null);
|
|
3726
|
+
},
|
|
3727
|
+
children: [
|
|
3728
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "orion-admin-nav-editor-row-head", children: [
|
|
3729
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "orion-admin-nav-editor-drag", children: "Drag" }),
|
|
3730
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "orion-admin-nav-editor-row-index", children: [
|
|
3731
|
+
"#",
|
|
3732
|
+
rowIndex + 1
|
|
3733
|
+
] }),
|
|
3734
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "orion-admin-nav-editor-remove", onClick: () => removeRow(row.id), type: "button", children: "Remove" })
|
|
3735
|
+
] }),
|
|
3736
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "orion-admin-nav-editor-row-grid", children: [
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { children: [
|
|
3738
|
+
"Label",
|
|
3739
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3740
|
+
"input",
|
|
3741
|
+
{
|
|
3742
|
+
name: `navLabel_${rowIndex}`,
|
|
3743
|
+
onChange: (event) => setRowValue(row.id, { label: event.target.value }),
|
|
3744
|
+
placeholder: labelPlaceholder,
|
|
3745
|
+
type: "text",
|
|
3746
|
+
value: row.label
|
|
3747
|
+
}
|
|
3748
|
+
)
|
|
3749
|
+
] }),
|
|
3750
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { children: [
|
|
3751
|
+
"Page",
|
|
3752
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3753
|
+
"select",
|
|
3754
|
+
{
|
|
3755
|
+
name: `navPage_${rowIndex}`,
|
|
3756
|
+
onChange: (event) => {
|
|
3757
|
+
const nextHref = event.target.value;
|
|
3758
|
+
const nextParent = row.parentHref && row.parentHref === nextHref ? "" : row.parentHref;
|
|
3759
|
+
setRowValue(row.id, { href: nextHref, parentHref: nextParent });
|
|
3760
|
+
},
|
|
3761
|
+
value: row.href,
|
|
3762
|
+
children: [
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Select page..." }),
|
|
3764
|
+
pageOptions.map((pageOption) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: pageOption.href, children: pageOption.label }, `${pageOption.href}-${pageOption.title}`))
|
|
3765
|
+
]
|
|
3766
|
+
}
|
|
3767
|
+
)
|
|
3768
|
+
] }),
|
|
3769
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { children: [
|
|
3770
|
+
"Parent (dropdown under)",
|
|
3771
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3772
|
+
"select",
|
|
3773
|
+
{
|
|
3774
|
+
name: `navParentHref_${rowIndex}`,
|
|
3775
|
+
onChange: (event) => setRowValue(row.id, { parentHref: event.target.value }),
|
|
3776
|
+
value: row.parentHref,
|
|
3777
|
+
children: [
|
|
3778
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Top-level item" }),
|
|
3779
|
+
parentCandidates.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: candidate.href, children: candidate.label }, `${row.id}-parent-${candidate.href}`))
|
|
3780
|
+
]
|
|
3781
|
+
}
|
|
3782
|
+
)
|
|
3783
|
+
] })
|
|
3784
|
+
] })
|
|
3785
|
+
]
|
|
3786
|
+
},
|
|
3787
|
+
row.id
|
|
3788
|
+
);
|
|
3789
|
+
}) })
|
|
3790
|
+
] });
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
// src/admin-app/components/SitePreview.tsx
|
|
3794
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3795
|
+
var fallbackHeaderNav = [{ href: "/", label: "Home" }];
|
|
3796
|
+
var socialGlyphByPlatform = {
|
|
3797
|
+
facebook: "f",
|
|
3798
|
+
instagram: "ig",
|
|
3799
|
+
linkedin: "in",
|
|
3800
|
+
pinterest: "p",
|
|
3801
|
+
snapchat: "sc",
|
|
3802
|
+
tiktok: "tt",
|
|
3803
|
+
x: "x",
|
|
3804
|
+
youtube: "yt"
|
|
3805
|
+
};
|
|
3806
|
+
var getInitials = (value) => {
|
|
3807
|
+
const initials = value.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((part) => part[0]?.toUpperCase() || "").join("");
|
|
3808
|
+
return initials || "OS";
|
|
3809
|
+
};
|
|
3810
|
+
var getSocialGlyph = (platform) => {
|
|
3811
|
+
const normalized = platform.trim().toLowerCase();
|
|
3812
|
+
return socialGlyphByPlatform[normalized] || normalized.slice(0, 2).toUpperCase() || "\u2022";
|
|
3813
|
+
};
|
|
3814
|
+
var getTaglineLines = (tagline) => {
|
|
3815
|
+
const parts = (tagline || "").split(".").map((part) => part.trim()).filter(Boolean);
|
|
3816
|
+
const first = parts[0] ? `${parts[0]}.` : "Warm Gifts.";
|
|
3817
|
+
const second = parts[1] ? `${parts[1]}.` : "Local Heart.";
|
|
3818
|
+
return [first, second];
|
|
3819
|
+
};
|
|
3820
|
+
function PreviewSocialLinks({
|
|
3821
|
+
links,
|
|
3822
|
+
variant
|
|
3823
|
+
}) {
|
|
3824
|
+
if (links.length === 0) {
|
|
3825
|
+
return null;
|
|
3826
|
+
}
|
|
3827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3828
|
+
"div",
|
|
3829
|
+
{
|
|
3830
|
+
className: variant === "header" ? "orion-admin-site-preview-social-list" : "orion-admin-site-preview-social-list orion-admin-site-preview-social-list--footer",
|
|
3831
|
+
children: links.map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3832
|
+
"a",
|
|
3833
|
+
{
|
|
3834
|
+
className: variant === "header" ? "orion-admin-site-preview-social-badge" : "orion-admin-site-preview-social-badge orion-admin-site-preview-social-badge--footer",
|
|
3835
|
+
href: item.url,
|
|
3836
|
+
tabIndex: -1,
|
|
3837
|
+
children: getSocialGlyph(item.platform)
|
|
3838
|
+
},
|
|
3839
|
+
`${item.platform}-${item.url}`
|
|
3840
|
+
))
|
|
3841
|
+
}
|
|
3842
|
+
);
|
|
3843
|
+
}
|
|
3844
|
+
function PreviewLogo({
|
|
3845
|
+
className,
|
|
3846
|
+
logoUrl,
|
|
3847
|
+
siteName
|
|
3848
|
+
}) {
|
|
3849
|
+
if (logoUrl && logoUrl.trim().length > 0) {
|
|
3850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { alt: `${siteName} logo`, className, src: logoUrl });
|
|
3851
|
+
}
|
|
3852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `${className} orion-admin-site-preview-logo-fallback`, children: getInitials(siteName) });
|
|
3853
|
+
}
|
|
3854
|
+
function SiteHeaderPreview({ site }) {
|
|
3855
|
+
const navItems = site.navItems.length > 0 ? site.navItems : fallbackHeaderNav;
|
|
3856
|
+
const [taglineLineOne, taglineLineTwo] = getTaglineLines(site.tagline);
|
|
3857
|
+
const socialLinks = site.socialLinks?.slice(0, 4) || [];
|
|
3858
|
+
const activePath = site.activePath || navItems[0]?.href || "/";
|
|
3859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { "aria-hidden": "true", className: "orion-admin-site-preview orion-admin-site-preview--header", children: [
|
|
3860
|
+
/* @__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: [
|
|
3861
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-utility-copy", children: site.locationSummary?.address?.trim() || "Neighborhood gift shop" }),
|
|
3862
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-utility-meta", children: [
|
|
3863
|
+
site.locationSummary?.hours?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-utility-copy", children: site.locationSummary.hours.trim() }) : null,
|
|
3864
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PreviewSocialLinks, { links: socialLinks, variant: "header" }),
|
|
3865
|
+
/* @__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" })
|
|
3866
|
+
] })
|
|
3867
|
+
] }) }),
|
|
3868
|
+
/* @__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: [
|
|
3869
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { className: "orion-admin-site-preview-brand", href: "/", tabIndex: -1, children: [
|
|
3870
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3871
|
+
PreviewLogo,
|
|
3872
|
+
{
|
|
3873
|
+
className: "orion-admin-site-preview-header-logo",
|
|
3874
|
+
logoUrl: site.logoUrl,
|
|
3875
|
+
siteName: site.siteName
|
|
3876
|
+
}
|
|
3877
|
+
),
|
|
3878
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-tagline", children: [
|
|
3879
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-tagline-line", children: taglineLineOne }),
|
|
3880
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-tagline-line", children: taglineLineTwo })
|
|
3881
|
+
] })
|
|
3882
|
+
] }),
|
|
3883
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("nav", { className: "orion-admin-site-preview-nav", children: navItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3884
|
+
"a",
|
|
3885
|
+
{
|
|
3886
|
+
className: item.href === activePath ? "is-active" : void 0,
|
|
3887
|
+
href: item.href,
|
|
3888
|
+
tabIndex: -1,
|
|
3889
|
+
children: item.label
|
|
3890
|
+
},
|
|
3891
|
+
`${item.href}-${item.label}`
|
|
3892
|
+
)) }),
|
|
3893
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-mobile-toggle", children: [
|
|
3894
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", {}),
|
|
3895
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", {}),
|
|
3896
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", {})
|
|
3897
|
+
] })
|
|
3898
|
+
] }) })
|
|
3899
|
+
] });
|
|
3900
|
+
}
|
|
3901
|
+
function SiteFooterPreview({ site }) {
|
|
3902
|
+
const description = site.description?.trim() || site.tagline?.trim() || "Thoughtful gifts, warm local service, and a beautifully stocked neighborhood shop.";
|
|
3903
|
+
const socialLinks = site.socialLinks?.slice(0, 4) || [];
|
|
3904
|
+
const builtByLabel = site.builtByLabel || "Built by Orion Studios";
|
|
3905
|
+
const builtByHref = site.builtByHref || "https://orionstudios.dev";
|
|
3906
|
+
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: [
|
|
3907
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-footer-grid", children: [
|
|
3908
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3909
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-footer-brand", children: [
|
|
3910
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3911
|
+
PreviewLogo,
|
|
3912
|
+
{
|
|
3913
|
+
className: "orion-admin-site-preview-footer-logo",
|
|
3914
|
+
logoUrl: site.logoUrl,
|
|
3915
|
+
siteName: site.siteName
|
|
3916
|
+
}
|
|
3917
|
+
),
|
|
3918
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-name", children: site.siteName })
|
|
3919
|
+
] }),
|
|
3920
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-description", children: description })
|
|
3921
|
+
] }),
|
|
3922
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3923
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-eyebrow", children: "Shop focus" }),
|
|
3924
|
+
/* @__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)) })
|
|
3925
|
+
] }),
|
|
3926
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3927
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-eyebrow", children: "Explore" }),
|
|
3928
|
+
/* @__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}`)) })
|
|
3929
|
+
] }),
|
|
3930
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3931
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "orion-admin-site-preview-footer-eyebrow", children: "Visit" }),
|
|
3932
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-footer-contact", children: [
|
|
3933
|
+
site.locationSummary.address?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: site.locationSummary.address.trim() }) : null,
|
|
3934
|
+
site.locationSummary.hours?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: site.locationSummary.hours.trim() }) : null,
|
|
3935
|
+
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,
|
|
3936
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: `mailto:${site.contactEmail}`, tabIndex: -1, children: site.contactEmail })
|
|
3937
|
+
] }),
|
|
3938
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PreviewSocialLinks, { links: socialLinks, variant: "footer" })
|
|
3939
|
+
] })
|
|
3940
|
+
] }),
|
|
3941
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-admin-site-preview-footer-meta", children: [
|
|
3942
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: site.copyright }),
|
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: builtByHref, tabIndex: -1, children: builtByLabel })
|
|
3944
|
+
] })
|
|
3945
|
+
] }) });
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
// src/admin-app/components/HeaderNavEditorWithPreview.tsx
|
|
3949
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3950
|
+
var fallbackNav = [{ href: "/", label: "Home" }];
|
|
3951
|
+
function HeaderNavEditorWithPreview({
|
|
3952
|
+
activePath,
|
|
3953
|
+
actionHref,
|
|
3954
|
+
actionLabel,
|
|
3955
|
+
brandName,
|
|
3956
|
+
initialItems,
|
|
3957
|
+
locationSummary,
|
|
3958
|
+
logoUrl,
|
|
3959
|
+
onItemsChange,
|
|
3960
|
+
pageOptions,
|
|
3961
|
+
socialLinks,
|
|
3962
|
+
tagline = ""
|
|
3963
|
+
}) {
|
|
3964
|
+
const [liveItems, setLiveItems] = (0, import_react16.useState)(initialItems);
|
|
3965
|
+
const previewItems = (0, import_react16.useMemo)(() => {
|
|
3966
|
+
const normalized = normalizeNestedNavItems(liveItems);
|
|
3967
|
+
const tree = buildNestedNavTree(normalized);
|
|
3968
|
+
return tree.topLevel.length > 0 ? tree : buildNestedNavTree(fallbackNav);
|
|
3969
|
+
}, [liveItems]);
|
|
3970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
3971
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3972
|
+
HeaderNavItemsEditor,
|
|
3973
|
+
{
|
|
3974
|
+
initialItems,
|
|
3975
|
+
onItemsChange: (items) => {
|
|
3976
|
+
setLiveItems(items);
|
|
3977
|
+
onItemsChange?.(items);
|
|
3978
|
+
},
|
|
3979
|
+
pageOptions
|
|
3980
|
+
}
|
|
3981
|
+
),
|
|
3982
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "orion-admin-preview-label", children: "Header Preview" }),
|
|
3983
|
+
/* @__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)(
|
|
3984
|
+
SiteHeaderPreview,
|
|
3985
|
+
{
|
|
3986
|
+
site: {
|
|
3987
|
+
activePath,
|
|
3988
|
+
actionHref,
|
|
3989
|
+
actionLabel,
|
|
3990
|
+
locationSummary,
|
|
3991
|
+
logoUrl,
|
|
3992
|
+
navItems: previewItems.topLevel.map((item) => ({
|
|
3993
|
+
href: item.href,
|
|
3994
|
+
label: item.label
|
|
3995
|
+
})),
|
|
3996
|
+
siteName: brandName,
|
|
3997
|
+
socialLinks,
|
|
3998
|
+
tagline
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
) }) })
|
|
4002
|
+
] });
|
|
4003
|
+
}
|
|
4004
|
+
|
|
4005
|
+
// src/shared/socialMedia.ts
|
|
4006
|
+
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
4007
|
+
facebook: "Facebook",
|
|
4008
|
+
instagram: "Instagram",
|
|
4009
|
+
x: "X (Twitter)",
|
|
4010
|
+
linkedin: "LinkedIn",
|
|
4011
|
+
youtube: "YouTube",
|
|
4012
|
+
tiktok: "TikTok",
|
|
4013
|
+
pinterest: "Pinterest",
|
|
4014
|
+
snapchat: "Snapchat"
|
|
4015
|
+
};
|
|
4016
|
+
var SOCIAL_MEDIA_PLATFORMS = [
|
|
4017
|
+
"facebook",
|
|
4018
|
+
"instagram",
|
|
4019
|
+
"x",
|
|
4020
|
+
"linkedin",
|
|
4021
|
+
"youtube",
|
|
4022
|
+
"tiktok",
|
|
4023
|
+
"pinterest",
|
|
4024
|
+
"snapchat"
|
|
4025
|
+
];
|
|
4026
|
+
var SOCIAL_MEDIA_ICON_OPTIONS = {
|
|
4027
|
+
facebook: [
|
|
4028
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
|
|
4029
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" },
|
|
4030
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-facebook" },
|
|
4031
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:facebook-fill" }
|
|
4032
|
+
],
|
|
4033
|
+
instagram: [
|
|
4034
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
|
|
4035
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" },
|
|
4036
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-instagram" },
|
|
4037
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:instagram-fill" }
|
|
4038
|
+
],
|
|
4039
|
+
x: [
|
|
4040
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
|
|
4041
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" },
|
|
4042
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-x" },
|
|
4043
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:twitter-x-fill" }
|
|
4044
|
+
],
|
|
4045
|
+
linkedin: [
|
|
4046
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
|
|
4047
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" },
|
|
4048
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-linkedin" },
|
|
4049
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:linkedin-fill" }
|
|
4050
|
+
],
|
|
4051
|
+
youtube: [
|
|
4052
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
|
|
4053
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" },
|
|
4054
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-youtube" },
|
|
4055
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:youtube-fill" }
|
|
4056
|
+
],
|
|
4057
|
+
tiktok: [
|
|
4058
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
|
|
4059
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" },
|
|
4060
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-tiktok" },
|
|
4061
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:tiktok-fill" }
|
|
4062
|
+
],
|
|
4063
|
+
pinterest: [
|
|
4064
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
|
|
4065
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" },
|
|
4066
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-pinterest" },
|
|
4067
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:pinterest-fill" }
|
|
4068
|
+
],
|
|
4069
|
+
snapchat: [
|
|
4070
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
|
|
4071
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" },
|
|
4072
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-snapchat" },
|
|
4073
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:snapchat-fill" }
|
|
4074
|
+
]
|
|
4075
|
+
};
|
|
4076
|
+
var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
4077
|
+
(acc, platform) => {
|
|
4078
|
+
acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
|
|
4079
|
+
return acc;
|
|
4080
|
+
},
|
|
4081
|
+
{}
|
|
4082
|
+
);
|
|
4083
|
+
|
|
4084
|
+
// src/nextjs/utilities/socialMedia.ts
|
|
4085
|
+
function resolveSocialMediaLinks(data) {
|
|
4086
|
+
const profiles = data?.profiles;
|
|
4087
|
+
if (!profiles || typeof profiles !== "object") {
|
|
4088
|
+
return [];
|
|
4089
|
+
}
|
|
4090
|
+
return SOCIAL_MEDIA_PLATFORMS.reduce((acc, platform) => {
|
|
4091
|
+
const profile = profiles[platform];
|
|
4092
|
+
if (!profile || typeof profile !== "object") {
|
|
4093
|
+
return acc;
|
|
4094
|
+
}
|
|
4095
|
+
const url = typeof profile.url === "string" ? profile.url.trim() : "";
|
|
4096
|
+
if (!url) {
|
|
4097
|
+
return acc;
|
|
4098
|
+
}
|
|
4099
|
+
const icon = typeof profile.icon === "string" && profile.icon.trim().length > 0 ? profile.icon.trim() : SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform];
|
|
4100
|
+
acc.push({
|
|
4101
|
+
icon,
|
|
4102
|
+
label: SOCIAL_MEDIA_PLATFORM_LABELS[platform],
|
|
4103
|
+
platform,
|
|
4104
|
+
url
|
|
4105
|
+
});
|
|
4106
|
+
return acc;
|
|
4107
|
+
}, []);
|
|
4108
|
+
}
|
|
4109
|
+
|
|
4110
|
+
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
4111
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4112
|
+
var getPropString6 = (props, key, fallback) => {
|
|
4113
|
+
if (!props || typeof props !== "object") return fallback;
|
|
4114
|
+
const direct = props[key];
|
|
4115
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
4116
|
+
const clientProps = props.clientProps;
|
|
4117
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4118
|
+
const nested = clientProps[key];
|
|
4119
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
4120
|
+
}
|
|
4121
|
+
return fallback;
|
|
4122
|
+
};
|
|
4123
|
+
var getPropLocationSummary = (props, key) => {
|
|
4124
|
+
if (!props || typeof props !== "object") return void 0;
|
|
4125
|
+
const read = (value) => {
|
|
4126
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4127
|
+
return void 0;
|
|
4128
|
+
}
|
|
4129
|
+
const record = value;
|
|
4130
|
+
return {
|
|
4131
|
+
...typeof record.address === "string" ? { address: record.address } : {},
|
|
4132
|
+
...typeof record.hours === "string" ? { hours: record.hours } : {},
|
|
4133
|
+
...typeof record.phone === "string" ? { phone: record.phone } : {}
|
|
4134
|
+
};
|
|
4135
|
+
};
|
|
4136
|
+
const direct = read(props[key]);
|
|
4137
|
+
if (direct) return direct;
|
|
4138
|
+
const clientProps = props.clientProps;
|
|
4139
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4140
|
+
return read(clientProps[key]);
|
|
4141
|
+
}
|
|
4142
|
+
return void 0;
|
|
4143
|
+
};
|
|
4144
|
+
var normalizeNavItems = (value) => {
|
|
4145
|
+
if (!Array.isArray(value)) {
|
|
4146
|
+
return [];
|
|
4147
|
+
}
|
|
4148
|
+
return value.filter((item) => Boolean(item) && typeof item === "object").map((item) => ({
|
|
4149
|
+
href: typeof item.href === "string" ? item.href.trim() : "",
|
|
4150
|
+
label: typeof item.label === "string" ? item.label.trim() : "",
|
|
4151
|
+
parentHref: typeof item.parentHref === "string" ? item.parentHref.trim() : ""
|
|
4152
|
+
})).filter((item) => item.href.length > 0 && item.label.length > 0).map((item) => item.parentHref ? item : { href: item.href, label: item.label });
|
|
4153
|
+
};
|
|
4154
|
+
var resolveMediaURL = (value) => {
|
|
4155
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4156
|
+
return "";
|
|
4157
|
+
}
|
|
4158
|
+
const record = value;
|
|
4159
|
+
if (typeof record.url === "string" && record.url.length > 0) {
|
|
4160
|
+
return record.url;
|
|
4161
|
+
}
|
|
4162
|
+
if (typeof record.filename === "string" && record.filename.length > 0) {
|
|
4163
|
+
return `/api/media/file/${encodeURIComponent(record.filename)}`;
|
|
4164
|
+
}
|
|
4165
|
+
return "";
|
|
4166
|
+
};
|
|
4167
|
+
function AdminStudioHeaderGlobalView(props) {
|
|
4168
|
+
const globalSlug = getPropString6(props, "globalSlug", "header");
|
|
4169
|
+
const globalsBasePath = getPropString6(props, "globalsBasePath", "/globals");
|
|
4170
|
+
const pagesCollectionSlug = getPropString6(props, "pagesCollectionSlug", "pages");
|
|
4171
|
+
const actionHref = getPropString6(props, "actionHref", "/contact");
|
|
4172
|
+
const actionLabel = getPropString6(props, "actionLabel", "Visit Today");
|
|
4173
|
+
const locationSummary = getPropLocationSummary(props, "locationSummary");
|
|
4174
|
+
const adminBasePath = useAdminBasePath();
|
|
4175
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
4176
|
+
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
4177
|
+
const [loading, setLoading] = (0, import_react17.useState)(true);
|
|
4178
|
+
const [saving, setSaving] = (0, import_react17.useState)(false);
|
|
4179
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
4180
|
+
const [savedMessage, setSavedMessage] = (0, import_react17.useState)(null);
|
|
4181
|
+
const [initialItems, setInitialItems] = (0, import_react17.useState)([]);
|
|
4182
|
+
const [liveItems, setLiveItems] = (0, import_react17.useState)([]);
|
|
4183
|
+
const [pages, setPages] = (0, import_react17.useState)([]);
|
|
4184
|
+
const [siteSettings, setSiteSettings] = (0, import_react17.useState)({});
|
|
4185
|
+
const [socialMedia, setSocialMedia] = (0, import_react17.useState)({});
|
|
4186
|
+
(0, import_react17.useEffect)(() => {
|
|
4187
|
+
let cancelled = false;
|
|
4188
|
+
const run = async () => {
|
|
4189
|
+
setLoading(true);
|
|
4190
|
+
setError(null);
|
|
4191
|
+
setSavedMessage(null);
|
|
4192
|
+
try {
|
|
4193
|
+
const pageParams = new URLSearchParams({
|
|
4194
|
+
depth: "0",
|
|
4195
|
+
draft: "true",
|
|
4196
|
+
limit: "200",
|
|
4197
|
+
sort: "path"
|
|
4198
|
+
});
|
|
4199
|
+
const [headerRes, siteSettingsRes, socialMediaRes, pagesRes] = await Promise.all([
|
|
4200
|
+
fetch(`/api/globals/${globalSlug}?depth=1&draft=true`, { credentials: "same-origin" }),
|
|
4201
|
+
fetch("/api/globals/site-settings?depth=1&draft=true", { credentials: "same-origin" }),
|
|
4202
|
+
fetch("/api/globals/social-media?depth=1&draft=true", { credentials: "same-origin" }),
|
|
4203
|
+
fetch(`/api/${pagesCollectionSlug}?${pageParams.toString()}`, {
|
|
4204
|
+
credentials: "same-origin"
|
|
4205
|
+
})
|
|
4206
|
+
]);
|
|
4207
|
+
if (!headerRes.ok) throw new Error(`Failed to load ${globalSlug} (${headerRes.status}).`);
|
|
4208
|
+
if (!siteSettingsRes.ok) {
|
|
4209
|
+
throw new Error(`Failed to load site settings (${siteSettingsRes.status}).`);
|
|
4210
|
+
}
|
|
4211
|
+
if (!socialMediaRes.ok) {
|
|
4212
|
+
throw new Error(`Failed to load social media (${socialMediaRes.status}).`);
|
|
4213
|
+
}
|
|
4214
|
+
if (!pagesRes.ok) throw new Error(`Failed to load pages (${pagesRes.status}).`);
|
|
4215
|
+
const [headerJson, siteSettingsJson, socialMediaJson, pagesJson] = await Promise.all([
|
|
4216
|
+
headerRes.json(),
|
|
4217
|
+
siteSettingsRes.json(),
|
|
4218
|
+
socialMediaRes.json(),
|
|
4219
|
+
pagesRes.json()
|
|
4220
|
+
]);
|
|
4221
|
+
if (cancelled) return;
|
|
4222
|
+
const nextInitialItems = normalizeNavItems(headerJson.navItems);
|
|
4223
|
+
setInitialItems(nextInitialItems);
|
|
4224
|
+
setLiveItems(nextInitialItems);
|
|
4225
|
+
setSiteSettings(
|
|
4226
|
+
siteSettingsJson && typeof siteSettingsJson === "object" && !Array.isArray(siteSettingsJson) ? siteSettingsJson : {}
|
|
4227
|
+
);
|
|
4228
|
+
setSocialMedia(
|
|
4229
|
+
socialMediaJson && typeof socialMediaJson === "object" && !Array.isArray(socialMediaJson) ? socialMediaJson : {}
|
|
4230
|
+
);
|
|
4231
|
+
setPages(
|
|
4232
|
+
Array.isArray(pagesJson.docs) ? pagesJson.docs : []
|
|
4233
|
+
);
|
|
4234
|
+
} catch (loadError) {
|
|
4235
|
+
if (!cancelled) {
|
|
4236
|
+
setError(loadError instanceof Error ? loadError.message : "Failed to load header settings.");
|
|
4237
|
+
}
|
|
4238
|
+
} finally {
|
|
4239
|
+
if (!cancelled) {
|
|
4240
|
+
setLoading(false);
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
};
|
|
4244
|
+
void run();
|
|
4245
|
+
return () => {
|
|
4246
|
+
cancelled = true;
|
|
4247
|
+
};
|
|
4248
|
+
}, [globalSlug, pagesCollectionSlug]);
|
|
4249
|
+
const pageOptions = (0, import_react17.useMemo)(() => buildAdminPageLinkOptions(pages), [pages]);
|
|
4250
|
+
const previewSocialLinks = (0, import_react17.useMemo)(
|
|
4251
|
+
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
4252
|
+
label: item.label,
|
|
4253
|
+
platform: item.platform,
|
|
4254
|
+
url: item.url
|
|
4255
|
+
})),
|
|
4256
|
+
[socialMedia]
|
|
4257
|
+
);
|
|
4258
|
+
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
4259
|
+
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
4260
|
+
const previewLogoUrl = resolveMediaURL(siteSettings.logo);
|
|
4261
|
+
const editorKey = (0, import_react17.useMemo)(() => JSON.stringify(initialItems), [initialItems]);
|
|
4262
|
+
const save = async () => {
|
|
4263
|
+
setSaving(true);
|
|
4264
|
+
setError(null);
|
|
4265
|
+
setSavedMessage(null);
|
|
4266
|
+
try {
|
|
4267
|
+
const response = await fetch(`/api/globals/${globalSlug}`, {
|
|
4268
|
+
body: JSON.stringify({
|
|
4269
|
+
navItems: liveItems.map((item) => ({
|
|
4270
|
+
href: item.href,
|
|
4271
|
+
label: item.label,
|
|
4272
|
+
...item.parentHref ? { parentHref: item.parentHref } : {}
|
|
4273
|
+
}))
|
|
4274
|
+
}),
|
|
4275
|
+
credentials: "same-origin",
|
|
4276
|
+
headers: {
|
|
4277
|
+
"Content-Type": "application/json"
|
|
4278
|
+
},
|
|
4279
|
+
method: "PATCH"
|
|
4280
|
+
});
|
|
4281
|
+
if (!response.ok) {
|
|
4282
|
+
throw new Error(`Failed to save ${globalSlug} (${response.status}).`);
|
|
4283
|
+
}
|
|
4284
|
+
const json = await response.json();
|
|
4285
|
+
const nextItems = normalizeNavItems(json.navItems);
|
|
4286
|
+
setInitialItems(nextItems);
|
|
4287
|
+
setLiveItems(nextItems);
|
|
4288
|
+
setSavedMessage("Saved.");
|
|
4289
|
+
} catch (saveError) {
|
|
4290
|
+
setError(saveError instanceof Error ? saveError.message : "Failed to save header settings.");
|
|
4291
|
+
} finally {
|
|
4292
|
+
setSaving(false);
|
|
4293
|
+
}
|
|
4294
|
+
};
|
|
4295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4296
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4297
|
+
import_ui8.SetStepNav,
|
|
4298
|
+
{
|
|
4299
|
+
nav: [
|
|
4300
|
+
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
4301
|
+
{ label: "Header & Navigation", url: rawGlobalPath }
|
|
4302
|
+
]
|
|
4303
|
+
}
|
|
4304
|
+
),
|
|
4305
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h1", { style: { margin: 0 }, children: "Header & Navigation" }),
|
|
4306
|
+
/* @__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." }),
|
|
4307
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading header settings\u2026" }) : null,
|
|
4308
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4309
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4310
|
+
!loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4311
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4312
|
+
HeaderNavEditorWithPreview,
|
|
4313
|
+
{
|
|
4314
|
+
actionHref,
|
|
4315
|
+
actionLabel,
|
|
4316
|
+
activePath: "/",
|
|
4317
|
+
brandName: previewSiteName,
|
|
4318
|
+
initialItems,
|
|
4319
|
+
locationSummary,
|
|
4320
|
+
logoUrl: previewLogoUrl || void 0,
|
|
4321
|
+
onItemsChange: setLiveItems,
|
|
4322
|
+
pageOptions,
|
|
4323
|
+
socialLinks: previewSocialLinks,
|
|
4324
|
+
tagline: previewTagline
|
|
4325
|
+
},
|
|
4326
|
+
editorKey
|
|
4327
|
+
),
|
|
4328
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4329
|
+
"button",
|
|
4330
|
+
{
|
|
4331
|
+
disabled: saving,
|
|
4332
|
+
onClick: () => void save(),
|
|
4333
|
+
style: {
|
|
4334
|
+
background: "var(--theme-elevation-900)",
|
|
4335
|
+
border: "none",
|
|
4336
|
+
borderRadius: 12,
|
|
4337
|
+
color: "var(--theme-elevation-0)",
|
|
4338
|
+
cursor: saving ? "not-allowed" : "pointer",
|
|
4339
|
+
fontWeight: 900,
|
|
4340
|
+
minHeight: 42,
|
|
4341
|
+
padding: "0 0.9rem"
|
|
4342
|
+
},
|
|
4343
|
+
type: "button",
|
|
4344
|
+
children: saving ? "Saving\u2026" : "Save Navigation"
|
|
4345
|
+
}
|
|
4346
|
+
) })
|
|
4347
|
+
] }) : null
|
|
4348
|
+
] }) });
|
|
4349
|
+
}
|
|
4350
|
+
|
|
4351
|
+
// src/admin/components/studio/AdminStudioFooterGlobalView.tsx
|
|
4352
|
+
var import_react18 = require("react");
|
|
4353
|
+
var import_ui9 = require("@payloadcms/ui");
|
|
4354
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4355
|
+
var getPropString7 = (props, key, fallback) => {
|
|
4356
|
+
if (!props || typeof props !== "object") return fallback;
|
|
4357
|
+
const direct = props[key];
|
|
4358
|
+
if (typeof direct === "string") return direct;
|
|
4359
|
+
const clientProps = props.clientProps;
|
|
4360
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4361
|
+
const nested = clientProps[key];
|
|
4362
|
+
if (typeof nested === "string") return nested;
|
|
4363
|
+
}
|
|
4364
|
+
return fallback;
|
|
4365
|
+
};
|
|
4366
|
+
var getPropStringArray2 = (props, key) => {
|
|
4367
|
+
if (!props || typeof props !== "object") return [];
|
|
4368
|
+
const read = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.trim().length > 0) : [];
|
|
4369
|
+
const direct = read(props[key]);
|
|
4370
|
+
if (direct.length > 0) return direct;
|
|
4371
|
+
const clientProps = props.clientProps;
|
|
4372
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4373
|
+
return read(clientProps[key]);
|
|
4374
|
+
}
|
|
4375
|
+
return [];
|
|
4376
|
+
};
|
|
4377
|
+
var getPropLinks = (props, key) => {
|
|
4378
|
+
if (!props || typeof props !== "object") return [];
|
|
4379
|
+
const read = (value) => Array.isArray(value) ? value.filter((item) => Boolean(item) && typeof item === "object").map((item) => ({
|
|
4380
|
+
href: typeof item.href === "string" ? item.href.trim() : "",
|
|
4381
|
+
label: typeof item.label === "string" ? item.label.trim() : ""
|
|
4382
|
+
})).filter((item) => item.href.length > 0 && item.label.length > 0) : [];
|
|
4383
|
+
const direct = read(props[key]);
|
|
4384
|
+
if (direct.length > 0) return direct;
|
|
4385
|
+
const clientProps = props.clientProps;
|
|
4386
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4387
|
+
return read(clientProps[key]);
|
|
4388
|
+
}
|
|
4389
|
+
return [];
|
|
4390
|
+
};
|
|
4391
|
+
var getPropLocationSummary2 = (props, key) => {
|
|
4392
|
+
if (!props || typeof props !== "object") return void 0;
|
|
4393
|
+
const read = (value) => {
|
|
4394
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4395
|
+
return void 0;
|
|
4396
|
+
}
|
|
4397
|
+
const record = value;
|
|
4398
|
+
return {
|
|
4399
|
+
...typeof record.address === "string" ? { address: record.address } : {},
|
|
4400
|
+
...typeof record.hours === "string" ? { hours: record.hours } : {},
|
|
4401
|
+
...typeof record.phone === "string" ? { phone: record.phone } : {}
|
|
4402
|
+
};
|
|
4403
|
+
};
|
|
4404
|
+
const direct = read(props[key]);
|
|
4405
|
+
if (direct) return direct;
|
|
4406
|
+
const clientProps = props.clientProps;
|
|
4407
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4408
|
+
return read(clientProps[key]);
|
|
4409
|
+
}
|
|
4410
|
+
return void 0;
|
|
4411
|
+
};
|
|
4412
|
+
var resolveMediaURL2 = (value) => {
|
|
4413
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4414
|
+
return "";
|
|
4415
|
+
}
|
|
4416
|
+
const record = value;
|
|
4417
|
+
if (typeof record.url === "string" && record.url.length > 0) {
|
|
4418
|
+
return record.url;
|
|
4419
|
+
}
|
|
4420
|
+
if (typeof record.filename === "string" && record.filename.length > 0) {
|
|
4421
|
+
return `/api/media/file/${encodeURIComponent(record.filename)}`;
|
|
4422
|
+
}
|
|
4423
|
+
return "";
|
|
4424
|
+
};
|
|
4425
|
+
var deriveAddress = (siteSettings) => {
|
|
4426
|
+
const businessProfile = siteSettings.businessProfile && typeof siteSettings.businessProfile === "object" && !Array.isArray(siteSettings.businessProfile) ? siteSettings.businessProfile : {};
|
|
4427
|
+
const parts = [
|
|
4428
|
+
businessProfile.streetAddress,
|
|
4429
|
+
[businessProfile.addressLocality, businessProfile.addressRegion].filter(Boolean).join(", "),
|
|
4430
|
+
businessProfile.postalCode
|
|
4431
|
+
].filter((part) => typeof part === "string" && part.trim().length > 0).map((part) => part.trim());
|
|
4432
|
+
return parts.join(" ");
|
|
4433
|
+
};
|
|
4434
|
+
var deriveHours = (siteSettings) => {
|
|
4435
|
+
const businessProfile = siteSettings.businessProfile && typeof siteSettings.businessProfile === "object" && !Array.isArray(siteSettings.businessProfile) ? siteSettings.businessProfile : {};
|
|
4436
|
+
if (!Array.isArray(businessProfile.openingHours) || businessProfile.openingHours.length === 0) {
|
|
4437
|
+
return "";
|
|
4438
|
+
}
|
|
4439
|
+
const firstRow = businessProfile.openingHours[0] && typeof businessProfile.openingHours[0] === "object" && !Array.isArray(businessProfile.openingHours[0]) ? businessProfile.openingHours[0] : {};
|
|
4440
|
+
const dayOfWeek = typeof firstRow.dayOfWeek === "string" ? firstRow.dayOfWeek.trim() : "";
|
|
4441
|
+
const opens = typeof firstRow.opens === "string" ? firstRow.opens.trim() : "";
|
|
4442
|
+
const closes = typeof firstRow.closes === "string" ? firstRow.closes.trim() : "";
|
|
4443
|
+
if (!dayOfWeek || !opens || !closes) {
|
|
4444
|
+
return "";
|
|
4445
|
+
}
|
|
4446
|
+
return `${dayOfWeek} \u2022 ${opens} - ${closes}`;
|
|
4447
|
+
};
|
|
4448
|
+
function AdminStudioFooterGlobalView(props) {
|
|
4449
|
+
const globalSlug = getPropString7(props, "globalSlug", "footer");
|
|
4450
|
+
const globalsBasePath = getPropString7(props, "globalsBasePath", "/globals");
|
|
4451
|
+
const builtByHref = getPropString7(props, "builtByHref", "");
|
|
4452
|
+
const builtByLabel = getPropString7(props, "builtByLabel", "");
|
|
4453
|
+
const description = getPropString7(props, "description", "");
|
|
4454
|
+
const footerCategories = getPropStringArray2(props, "footerCategories");
|
|
4455
|
+
const footerLinks = getPropLinks(props, "footerLinks");
|
|
4456
|
+
const configuredLocationSummary = getPropLocationSummary2(props, "locationSummary");
|
|
4457
|
+
const adminBasePath = useAdminBasePath();
|
|
4458
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
4459
|
+
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
4460
|
+
const [loading, setLoading] = (0, import_react18.useState)(true);
|
|
4461
|
+
const [saving, setSaving] = (0, import_react18.useState)(false);
|
|
4462
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
4463
|
+
const [savedMessage, setSavedMessage] = (0, import_react18.useState)(null);
|
|
4464
|
+
const [doc, setDoc] = (0, import_react18.useState)({
|
|
4465
|
+
contactEmail: "",
|
|
4466
|
+
contactPhone: "",
|
|
4467
|
+
copyright: ""
|
|
4468
|
+
});
|
|
4469
|
+
const [siteSettings, setSiteSettings] = (0, import_react18.useState)({});
|
|
4470
|
+
const [socialMedia, setSocialMedia] = (0, import_react18.useState)({});
|
|
4471
|
+
(0, import_react18.useEffect)(() => {
|
|
4472
|
+
let cancelled = false;
|
|
4473
|
+
const run = async () => {
|
|
4474
|
+
setLoading(true);
|
|
4475
|
+
setError(null);
|
|
4476
|
+
setSavedMessage(null);
|
|
4477
|
+
try {
|
|
4478
|
+
const [footerRes, siteSettingsRes, socialMediaRes] = await Promise.all([
|
|
4479
|
+
fetch(`/api/globals/${globalSlug}?depth=1&draft=true`, { credentials: "same-origin" }),
|
|
4480
|
+
fetch("/api/globals/site-settings?depth=1&draft=true", { credentials: "same-origin" }),
|
|
4481
|
+
fetch("/api/globals/social-media?depth=1&draft=true", { credentials: "same-origin" })
|
|
4482
|
+
]);
|
|
4483
|
+
if (!footerRes.ok) throw new Error(`Failed to load ${globalSlug} (${footerRes.status}).`);
|
|
4484
|
+
if (!siteSettingsRes.ok) {
|
|
4485
|
+
throw new Error(`Failed to load site settings (${siteSettingsRes.status}).`);
|
|
4486
|
+
}
|
|
4487
|
+
if (!socialMediaRes.ok) {
|
|
4488
|
+
throw new Error(`Failed to load social media (${socialMediaRes.status}).`);
|
|
4489
|
+
}
|
|
4490
|
+
const [footerJson, siteSettingsJson, socialMediaJson] = await Promise.all([
|
|
4491
|
+
footerRes.json(),
|
|
4492
|
+
siteSettingsRes.json(),
|
|
4493
|
+
socialMediaRes.json()
|
|
4494
|
+
]);
|
|
4495
|
+
if (cancelled) return;
|
|
4496
|
+
const footerRecord = footerJson && typeof footerJson === "object" && !Array.isArray(footerJson) ? footerJson : {};
|
|
4497
|
+
setDoc({
|
|
4498
|
+
contactEmail: typeof footerRecord.contactEmail === "string" ? footerRecord.contactEmail : "",
|
|
4499
|
+
contactPhone: typeof footerRecord.contactPhone === "string" ? footerRecord.contactPhone : "",
|
|
4500
|
+
copyright: typeof footerRecord.copyright === "string" ? footerRecord.copyright : ""
|
|
4501
|
+
});
|
|
4502
|
+
setSiteSettings(
|
|
4503
|
+
siteSettingsJson && typeof siteSettingsJson === "object" && !Array.isArray(siteSettingsJson) ? siteSettingsJson : {}
|
|
4504
|
+
);
|
|
4505
|
+
setSocialMedia(
|
|
4506
|
+
socialMediaJson && typeof socialMediaJson === "object" && !Array.isArray(socialMediaJson) ? socialMediaJson : {}
|
|
4507
|
+
);
|
|
4508
|
+
} catch (loadError) {
|
|
4509
|
+
if (!cancelled) {
|
|
4510
|
+
setError(loadError instanceof Error ? loadError.message : "Failed to load footer settings.");
|
|
4511
|
+
}
|
|
4512
|
+
} finally {
|
|
4513
|
+
if (!cancelled) {
|
|
4514
|
+
setLoading(false);
|
|
4515
|
+
}
|
|
4516
|
+
}
|
|
4517
|
+
};
|
|
4518
|
+
void run();
|
|
4519
|
+
return () => {
|
|
4520
|
+
cancelled = true;
|
|
4521
|
+
};
|
|
4522
|
+
}, [globalSlug]);
|
|
4523
|
+
const previewSocialLinks = (0, import_react18.useMemo)(
|
|
4524
|
+
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
4525
|
+
label: item.label,
|
|
4526
|
+
platform: item.platform,
|
|
4527
|
+
url: item.url
|
|
4528
|
+
})),
|
|
4529
|
+
[socialMedia]
|
|
4530
|
+
);
|
|
4531
|
+
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
4532
|
+
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
4533
|
+
const previewLogoUrl = resolveMediaURL2(siteSettings.logo);
|
|
4534
|
+
const previewLocationSummary = {
|
|
4535
|
+
address: configuredLocationSummary?.address || deriveAddress(siteSettings),
|
|
4536
|
+
hours: configuredLocationSummary?.hours || deriveHours(siteSettings),
|
|
4537
|
+
phone: doc.contactPhone
|
|
4538
|
+
};
|
|
4539
|
+
const save = async () => {
|
|
4540
|
+
setSaving(true);
|
|
4541
|
+
setError(null);
|
|
4542
|
+
setSavedMessage(null);
|
|
4543
|
+
try {
|
|
4544
|
+
const response = await fetch(`/api/globals/${globalSlug}`, {
|
|
4545
|
+
body: JSON.stringify(doc),
|
|
4546
|
+
credentials: "same-origin",
|
|
4547
|
+
headers: {
|
|
4548
|
+
"Content-Type": "application/json"
|
|
4549
|
+
},
|
|
4550
|
+
method: "PATCH"
|
|
4551
|
+
});
|
|
4552
|
+
if (!response.ok) {
|
|
4553
|
+
throw new Error(`Failed to save ${globalSlug} (${response.status}).`);
|
|
4554
|
+
}
|
|
4555
|
+
const json = await response.json();
|
|
4556
|
+
setDoc({
|
|
4557
|
+
contactEmail: typeof json.contactEmail === "string" ? json.contactEmail : "",
|
|
4558
|
+
contactPhone: typeof json.contactPhone === "string" ? json.contactPhone : "",
|
|
4559
|
+
copyright: typeof json.copyright === "string" ? json.copyright : ""
|
|
4560
|
+
});
|
|
4561
|
+
setSavedMessage("Saved.");
|
|
4562
|
+
} catch (saveError) {
|
|
4563
|
+
setError(saveError instanceof Error ? saveError.message : "Failed to save footer settings.");
|
|
4564
|
+
} finally {
|
|
4565
|
+
setSaving(false);
|
|
4566
|
+
}
|
|
4567
|
+
};
|
|
4568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4569
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4570
|
+
import_ui9.SetStepNav,
|
|
4571
|
+
{
|
|
4572
|
+
nav: [
|
|
4573
|
+
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
4574
|
+
{ label: "Footer", url: rawGlobalPath }
|
|
4575
|
+
]
|
|
4576
|
+
}
|
|
4577
|
+
),
|
|
4578
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h1", { style: { margin: 0 }, children: "Footer" }),
|
|
4579
|
+
/* @__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." }),
|
|
4580
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading footer settings\u2026" }) : null,
|
|
4581
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4582
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4583
|
+
!loading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4584
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4585
|
+
"label",
|
|
4586
|
+
{
|
|
4587
|
+
style: {
|
|
4588
|
+
color: "var(--theme-elevation-800)",
|
|
4589
|
+
display: "grid",
|
|
4590
|
+
fontSize: "0.88rem",
|
|
4591
|
+
fontWeight: 700,
|
|
4592
|
+
gap: "0.35rem"
|
|
4593
|
+
},
|
|
4594
|
+
children: [
|
|
4595
|
+
"Copyright",
|
|
4596
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4597
|
+
"input",
|
|
4598
|
+
{
|
|
4599
|
+
onChange: (event) => setDoc((current) => ({ ...current, copyright: event.target.value })),
|
|
4600
|
+
style: {
|
|
4601
|
+
background: "var(--theme-elevation-0)",
|
|
4602
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
4603
|
+
borderRadius: 10,
|
|
4604
|
+
color: "inherit",
|
|
4605
|
+
fontSize: "0.95rem",
|
|
4606
|
+
minHeight: 42,
|
|
4607
|
+
padding: "0.55rem 0.65rem",
|
|
4608
|
+
width: "100%"
|
|
4609
|
+
},
|
|
4610
|
+
type: "text",
|
|
4611
|
+
value: doc.copyright
|
|
4612
|
+
}
|
|
4613
|
+
)
|
|
4614
|
+
]
|
|
4615
|
+
}
|
|
4616
|
+
),
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4618
|
+
"label",
|
|
4619
|
+
{
|
|
4620
|
+
style: {
|
|
4621
|
+
color: "var(--theme-elevation-800)",
|
|
4622
|
+
display: "grid",
|
|
4623
|
+
fontSize: "0.88rem",
|
|
4624
|
+
fontWeight: 700,
|
|
4625
|
+
gap: "0.35rem"
|
|
4626
|
+
},
|
|
4627
|
+
children: [
|
|
4628
|
+
"Contact Email",
|
|
4629
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4630
|
+
"input",
|
|
4631
|
+
{
|
|
4632
|
+
onChange: (event) => setDoc((current) => ({ ...current, contactEmail: event.target.value })),
|
|
4633
|
+
style: {
|
|
4634
|
+
background: "var(--theme-elevation-0)",
|
|
4635
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
4636
|
+
borderRadius: 10,
|
|
4637
|
+
color: "inherit",
|
|
4638
|
+
fontSize: "0.95rem",
|
|
4639
|
+
minHeight: 42,
|
|
4640
|
+
padding: "0.55rem 0.65rem",
|
|
4641
|
+
width: "100%"
|
|
4642
|
+
},
|
|
4643
|
+
type: "email",
|
|
4644
|
+
value: doc.contactEmail
|
|
4645
|
+
}
|
|
4646
|
+
)
|
|
4647
|
+
]
|
|
4648
|
+
}
|
|
4649
|
+
),
|
|
4650
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4651
|
+
"label",
|
|
4652
|
+
{
|
|
4653
|
+
style: {
|
|
4654
|
+
color: "var(--theme-elevation-800)",
|
|
4655
|
+
display: "grid",
|
|
4656
|
+
fontSize: "0.88rem",
|
|
4657
|
+
fontWeight: 700,
|
|
4658
|
+
gap: "0.35rem"
|
|
4659
|
+
},
|
|
4660
|
+
children: [
|
|
4661
|
+
"Contact Phone",
|
|
4662
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4663
|
+
"input",
|
|
4664
|
+
{
|
|
4665
|
+
onChange: (event) => setDoc((current) => ({ ...current, contactPhone: event.target.value })),
|
|
4666
|
+
style: {
|
|
4667
|
+
background: "var(--theme-elevation-0)",
|
|
4668
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
4669
|
+
borderRadius: 10,
|
|
4670
|
+
color: "inherit",
|
|
4671
|
+
fontSize: "0.95rem",
|
|
4672
|
+
minHeight: 42,
|
|
4673
|
+
padding: "0.55rem 0.65rem",
|
|
4674
|
+
width: "100%"
|
|
4675
|
+
},
|
|
4676
|
+
type: "text",
|
|
4677
|
+
value: doc.contactPhone
|
|
4678
|
+
}
|
|
4679
|
+
)
|
|
4680
|
+
]
|
|
4681
|
+
}
|
|
4682
|
+
),
|
|
4683
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "orion-admin-preview-label", children: "Footer Preview" }),
|
|
4684
|
+
/* @__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)(
|
|
4685
|
+
SiteFooterPreview,
|
|
4686
|
+
{
|
|
4687
|
+
site: {
|
|
4688
|
+
...builtByHref ? { builtByHref } : {},
|
|
4689
|
+
...builtByLabel ? { builtByLabel } : {},
|
|
4690
|
+
contactEmail: doc.contactEmail || "hello@example.com",
|
|
4691
|
+
copyright: doc.copyright || `\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} ${previewSiteName}`,
|
|
4692
|
+
...description ? { description } : {},
|
|
4693
|
+
footerCategories,
|
|
4694
|
+
footerLinks,
|
|
4695
|
+
locationSummary: previewLocationSummary,
|
|
4696
|
+
logoUrl: previewLogoUrl || void 0,
|
|
4697
|
+
siteName: previewSiteName,
|
|
4698
|
+
socialLinks: previewSocialLinks,
|
|
4699
|
+
tagline: previewTagline
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4702
|
+
) }) }),
|
|
4703
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4704
|
+
"button",
|
|
4705
|
+
{
|
|
4706
|
+
disabled: saving,
|
|
4707
|
+
onClick: () => void save(),
|
|
4708
|
+
style: {
|
|
4709
|
+
background: "var(--theme-elevation-900)",
|
|
4710
|
+
border: "none",
|
|
4711
|
+
borderRadius: 12,
|
|
4712
|
+
color: "var(--theme-elevation-0)",
|
|
4713
|
+
cursor: saving ? "not-allowed" : "pointer",
|
|
4714
|
+
fontWeight: 900,
|
|
4715
|
+
minHeight: 42,
|
|
4716
|
+
padding: "0 0.9rem"
|
|
4717
|
+
},
|
|
4718
|
+
type: "button",
|
|
4719
|
+
children: saving ? "Saving\u2026" : "Save Footer"
|
|
4720
|
+
}
|
|
4721
|
+
) })
|
|
4722
|
+
] }) : null
|
|
4723
|
+
] }) });
|
|
4724
|
+
}
|
|
4725
|
+
|
|
4726
|
+
// src/admin/components/studio/AdminStudioContactFormView.tsx
|
|
4727
|
+
var import_react19 = require("react");
|
|
4728
|
+
var import_ui10 = require("@payloadcms/ui");
|
|
4729
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4730
|
+
var defaultDoc = {
|
|
4731
|
+
disabledMessage: "This form is temporarily unavailable. Please call us for immediate service.",
|
|
4732
|
+
enabled: true,
|
|
4733
|
+
errorMessage: "Submission failed. Please call us at (512) 555-0149.",
|
|
4734
|
+
notificationEmail: "",
|
|
4735
|
+
serviceOptions: [
|
|
4736
|
+
{ label: "Tree Trimming" },
|
|
4737
|
+
{ label: "Tree Removal" },
|
|
4738
|
+
{ label: "Stump Grinding" },
|
|
4739
|
+
{ label: "Storm Cleanup" }
|
|
4740
|
+
],
|
|
4741
|
+
submitButtonLabel: "Send Request",
|
|
4742
|
+
successMessage: "Thanks, your request has been received. We will follow up shortly."
|
|
4743
|
+
};
|
|
4744
|
+
var getPropString8 = (props, key, fallback) => {
|
|
4745
|
+
if (!props || typeof props !== "object") return fallback;
|
|
4746
|
+
const direct = props[key];
|
|
4747
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
4748
|
+
const clientProps = props.clientProps;
|
|
4749
|
+
if (clientProps && typeof clientProps === "object") {
|
|
4750
|
+
const nested = clientProps[key];
|
|
4751
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
4752
|
+
}
|
|
4753
|
+
return fallback;
|
|
4754
|
+
};
|
|
4755
|
+
var normalizeOption = (value) => {
|
|
4756
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
4757
|
+
const label = value.label;
|
|
4758
|
+
if (typeof label !== "string") return null;
|
|
4759
|
+
const trimmed = label.trim();
|
|
4760
|
+
if (!trimmed) return null;
|
|
4761
|
+
return { label: trimmed };
|
|
4762
|
+
};
|
|
4763
|
+
var normalizeDoc = (value) => {
|
|
4764
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4765
|
+
return defaultDoc;
|
|
4766
|
+
}
|
|
4767
|
+
const record = value;
|
|
4768
|
+
const options = Array.isArray(record.serviceOptions) ? record.serviceOptions.map(normalizeOption).filter((option) => option !== null) : defaultDoc.serviceOptions;
|
|
4769
|
+
return {
|
|
4770
|
+
disabledMessage: typeof record.disabledMessage === "string" && record.disabledMessage.length > 0 ? record.disabledMessage : defaultDoc.disabledMessage,
|
|
4771
|
+
enabled: record.enabled !== false,
|
|
4772
|
+
errorMessage: typeof record.errorMessage === "string" && record.errorMessage.length > 0 ? record.errorMessage : defaultDoc.errorMessage,
|
|
4773
|
+
notificationEmail: typeof record.notificationEmail === "string" ? record.notificationEmail : defaultDoc.notificationEmail,
|
|
4774
|
+
serviceOptions: options.length > 0 ? options : defaultDoc.serviceOptions,
|
|
4775
|
+
submitButtonLabel: typeof record.submitButtonLabel === "string" && record.submitButtonLabel.length > 0 ? record.submitButtonLabel : defaultDoc.submitButtonLabel,
|
|
4776
|
+
successMessage: typeof record.successMessage === "string" && record.successMessage.length > 0 ? record.successMessage : defaultDoc.successMessage
|
|
4777
|
+
};
|
|
4778
|
+
};
|
|
4779
|
+
var inputStyle = {
|
|
4780
|
+
background: "var(--theme-elevation-0)",
|
|
4781
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
4782
|
+
borderRadius: 10,
|
|
4783
|
+
color: "inherit",
|
|
4784
|
+
fontSize: "0.95rem",
|
|
4785
|
+
minHeight: 42,
|
|
4786
|
+
padding: "0.55rem 0.65rem",
|
|
4787
|
+
width: "100%"
|
|
4788
|
+
};
|
|
4789
|
+
var fieldLabelStyle = {
|
|
4790
|
+
color: "var(--theme-elevation-800)",
|
|
4791
|
+
display: "grid",
|
|
4792
|
+
fontSize: "0.88rem",
|
|
4793
|
+
fontWeight: 700,
|
|
4794
|
+
gap: "0.35rem"
|
|
4795
|
+
};
|
|
4796
|
+
var buttonStyle = {
|
|
4797
|
+
background: "var(--theme-success-700)",
|
|
4798
|
+
border: "1px solid var(--theme-success-700)",
|
|
4799
|
+
borderRadius: 10,
|
|
4800
|
+
color: "#fff",
|
|
4801
|
+
cursor: "pointer",
|
|
4802
|
+
fontSize: "0.9rem",
|
|
4803
|
+
fontWeight: 800,
|
|
4804
|
+
minHeight: 40,
|
|
4805
|
+
padding: "0 0.9rem"
|
|
4806
|
+
};
|
|
4807
|
+
var ghostButtonStyle = {
|
|
4808
|
+
...buttonStyle,
|
|
4809
|
+
background: "transparent",
|
|
4810
|
+
color: "var(--theme-elevation-900)"
|
|
4811
|
+
};
|
|
4812
|
+
function AdminStudioContactFormView(props) {
|
|
4813
|
+
const globalSlug = getPropString8(props, "globalSlug", "contact-form");
|
|
4814
|
+
const globalsBasePath = getPropString8(props, "globalsBasePath", "/globals");
|
|
4815
|
+
const adminBasePath = useAdminBasePath();
|
|
4816
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
4817
|
+
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
4818
|
+
const [doc, setDoc] = (0, import_react19.useState)(defaultDoc);
|
|
4819
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
4820
|
+
const [isLoading, setIsLoading] = (0, import_react19.useState)(true);
|
|
4821
|
+
const [isSaving, setIsSaving] = (0, import_react19.useState)(false);
|
|
4822
|
+
const [savedMessage, setSavedMessage] = (0, import_react19.useState)(null);
|
|
4823
|
+
(0, import_react19.useEffect)(() => {
|
|
4824
|
+
let mounted = true;
|
|
4825
|
+
const load = async () => {
|
|
4826
|
+
setIsLoading(true);
|
|
4827
|
+
setError(null);
|
|
4828
|
+
setSavedMessage(null);
|
|
4829
|
+
try {
|
|
4830
|
+
const response = await fetch(`/api/globals/${globalSlug}?depth=0&draft=true`, {
|
|
4831
|
+
credentials: "same-origin"
|
|
4832
|
+
});
|
|
4833
|
+
if (!response.ok) {
|
|
4834
|
+
throw new Error(`Failed to load global (${response.status}).`);
|
|
4835
|
+
}
|
|
4836
|
+
const json = await response.json();
|
|
4837
|
+
if (!mounted) return;
|
|
4838
|
+
setDoc(normalizeDoc(json));
|
|
4839
|
+
} catch (loadError) {
|
|
4840
|
+
if (!mounted) return;
|
|
4841
|
+
setError(loadError instanceof Error ? loadError.message : "Failed to load contact form settings.");
|
|
4842
|
+
} finally {
|
|
4843
|
+
if (mounted) {
|
|
4844
|
+
setIsLoading(false);
|
|
4845
|
+
}
|
|
4846
|
+
}
|
|
4847
|
+
};
|
|
4848
|
+
void load();
|
|
4849
|
+
return () => {
|
|
4850
|
+
mounted = false;
|
|
4851
|
+
};
|
|
4852
|
+
}, [globalSlug]);
|
|
4853
|
+
const payload = (0, import_react19.useMemo)(
|
|
4854
|
+
() => ({
|
|
4855
|
+
disabledMessage: doc.disabledMessage,
|
|
4856
|
+
enabled: doc.enabled,
|
|
4857
|
+
errorMessage: doc.errorMessage,
|
|
4858
|
+
notificationEmail: doc.notificationEmail.trim(),
|
|
4859
|
+
serviceOptions: doc.serviceOptions.map((option) => ({ label: option.label.trim() })).filter((option) => option.label.length > 0),
|
|
4860
|
+
submitButtonLabel: doc.submitButtonLabel,
|
|
4861
|
+
successMessage: doc.successMessage
|
|
4862
|
+
}),
|
|
4863
|
+
[doc]
|
|
4864
|
+
);
|
|
4865
|
+
const save = async () => {
|
|
4866
|
+
setIsSaving(true);
|
|
4867
|
+
setError(null);
|
|
4868
|
+
setSavedMessage(null);
|
|
4869
|
+
try {
|
|
4870
|
+
const response = await fetch(`/api/globals/${globalSlug}`, {
|
|
4871
|
+
body: JSON.stringify(payload),
|
|
4872
|
+
credentials: "same-origin",
|
|
4873
|
+
headers: {
|
|
4874
|
+
"Content-Type": "application/json"
|
|
4875
|
+
},
|
|
4876
|
+
method: "PATCH"
|
|
4877
|
+
});
|
|
4878
|
+
if (!response.ok) {
|
|
4879
|
+
throw new Error(`Failed to save settings (${response.status}).`);
|
|
4880
|
+
}
|
|
4881
|
+
const json = await response.json();
|
|
4882
|
+
setDoc(normalizeDoc(json));
|
|
4883
|
+
setSavedMessage("Saved.");
|
|
4884
|
+
} catch (saveError) {
|
|
4885
|
+
setError(saveError instanceof Error ? saveError.message : "Failed to save contact form settings.");
|
|
4886
|
+
} finally {
|
|
4887
|
+
setIsSaving(false);
|
|
4888
|
+
}
|
|
4889
|
+
};
|
|
4890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4891
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4892
|
+
import_ui10.SetStepNav,
|
|
4893
|
+
{
|
|
4894
|
+
nav: [
|
|
4895
|
+
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
4896
|
+
{ label: "Contact Form" }
|
|
4897
|
+
]
|
|
4898
|
+
}
|
|
4899
|
+
),
|
|
4900
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h1", { style: { margin: 0 }, children: "Contact Form" }),
|
|
4901
|
+
/* @__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." }),
|
|
4902
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading form settings\u2026" }) : null,
|
|
4903
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4904
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4905
|
+
!isLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem", maxWidth: 900 }, children: [
|
|
4906
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: { ...fieldLabelStyle, alignItems: "center", display: "flex", gap: "0.6rem" }, children: [
|
|
4907
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4908
|
+
"input",
|
|
4909
|
+
{
|
|
4910
|
+
checked: doc.enabled,
|
|
4911
|
+
onChange: (event) => setDoc((prev) => ({ ...prev, enabled: event.target.checked })),
|
|
4912
|
+
type: "checkbox"
|
|
4913
|
+
}
|
|
4914
|
+
),
|
|
4915
|
+
"Form enabled"
|
|
4916
|
+
] }),
|
|
4917
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
4918
|
+
"Notification Email",
|
|
4919
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4920
|
+
"input",
|
|
4921
|
+
{
|
|
3552
4922
|
onChange: (event) => setDoc((prev) => ({ ...prev, notificationEmail: event.target.value })),
|
|
3553
4923
|
style: inputStyle,
|
|
3554
4924
|
type: "email",
|
|
@@ -3556,9 +4926,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3556
4926
|
}
|
|
3557
4927
|
)
|
|
3558
4928
|
] }),
|
|
3559
|
-
/* @__PURE__ */ (0,
|
|
4929
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
3560
4930
|
"Submit Button Label",
|
|
3561
|
-
/* @__PURE__ */ (0,
|
|
4931
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3562
4932
|
"input",
|
|
3563
4933
|
{
|
|
3564
4934
|
onChange: (event) => setDoc((prev) => ({ ...prev, submitButtonLabel: event.target.value })),
|
|
@@ -3568,9 +4938,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3568
4938
|
}
|
|
3569
4939
|
)
|
|
3570
4940
|
] }),
|
|
3571
|
-
/* @__PURE__ */ (0,
|
|
4941
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
3572
4942
|
"Success Message",
|
|
3573
|
-
/* @__PURE__ */ (0,
|
|
4943
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3574
4944
|
"input",
|
|
3575
4945
|
{
|
|
3576
4946
|
onChange: (event) => setDoc((prev) => ({ ...prev, successMessage: event.target.value })),
|
|
@@ -3580,9 +4950,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3580
4950
|
}
|
|
3581
4951
|
)
|
|
3582
4952
|
] }),
|
|
3583
|
-
/* @__PURE__ */ (0,
|
|
4953
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
3584
4954
|
"Error Message",
|
|
3585
|
-
/* @__PURE__ */ (0,
|
|
4955
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3586
4956
|
"input",
|
|
3587
4957
|
{
|
|
3588
4958
|
onChange: (event) => setDoc((prev) => ({ ...prev, errorMessage: event.target.value })),
|
|
@@ -3592,9 +4962,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3592
4962
|
}
|
|
3593
4963
|
)
|
|
3594
4964
|
] }),
|
|
3595
|
-
/* @__PURE__ */ (0,
|
|
4965
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
3596
4966
|
"Disabled Message",
|
|
3597
|
-
/* @__PURE__ */ (0,
|
|
4967
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3598
4968
|
"input",
|
|
3599
4969
|
{
|
|
3600
4970
|
onChange: (event) => setDoc((prev) => ({ ...prev, disabledMessage: event.target.value })),
|
|
@@ -3604,7 +4974,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3604
4974
|
}
|
|
3605
4975
|
)
|
|
3606
4976
|
] }),
|
|
3607
|
-
/* @__PURE__ */ (0,
|
|
4977
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3608
4978
|
"div",
|
|
3609
4979
|
{
|
|
3610
4980
|
style: {
|
|
@@ -3614,9 +4984,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3614
4984
|
padding: "0.85rem"
|
|
3615
4985
|
},
|
|
3616
4986
|
children: [
|
|
3617
|
-
/* @__PURE__ */ (0,
|
|
3618
|
-
/* @__PURE__ */ (0,
|
|
3619
|
-
/* @__PURE__ */ (0,
|
|
4987
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { fontWeight: 900, marginBottom: "0.65rem" }, children: "Service Options" }),
|
|
4988
|
+
/* @__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: [
|
|
4989
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3620
4990
|
"input",
|
|
3621
4991
|
{
|
|
3622
4992
|
onChange: (event) => setDoc((prev) => ({
|
|
@@ -3630,7 +5000,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3630
5000
|
value: option.label
|
|
3631
5001
|
}
|
|
3632
5002
|
),
|
|
3633
|
-
/* @__PURE__ */ (0,
|
|
5003
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3634
5004
|
"button",
|
|
3635
5005
|
{
|
|
3636
5006
|
onClick: () => setDoc((prev) => ({
|
|
@@ -3643,7 +5013,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3643
5013
|
}
|
|
3644
5014
|
)
|
|
3645
5015
|
] }, `${index}-${option.label}`)) }),
|
|
3646
|
-
/* @__PURE__ */ (0,
|
|
5016
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3647
5017
|
"button",
|
|
3648
5018
|
{
|
|
3649
5019
|
onClick: () => setDoc((prev) => ({
|
|
@@ -3658,9 +5028,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3658
5028
|
]
|
|
3659
5029
|
}
|
|
3660
5030
|
),
|
|
3661
|
-
/* @__PURE__ */ (0,
|
|
3662
|
-
/* @__PURE__ */ (0,
|
|
3663
|
-
/* @__PURE__ */ (0,
|
|
5031
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "0.6rem" }, children: [
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { disabled: isSaving, onClick: () => void save(), style: buttonStyle, type: "button", children: isSaving ? "Saving\u2026" : "Save Form Settings" }),
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3664
5034
|
"a",
|
|
3665
5035
|
{
|
|
3666
5036
|
href: rawGlobalPath,
|
|
@@ -3676,13 +5046,13 @@ function AdminStudioContactFormView(props) {
|
|
|
3676
5046
|
)
|
|
3677
5047
|
] })
|
|
3678
5048
|
] }) : null
|
|
3679
|
-
] });
|
|
5049
|
+
] }) });
|
|
3680
5050
|
}
|
|
3681
5051
|
|
|
3682
5052
|
// src/admin/components/studio/AdminStudioMediaView.tsx
|
|
3683
|
-
var
|
|
3684
|
-
var
|
|
3685
|
-
var
|
|
5053
|
+
var import_ui11 = require("@payloadcms/ui");
|
|
5054
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5055
|
+
var getPropString9 = (props, key, fallback) => {
|
|
3686
5056
|
if (!props || typeof props !== "object") return fallback;
|
|
3687
5057
|
const direct = props[key];
|
|
3688
5058
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3694,15 +5064,15 @@ var getPropString7 = (props, key, fallback) => {
|
|
|
3694
5064
|
return fallback;
|
|
3695
5065
|
};
|
|
3696
5066
|
function AdminStudioMediaView(props) {
|
|
3697
|
-
const mediaCollectionSlug =
|
|
5067
|
+
const mediaCollectionSlug = getPropString9(props, "mediaCollectionSlug", "media");
|
|
3698
5068
|
const adminBasePath = useAdminBasePath();
|
|
3699
5069
|
const mediaPath = resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`);
|
|
3700
5070
|
const mediaViewPath = resolveAdminPath(adminBasePath, "/media");
|
|
3701
|
-
return /* @__PURE__ */ (0,
|
|
3702
|
-
/* @__PURE__ */ (0,
|
|
3703
|
-
/* @__PURE__ */ (0,
|
|
3704
|
-
/* @__PURE__ */ (0,
|
|
3705
|
-
/* @__PURE__ */ (0,
|
|
5071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
5072
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui11.SetStepNav, { nav: [{ label: "Media", url: mediaViewPath }] }),
|
|
5073
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h1", { style: { margin: 0 }, children: "Media" }),
|
|
5074
|
+
/* @__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." }),
|
|
5075
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3706
5076
|
"a",
|
|
3707
5077
|
{
|
|
3708
5078
|
href: mediaPath,
|
|
@@ -3715,18 +5085,18 @@ function AdminStudioMediaView(props) {
|
|
|
3715
5085
|
textDecoration: "none"
|
|
3716
5086
|
},
|
|
3717
5087
|
children: [
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
5088
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { fontWeight: 900 }, children: "Open Media Library" }),
|
|
5089
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: mediaPath })
|
|
3720
5090
|
]
|
|
3721
5091
|
}
|
|
3722
5092
|
) })
|
|
3723
|
-
] });
|
|
5093
|
+
] }) });
|
|
3724
5094
|
}
|
|
3725
5095
|
|
|
3726
5096
|
// src/admin/components/studio/AdminStudioFormsView.tsx
|
|
3727
|
-
var
|
|
3728
|
-
var
|
|
3729
|
-
var
|
|
5097
|
+
var import_react20 = require("react");
|
|
5098
|
+
var import_ui12 = require("@payloadcms/ui");
|
|
5099
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3730
5100
|
var isAdmin3 = (user) => {
|
|
3731
5101
|
if (!user || typeof user !== "object") return false;
|
|
3732
5102
|
const role = user.role;
|
|
@@ -3738,7 +5108,7 @@ var isEditor2 = (user) => {
|
|
|
3738
5108
|
return typeof role === "string" && role === "editor";
|
|
3739
5109
|
};
|
|
3740
5110
|
var canReviewForms = (user) => isAdmin3(user) || isEditor2(user);
|
|
3741
|
-
var
|
|
5111
|
+
var getPropString10 = (props, key, fallback) => {
|
|
3742
5112
|
if (!props || typeof props !== "object") return fallback;
|
|
3743
5113
|
const direct = props[key];
|
|
3744
5114
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3788,14 +5158,14 @@ var getSubmissionIdentity = (value) => {
|
|
|
3788
5158
|
};
|
|
3789
5159
|
var renderValue = (value) => {
|
|
3790
5160
|
if (value === null || value === void 0 || value === "") {
|
|
3791
|
-
return /* @__PURE__ */ (0,
|
|
5161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { color: "var(--theme-elevation-500)" }, children: "\u2014" });
|
|
3792
5162
|
}
|
|
3793
5163
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
3794
5164
|
return String(value);
|
|
3795
5165
|
}
|
|
3796
5166
|
if (Array.isArray(value)) {
|
|
3797
5167
|
if (value.length === 0) {
|
|
3798
|
-
return /* @__PURE__ */ (0,
|
|
5168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { color: "var(--theme-elevation-500)" }, children: "\u2014" });
|
|
3799
5169
|
}
|
|
3800
5170
|
const primitiveValues = value.every(
|
|
3801
5171
|
(entry) => typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean" || entry === null
|
|
@@ -3803,7 +5173,7 @@ var renderValue = (value) => {
|
|
|
3803
5173
|
if (primitiveValues) {
|
|
3804
5174
|
return value.map((entry) => String(entry)).join(", ");
|
|
3805
5175
|
}
|
|
3806
|
-
return /* @__PURE__ */ (0,
|
|
5176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3807
5177
|
"pre",
|
|
3808
5178
|
{
|
|
3809
5179
|
style: {
|
|
@@ -3817,7 +5187,7 @@ var renderValue = (value) => {
|
|
|
3817
5187
|
);
|
|
3818
5188
|
}
|
|
3819
5189
|
if (typeof value === "object") {
|
|
3820
|
-
return /* @__PURE__ */ (0,
|
|
5190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3821
5191
|
"pre",
|
|
3822
5192
|
{
|
|
3823
5193
|
style: {
|
|
@@ -3864,37 +5234,37 @@ var panelStyle = {
|
|
|
3864
5234
|
borderRadius: 18
|
|
3865
5235
|
};
|
|
3866
5236
|
function AdminStudioFormsView(props) {
|
|
3867
|
-
const { user } = (0,
|
|
3868
|
-
const formsCollectionSlug =
|
|
3869
|
-
const formSubmissionsCollectionSlug =
|
|
5237
|
+
const { user } = (0, import_ui12.useAuth)();
|
|
5238
|
+
const formsCollectionSlug = getPropString10(props, "formsCollectionSlug", "forms");
|
|
5239
|
+
const formSubmissionsCollectionSlug = getPropString10(
|
|
3870
5240
|
props,
|
|
3871
5241
|
"formSubmissionsCollectionSlug",
|
|
3872
5242
|
"form-submissions"
|
|
3873
5243
|
);
|
|
3874
|
-
const formUploadsCollectionSlug =
|
|
5244
|
+
const formUploadsCollectionSlug = getPropString10(props, "formUploadsCollectionSlug", "form-uploads");
|
|
3875
5245
|
const adminBasePath = useAdminBasePath();
|
|
3876
|
-
const formsViewPath = resolveAdminPath(adminBasePath, "/
|
|
5246
|
+
const formsViewPath = resolveAdminPath(adminBasePath, "/forms");
|
|
3877
5247
|
const rawFormsPath = resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`);
|
|
3878
5248
|
const rawSubmissionsPath = resolveAdminPath(
|
|
3879
5249
|
adminBasePath,
|
|
3880
5250
|
`/collections/${formSubmissionsCollectionSlug}`
|
|
3881
5251
|
);
|
|
3882
5252
|
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,
|
|
5253
|
+
const [selectedFormID, setSelectedFormID] = (0, import_react20.useState)("");
|
|
5254
|
+
const [forms, setForms] = (0, import_react20.useState)([]);
|
|
5255
|
+
const [submissions, setSubmissions] = (0, import_react20.useState)([]);
|
|
5256
|
+
const [formsLoading, setFormsLoading] = (0, import_react20.useState)(true);
|
|
5257
|
+
const [submissionsLoading, setSubmissionsLoading] = (0, import_react20.useState)(false);
|
|
5258
|
+
const [formsError, setFormsError] = (0, import_react20.useState)(null);
|
|
5259
|
+
const [submissionsError, setSubmissionsError] = (0, import_react20.useState)(null);
|
|
5260
|
+
const selectedForm = (0, import_react20.useMemo)(
|
|
3891
5261
|
() => forms.find((form) => {
|
|
3892
5262
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
3893
5263
|
return selectedFormID.length > 0 && id === selectedFormID;
|
|
3894
5264
|
}) || null,
|
|
3895
5265
|
[forms, selectedFormID]
|
|
3896
5266
|
);
|
|
3897
|
-
(0,
|
|
5267
|
+
(0, import_react20.useEffect)(() => {
|
|
3898
5268
|
if (typeof window === "undefined") {
|
|
3899
5269
|
return;
|
|
3900
5270
|
}
|
|
@@ -3904,7 +5274,7 @@ function AdminStudioFormsView(props) {
|
|
|
3904
5274
|
setSelectedFormID(formID);
|
|
3905
5275
|
}
|
|
3906
5276
|
}, []);
|
|
3907
|
-
(0,
|
|
5277
|
+
(0, import_react20.useEffect)(() => {
|
|
3908
5278
|
if (!canReviewForms(user)) {
|
|
3909
5279
|
return;
|
|
3910
5280
|
}
|
|
@@ -3958,7 +5328,7 @@ function AdminStudioFormsView(props) {
|
|
|
3958
5328
|
cancelled = true;
|
|
3959
5329
|
};
|
|
3960
5330
|
}, [formsCollectionSlug, user]);
|
|
3961
|
-
(0,
|
|
5331
|
+
(0, import_react20.useEffect)(() => {
|
|
3962
5332
|
if (!selectedFormID || !canReviewForms(user)) {
|
|
3963
5333
|
setSubmissions([]);
|
|
3964
5334
|
return;
|
|
@@ -4002,7 +5372,7 @@ function AdminStudioFormsView(props) {
|
|
|
4002
5372
|
cancelled = true;
|
|
4003
5373
|
};
|
|
4004
5374
|
}, [formSubmissionsCollectionSlug, selectedFormID, user]);
|
|
4005
|
-
(0,
|
|
5375
|
+
(0, import_react20.useEffect)(() => {
|
|
4006
5376
|
if (typeof window === "undefined" || !selectedFormID) {
|
|
4007
5377
|
return;
|
|
4008
5378
|
}
|
|
@@ -4011,11 +5381,11 @@ function AdminStudioFormsView(props) {
|
|
|
4011
5381
|
window.history.replaceState({}, "", url.toString());
|
|
4012
5382
|
}, [selectedFormID]);
|
|
4013
5383
|
if (!canReviewForms(user)) {
|
|
4014
|
-
return /* @__PURE__ */ (0,
|
|
4015
|
-
/* @__PURE__ */ (0,
|
|
4016
|
-
/* @__PURE__ */ (0,
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4018
|
-
] });
|
|
5384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5385
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui12.SetStepNav, { nav: [{ label: "Forms", url: formsViewPath }] }),
|
|
5386
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h1", { style: { margin: 0 }, children: "Forms" }),
|
|
5387
|
+
/* @__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." })
|
|
5388
|
+
] }) });
|
|
4019
5389
|
}
|
|
4020
5390
|
const selectedTitle = selectedForm && typeof selectedForm.title === "string" && selectedForm.title || "Forms";
|
|
4021
5391
|
const selectedSlug = selectedForm && typeof selectedForm.slug === "string" && selectedForm.slug || null;
|
|
@@ -4025,15 +5395,15 @@ function AdminStudioFormsView(props) {
|
|
|
4025
5395
|
const fields = step.fields;
|
|
4026
5396
|
return count + (Array.isArray(fields) ? fields.length : 0);
|
|
4027
5397
|
}, 0) : 0;
|
|
4028
|
-
return /* @__PURE__ */ (0,
|
|
4029
|
-
/* @__PURE__ */ (0,
|
|
4030
|
-
/* @__PURE__ */ (0,
|
|
4031
|
-
/* @__PURE__ */ (0,
|
|
4032
|
-
/* @__PURE__ */ (0,
|
|
4033
|
-
/* @__PURE__ */ (0,
|
|
5398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5399
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui12.SetStepNav, { nav: [{ label: "Forms", url: formsViewPath }] }),
|
|
5400
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { alignItems: "flex-end", display: "flex", flexWrap: "wrap", gap: "0.75rem" }, children: [
|
|
5401
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { flex: 1, minWidth: 240 }, children: [
|
|
5402
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h1", { style: { margin: 0 }, children: "Forms" }),
|
|
5403
|
+
/* @__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
5404
|
] }),
|
|
4035
|
-
/* @__PURE__ */ (0,
|
|
4036
|
-
/* @__PURE__ */ (0,
|
|
5405
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
|
|
5406
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4037
5407
|
"a",
|
|
4038
5408
|
{
|
|
4039
5409
|
href: rawFormsPath,
|
|
@@ -4048,7 +5418,7 @@ function AdminStudioFormsView(props) {
|
|
|
4048
5418
|
children: "Open Forms Collection"
|
|
4049
5419
|
}
|
|
4050
5420
|
),
|
|
4051
|
-
/* @__PURE__ */ (0,
|
|
5421
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4052
5422
|
"a",
|
|
4053
5423
|
{
|
|
4054
5424
|
href: rawSubmissionsPath,
|
|
@@ -4063,7 +5433,7 @@ function AdminStudioFormsView(props) {
|
|
|
4063
5433
|
children: "Open Submissions"
|
|
4064
5434
|
}
|
|
4065
5435
|
),
|
|
4066
|
-
/* @__PURE__ */ (0,
|
|
5436
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4067
5437
|
"a",
|
|
4068
5438
|
{
|
|
4069
5439
|
href: rawUploadsPath,
|
|
@@ -4080,7 +5450,7 @@ function AdminStudioFormsView(props) {
|
|
|
4080
5450
|
)
|
|
4081
5451
|
] })
|
|
4082
5452
|
] }),
|
|
4083
|
-
/* @__PURE__ */ (0,
|
|
5453
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4084
5454
|
"div",
|
|
4085
5455
|
{
|
|
4086
5456
|
style: {
|
|
@@ -4090,11 +5460,11 @@ function AdminStudioFormsView(props) {
|
|
|
4090
5460
|
marginTop: "1rem"
|
|
4091
5461
|
},
|
|
4092
5462
|
children: [
|
|
4093
|
-
/* @__PURE__ */ (0,
|
|
4094
|
-
/* @__PURE__ */ (0,
|
|
4095
|
-
formsLoading ? /* @__PURE__ */ (0,
|
|
4096
|
-
formsError ? /* @__PURE__ */ (0,
|
|
4097
|
-
!formsLoading && !formsError && forms.length === 0 ? /* @__PURE__ */ (0,
|
|
5463
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
5464
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontSize: "0.82rem", fontWeight: 900, letterSpacing: "0.08em", textTransform: "uppercase" }, children: "Site forms" }),
|
|
5465
|
+
formsLoading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.85rem" }, children: "Loading forms\u2026" }) : null,
|
|
5466
|
+
formsError ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "crimson", marginTop: "0.85rem" }, children: formsError }) : null,
|
|
5467
|
+
!formsLoading && !formsError && forms.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4098
5468
|
"div",
|
|
4099
5469
|
{
|
|
4100
5470
|
style: {
|
|
@@ -4107,13 +5477,13 @@ function AdminStudioFormsView(props) {
|
|
|
4107
5477
|
children: "No forms found."
|
|
4108
5478
|
}
|
|
4109
5479
|
) : null,
|
|
4110
|
-
/* @__PURE__ */ (0,
|
|
5480
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "grid", gap: "0.55rem", marginTop: "0.85rem" }, children: forms.map((form) => {
|
|
4111
5481
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
4112
5482
|
if (!id) return null;
|
|
4113
5483
|
const title = typeof form.title === "string" ? form.title : "Untitled Form";
|
|
4114
5484
|
const slug = typeof form.slug === "string" ? form.slug : "";
|
|
4115
5485
|
const isSelected = id === selectedFormID;
|
|
4116
|
-
return /* @__PURE__ */ (0,
|
|
5486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4117
5487
|
"button",
|
|
4118
5488
|
{
|
|
4119
5489
|
onClick: () => setSelectedFormID(id),
|
|
@@ -4127,8 +5497,8 @@ function AdminStudioFormsView(props) {
|
|
|
4127
5497
|
},
|
|
4128
5498
|
type: "button",
|
|
4129
5499
|
children: [
|
|
4130
|
-
/* @__PURE__ */ (0,
|
|
4131
|
-
slug ? /* @__PURE__ */ (0,
|
|
5500
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900 }, children: title }),
|
|
5501
|
+
slug ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4132
5502
|
"div",
|
|
4133
5503
|
{
|
|
4134
5504
|
style: {
|
|
@@ -4145,9 +5515,9 @@ function AdminStudioFormsView(props) {
|
|
|
4145
5515
|
);
|
|
4146
5516
|
}) })
|
|
4147
5517
|
] }),
|
|
4148
|
-
/* @__PURE__ */ (0,
|
|
4149
|
-
/* @__PURE__ */ (0,
|
|
4150
|
-
/* @__PURE__ */ (0,
|
|
5518
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { style: { display: "grid", gap: "1rem" }, children: [
|
|
5519
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
5520
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4151
5521
|
"div",
|
|
4152
5522
|
{
|
|
4153
5523
|
style: {
|
|
@@ -4158,8 +5528,8 @@ function AdminStudioFormsView(props) {
|
|
|
4158
5528
|
justifyContent: "space-between"
|
|
4159
5529
|
},
|
|
4160
5530
|
children: [
|
|
4161
|
-
/* @__PURE__ */ (0,
|
|
4162
|
-
/* @__PURE__ */ (0,
|
|
5531
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5532
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4163
5533
|
"div",
|
|
4164
5534
|
{
|
|
4165
5535
|
style: {
|
|
@@ -4172,10 +5542,10 @@ function AdminStudioFormsView(props) {
|
|
|
4172
5542
|
children: "Selected form"
|
|
4173
5543
|
}
|
|
4174
5544
|
),
|
|
4175
|
-
/* @__PURE__ */ (0,
|
|
4176
|
-
selectedSlug ? /* @__PURE__ */ (0,
|
|
5545
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h2", { style: { margin: "0.2rem 0 0", fontSize: "1.45rem" }, children: selectedTitle }),
|
|
5546
|
+
selectedSlug ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.2rem" }, children: selectedSlug }) : null
|
|
4177
5547
|
] }),
|
|
4178
|
-
selectedFormID ? /* @__PURE__ */ (0,
|
|
5548
|
+
selectedFormID ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4179
5549
|
"a",
|
|
4180
5550
|
{
|
|
4181
5551
|
href: `${rawFormsPath}/${selectedFormID}`,
|
|
@@ -4193,7 +5563,7 @@ function AdminStudioFormsView(props) {
|
|
|
4193
5563
|
]
|
|
4194
5564
|
}
|
|
4195
5565
|
),
|
|
4196
|
-
selectedForm ? /* @__PURE__ */ (0,
|
|
5566
|
+
selectedForm ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4197
5567
|
"div",
|
|
4198
5568
|
{
|
|
4199
5569
|
style: {
|
|
@@ -4203,28 +5573,28 @@ function AdminStudioFormsView(props) {
|
|
|
4203
5573
|
marginTop: "1rem"
|
|
4204
5574
|
},
|
|
4205
5575
|
children: [
|
|
4206
|
-
/* @__PURE__ */ (0,
|
|
4207
|
-
/* @__PURE__ */ (0,
|
|
4208
|
-
/* @__PURE__ */ (0,
|
|
5576
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
5577
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Steps" }),
|
|
5578
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontSize: "1.35rem", fontWeight: 900, marginTop: "0.2rem" }, children: selectedStepCount })
|
|
4209
5579
|
] }),
|
|
4210
|
-
/* @__PURE__ */ (0,
|
|
4211
|
-
/* @__PURE__ */ (0,
|
|
4212
|
-
/* @__PURE__ */ (0,
|
|
5580
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
5581
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Fields" }),
|
|
5582
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontSize: "1.35rem", fontWeight: 900, marginTop: "0.2rem" }, children: selectedFieldCount })
|
|
4213
5583
|
] }),
|
|
4214
|
-
/* @__PURE__ */ (0,
|
|
4215
|
-
/* @__PURE__ */ (0,
|
|
4216
|
-
/* @__PURE__ */ (0,
|
|
5584
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
5585
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Submit label" }),
|
|
5586
|
+
/* @__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
5587
|
] }),
|
|
4218
|
-
/* @__PURE__ */ (0,
|
|
4219
|
-
/* @__PURE__ */ (0,
|
|
4220
|
-
/* @__PURE__ */ (0,
|
|
5588
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.8rem 0.9rem" }, children: [
|
|
5589
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Updated" }),
|
|
5590
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontSize: "1rem", fontWeight: 900, marginTop: "0.2rem" }, children: formatDate(selectedForm.updatedAt) })
|
|
4221
5591
|
] })
|
|
4222
5592
|
]
|
|
4223
5593
|
}
|
|
4224
|
-
) : /* @__PURE__ */ (0,
|
|
5594
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "1rem" }, children: "Pick a form to review its responses." })
|
|
4225
5595
|
] }),
|
|
4226
|
-
/* @__PURE__ */ (0,
|
|
4227
|
-
/* @__PURE__ */ (0,
|
|
5596
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
5597
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4228
5598
|
"div",
|
|
4229
5599
|
{
|
|
4230
5600
|
style: {
|
|
@@ -4235,11 +5605,11 @@ function AdminStudioFormsView(props) {
|
|
|
4235
5605
|
justifyContent: "space-between"
|
|
4236
5606
|
},
|
|
4237
5607
|
children: [
|
|
4238
|
-
/* @__PURE__ */ (0,
|
|
4239
|
-
/* @__PURE__ */ (0,
|
|
4240
|
-
/* @__PURE__ */ (0,
|
|
5608
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5609
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h2", { style: { fontSize: "1.2rem", margin: 0 }, children: "Responses" }),
|
|
5610
|
+
/* @__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
5611
|
] }),
|
|
4242
|
-
selectedFormID ? /* @__PURE__ */ (0,
|
|
5612
|
+
selectedFormID ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4243
5613
|
"a",
|
|
4244
5614
|
{
|
|
4245
5615
|
href: rawSubmissionsPath,
|
|
@@ -4257,9 +5627,9 @@ function AdminStudioFormsView(props) {
|
|
|
4257
5627
|
]
|
|
4258
5628
|
}
|
|
4259
5629
|
),
|
|
4260
|
-
submissionsLoading ? /* @__PURE__ */ (0,
|
|
4261
|
-
submissionsError ? /* @__PURE__ */ (0,
|
|
4262
|
-
!submissionsLoading && !submissionsError && selectedFormID && submissions.length === 0 ? /* @__PURE__ */ (0,
|
|
5630
|
+
submissionsLoading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "1rem" }, children: "Loading responses\u2026" }) : null,
|
|
5631
|
+
submissionsError ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "crimson", marginTop: "1rem" }, children: submissionsError }) : null,
|
|
5632
|
+
!submissionsLoading && !submissionsError && selectedFormID && submissions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4263
5633
|
"div",
|
|
4264
5634
|
{
|
|
4265
5635
|
style: {
|
|
@@ -4272,7 +5642,7 @@ function AdminStudioFormsView(props) {
|
|
|
4272
5642
|
children: "No responses yet for this form."
|
|
4273
5643
|
}
|
|
4274
5644
|
) : null,
|
|
4275
|
-
/* @__PURE__ */ (0,
|
|
5645
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "grid", gap: "0.9rem", marginTop: "1rem" }, children: submissions.map((submission) => {
|
|
4276
5646
|
const id = typeof submission.id === "string" || typeof submission.id === "number" ? String(submission.id) : "";
|
|
4277
5647
|
if (!id) return null;
|
|
4278
5648
|
const submissionData = submission.data;
|
|
@@ -4280,8 +5650,8 @@ function AdminStudioFormsView(props) {
|
|
|
4280
5650
|
const uploads = getUploads(submission.files);
|
|
4281
5651
|
const formSlug = getString(submission.formSlug);
|
|
4282
5652
|
const submissionFormID = getFormID(submission.form);
|
|
4283
|
-
return /* @__PURE__ */ (0,
|
|
4284
|
-
/* @__PURE__ */ (0,
|
|
5653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("article", { style: { ...panelStyle, padding: "1rem" }, children: [
|
|
5654
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4285
5655
|
"div",
|
|
4286
5656
|
{
|
|
4287
5657
|
style: {
|
|
@@ -4292,15 +5662,15 @@ function AdminStudioFormsView(props) {
|
|
|
4292
5662
|
justifyContent: "space-between"
|
|
4293
5663
|
},
|
|
4294
5664
|
children: [
|
|
4295
|
-
/* @__PURE__ */ (0,
|
|
4296
|
-
/* @__PURE__ */ (0,
|
|
4297
|
-
/* @__PURE__ */ (0,
|
|
5665
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5666
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900 }, children: identity.name || identity.email || "Submission" }),
|
|
5667
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.2rem" }, children: [
|
|
4298
5668
|
formatDate(submission.submittedAt),
|
|
4299
5669
|
formSlug ? ` \xB7 ${formSlug}` : ""
|
|
4300
5670
|
] })
|
|
4301
5671
|
] }),
|
|
4302
|
-
/* @__PURE__ */ (0,
|
|
4303
|
-
submissionFormID ? /* @__PURE__ */ (0,
|
|
5672
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
|
|
5673
|
+
submissionFormID ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4304
5674
|
"a",
|
|
4305
5675
|
{
|
|
4306
5676
|
href: `${rawFormsPath}/${submissionFormID}`,
|
|
@@ -4316,7 +5686,7 @@ function AdminStudioFormsView(props) {
|
|
|
4316
5686
|
children: "Form"
|
|
4317
5687
|
}
|
|
4318
5688
|
) : null,
|
|
4319
|
-
/* @__PURE__ */ (0,
|
|
5689
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4320
5690
|
"a",
|
|
4321
5691
|
{
|
|
4322
5692
|
href: `${rawSubmissionsPath}/${id}`,
|
|
@@ -4336,7 +5706,7 @@ function AdminStudioFormsView(props) {
|
|
|
4336
5706
|
]
|
|
4337
5707
|
}
|
|
4338
5708
|
),
|
|
4339
|
-
identity.name || identity.email ? /* @__PURE__ */ (0,
|
|
5709
|
+
identity.name || identity.email ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4340
5710
|
"div",
|
|
4341
5711
|
{
|
|
4342
5712
|
style: {
|
|
@@ -4346,19 +5716,19 @@ function AdminStudioFormsView(props) {
|
|
|
4346
5716
|
marginTop: "0.9rem"
|
|
4347
5717
|
},
|
|
4348
5718
|
children: [
|
|
4349
|
-
identity.name ? /* @__PURE__ */ (0,
|
|
4350
|
-
/* @__PURE__ */ (0,
|
|
4351
|
-
/* @__PURE__ */ (0,
|
|
5719
|
+
identity.name ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.75rem 0.85rem" }, children: [
|
|
5720
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Name" }),
|
|
5721
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900, marginTop: "0.2rem" }, children: identity.name })
|
|
4352
5722
|
] }) : null,
|
|
4353
|
-
identity.email ? /* @__PURE__ */ (0,
|
|
4354
|
-
/* @__PURE__ */ (0,
|
|
4355
|
-
/* @__PURE__ */ (0,
|
|
5723
|
+
identity.email ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { ...panelStyle, padding: "0.75rem 0.85rem" }, children: [
|
|
5724
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.82rem" }, children: "Email" }),
|
|
5725
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900, marginTop: "0.2rem" }, children: identity.email })
|
|
4356
5726
|
] }) : null
|
|
4357
5727
|
]
|
|
4358
5728
|
}
|
|
4359
5729
|
) : null,
|
|
4360
|
-
/* @__PURE__ */ (0,
|
|
4361
|
-
/* @__PURE__ */ (0,
|
|
5730
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { marginTop: "1rem" }, children: [
|
|
5731
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4362
5732
|
"div",
|
|
4363
5733
|
{
|
|
4364
5734
|
style: {
|
|
@@ -4372,7 +5742,7 @@ function AdminStudioFormsView(props) {
|
|
|
4372
5742
|
children: "Response data"
|
|
4373
5743
|
}
|
|
4374
5744
|
),
|
|
4375
|
-
/* @__PURE__ */ (0,
|
|
5745
|
+
/* @__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
5746
|
"div",
|
|
4377
5747
|
{
|
|
4378
5748
|
style: {
|
|
@@ -4383,7 +5753,7 @@ function AdminStudioFormsView(props) {
|
|
|
4383
5753
|
padding: "0.8rem 0.9rem"
|
|
4384
5754
|
},
|
|
4385
5755
|
children: [
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
5756
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4387
5757
|
"div",
|
|
4388
5758
|
{
|
|
4389
5759
|
style: {
|
|
@@ -4395,14 +5765,14 @@ function AdminStudioFormsView(props) {
|
|
|
4395
5765
|
children: key
|
|
4396
5766
|
}
|
|
4397
5767
|
),
|
|
4398
|
-
/* @__PURE__ */ (0,
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { overflowWrap: "anywhere" }, children: renderValue(value) })
|
|
4399
5769
|
]
|
|
4400
5770
|
},
|
|
4401
5771
|
key
|
|
4402
5772
|
)) })
|
|
4403
5773
|
] }),
|
|
4404
|
-
/* @__PURE__ */ (0,
|
|
4405
|
-
/* @__PURE__ */ (0,
|
|
5774
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { marginTop: "1rem" }, children: [
|
|
5775
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4406
5776
|
"div",
|
|
4407
5777
|
{
|
|
4408
5778
|
style: {
|
|
@@ -4416,7 +5786,7 @@ function AdminStudioFormsView(props) {
|
|
|
4416
5786
|
children: "Uploads"
|
|
4417
5787
|
}
|
|
4418
5788
|
),
|
|
4419
|
-
uploads.length === 0 ? /* @__PURE__ */ (0,
|
|
5789
|
+
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
5790
|
const uploadID = typeof upload.id === "string" || typeof upload.id === "number" ? String(upload.id) : "";
|
|
4421
5791
|
if (!uploadID) return null;
|
|
4422
5792
|
const label = typeof upload.filename === "string" && upload.filename || `Upload ${index + 1}`;
|
|
@@ -4424,7 +5794,7 @@ function AdminStudioFormsView(props) {
|
|
|
4424
5794
|
typeof upload.mimeType === "string" ? upload.mimeType : null,
|
|
4425
5795
|
formatFileSize(upload.filesize)
|
|
4426
5796
|
].filter(Boolean);
|
|
4427
|
-
return /* @__PURE__ */ (0,
|
|
5797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4428
5798
|
"a",
|
|
4429
5799
|
{
|
|
4430
5800
|
href: `${rawUploadsPath}/${uploadID}`,
|
|
@@ -4438,9 +5808,9 @@ function AdminStudioFormsView(props) {
|
|
|
4438
5808
|
textDecoration: "none"
|
|
4439
5809
|
},
|
|
4440
5810
|
children: [
|
|
4441
|
-
/* @__PURE__ */ (0,
|
|
4442
|
-
/* @__PURE__ */ (0,
|
|
4443
|
-
meta.length > 0 ? /* @__PURE__ */ (0,
|
|
5811
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5812
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { fontWeight: 900 }, children: label }),
|
|
5813
|
+
meta.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4444
5814
|
"div",
|
|
4445
5815
|
{
|
|
4446
5816
|
style: {
|
|
@@ -4452,7 +5822,7 @@ function AdminStudioFormsView(props) {
|
|
|
4452
5822
|
}
|
|
4453
5823
|
) : null
|
|
4454
5824
|
] }),
|
|
4455
|
-
/* @__PURE__ */ (0,
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontWeight: 800 }, children: "Open" })
|
|
4456
5826
|
]
|
|
4457
5827
|
},
|
|
4458
5828
|
uploadID
|
|
@@ -4466,18 +5836,18 @@ function AdminStudioFormsView(props) {
|
|
|
4466
5836
|
]
|
|
4467
5837
|
}
|
|
4468
5838
|
)
|
|
4469
|
-
] });
|
|
5839
|
+
] }) });
|
|
4470
5840
|
}
|
|
4471
5841
|
|
|
4472
5842
|
// src/admin/components/studio/AdminStudioToolsView.tsx
|
|
4473
|
-
var
|
|
4474
|
-
var
|
|
5843
|
+
var import_ui13 = require("@payloadcms/ui");
|
|
5844
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4475
5845
|
var isAdmin4 = (user) => {
|
|
4476
5846
|
if (!user || typeof user !== "object") return false;
|
|
4477
5847
|
const role = user.role;
|
|
4478
5848
|
return typeof role === "string" && role === "admin";
|
|
4479
5849
|
};
|
|
4480
|
-
var
|
|
5850
|
+
var getPropString11 = (props, key, fallback) => {
|
|
4481
5851
|
if (!props || typeof props !== "object") return fallback;
|
|
4482
5852
|
const direct = props[key];
|
|
4483
5853
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -4489,18 +5859,18 @@ var getPropString9 = (props, key, fallback) => {
|
|
|
4489
5859
|
return fallback;
|
|
4490
5860
|
};
|
|
4491
5861
|
function AdminStudioToolsView(props) {
|
|
4492
|
-
const { user } = (0,
|
|
5862
|
+
const { user } = (0, import_ui13.useAuth)();
|
|
4493
5863
|
const adminBasePath = useAdminBasePath();
|
|
4494
5864
|
const toolsPath = resolveAdminPath(adminBasePath, "/tools");
|
|
4495
5865
|
if (!isAdmin4(user)) {
|
|
4496
|
-
return /* @__PURE__ */ (0,
|
|
4497
|
-
/* @__PURE__ */ (0,
|
|
4498
|
-
/* @__PURE__ */ (0,
|
|
4499
|
-
/* @__PURE__ */ (0,
|
|
4500
|
-
] });
|
|
5866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5867
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ui13.SetStepNav, { nav: [{ label: "Admin Tools", url: toolsPath }] }),
|
|
5868
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h1", { style: { margin: 0 }, children: "Admin Tools" }),
|
|
5869
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "You do not have access to this page." })
|
|
5870
|
+
] }) });
|
|
4501
5871
|
}
|
|
4502
|
-
const pagesCollectionSlug =
|
|
4503
|
-
const mediaCollectionSlug =
|
|
5872
|
+
const pagesCollectionSlug = getPropString11(props, "pagesCollectionSlug", "pages");
|
|
5873
|
+
const mediaCollectionSlug = getPropString11(props, "mediaCollectionSlug", "media");
|
|
4504
5874
|
const links = [
|
|
4505
5875
|
{ href: resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`), label: "Raw Pages Collection" },
|
|
4506
5876
|
{ href: resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`), label: "Raw Media Collection" },
|
|
@@ -4509,11 +5879,11 @@ function AdminStudioToolsView(props) {
|
|
|
4509
5879
|
{ href: resolveAdminPath(adminBasePath, "/globals/footer"), label: "Raw Footer Global" },
|
|
4510
5880
|
{ href: resolveAdminPath(adminBasePath, "/collections/users"), label: "Users / Roles" }
|
|
4511
5881
|
];
|
|
4512
|
-
return /* @__PURE__ */ (0,
|
|
4513
|
-
/* @__PURE__ */ (0,
|
|
4514
|
-
/* @__PURE__ */ (0,
|
|
4515
|
-
/* @__PURE__ */ (0,
|
|
4516
|
-
/* @__PURE__ */ (0,
|
|
5882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5883
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ui13.SetStepNav, { nav: [{ label: "Admin Tools", url: toolsPath }] }),
|
|
5884
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h1", { style: { margin: 0 }, children: "Admin Tools" }),
|
|
5885
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Hidden fallback links for administrators." }),
|
|
5886
|
+
/* @__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
5887
|
"a",
|
|
4518
5888
|
{
|
|
4519
5889
|
href: link.href,
|
|
@@ -4526,25 +5896,25 @@ function AdminStudioToolsView(props) {
|
|
|
4526
5896
|
textDecoration: "none"
|
|
4527
5897
|
},
|
|
4528
5898
|
children: [
|
|
4529
|
-
/* @__PURE__ */ (0,
|
|
4530
|
-
/* @__PURE__ */ (0,
|
|
5899
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { fontWeight: 900 }, children: link.label }),
|
|
5900
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: link.href })
|
|
4531
5901
|
]
|
|
4532
5902
|
},
|
|
4533
5903
|
link.href
|
|
4534
5904
|
)) })
|
|
4535
|
-
] });
|
|
5905
|
+
] }) });
|
|
4536
5906
|
}
|
|
4537
5907
|
|
|
4538
5908
|
// src/admin/components/studio/OpenInStudioMenuItem.tsx
|
|
4539
|
-
var
|
|
4540
|
-
var
|
|
4541
|
-
function OpenInStudioMenuItem({ pagesPathBase = "/
|
|
4542
|
-
const documentInfo = (0,
|
|
5909
|
+
var import_ui14 = require("@payloadcms/ui");
|
|
5910
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5911
|
+
function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
5912
|
+
const documentInfo = (0, import_ui14.useDocumentInfo)();
|
|
4543
5913
|
const id = documentInfo?.id;
|
|
4544
5914
|
if (!id) {
|
|
4545
5915
|
return null;
|
|
4546
5916
|
}
|
|
4547
|
-
return /* @__PURE__ */ (0,
|
|
5917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4548
5918
|
"a",
|
|
4549
5919
|
{
|
|
4550
5920
|
href: `${pagesPathBase}/${id}`,
|
|
@@ -4563,19 +5933,19 @@ function OpenInStudioMenuItem({ pagesPathBase = "/studio/pages" }) {
|
|
|
4563
5933
|
}
|
|
4564
5934
|
|
|
4565
5935
|
// src/admin/components/studio/PageEditRedirectToStudio.tsx
|
|
4566
|
-
var
|
|
4567
|
-
var
|
|
4568
|
-
var
|
|
4569
|
-
function PageEditRedirectToStudio({ pagesPathBase = "/
|
|
4570
|
-
const documentInfo = (0,
|
|
5936
|
+
var import_react21 = require("react");
|
|
5937
|
+
var import_ui15 = require("@payloadcms/ui");
|
|
5938
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5939
|
+
function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
5940
|
+
const documentInfo = (0, import_ui15.useDocumentInfo)();
|
|
4571
5941
|
const id = documentInfo?.id;
|
|
4572
|
-
(0,
|
|
5942
|
+
(0, import_react21.useEffect)(() => {
|
|
4573
5943
|
if (!id) {
|
|
4574
5944
|
return;
|
|
4575
5945
|
}
|
|
4576
5946
|
window.location.replace(`${pagesPathBase}/${id}`);
|
|
4577
5947
|
}, [id, pagesPathBase]);
|
|
4578
|
-
return /* @__PURE__ */ (0,
|
|
5948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4579
5949
|
"div",
|
|
4580
5950
|
{
|
|
4581
5951
|
style: {
|
|
@@ -4587,49 +5957,55 @@ function PageEditRedirectToStudio({ pagesPathBase = "/studio/pages" }) {
|
|
|
4587
5957
|
minHeight: "50vh"
|
|
4588
5958
|
},
|
|
4589
5959
|
children: [
|
|
4590
|
-
/* @__PURE__ */ (0,
|
|
4591
|
-
/* @__PURE__ */ (0,
|
|
4592
|
-
id ? /* @__PURE__ */ (0,
|
|
5960
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
|
|
5961
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
|
|
5962
|
+
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
5963
|
]
|
|
4594
5964
|
}
|
|
4595
5965
|
);
|
|
4596
5966
|
}
|
|
4597
5967
|
|
|
4598
5968
|
// src/admin/components/studio/StudioBackBreadcrumb.tsx
|
|
4599
|
-
var
|
|
4600
|
-
var
|
|
4601
|
-
var
|
|
5969
|
+
var import_react22 = require("react");
|
|
5970
|
+
var import_ui16 = require("@payloadcms/ui");
|
|
5971
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4602
5972
|
var toTitle = (slug) => slug.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
4603
5973
|
var buildNav = (pathname, adminBasePath) => {
|
|
4604
5974
|
if (pathname.includes("/globals/")) {
|
|
4605
5975
|
const slug = pathname.split("/globals/")[1]?.split("/")[0] || "";
|
|
4606
5976
|
const currentLabel = slug === "site-settings" ? "Website Settings" : toTitle(slug) || "Global";
|
|
4607
5977
|
return [
|
|
4608
|
-
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/
|
|
5978
|
+
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/globals") },
|
|
4609
5979
|
{ label: currentLabel }
|
|
4610
5980
|
];
|
|
4611
5981
|
}
|
|
4612
|
-
if (pathname.includes("/
|
|
5982
|
+
if (pathname.includes("/contact-form")) {
|
|
4613
5983
|
return [
|
|
4614
|
-
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/
|
|
5984
|
+
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/globals") },
|
|
4615
5985
|
{ label: "Contact Form" }
|
|
4616
5986
|
];
|
|
4617
5987
|
}
|
|
4618
5988
|
if (pathname.includes("/collections/pages") || pathname.includes("/pages/")) {
|
|
4619
5989
|
return [
|
|
4620
|
-
{ label: "Pages", url: resolveAdminPath(adminBasePath, "/
|
|
5990
|
+
{ label: "Pages", url: resolveAdminPath(adminBasePath, "/pages") },
|
|
4621
5991
|
{ label: "Page" }
|
|
4622
5992
|
];
|
|
4623
5993
|
}
|
|
5994
|
+
if (pathname.includes("/collections/forms") || pathname.includes("/collections/form-submissions") || pathname.includes("/collections/form-uploads")) {
|
|
5995
|
+
return [
|
|
5996
|
+
{ label: "Forms", url: resolveAdminPath(adminBasePath, "/forms") },
|
|
5997
|
+
{ label: "Form" }
|
|
5998
|
+
];
|
|
5999
|
+
}
|
|
4624
6000
|
if (pathname.includes("/collections/media")) {
|
|
4625
6001
|
return [
|
|
4626
|
-
{ label: "Media", url: resolveAdminPath(adminBasePath, "/
|
|
6002
|
+
{ label: "Media", url: resolveAdminPath(adminBasePath, "/media") },
|
|
4627
6003
|
{ label: "Media Item" }
|
|
4628
6004
|
];
|
|
4629
6005
|
}
|
|
4630
6006
|
if (pathname.includes("/tools") || pathname.includes("/collections/users")) {
|
|
4631
6007
|
return [
|
|
4632
|
-
{ label: "Admin Tools", url: resolveAdminPath(adminBasePath, "/
|
|
6008
|
+
{ label: "Admin Tools", url: resolveAdminPath(adminBasePath, "/tools") },
|
|
4633
6009
|
{ label: "Tool" }
|
|
4634
6010
|
];
|
|
4635
6011
|
}
|
|
@@ -4637,8 +6013,8 @@ var buildNav = (pathname, adminBasePath) => {
|
|
|
4637
6013
|
};
|
|
4638
6014
|
function StudioBackBreadcrumb() {
|
|
4639
6015
|
const adminBasePath = useAdminBasePath();
|
|
4640
|
-
const [pathname, setPathname] = (0,
|
|
4641
|
-
(0,
|
|
6016
|
+
const [pathname, setPathname] = (0, import_react22.useState)("");
|
|
6017
|
+
(0, import_react22.useEffect)(() => {
|
|
4642
6018
|
const update = () => setPathname(window.location.pathname);
|
|
4643
6019
|
update();
|
|
4644
6020
|
window.addEventListener("popstate", update);
|
|
@@ -4646,13 +6022,13 @@ function StudioBackBreadcrumb() {
|
|
|
4646
6022
|
}, []);
|
|
4647
6023
|
const nav = buildNav(pathname, adminBasePath);
|
|
4648
6024
|
if (!nav) return null;
|
|
4649
|
-
return /* @__PURE__ */ (0,
|
|
6025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui16.SetStepNav, { nav });
|
|
4650
6026
|
}
|
|
4651
6027
|
|
|
4652
6028
|
// src/admin/components/studio/StudioContactFormRedirect.tsx
|
|
4653
|
-
var
|
|
4654
|
-
var
|
|
4655
|
-
var
|
|
6029
|
+
var import_react23 = require("react");
|
|
6030
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6031
|
+
var getPropString12 = (props, key, fallback) => {
|
|
4656
6032
|
if (!props || typeof props !== "object") return fallback;
|
|
4657
6033
|
const direct = props[key];
|
|
4658
6034
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -4665,13 +6041,13 @@ var getPropString10 = (props, key, fallback) => {
|
|
|
4665
6041
|
};
|
|
4666
6042
|
function StudioContactFormRedirect(props) {
|
|
4667
6043
|
const adminBasePath = useAdminBasePath();
|
|
4668
|
-
const studioContactFormPath =
|
|
6044
|
+
const studioContactFormPath = getPropString12(props, "studioContactFormPath", "/contact-form");
|
|
4669
6045
|
const targetPath = resolveAdminPath(adminBasePath, studioContactFormPath);
|
|
4670
|
-
(0,
|
|
6046
|
+
(0, import_react23.useEffect)(() => {
|
|
4671
6047
|
if (window.location.pathname === targetPath) return;
|
|
4672
6048
|
window.location.replace(targetPath);
|
|
4673
6049
|
}, [targetPath]);
|
|
4674
|
-
return /* @__PURE__ */ (0,
|
|
6050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4675
6051
|
"div",
|
|
4676
6052
|
{
|
|
4677
6053
|
style: {
|
|
@@ -4684,8 +6060,8 @@ function StudioContactFormRedirect(props) {
|
|
|
4684
6060
|
minHeight: "40vh"
|
|
4685
6061
|
},
|
|
4686
6062
|
children: [
|
|
4687
|
-
/* @__PURE__ */ (0,
|
|
4688
|
-
/* @__PURE__ */ (0,
|
|
6063
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h2", { style: { margin: 0 }, children: "Opening Contact Form Editor..." }),
|
|
6064
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { href: targetPath, children: "Continue" })
|
|
4689
6065
|
]
|
|
4690
6066
|
}
|
|
4691
6067
|
);
|
|
@@ -4694,8 +6070,10 @@ function StudioContactFormRedirect(props) {
|
|
|
4694
6070
|
0 && (module.exports = {
|
|
4695
6071
|
AdminStudioContactFormView,
|
|
4696
6072
|
AdminStudioDashboard,
|
|
6073
|
+
AdminStudioFooterGlobalView,
|
|
4697
6074
|
AdminStudioFormsView,
|
|
4698
6075
|
AdminStudioGlobalsView,
|
|
6076
|
+
AdminStudioHeaderGlobalView,
|
|
4699
6077
|
AdminStudioMediaView,
|
|
4700
6078
|
AdminStudioNav,
|
|
4701
6079
|
AdminStudioPageEditView,
|