@orion-studios/payload-studio 0.6.0-beta.1 → 0.6.0-beta.10
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.d.mts +2 -1
- package/dist/admin/client.d.ts +2 -1
- package/dist/admin/client.js +2243 -1416
- package/dist/admin/client.mjs +1795 -971
- package/dist/admin/index.d.mts +1 -1
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/index.js +17 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin-app/styles.css +448 -38
- package/dist/{chunk-Q2HGC67S.mjs → chunk-WLOPFFN2.mjs} +17 -1
- package/dist/index-Bm2SaC3r.d.mts +187 -0
- package/dist/index-CkT_eyhK.d.ts +187 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/index-BMitiKK8.d.ts +0 -435
- package/dist/index-D_b24Gef.d.mts +0 -435
package/dist/admin/client.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
|
59
59
|
let cancelled = false;
|
|
60
60
|
const run = async () => {
|
|
61
61
|
try {
|
|
62
|
-
const res = await fetch("/api/globals/site-settings?depth=1
|
|
62
|
+
const res = await fetch("/api/globals/site-settings?depth=1", {
|
|
63
63
|
credentials: "include"
|
|
64
64
|
});
|
|
65
65
|
if (!res.ok) return;
|
|
@@ -234,38 +234,122 @@ function AdminLoginIntro({ brandName = "Orion Studio", logoUrl } = {}) {
|
|
|
234
234
|
const branding = useSiteBranding(brandName, logoUrl);
|
|
235
235
|
const resolvedName = branding.siteName || brandName;
|
|
236
236
|
return /* @__PURE__ */ jsxs3("div", { className: "orion-admin-login-intro", children: [
|
|
237
|
-
/* @__PURE__ */ jsx3("span", { className: "orion-admin-login-eyebrow", children: "
|
|
237
|
+
/* @__PURE__ */ jsx3("span", { className: "orion-admin-login-eyebrow", children: "Private Admin" }),
|
|
238
238
|
/* @__PURE__ */ jsxs3("h1", { children: [
|
|
239
|
-
"Manage ",
|
|
240
239
|
resolvedName,
|
|
241
|
-
"
|
|
240
|
+
" admin"
|
|
242
241
|
] }),
|
|
243
|
-
/* @__PURE__ */ jsx3("p", { children: "Sign in to update
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
/* @__PURE__ */ jsxs3("article", { className: "orion-admin-login-note", children: [
|
|
246
|
-
/* @__PURE__ */ jsx3("strong", { children: "Branded workspace" }),
|
|
247
|
-
/* @__PURE__ */ jsx3("span", { children: "The admin mirrors the live site instead of dropping editors into a generic CMS shell." })
|
|
248
|
-
] }),
|
|
249
|
-
/* @__PURE__ */ jsxs3("article", { className: "orion-admin-login-note", children: [
|
|
250
|
-
/* @__PURE__ */ jsx3("strong", { children: "One editorial flow" }),
|
|
251
|
-
/* @__PURE__ */ jsx3("span", { children: "Pages, globals, media, forms, and analytics stay in one place once you are inside." })
|
|
252
|
-
] }),
|
|
253
|
-
/* @__PURE__ */ jsxs3("article", { className: "orion-admin-login-note", children: [
|
|
254
|
-
/* @__PURE__ */ jsx3("strong", { children: "Protected entry" }),
|
|
255
|
-
/* @__PURE__ */ jsx3("span", { children: "Only authorized administrators and editors can access this workspace." })
|
|
256
|
-
] })
|
|
257
|
-
] })
|
|
242
|
+
/* @__PURE__ */ jsx3("p", { children: "Sign in to update pages, review forms, manage media, and adjust site settings." }),
|
|
243
|
+
/* @__PURE__ */ jsx3("p", { className: "orion-admin-login-caption", children: "For owners and authorized team members." })
|
|
258
244
|
] });
|
|
259
245
|
}
|
|
260
246
|
|
|
247
|
+
// src/admin/components/AdminLoginPasswordToggle.tsx
|
|
248
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
249
|
+
import { createPortal } from "react-dom";
|
|
250
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
251
|
+
var loginPasswordSelector = '.template-minimal.login .login__form input[name="password"]';
|
|
252
|
+
function EyeIcon({ crossed = false }) {
|
|
253
|
+
return /* @__PURE__ */ jsxs4(
|
|
254
|
+
"svg",
|
|
255
|
+
{
|
|
256
|
+
"aria-hidden": "true",
|
|
257
|
+
fill: "none",
|
|
258
|
+
height: "18",
|
|
259
|
+
stroke: "currentColor",
|
|
260
|
+
strokeLinecap: "round",
|
|
261
|
+
strokeLinejoin: "round",
|
|
262
|
+
strokeWidth: "1.9",
|
|
263
|
+
viewBox: "0 0 24 24",
|
|
264
|
+
width: "18",
|
|
265
|
+
children: [
|
|
266
|
+
/* @__PURE__ */ jsx4("path", { d: "M2 12s3.6-6 10-6 10 6 10 6-3.6 6-10 6S2 12 2 12Z" }),
|
|
267
|
+
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "2.75" }),
|
|
268
|
+
crossed ? /* @__PURE__ */ jsx4("path", { d: "M4 4l16 16" }) : null
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
function AdminLoginPasswordToggle() {
|
|
274
|
+
const [hostEl, setHostEl] = useState2(null);
|
|
275
|
+
const [inputEl, setInputEl] = useState2(null);
|
|
276
|
+
const [portalEl, setPortalEl] = useState2(null);
|
|
277
|
+
const [visible, setVisible] = useState2(false);
|
|
278
|
+
useEffect2(() => {
|
|
279
|
+
const sync = () => {
|
|
280
|
+
const nextInput = document.querySelector(loginPasswordSelector);
|
|
281
|
+
const nextHost = nextInput?.parentElement ?? null;
|
|
282
|
+
setInputEl((current) => current === nextInput ? current : nextInput);
|
|
283
|
+
setHostEl((current) => current === nextHost ? current : nextHost);
|
|
284
|
+
};
|
|
285
|
+
sync();
|
|
286
|
+
const observer = new MutationObserver(sync);
|
|
287
|
+
observer.observe(document.body, {
|
|
288
|
+
childList: true,
|
|
289
|
+
subtree: true
|
|
290
|
+
});
|
|
291
|
+
return () => observer.disconnect();
|
|
292
|
+
}, []);
|
|
293
|
+
useEffect2(() => {
|
|
294
|
+
setVisible(false);
|
|
295
|
+
}, [inputEl]);
|
|
296
|
+
useEffect2(() => {
|
|
297
|
+
if (!inputEl) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
inputEl.type = visible ? "text" : "password";
|
|
301
|
+
return () => {
|
|
302
|
+
inputEl.type = "password";
|
|
303
|
+
};
|
|
304
|
+
}, [inputEl, visible]);
|
|
305
|
+
useEffect2(() => {
|
|
306
|
+
if (!hostEl) {
|
|
307
|
+
setPortalEl(null);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const existing = hostEl.querySelector(".orion-admin-password-toggle-slot");
|
|
311
|
+
const slot = existing || document.createElement("div");
|
|
312
|
+
slot.className = "orion-admin-password-toggle-slot";
|
|
313
|
+
if (!slot.parentElement) {
|
|
314
|
+
hostEl.appendChild(slot);
|
|
315
|
+
}
|
|
316
|
+
setPortalEl(slot);
|
|
317
|
+
return () => {
|
|
318
|
+
if (slot.parentElement === hostEl) {
|
|
319
|
+
slot.remove();
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}, [hostEl]);
|
|
323
|
+
if (!inputEl || inputEl.disabled || !portalEl) {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
return createPortal(
|
|
327
|
+
/* @__PURE__ */ jsx4(
|
|
328
|
+
"button",
|
|
329
|
+
{
|
|
330
|
+
"aria-label": visible ? "Hide password" : "Show password",
|
|
331
|
+
"aria-pressed": visible,
|
|
332
|
+
className: "orion-admin-password-toggle",
|
|
333
|
+
"data-visible": visible ? "true" : "false",
|
|
334
|
+
onClick: () => setVisible((current) => !current),
|
|
335
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
336
|
+
title: visible ? "Hide password" : "Show password",
|
|
337
|
+
type: "button",
|
|
338
|
+
children: /* @__PURE__ */ jsx4(EyeIcon, { crossed: visible })
|
|
339
|
+
}
|
|
340
|
+
),
|
|
341
|
+
portalEl
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
|
|
261
345
|
// src/admin/components/Dashboard.tsx
|
|
262
|
-
import { useEffect as
|
|
346
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
263
347
|
|
|
264
348
|
// src/admin/components/ThemeSwitcher.tsx
|
|
265
349
|
import { useLayoutEffect } from "react";
|
|
266
350
|
|
|
267
351
|
// src/admin/hooks/useTheme.ts
|
|
268
|
-
import { useCallback, useEffect as
|
|
352
|
+
import { useCallback, useEffect as useEffect3, useRef, useState as useState3 } from "react";
|
|
269
353
|
var STORAGE_KEY = "orion-admin-theme";
|
|
270
354
|
function applyTheme(theme) {
|
|
271
355
|
const html = document.documentElement;
|
|
@@ -299,12 +383,12 @@ function cacheTheme(theme) {
|
|
|
299
383
|
}
|
|
300
384
|
}
|
|
301
385
|
function useTheme(defaultTheme = "brand-light") {
|
|
302
|
-
const [theme, setThemeState] =
|
|
303
|
-
const [isLoading, setIsLoading] =
|
|
304
|
-
const [hasMounted, setHasMounted] =
|
|
386
|
+
const [theme, setThemeState] = useState3(defaultTheme);
|
|
387
|
+
const [isLoading, setIsLoading] = useState3(true);
|
|
388
|
+
const [hasMounted, setHasMounted] = useState3(false);
|
|
305
389
|
const debounceRef = useRef(null);
|
|
306
390
|
const userIdRef = useRef(null);
|
|
307
|
-
|
|
391
|
+
useEffect3(() => {
|
|
308
392
|
setHasMounted(true);
|
|
309
393
|
const cached = getCachedTheme();
|
|
310
394
|
if (cached) {
|
|
@@ -379,31 +463,31 @@ function useTheme(defaultTheme = "brand-light") {
|
|
|
379
463
|
}
|
|
380
464
|
|
|
381
465
|
// src/admin/components/ThemeSwitcher.tsx
|
|
382
|
-
import { Fragment, jsx as
|
|
466
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
383
467
|
var iconSize = 16;
|
|
384
468
|
function SunIcon() {
|
|
385
|
-
return /* @__PURE__ */
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
/* @__PURE__ */
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
469
|
+
return /* @__PURE__ */ jsxs5("svg", { width: iconSize, height: iconSize, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
470
|
+
/* @__PURE__ */ jsx5("circle", { cx: "12", cy: "12", r: "5" }),
|
|
471
|
+
/* @__PURE__ */ jsx5("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
472
|
+
/* @__PURE__ */ jsx5("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
473
|
+
/* @__PURE__ */ jsx5("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
|
|
474
|
+
/* @__PURE__ */ jsx5("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
|
|
475
|
+
/* @__PURE__ */ jsx5("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
|
|
476
|
+
/* @__PURE__ */ jsx5("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
|
|
477
|
+
/* @__PURE__ */ jsx5("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
478
|
+
/* @__PURE__ */ jsx5("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
395
479
|
] });
|
|
396
480
|
}
|
|
397
481
|
function MoonIcon() {
|
|
398
|
-
return /* @__PURE__ */
|
|
482
|
+
return /* @__PURE__ */ jsx5("svg", { width: iconSize, height: iconSize, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx5("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) });
|
|
399
483
|
}
|
|
400
484
|
function PaletteIcon() {
|
|
401
|
-
return /* @__PURE__ */
|
|
402
|
-
/* @__PURE__ */
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
-
/* @__PURE__ */
|
|
485
|
+
return /* @__PURE__ */ jsxs5("svg", { width: iconSize, height: iconSize, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
486
|
+
/* @__PURE__ */ jsx5("circle", { cx: "13.5", cy: "6.5", r: "0.5", fill: "currentColor" }),
|
|
487
|
+
/* @__PURE__ */ jsx5("circle", { cx: "17.5", cy: "10.5", r: "0.5", fill: "currentColor" }),
|
|
488
|
+
/* @__PURE__ */ jsx5("circle", { cx: "8.5", cy: "7.5", r: "0.5", fill: "currentColor" }),
|
|
489
|
+
/* @__PURE__ */ jsx5("circle", { cx: "6.5", cy: "12", r: "0.5", fill: "currentColor" }),
|
|
490
|
+
/* @__PURE__ */ jsx5("path", { d: "M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z" })
|
|
407
491
|
] });
|
|
408
492
|
}
|
|
409
493
|
var buttonBase = {
|
|
@@ -438,7 +522,7 @@ function ThemeSwitcher({
|
|
|
438
522
|
const { isDark, isBrand, hasMounted, toggleDarkMode, toggleBrandMode } = useTheme(defaultTheme);
|
|
439
523
|
const showDark = hasMounted && isDark;
|
|
440
524
|
const showBrand = hasMounted && isBrand;
|
|
441
|
-
return /* @__PURE__ */
|
|
525
|
+
return /* @__PURE__ */ jsxs5(
|
|
442
526
|
"div",
|
|
443
527
|
{
|
|
444
528
|
style: {
|
|
@@ -448,7 +532,7 @@ function ThemeSwitcher({
|
|
|
448
532
|
padding: "8px 12px"
|
|
449
533
|
},
|
|
450
534
|
children: [
|
|
451
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ jsx5(
|
|
452
536
|
"button",
|
|
453
537
|
{
|
|
454
538
|
type: "button",
|
|
@@ -456,10 +540,10 @@ function ThemeSwitcher({
|
|
|
456
540
|
style: showDark ? buttonActive : buttonBase,
|
|
457
541
|
title: showDark ? "Switch to light mode" : "Switch to dark mode",
|
|
458
542
|
"aria-label": showDark ? "Switch to light mode" : "Switch to dark mode",
|
|
459
|
-
children: showDark ? /* @__PURE__ */
|
|
543
|
+
children: showDark ? /* @__PURE__ */ jsx5(MoonIcon, {}) : /* @__PURE__ */ jsx5(SunIcon, {})
|
|
460
544
|
}
|
|
461
545
|
),
|
|
462
|
-
/* @__PURE__ */
|
|
546
|
+
/* @__PURE__ */ jsx5(
|
|
463
547
|
"button",
|
|
464
548
|
{
|
|
465
549
|
type: "button",
|
|
@@ -467,7 +551,7 @@ function ThemeSwitcher({
|
|
|
467
551
|
style: showBrand ? buttonActive : buttonBase,
|
|
468
552
|
title: showBrand ? "Switch to standard colors" : "Switch to brand colors",
|
|
469
553
|
"aria-label": showBrand ? "Switch to standard colors" : "Switch to brand colors",
|
|
470
|
-
children: /* @__PURE__ */
|
|
554
|
+
children: /* @__PURE__ */ jsx5(PaletteIcon, {})
|
|
471
555
|
}
|
|
472
556
|
)
|
|
473
557
|
]
|
|
@@ -519,24 +603,24 @@ function ThemeProvider({
|
|
|
519
603
|
} catch {
|
|
520
604
|
}
|
|
521
605
|
}, [allowThemePreference, defaultTheme]);
|
|
522
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ jsx5(Fragment, { children });
|
|
523
607
|
}
|
|
524
608
|
|
|
525
609
|
// src/admin/components/HelpTooltip.tsx
|
|
526
|
-
import { useCallback as useCallback2, useEffect as
|
|
527
|
-
import { jsx as
|
|
610
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
|
|
611
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
528
612
|
function HelpTooltip({
|
|
529
613
|
content,
|
|
530
614
|
position = "top"
|
|
531
615
|
}) {
|
|
532
|
-
const [isVisible, setIsVisible] =
|
|
616
|
+
const [isVisible, setIsVisible] = useState4(false);
|
|
533
617
|
const triggerRef = useRef2(null);
|
|
534
618
|
const tooltipRef = useRef2(null);
|
|
535
619
|
const tooltipId = useRef2(`tooltip-${Math.random().toString(36).slice(2, 9)}`);
|
|
536
620
|
const show = useCallback2(() => setIsVisible(true), []);
|
|
537
621
|
const hide = useCallback2(() => setIsVisible(false), []);
|
|
538
622
|
const toggle = useCallback2(() => setIsVisible((v) => !v), []);
|
|
539
|
-
|
|
623
|
+
useEffect4(() => {
|
|
540
624
|
if (!isVisible) return;
|
|
541
625
|
const handleKeyDown = (e) => {
|
|
542
626
|
if (e.key === "Escape") setIsVisible(false);
|
|
@@ -544,7 +628,7 @@ function HelpTooltip({
|
|
|
544
628
|
document.addEventListener("keydown", handleKeyDown);
|
|
545
629
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
546
630
|
}, [isVisible]);
|
|
547
|
-
|
|
631
|
+
useEffect4(() => {
|
|
548
632
|
if (!isVisible) return;
|
|
549
633
|
const handleClick = (e) => {
|
|
550
634
|
if (triggerRef.current && !triggerRef.current.contains(e.target) && tooltipRef.current && !tooltipRef.current.contains(e.target)) {
|
|
@@ -560,8 +644,8 @@ function HelpTooltip({
|
|
|
560
644
|
left: { right: "100%", top: "50%", transform: "translateY(-50%)", marginRight: 8 },
|
|
561
645
|
right: { left: "100%", top: "50%", transform: "translateY(-50%)", marginLeft: 8 }
|
|
562
646
|
};
|
|
563
|
-
return /* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
647
|
+
return /* @__PURE__ */ jsxs6("span", { style: { position: "relative", display: "inline-flex", verticalAlign: "middle", marginLeft: 6 }, children: [
|
|
648
|
+
/* @__PURE__ */ jsx6(
|
|
565
649
|
"button",
|
|
566
650
|
{
|
|
567
651
|
ref: triggerRef,
|
|
@@ -597,7 +681,7 @@ function HelpTooltip({
|
|
|
597
681
|
children: "?"
|
|
598
682
|
}
|
|
599
683
|
),
|
|
600
|
-
isVisible && /* @__PURE__ */
|
|
684
|
+
isVisible && /* @__PURE__ */ jsx6(
|
|
601
685
|
"div",
|
|
602
686
|
{
|
|
603
687
|
ref: tooltipRef,
|
|
@@ -627,7 +711,7 @@ function HelpTooltip({
|
|
|
627
711
|
}
|
|
628
712
|
|
|
629
713
|
// src/admin/components/StatusBadge.tsx
|
|
630
|
-
import { jsx as
|
|
714
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
631
715
|
var statusConfig = {
|
|
632
716
|
draft: { label: "Draft" },
|
|
633
717
|
published: { label: "Published" },
|
|
@@ -639,7 +723,7 @@ function StatusBadge({
|
|
|
639
723
|
}) {
|
|
640
724
|
const config = statusConfig[status];
|
|
641
725
|
const isSm = size === "sm";
|
|
642
|
-
return /* @__PURE__ */
|
|
726
|
+
return /* @__PURE__ */ jsxs7(
|
|
643
727
|
"span",
|
|
644
728
|
{
|
|
645
729
|
style: {
|
|
@@ -656,7 +740,7 @@ function StatusBadge({
|
|
|
656
740
|
whiteSpace: "nowrap"
|
|
657
741
|
},
|
|
658
742
|
children: [
|
|
659
|
-
/* @__PURE__ */
|
|
743
|
+
/* @__PURE__ */ jsx7(
|
|
660
744
|
"span",
|
|
661
745
|
{
|
|
662
746
|
style: {
|
|
@@ -675,46 +759,46 @@ function StatusBadge({
|
|
|
675
759
|
}
|
|
676
760
|
|
|
677
761
|
// src/admin/components/Dashboard.tsx
|
|
678
|
-
import { jsx as
|
|
762
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
679
763
|
function PagesIcon({ size = 24 }) {
|
|
680
|
-
return /* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
764
|
+
return /* @__PURE__ */ jsxs8("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
765
|
+
/* @__PURE__ */ jsx8("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
766
|
+
/* @__PURE__ */ jsx8("polyline", { points: "14 2 14 8 20 8" }),
|
|
767
|
+
/* @__PURE__ */ jsx8("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
|
|
768
|
+
/* @__PURE__ */ jsx8("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
|
|
769
|
+
/* @__PURE__ */ jsx8("polyline", { points: "10 9 9 9 8 9" })
|
|
686
770
|
] });
|
|
687
771
|
}
|
|
688
772
|
function MediaIcon({ size = 24 }) {
|
|
689
|
-
return /* @__PURE__ */
|
|
690
|
-
/* @__PURE__ */
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
773
|
+
return /* @__PURE__ */ jsxs8("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
774
|
+
/* @__PURE__ */ jsx8("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
775
|
+
/* @__PURE__ */ jsx8("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
776
|
+
/* @__PURE__ */ jsx8("polyline", { points: "21 15 16 10 5 21" })
|
|
693
777
|
] });
|
|
694
778
|
}
|
|
695
779
|
function SettingsIcon({ size = 24 }) {
|
|
696
|
-
return /* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ jsxs8("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
781
|
+
/* @__PURE__ */ jsx8("circle", { cx: "12", cy: "12", r: "3" }),
|
|
782
|
+
/* @__PURE__ */ jsx8("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.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-2 2 2 2 0 0 1-2-2v-.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 0 2 2 0 0 1 0-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-2-2 2 2 0 0 1 2-2h.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 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.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 0 2 2 0 0 1 0 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 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
699
783
|
] });
|
|
700
784
|
}
|
|
701
785
|
function LayoutIcon({ size = 24 }) {
|
|
702
|
-
return /* @__PURE__ */
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
786
|
+
return /* @__PURE__ */ jsxs8("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
787
|
+
/* @__PURE__ */ jsx8("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
788
|
+
/* @__PURE__ */ jsx8("line", { x1: "3", y1: "9", x2: "21", y2: "9" }),
|
|
789
|
+
/* @__PURE__ */ jsx8("line", { x1: "3", y1: "15", x2: "21", y2: "15" })
|
|
706
790
|
] });
|
|
707
791
|
}
|
|
708
792
|
function PlusIcon({ size = 16 }) {
|
|
709
|
-
return /* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ jsxs8("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
794
|
+
/* @__PURE__ */ jsx8("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
795
|
+
/* @__PURE__ */ jsx8("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
712
796
|
] });
|
|
713
797
|
}
|
|
714
798
|
function ClockIcon({ size = 14 }) {
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
799
|
+
return /* @__PURE__ */ jsxs8("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
800
|
+
/* @__PURE__ */ jsx8("circle", { cx: "12", cy: "12", r: "10" }),
|
|
801
|
+
/* @__PURE__ */ jsx8("polyline", { points: "12 6 12 12 16 14" })
|
|
718
802
|
] });
|
|
719
803
|
}
|
|
720
804
|
function getGreeting() {
|
|
@@ -737,11 +821,11 @@ function formatRelativeTime(dateStr) {
|
|
|
737
821
|
return date.toLocaleDateString();
|
|
738
822
|
}
|
|
739
823
|
function Dashboard() {
|
|
740
|
-
const [userName, setUserName] =
|
|
741
|
-
const [recentPages, setRecentPages] =
|
|
742
|
-
const [pageCount, setPageCount] =
|
|
743
|
-
const [mediaCount, setMediaCount] =
|
|
744
|
-
|
|
824
|
+
const [userName, setUserName] = useState5("");
|
|
825
|
+
const [recentPages, setRecentPages] = useState5([]);
|
|
826
|
+
const [pageCount, setPageCount] = useState5(null);
|
|
827
|
+
const [mediaCount, setMediaCount] = useState5(null);
|
|
828
|
+
useEffect5(() => {
|
|
745
829
|
fetch("/api/users/me", { credentials: "include" }).then((res) => res.json()).then((data) => {
|
|
746
830
|
const user = data?.user || data;
|
|
747
831
|
setUserName(user?.fullName || user?.email?.split("@")[0] || "");
|
|
@@ -757,24 +841,24 @@ function Dashboard() {
|
|
|
757
841
|
}).catch(() => {
|
|
758
842
|
});
|
|
759
843
|
}, []);
|
|
760
|
-
return /* @__PURE__ */
|
|
761
|
-
/* @__PURE__ */
|
|
762
|
-
/* @__PURE__ */
|
|
763
|
-
/* @__PURE__ */
|
|
844
|
+
return /* @__PURE__ */ jsxs8("div", { style: { padding: "32px", maxWidth: 1200, margin: "0 auto" }, children: [
|
|
845
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", marginBottom: 32 }, children: [
|
|
846
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
847
|
+
/* @__PURE__ */ jsxs8("h1", { style: { fontSize: 28, fontWeight: 700, color: "var(--admin-text)", margin: "0 0 6px" }, children: [
|
|
764
848
|
getGreeting(),
|
|
765
849
|
userName ? `, ${userName}` : ""
|
|
766
850
|
] }),
|
|
767
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ jsx8("p", { style: { fontSize: 15, color: "var(--admin-text-muted)", margin: 0 }, children: "Manage your website content and settings from here." })
|
|
768
852
|
] }),
|
|
769
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx8(ThemeSwitcher, {})
|
|
770
854
|
] }),
|
|
771
|
-
/* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
855
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", gap: 10, marginBottom: 32, flexWrap: "wrap" }, children: [
|
|
856
|
+
/* @__PURE__ */ jsx8(QuickAction, { href: "/admin/collections/pages/create", icon: /* @__PURE__ */ jsx8(PlusIcon, {}), label: "New Page" }),
|
|
857
|
+
/* @__PURE__ */ jsx8(QuickAction, { href: "/admin/collections/media/create", icon: /* @__PURE__ */ jsx8(PlusIcon, {}), label: "Upload Media" }),
|
|
858
|
+
/* @__PURE__ */ jsx8(QuickAction, { href: "/admin/globals/header", icon: /* @__PURE__ */ jsx8(LayoutIcon, { size: 16 }), label: "Edit Navigation" }),
|
|
859
|
+
/* @__PURE__ */ jsx8(QuickAction, { href: "/admin/globals/site-settings", icon: /* @__PURE__ */ jsx8(SettingsIcon, { size: 16 }), label: "Website Settings" })
|
|
776
860
|
] }),
|
|
777
|
-
/* @__PURE__ */
|
|
861
|
+
/* @__PURE__ */ jsxs8(
|
|
778
862
|
"div",
|
|
779
863
|
{
|
|
780
864
|
style: {
|
|
@@ -784,10 +868,10 @@ function Dashboard() {
|
|
|
784
868
|
marginBottom: 32
|
|
785
869
|
},
|
|
786
870
|
children: [
|
|
787
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ jsx8(
|
|
788
872
|
ContentCard,
|
|
789
873
|
{
|
|
790
|
-
icon: /* @__PURE__ */
|
|
874
|
+
icon: /* @__PURE__ */ jsx8(PagesIcon, {}),
|
|
791
875
|
title: "Pages",
|
|
792
876
|
description: "Create and manage your website pages",
|
|
793
877
|
count: pageCount,
|
|
@@ -799,10 +883,10 @@ function Dashboard() {
|
|
|
799
883
|
]
|
|
800
884
|
}
|
|
801
885
|
),
|
|
802
|
-
/* @__PURE__ */
|
|
886
|
+
/* @__PURE__ */ jsx8(
|
|
803
887
|
ContentCard,
|
|
804
888
|
{
|
|
805
|
-
icon: /* @__PURE__ */
|
|
889
|
+
icon: /* @__PURE__ */ jsx8(MediaIcon, {}),
|
|
806
890
|
title: "Media Library",
|
|
807
891
|
description: "Upload and organize images and files",
|
|
808
892
|
count: mediaCount,
|
|
@@ -814,10 +898,10 @@ function Dashboard() {
|
|
|
814
898
|
]
|
|
815
899
|
}
|
|
816
900
|
),
|
|
817
|
-
/* @__PURE__ */
|
|
901
|
+
/* @__PURE__ */ jsx8(
|
|
818
902
|
ContentCard,
|
|
819
903
|
{
|
|
820
|
-
icon: /* @__PURE__ */
|
|
904
|
+
icon: /* @__PURE__ */ jsx8(LayoutIcon, {}),
|
|
821
905
|
title: "Site Design",
|
|
822
906
|
description: "Customize your header, footer, and site-wide settings",
|
|
823
907
|
tooltip: "These settings apply to every page on your website \u2014 your navigation menu, footer information, and global SEO settings.",
|
|
@@ -831,7 +915,7 @@ function Dashboard() {
|
|
|
831
915
|
]
|
|
832
916
|
}
|
|
833
917
|
),
|
|
834
|
-
recentPages.length > 0 && /* @__PURE__ */
|
|
918
|
+
recentPages.length > 0 && /* @__PURE__ */ jsxs8(
|
|
835
919
|
"div",
|
|
836
920
|
{
|
|
837
921
|
style: {
|
|
@@ -841,7 +925,7 @@ function Dashboard() {
|
|
|
841
925
|
overflow: "hidden"
|
|
842
926
|
},
|
|
843
927
|
children: [
|
|
844
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ jsxs8(
|
|
845
929
|
"div",
|
|
846
930
|
{
|
|
847
931
|
style: {
|
|
@@ -852,11 +936,11 @@ function Dashboard() {
|
|
|
852
936
|
justifyContent: "space-between"
|
|
853
937
|
},
|
|
854
938
|
children: [
|
|
855
|
-
/* @__PURE__ */
|
|
856
|
-
/* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ jsxs8("h3", { style: { fontSize: 15, fontWeight: 600, color: "var(--admin-text)", margin: 0, display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
940
|
+
/* @__PURE__ */ jsx8(ClockIcon, {}),
|
|
857
941
|
" Recently Edited"
|
|
858
942
|
] }),
|
|
859
|
-
/* @__PURE__ */
|
|
943
|
+
/* @__PURE__ */ jsx8(
|
|
860
944
|
"a",
|
|
861
945
|
{
|
|
862
946
|
href: "/admin/collections/pages",
|
|
@@ -867,7 +951,7 @@ function Dashboard() {
|
|
|
867
951
|
]
|
|
868
952
|
}
|
|
869
953
|
),
|
|
870
|
-
recentPages.map((page, i) => /* @__PURE__ */
|
|
954
|
+
recentPages.map((page, i) => /* @__PURE__ */ jsxs8(
|
|
871
955
|
"a",
|
|
872
956
|
{
|
|
873
957
|
href: `/admin/collections/pages/${page.id}`,
|
|
@@ -887,13 +971,13 @@ function Dashboard() {
|
|
|
887
971
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
888
972
|
},
|
|
889
973
|
children: [
|
|
890
|
-
/* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
974
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: 12, minWidth: 0 }, children: [
|
|
975
|
+
/* @__PURE__ */ jsx8(PagesIcon, { size: 16 }),
|
|
976
|
+
/* @__PURE__ */ jsx8("span", { style: { fontSize: 14, fontWeight: 500, color: "var(--admin-text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: page.title || page.slug || "Untitled" })
|
|
893
977
|
] }),
|
|
894
|
-
/* @__PURE__ */
|
|
895
|
-
page._status && /* @__PURE__ */
|
|
896
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: 12, flexShrink: 0 }, children: [
|
|
979
|
+
page._status && /* @__PURE__ */ jsx8(StatusBadge, { status: page._status, size: "sm" }),
|
|
980
|
+
/* @__PURE__ */ jsx8("span", { style: { fontSize: 12, color: "var(--admin-text-muted)", whiteSpace: "nowrap" }, children: formatRelativeTime(page.updatedAt) })
|
|
897
981
|
] })
|
|
898
982
|
]
|
|
899
983
|
},
|
|
@@ -905,7 +989,7 @@ function Dashboard() {
|
|
|
905
989
|
] });
|
|
906
990
|
}
|
|
907
991
|
function QuickAction({ href, icon, label }) {
|
|
908
|
-
return /* @__PURE__ */
|
|
992
|
+
return /* @__PURE__ */ jsxs8(
|
|
909
993
|
"a",
|
|
910
994
|
{
|
|
911
995
|
href,
|
|
@@ -950,7 +1034,7 @@ function ContentCard({
|
|
|
950
1034
|
tooltip,
|
|
951
1035
|
actions
|
|
952
1036
|
}) {
|
|
953
|
-
return /* @__PURE__ */
|
|
1037
|
+
return /* @__PURE__ */ jsxs8(
|
|
954
1038
|
"div",
|
|
955
1039
|
{
|
|
956
1040
|
style: {
|
|
@@ -965,8 +1049,8 @@ function ContentCard({
|
|
|
965
1049
|
transition: "all 0.2s ease"
|
|
966
1050
|
},
|
|
967
1051
|
children: [
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
1052
|
+
/* @__PURE__ */ jsx8("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between" }, children: /* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
1053
|
+
/* @__PURE__ */ jsx8(
|
|
970
1054
|
"div",
|
|
971
1055
|
{
|
|
972
1056
|
style: {
|
|
@@ -982,20 +1066,20 @@ function ContentCard({
|
|
|
982
1066
|
children: icon
|
|
983
1067
|
}
|
|
984
1068
|
),
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
/* @__PURE__ */
|
|
1069
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
1070
|
+
/* @__PURE__ */ jsxs8("h3", { style: { fontSize: 16, fontWeight: 600, color: "var(--admin-text)", margin: 0, display: "flex", alignItems: "center" }, children: [
|
|
987
1071
|
title,
|
|
988
|
-
tooltip && /* @__PURE__ */
|
|
1072
|
+
tooltip && /* @__PURE__ */ jsx8(HelpTooltip, { content: tooltip, position: "right" })
|
|
989
1073
|
] }),
|
|
990
|
-
count !== void 0 && count !== null && /* @__PURE__ */
|
|
1074
|
+
count !== void 0 && count !== null && /* @__PURE__ */ jsxs8("span", { style: { fontSize: 12, color: "var(--admin-text-muted)" }, children: [
|
|
991
1075
|
count,
|
|
992
1076
|
" ",
|
|
993
1077
|
countLabel
|
|
994
1078
|
] })
|
|
995
1079
|
] })
|
|
996
1080
|
] }) }),
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
actions && actions.length > 0 && /* @__PURE__ */
|
|
1081
|
+
/* @__PURE__ */ jsx8("p", { style: { fontSize: 13, color: "var(--admin-text-muted)", margin: 0, lineHeight: 1.5 }, children: description }),
|
|
1082
|
+
actions && actions.length > 0 && /* @__PURE__ */ jsx8("div", { style: { display: "flex", gap: 8, marginTop: "auto", flexWrap: "wrap" }, children: actions.map((action) => /* @__PURE__ */ jsx8(
|
|
999
1083
|
"a",
|
|
1000
1084
|
{
|
|
1001
1085
|
href: action.href,
|
|
@@ -1027,7 +1111,7 @@ function ContentCard({
|
|
|
1027
1111
|
}
|
|
1028
1112
|
|
|
1029
1113
|
// src/admin/components/EmptyState.tsx
|
|
1030
|
-
import { jsx as
|
|
1114
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1031
1115
|
function EmptyState({
|
|
1032
1116
|
icon,
|
|
1033
1117
|
title,
|
|
@@ -1035,7 +1119,7 @@ function EmptyState({
|
|
|
1035
1119
|
actionLabel,
|
|
1036
1120
|
actionHref
|
|
1037
1121
|
}) {
|
|
1038
|
-
return /* @__PURE__ */
|
|
1122
|
+
return /* @__PURE__ */ jsxs9(
|
|
1039
1123
|
"div",
|
|
1040
1124
|
{
|
|
1041
1125
|
style: {
|
|
@@ -1050,7 +1134,7 @@ function EmptyState({
|
|
|
1050
1134
|
border: "1px dashed var(--admin-border)"
|
|
1051
1135
|
},
|
|
1052
1136
|
children: [
|
|
1053
|
-
icon && /* @__PURE__ */
|
|
1137
|
+
icon && /* @__PURE__ */ jsx9(
|
|
1054
1138
|
"div",
|
|
1055
1139
|
{
|
|
1056
1140
|
style: {
|
|
@@ -1061,7 +1145,7 @@ function EmptyState({
|
|
|
1061
1145
|
children: icon
|
|
1062
1146
|
}
|
|
1063
1147
|
),
|
|
1064
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx9(
|
|
1065
1149
|
"h3",
|
|
1066
1150
|
{
|
|
1067
1151
|
style: {
|
|
@@ -1073,7 +1157,7 @@ function EmptyState({
|
|
|
1073
1157
|
children: title
|
|
1074
1158
|
}
|
|
1075
1159
|
),
|
|
1076
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ jsx9(
|
|
1077
1161
|
"p",
|
|
1078
1162
|
{
|
|
1079
1163
|
style: {
|
|
@@ -1086,7 +1170,7 @@ function EmptyState({
|
|
|
1086
1170
|
children: description
|
|
1087
1171
|
}
|
|
1088
1172
|
),
|
|
1089
|
-
actionLabel && actionHref && /* @__PURE__ */
|
|
1173
|
+
actionLabel && actionHref && /* @__PURE__ */ jsx9(
|
|
1090
1174
|
"a",
|
|
1091
1175
|
{
|
|
1092
1176
|
href: actionHref,
|
|
@@ -1113,24 +1197,24 @@ function EmptyState({
|
|
|
1113
1197
|
|
|
1114
1198
|
// src/admin/components/OrionBlocksField.tsx
|
|
1115
1199
|
import { lazy, Suspense } from "react";
|
|
1116
|
-
import { jsx as
|
|
1200
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1117
1201
|
var OrionBlocksFieldImpl = lazy(async () => {
|
|
1118
1202
|
const mod = await import("../OrionBlocksFieldImpl-QX5GTMQZ.mjs");
|
|
1119
1203
|
return { default: mod.OrionBlocksFieldImpl };
|
|
1120
1204
|
});
|
|
1121
1205
|
function OrionBlocksField(props) {
|
|
1122
|
-
return /* @__PURE__ */
|
|
1206
|
+
return /* @__PURE__ */ jsx10(Suspense, { fallback: null, children: /* @__PURE__ */ jsx10(OrionBlocksFieldImpl, { ...props }) });
|
|
1123
1207
|
}
|
|
1124
1208
|
|
|
1125
1209
|
// src/admin/components/WelcomeHeader.tsx
|
|
1126
|
-
import { jsx as
|
|
1210
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1127
1211
|
function WelcomeHeader({
|
|
1128
1212
|
title,
|
|
1129
1213
|
description,
|
|
1130
1214
|
tooltip,
|
|
1131
1215
|
actions
|
|
1132
1216
|
}) {
|
|
1133
|
-
return /* @__PURE__ */
|
|
1217
|
+
return /* @__PURE__ */ jsxs10(
|
|
1134
1218
|
"div",
|
|
1135
1219
|
{
|
|
1136
1220
|
style: {
|
|
@@ -1142,8 +1226,8 @@ function WelcomeHeader({
|
|
|
1142
1226
|
marginBottom: 24
|
|
1143
1227
|
},
|
|
1144
1228
|
children: [
|
|
1145
|
-
/* @__PURE__ */
|
|
1146
|
-
/* @__PURE__ */
|
|
1229
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
1230
|
+
/* @__PURE__ */ jsxs10(
|
|
1147
1231
|
"h1",
|
|
1148
1232
|
{
|
|
1149
1233
|
style: {
|
|
@@ -1156,62 +1240,109 @@ function WelcomeHeader({
|
|
|
1156
1240
|
},
|
|
1157
1241
|
children: [
|
|
1158
1242
|
title,
|
|
1159
|
-
tooltip && /* @__PURE__ */
|
|
1243
|
+
tooltip && /* @__PURE__ */ jsx11(HelpTooltip, { content: tooltip, position: "right" })
|
|
1160
1244
|
]
|
|
1161
1245
|
}
|
|
1162
1246
|
),
|
|
1163
|
-
description && /* @__PURE__ */
|
|
1247
|
+
description && /* @__PURE__ */ jsx11("p", { style: { fontSize: 14, color: "var(--admin-text-muted)", margin: "6px 0 0" }, children: description })
|
|
1164
1248
|
] }),
|
|
1165
|
-
actions && /* @__PURE__ */
|
|
1249
|
+
actions && /* @__PURE__ */ jsx11("div", { style: { display: "flex", gap: 8 }, children: actions })
|
|
1166
1250
|
]
|
|
1167
1251
|
}
|
|
1168
1252
|
);
|
|
1169
1253
|
}
|
|
1170
1254
|
|
|
1171
|
-
// src/admin/components/studio/
|
|
1172
|
-
import
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1176
|
-
function AdminBreadcrumbs({ items }) {
|
|
1177
|
-
return /* @__PURE__ */ jsx11("nav", { "aria-label": "Breadcrumb", className: "orion-admin-breadcrumbs", children: items.map((item, index) => {
|
|
1178
|
-
const isLast = index === items.length - 1;
|
|
1179
|
-
return /* @__PURE__ */ jsxs10("span", { children: [
|
|
1180
|
-
item.href && !isLast ? /* @__PURE__ */ jsx11("a", { href: item.href, children: item.label }) : /* @__PURE__ */ jsx11("span", { children: item.label }),
|
|
1181
|
-
!isLast ? /* @__PURE__ */ jsx11("span", { className: "orion-admin-breadcrumb-sep", children: "/" }) : null
|
|
1182
|
-
] }, `${item.label}-${index}`);
|
|
1183
|
-
}) });
|
|
1184
|
-
}
|
|
1255
|
+
// src/admin/components/studio/AdminStudioNav.tsx
|
|
1256
|
+
import { useMemo } from "react";
|
|
1257
|
+
import { usePathname } from "next/navigation";
|
|
1258
|
+
import { Logout, useAuth } from "@payloadcms/ui";
|
|
1185
1259
|
|
|
1186
|
-
// src/admin
|
|
1187
|
-
import {
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1260
|
+
// src/admin/components/studio/adminPathUtils.ts
|
|
1261
|
+
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1262
|
+
var DEFAULT_ADMIN_BASE_PATH = "/admin";
|
|
1263
|
+
var normalizePath = (value) => {
|
|
1264
|
+
if (!value || value === "/") return "/";
|
|
1265
|
+
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
1266
|
+
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
1267
|
+
return trimmed.length > 0 ? trimmed : "/";
|
|
1268
|
+
};
|
|
1269
|
+
var normalizeAdminBasePath = (value) => {
|
|
1270
|
+
const normalized = normalizePath(value);
|
|
1271
|
+
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH : normalized;
|
|
1272
|
+
};
|
|
1273
|
+
var detectAdminBasePath = (pathname, fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1274
|
+
const normalizedPathname = normalizePath(pathname);
|
|
1275
|
+
const normalizedFallback = normalizeAdminBasePath(fallback);
|
|
1276
|
+
const markers = [
|
|
1277
|
+
"/contact-form",
|
|
1278
|
+
"/collections/",
|
|
1279
|
+
"/globals/",
|
|
1280
|
+
"/forms",
|
|
1281
|
+
"/pages/",
|
|
1282
|
+
"/tools",
|
|
1283
|
+
"/media",
|
|
1284
|
+
"/logout",
|
|
1285
|
+
"/login"
|
|
1286
|
+
];
|
|
1287
|
+
for (const marker of markers) {
|
|
1288
|
+
const index = normalizedPathname.indexOf(marker);
|
|
1289
|
+
if (index > 0) {
|
|
1290
|
+
return normalizeAdminBasePath(normalizedPathname.slice(0, index));
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
if (normalizedPathname === normalizedFallback || normalizedPathname.startsWith(`${normalizedFallback}/`)) {
|
|
1294
|
+
return normalizedFallback;
|
|
1295
|
+
}
|
|
1296
|
+
const segments = normalizedPathname.split("/").filter(Boolean);
|
|
1297
|
+
if (segments.length > 0) {
|
|
1298
|
+
return normalizeAdminBasePath(`/${segments[0]}`);
|
|
1299
|
+
}
|
|
1300
|
+
return normalizedFallback;
|
|
1301
|
+
};
|
|
1302
|
+
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
1303
|
+
var resolveAdminPath = (adminBasePath, targetPath) => {
|
|
1304
|
+
if (!targetPath) return adminBasePath;
|
|
1305
|
+
if (isAbsoluteExternalURL(targetPath)) return targetPath;
|
|
1306
|
+
const normalizedBasePath = normalizeAdminBasePath(adminBasePath);
|
|
1307
|
+
const normalizedTargetPath = normalizePath(targetPath);
|
|
1308
|
+
if (normalizedTargetPath === "/admin") {
|
|
1309
|
+
return normalizedBasePath;
|
|
1310
|
+
}
|
|
1311
|
+
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
1312
|
+
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
1313
|
+
}
|
|
1314
|
+
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
1315
|
+
return normalizedTargetPath;
|
|
1316
|
+
}
|
|
1317
|
+
if (normalizedTargetPath === "/") {
|
|
1318
|
+
return normalizedBasePath;
|
|
1319
|
+
}
|
|
1320
|
+
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
1321
|
+
};
|
|
1322
|
+
var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1323
|
+
const [adminBasePath, setAdminBasePath] = useState6(normalizeAdminBasePath(fallback));
|
|
1324
|
+
useEffect6(() => {
|
|
1325
|
+
const update = () => {
|
|
1326
|
+
setAdminBasePath(detectAdminBasePath(window.location.pathname, fallback));
|
|
1327
|
+
};
|
|
1328
|
+
update();
|
|
1329
|
+
window.addEventListener("popstate", update);
|
|
1330
|
+
return () => window.removeEventListener("popstate", update);
|
|
1331
|
+
}, [fallback]);
|
|
1332
|
+
return adminBasePath;
|
|
1333
|
+
};
|
|
1203
1334
|
|
|
1204
1335
|
// src/shared/studioSections.ts
|
|
1205
1336
|
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
1206
1337
|
var studioIcons = new Set(adminNavIcons);
|
|
1207
1338
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1208
|
-
var
|
|
1339
|
+
var isAbsoluteExternalURL2 = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
1209
1340
|
var normalizePathLikeValue = (value) => {
|
|
1210
1341
|
const trimmed = value.trim();
|
|
1211
1342
|
if (!trimmed) {
|
|
1212
1343
|
return "";
|
|
1213
1344
|
}
|
|
1214
|
-
if (
|
|
1345
|
+
if (isAbsoluteExternalURL2(trimmed)) {
|
|
1215
1346
|
return trimmed;
|
|
1216
1347
|
}
|
|
1217
1348
|
const withLeadingSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
@@ -1279,86 +1410,6 @@ var resolveStudioSections = (value) => {
|
|
|
1279
1410
|
return sections;
|
|
1280
1411
|
};
|
|
1281
1412
|
|
|
1282
|
-
// src/admin/components/studio/adminPathUtils.ts
|
|
1283
|
-
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
1284
|
-
var DEFAULT_ADMIN_BASE_PATH = "/admin";
|
|
1285
|
-
var normalizePath = (value) => {
|
|
1286
|
-
if (!value || value === "/") return "/";
|
|
1287
|
-
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
1288
|
-
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
1289
|
-
return trimmed.length > 0 ? trimmed : "/";
|
|
1290
|
-
};
|
|
1291
|
-
var normalizeAdminBasePath = (value) => {
|
|
1292
|
-
const normalized = normalizePath(value);
|
|
1293
|
-
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH : normalized;
|
|
1294
|
-
};
|
|
1295
|
-
var detectAdminBasePath = (pathname, fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1296
|
-
const normalizedPathname = normalizePath(pathname);
|
|
1297
|
-
const normalizedFallback = normalizeAdminBasePath(fallback);
|
|
1298
|
-
const markers = [
|
|
1299
|
-
"/contact-form",
|
|
1300
|
-
"/collections/",
|
|
1301
|
-
"/globals/",
|
|
1302
|
-
"/forms",
|
|
1303
|
-
"/pages/",
|
|
1304
|
-
"/tools",
|
|
1305
|
-
"/media",
|
|
1306
|
-
"/logout",
|
|
1307
|
-
"/login"
|
|
1308
|
-
];
|
|
1309
|
-
for (const marker of markers) {
|
|
1310
|
-
const index = normalizedPathname.indexOf(marker);
|
|
1311
|
-
if (index > 0) {
|
|
1312
|
-
return normalizeAdminBasePath(normalizedPathname.slice(0, index));
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
if (normalizedPathname === normalizedFallback || normalizedPathname.startsWith(`${normalizedFallback}/`)) {
|
|
1316
|
-
return normalizedFallback;
|
|
1317
|
-
}
|
|
1318
|
-
const segments = normalizedPathname.split("/").filter(Boolean);
|
|
1319
|
-
if (segments.length > 0) {
|
|
1320
|
-
return normalizeAdminBasePath(`/${segments[0]}`);
|
|
1321
|
-
}
|
|
1322
|
-
return normalizedFallback;
|
|
1323
|
-
};
|
|
1324
|
-
var isAbsoluteExternalURL2 = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
1325
|
-
var resolveAdminPath = (adminBasePath, targetPath) => {
|
|
1326
|
-
if (!targetPath) return adminBasePath;
|
|
1327
|
-
if (isAbsoluteExternalURL2(targetPath)) return targetPath;
|
|
1328
|
-
const normalizedBasePath = normalizeAdminBasePath(adminBasePath);
|
|
1329
|
-
const normalizedTargetPath = normalizePath(targetPath);
|
|
1330
|
-
if (normalizedTargetPath === "/admin") {
|
|
1331
|
-
return normalizedBasePath;
|
|
1332
|
-
}
|
|
1333
|
-
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
1334
|
-
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
1335
|
-
}
|
|
1336
|
-
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
1337
|
-
return normalizedTargetPath;
|
|
1338
|
-
}
|
|
1339
|
-
if (normalizedTargetPath === "/") {
|
|
1340
|
-
return normalizedBasePath;
|
|
1341
|
-
}
|
|
1342
|
-
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
1343
|
-
};
|
|
1344
|
-
var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1345
|
-
const [adminBasePath, setAdminBasePath] = useState5(normalizeAdminBasePath(fallback));
|
|
1346
|
-
useEffect5(() => {
|
|
1347
|
-
const update = () => {
|
|
1348
|
-
setAdminBasePath(detectAdminBasePath(window.location.pathname, fallback));
|
|
1349
|
-
};
|
|
1350
|
-
update();
|
|
1351
|
-
window.addEventListener("popstate", update);
|
|
1352
|
-
return () => window.removeEventListener("popstate", update);
|
|
1353
|
-
}, [fallback]);
|
|
1354
|
-
return adminBasePath;
|
|
1355
|
-
};
|
|
1356
|
-
|
|
1357
|
-
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
1358
|
-
import { useLayoutEffect as useLayoutEffect2, useMemo } from "react";
|
|
1359
|
-
import { usePathname, useRouter } from "next/navigation";
|
|
1360
|
-
import { useAuth } from "@payloadcms/ui";
|
|
1361
|
-
|
|
1362
1413
|
// src/admin/components/studio/studioNavModel.ts
|
|
1363
1414
|
var getPropString = (props, key, fallback) => {
|
|
1364
1415
|
if (!props || typeof props !== "object") return fallback;
|
|
@@ -1432,7 +1483,7 @@ var buildStudioNavItems = (props, adminBasePath) => {
|
|
|
1432
1483
|
const resolvedGlobalsExtraMatchPrefixes = globalsExtraMatchPrefixes.map(
|
|
1433
1484
|
(prefix) => resolveAdminPath(adminBasePath, prefix)
|
|
1434
1485
|
);
|
|
1435
|
-
const
|
|
1486
|
+
const baseItemsBeforeTools = [
|
|
1436
1487
|
{
|
|
1437
1488
|
href: adminBasePath,
|
|
1438
1489
|
icon: "dashboard",
|
|
@@ -1473,15 +1524,15 @@ var buildStudioNavItems = (props, adminBasePath) => {
|
|
|
1473
1524
|
icon: "media",
|
|
1474
1525
|
label: "Media",
|
|
1475
1526
|
matchPrefixes: [mediaPath, resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`)]
|
|
1476
|
-
},
|
|
1477
|
-
{
|
|
1478
|
-
href: toolsPath,
|
|
1479
|
-
icon: "tools",
|
|
1480
|
-
label: "Admin Tools",
|
|
1481
|
-
matchPrefixes: [toolsPath, resolveAdminPath(adminBasePath, "/collections/users")],
|
|
1482
|
-
roles: ["admin"]
|
|
1483
1527
|
}
|
|
1484
1528
|
];
|
|
1529
|
+
const adminToolsItem = {
|
|
1530
|
+
href: toolsPath,
|
|
1531
|
+
icon: "tools",
|
|
1532
|
+
label: "Admin Tools",
|
|
1533
|
+
matchPrefixes: [toolsPath, resolveAdminPath(adminBasePath, "/collections/users")],
|
|
1534
|
+
roles: ["admin"]
|
|
1535
|
+
};
|
|
1485
1536
|
const extensionItems = sections.map((section) => ({
|
|
1486
1537
|
href: resolveAdminPath(adminBasePath, section.href),
|
|
1487
1538
|
...section.icon ? { icon: section.icon } : {},
|
|
@@ -1489,7 +1540,7 @@ var buildStudioNavItems = (props, adminBasePath) => {
|
|
|
1489
1540
|
matchPrefixes: section.matchPrefixes.map((prefix) => resolveAdminPath(adminBasePath, prefix)),
|
|
1490
1541
|
roles: section.roles
|
|
1491
1542
|
}));
|
|
1492
|
-
return [...
|
|
1543
|
+
return [...baseItemsBeforeTools, ...extensionItems, adminToolsItem];
|
|
1493
1544
|
};
|
|
1494
1545
|
var isStudioShellRoute = (pathname, props, adminBasePath) => {
|
|
1495
1546
|
const globalsBasePath = getPropString(props, "globalsBasePath", "/globals");
|
|
@@ -1516,30 +1567,205 @@ var isStudioShellRoute = (pathname, props, adminBasePath) => {
|
|
|
1516
1567
|
return shellPrefixes.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`));
|
|
1517
1568
|
};
|
|
1518
1569
|
|
|
1519
|
-
// src/admin/components/studio/
|
|
1520
|
-
import { jsx as
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1570
|
+
// src/admin/components/studio/AdminStudioNav.tsx
|
|
1571
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1572
|
+
var iconSize2 = 18;
|
|
1573
|
+
function NavIcon({ sectionID }) {
|
|
1574
|
+
const props = {
|
|
1575
|
+
fill: "none",
|
|
1576
|
+
height: iconSize2,
|
|
1577
|
+
stroke: "currentColor",
|
|
1578
|
+
strokeLinecap: "round",
|
|
1579
|
+
strokeLinejoin: "round",
|
|
1580
|
+
strokeWidth: 2,
|
|
1581
|
+
viewBox: "0 0 24 24",
|
|
1582
|
+
width: iconSize2
|
|
1583
|
+
};
|
|
1584
|
+
switch (sectionID) {
|
|
1585
|
+
case "dashboard":
|
|
1586
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1587
|
+
/* @__PURE__ */ jsx12("rect", { x: "3", y: "3", width: "7", height: "9", rx: "1" }),
|
|
1588
|
+
/* @__PURE__ */ jsx12("rect", { x: "14", y: "3", width: "7", height: "5", rx: "1" }),
|
|
1589
|
+
/* @__PURE__ */ jsx12("rect", { x: "14", y: "12", width: "7", height: "9", rx: "1" }),
|
|
1590
|
+
/* @__PURE__ */ jsx12("rect", { x: "3", y: "16", width: "7", height: "5", rx: "1" })
|
|
1591
|
+
] });
|
|
1592
|
+
case "pages":
|
|
1593
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1594
|
+
/* @__PURE__ */ jsx12("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
|
|
1595
|
+
/* @__PURE__ */ jsx12("polyline", { points: "14 2 14 8 20 8" }),
|
|
1596
|
+
/* @__PURE__ */ jsx12("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
|
|
1597
|
+
/* @__PURE__ */ jsx12("line", { x1: "8", y1: "17", x2: "12", y2: "17" })
|
|
1598
|
+
] });
|
|
1599
|
+
case "forms":
|
|
1600
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1601
|
+
/* @__PURE__ */ jsx12("path", { d: "M9 3h6" }),
|
|
1602
|
+
/* @__PURE__ */ jsx12("path", { d: "M12 3v18" }),
|
|
1603
|
+
/* @__PURE__ */ jsx12("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" }),
|
|
1604
|
+
/* @__PURE__ */ jsx12("path", { d: "M7 11h10" }),
|
|
1605
|
+
/* @__PURE__ */ jsx12("path", { d: "M7 15h6" })
|
|
1606
|
+
] });
|
|
1607
|
+
case "globals":
|
|
1608
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1609
|
+
/* @__PURE__ */ jsx12("circle", { cx: "12", cy: "12", r: "3" }),
|
|
1610
|
+
/* @__PURE__ */ jsx12("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" })
|
|
1611
|
+
] });
|
|
1612
|
+
case "media":
|
|
1613
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1614
|
+
/* @__PURE__ */ jsx12("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
1615
|
+
/* @__PURE__ */ jsx12("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
1616
|
+
/* @__PURE__ */ jsx12("polyline", { points: "21 15 16 10 5 21" })
|
|
1617
|
+
] });
|
|
1618
|
+
case "analytics":
|
|
1619
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1620
|
+
/* @__PURE__ */ jsx12("path", { d: "M4 19V5" }),
|
|
1621
|
+
/* @__PURE__ */ jsx12("path", { d: "M10 19V10" }),
|
|
1622
|
+
/* @__PURE__ */ jsx12("path", { d: "M16 19v-6" }),
|
|
1623
|
+
/* @__PURE__ */ jsx12("path", { d: "M22 19V3" })
|
|
1624
|
+
] });
|
|
1625
|
+
case "admin-tools":
|
|
1626
|
+
return /* @__PURE__ */ jsx12("svg", { ...props, children: /* @__PURE__ */ jsx12("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" }) });
|
|
1627
|
+
default:
|
|
1628
|
+
return null;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
function AdminStudioNav(props) {
|
|
1632
|
+
const { user } = useAuth();
|
|
1633
|
+
const brandName = getPropString(props, "brandName", "Orion Studio");
|
|
1634
|
+
const logoUrl = getPropString(props, "logoUrl", "");
|
|
1635
|
+
const compact = getPropBoolean(props, "compact", false);
|
|
1636
|
+
const adminBasePath = useAdminBasePath();
|
|
1637
|
+
const pathname = usePathname() || "";
|
|
1638
|
+
const branding = useSiteBranding(brandName, logoUrl || void 0);
|
|
1639
|
+
const resolvedName = branding.siteName || brandName;
|
|
1640
|
+
const dashboardPath = adminBasePath;
|
|
1641
|
+
const userRole = readUserRole(user);
|
|
1642
|
+
const links = useMemo(() => buildStudioNavItems(props, adminBasePath), [adminBasePath, props]);
|
|
1643
|
+
if (isStudioShellRoute(pathname, props, adminBasePath)) {
|
|
1644
|
+
return null;
|
|
1645
|
+
}
|
|
1646
|
+
const linkStyle = (active) => ({
|
|
1647
|
+
alignItems: "center",
|
|
1648
|
+
background: active ? "var(--theme-elevation-100)" : "transparent",
|
|
1649
|
+
borderRadius: 10,
|
|
1650
|
+
color: "var(--theme-elevation-900)",
|
|
1651
|
+
display: "flex",
|
|
1652
|
+
fontSize: "0.95rem",
|
|
1653
|
+
fontWeight: active ? 800 : 650,
|
|
1654
|
+
justifyContent: compact ? "center" : "flex-start",
|
|
1655
|
+
minHeight: 40,
|
|
1656
|
+
padding: compact ? "0.6rem" : "0.6rem 0.75rem",
|
|
1657
|
+
textDecoration: "none"
|
|
1658
|
+
});
|
|
1659
|
+
return /* @__PURE__ */ jsxs11(
|
|
1660
|
+
"div",
|
|
1661
|
+
{
|
|
1662
|
+
style: {
|
|
1663
|
+
display: "flex",
|
|
1664
|
+
flexDirection: "column",
|
|
1665
|
+
gap: "0.85rem",
|
|
1666
|
+
height: "100%",
|
|
1667
|
+
padding: compact ? "0.8rem 0.5rem" : "1rem 0.85rem"
|
|
1668
|
+
},
|
|
1669
|
+
children: [
|
|
1670
|
+
/* @__PURE__ */ jsxs11("div", { className: "admin-studio-brand", style: { padding: compact ? "0" : "0 0.35rem 0 2.4rem" }, children: [
|
|
1671
|
+
branding.logoUrl ? /* @__PURE__ */ jsx12(
|
|
1672
|
+
"div",
|
|
1673
|
+
{
|
|
1674
|
+
style: {
|
|
1675
|
+
borderRadius: 8,
|
|
1676
|
+
height: compact ? 34 : 40,
|
|
1677
|
+
marginBottom: compact ? 0 : "0.35rem",
|
|
1678
|
+
overflow: "hidden",
|
|
1679
|
+
width: compact ? 34 : 40
|
|
1680
|
+
},
|
|
1681
|
+
children: /* @__PURE__ */ jsx12("img", { alt: `${resolvedName} logo`, src: branding.logoUrl, style: { height: "100%", objectFit: "cover", width: "100%" } })
|
|
1682
|
+
}
|
|
1683
|
+
) : null,
|
|
1684
|
+
/* @__PURE__ */ jsx12(
|
|
1685
|
+
"div",
|
|
1686
|
+
{
|
|
1687
|
+
style: {
|
|
1688
|
+
fontSize: compact ? "0.95rem" : "1.05rem",
|
|
1689
|
+
fontWeight: 900,
|
|
1690
|
+
letterSpacing: "-0.01em",
|
|
1691
|
+
overflow: "hidden",
|
|
1692
|
+
textOverflow: "ellipsis",
|
|
1693
|
+
whiteSpace: "nowrap"
|
|
1694
|
+
},
|
|
1695
|
+
title: resolvedName,
|
|
1696
|
+
children: compact ? resolvedName.slice(0, 1).toUpperCase() : resolvedName
|
|
1697
|
+
}
|
|
1698
|
+
),
|
|
1699
|
+
!compact ? /* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.85rem" }, children: "Studio" }) : null
|
|
1700
|
+
] }),
|
|
1701
|
+
/* @__PURE__ */ jsx12("nav", { style: { display: "grid", gap: "0.25rem" }, children: links.filter((link) => !link.roles || userRole && link.roles.includes(userRole)).map((link) => {
|
|
1702
|
+
const active = link.href === dashboardPath ? pathname === dashboardPath : link.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
1703
|
+
return /* @__PURE__ */ jsx12("a", { href: link.href, style: linkStyle(active), title: link.label, children: (() => {
|
|
1704
|
+
const icon = /* @__PURE__ */ jsx12(
|
|
1705
|
+
NavIcon,
|
|
1706
|
+
{
|
|
1707
|
+
sectionID: link.icon === "tools" ? "admin-tools" : link.icon || ""
|
|
1708
|
+
}
|
|
1709
|
+
);
|
|
1710
|
+
if (compact) {
|
|
1711
|
+
return icon || link.label.slice(0, 1);
|
|
1712
|
+
}
|
|
1713
|
+
return /* @__PURE__ */ jsxs11("span", { style: { alignItems: "center", display: "inline-flex", gap: "0.6rem" }, children: [
|
|
1714
|
+
icon,
|
|
1715
|
+
/* @__PURE__ */ jsx12("span", { children: link.label })
|
|
1716
|
+
] });
|
|
1717
|
+
})() }, link.href);
|
|
1718
|
+
}) }),
|
|
1719
|
+
/* @__PURE__ */ jsx12("div", { style: { flex: 1 } }),
|
|
1720
|
+
/* @__PURE__ */ jsxs11(
|
|
1721
|
+
"div",
|
|
1722
|
+
{
|
|
1723
|
+
style: {
|
|
1724
|
+
borderTop: "1px solid var(--theme-elevation-150)",
|
|
1725
|
+
paddingTop: "0.85rem",
|
|
1726
|
+
textAlign: compact ? "center" : "left"
|
|
1727
|
+
},
|
|
1728
|
+
children: [
|
|
1729
|
+
!compact ? /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1730
|
+
/* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-700)", fontSize: "0.85rem" }, children: "Signed in as" }),
|
|
1731
|
+
/* @__PURE__ */ jsx12("div", { style: { fontWeight: 800, marginBottom: "0.55rem" }, children: typeof user?.email === "string" ? user.email : "User" })
|
|
1732
|
+
] }) : null,
|
|
1733
|
+
/* @__PURE__ */ jsx12(Logout, {})
|
|
1734
|
+
]
|
|
1735
|
+
}
|
|
1736
|
+
)
|
|
1737
|
+
]
|
|
1738
|
+
}
|
|
1739
|
+
);
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
1743
|
+
import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo2 } from "react";
|
|
1744
|
+
import { usePathname as usePathname2, useRouter } from "next/navigation";
|
|
1745
|
+
import { useAuth as useAuth2 } from "@payloadcms/ui";
|
|
1746
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1747
|
+
function StudioSectionLayout({ children, navProps }) {
|
|
1748
|
+
const { user } = useAuth2();
|
|
1749
|
+
const pathname = usePathname2() || "";
|
|
1750
|
+
const router = useRouter();
|
|
1751
|
+
const adminBasePath = useAdminBasePath();
|
|
1752
|
+
const defaultBrandName = getPropString(navProps, "brandName", "Orion Studio");
|
|
1753
|
+
const defaultLogoUrl = getPropString(navProps, "logoUrl", "");
|
|
1754
|
+
const navItems = useMemo2(
|
|
1755
|
+
() => buildStudioNavItems(navProps, adminBasePath),
|
|
1756
|
+
[adminBasePath, navProps]
|
|
1757
|
+
);
|
|
1758
|
+
const branding = useSiteBranding(defaultBrandName, defaultLogoUrl || void 0);
|
|
1759
|
+
useLayoutEffect2(() => {
|
|
1760
|
+
document.body.classList.add("orion-studio-shell-active");
|
|
1761
|
+
return () => {
|
|
1762
|
+
document.body.classList.remove("orion-studio-shell-active");
|
|
1763
|
+
};
|
|
1764
|
+
}, []);
|
|
1765
|
+
const logout = useMemo2(
|
|
1766
|
+
() => async () => {
|
|
1767
|
+
await fetch("/api/users/logout", {
|
|
1768
|
+
credentials: "include",
|
|
1543
1769
|
method: "POST"
|
|
1544
1770
|
});
|
|
1545
1771
|
router.push(resolveAdminPath(adminBasePath, "/login"));
|
|
@@ -1563,8 +1789,677 @@ function StudioSectionLayout({ children, navProps }) {
|
|
|
1563
1789
|
);
|
|
1564
1790
|
}
|
|
1565
1791
|
|
|
1566
|
-
// src/admin/components/
|
|
1792
|
+
// src/admin-app/components/AdminBreadcrumbs.tsx
|
|
1567
1793
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1794
|
+
function AdminBreadcrumbs({ items }) {
|
|
1795
|
+
return /* @__PURE__ */ jsx14("nav", { "aria-label": "Breadcrumb", className: "orion-admin-breadcrumbs", children: items.map((item, index) => {
|
|
1796
|
+
const isLast = index === items.length - 1;
|
|
1797
|
+
return /* @__PURE__ */ jsxs12("span", { children: [
|
|
1798
|
+
item.href && !isLast ? /* @__PURE__ */ jsx14("a", { href: item.href, children: item.label }) : /* @__PURE__ */ jsx14("span", { children: item.label }),
|
|
1799
|
+
!isLast ? /* @__PURE__ */ jsx14("span", { className: "orion-admin-breadcrumb-sep", children: "/" }) : null
|
|
1800
|
+
] }, `${item.label}-${index}`);
|
|
1801
|
+
}) });
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
// src/admin-app/components/AdminPage.tsx
|
|
1805
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1806
|
+
function AdminPage({ title, description, breadcrumbs, actions, children }) {
|
|
1807
|
+
return /* @__PURE__ */ jsxs13("div", { className: "orion-admin-page", children: [
|
|
1808
|
+
/* @__PURE__ */ jsxs13("div", { className: "orion-admin-page-header", children: [
|
|
1809
|
+
/* @__PURE__ */ jsx15(AdminBreadcrumbs, { items: breadcrumbs }),
|
|
1810
|
+
/* @__PURE__ */ jsxs13("div", { className: "orion-admin-page-title-row", children: [
|
|
1811
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
1812
|
+
/* @__PURE__ */ jsx15("h1", { children: title }),
|
|
1813
|
+
description ? /* @__PURE__ */ jsx15("p", { children: description }) : null
|
|
1814
|
+
] }),
|
|
1815
|
+
actions ? /* @__PURE__ */ jsx15("div", { className: "orion-admin-page-actions", children: actions }) : null
|
|
1816
|
+
] })
|
|
1817
|
+
] }),
|
|
1818
|
+
/* @__PURE__ */ jsx15("div", { className: "orion-admin-page-content", children })
|
|
1819
|
+
] });
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
// src/admin/components/studio/AdminStudioDashboardClient.tsx
|
|
1823
|
+
import { startTransition, useEffect as useEffect7, useMemo as useMemo3, useState as useState7 } from "react";
|
|
1824
|
+
import Link from "next/link";
|
|
1825
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1826
|
+
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
1827
|
+
var isRole = (value) => value === "admin" || value === "editor" || value === "client";
|
|
1828
|
+
var canReviewForms = (role) => role === "admin" || role === "editor";
|
|
1829
|
+
var canCreatePages = (role) => role === "admin" || role === "editor";
|
|
1830
|
+
var canAccess = (role, roles) => {
|
|
1831
|
+
if (!roles || roles.length === 0) {
|
|
1832
|
+
return true;
|
|
1833
|
+
}
|
|
1834
|
+
if (!role) {
|
|
1835
|
+
return false;
|
|
1836
|
+
}
|
|
1837
|
+
return roles.includes(role);
|
|
1838
|
+
};
|
|
1839
|
+
var asText = (value, fallback) => typeof value === "string" && value.trim().length > 0 ? value.trim() : fallback;
|
|
1840
|
+
var asID = (value) => {
|
|
1841
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
1842
|
+
return "";
|
|
1843
|
+
};
|
|
1844
|
+
var toTimestamp = (value) => {
|
|
1845
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
1846
|
+
return Number.NaN;
|
|
1847
|
+
}
|
|
1848
|
+
const timestamp = Date.parse(value);
|
|
1849
|
+
return Number.isFinite(timestamp) ? timestamp : Number.NaN;
|
|
1850
|
+
};
|
|
1851
|
+
var isRecent = (value) => {
|
|
1852
|
+
const timestamp = toTimestamp(value);
|
|
1853
|
+
return Number.isFinite(timestamp) && Date.now() - timestamp <= SEVEN_DAYS_MS;
|
|
1854
|
+
};
|
|
1855
|
+
var formatDateTime = (value) => {
|
|
1856
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
1857
|
+
return "Unknown time";
|
|
1858
|
+
}
|
|
1859
|
+
const date = new Date(value);
|
|
1860
|
+
if (Number.isNaN(date.getTime())) {
|
|
1861
|
+
return value;
|
|
1862
|
+
}
|
|
1863
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1864
|
+
dateStyle: "medium",
|
|
1865
|
+
timeStyle: "short"
|
|
1866
|
+
}).format(date);
|
|
1867
|
+
};
|
|
1868
|
+
var formatRelativeTime2 = (timestamp) => {
|
|
1869
|
+
if (!Number.isFinite(timestamp)) {
|
|
1870
|
+
return "Unknown time";
|
|
1871
|
+
}
|
|
1872
|
+
const diffMs = timestamp - Date.now();
|
|
1873
|
+
const diffMinutes = Math.round(diffMs / (60 * 1e3));
|
|
1874
|
+
const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
1875
|
+
if (Math.abs(diffMinutes) < 60) {
|
|
1876
|
+
return rtf.format(diffMinutes, "minute");
|
|
1877
|
+
}
|
|
1878
|
+
const diffHours = Math.round(diffMinutes / 60);
|
|
1879
|
+
if (Math.abs(diffHours) < 24) {
|
|
1880
|
+
return rtf.format(diffHours, "hour");
|
|
1881
|
+
}
|
|
1882
|
+
const diffDays = Math.round(diffHours / 24);
|
|
1883
|
+
return rtf.format(diffDays, "day");
|
|
1884
|
+
};
|
|
1885
|
+
var readSubmissionIdentity = (value) => {
|
|
1886
|
+
if (!value || typeof value !== "object") {
|
|
1887
|
+
return "New submission";
|
|
1888
|
+
}
|
|
1889
|
+
const data = value;
|
|
1890
|
+
const firstName = typeof data.firstName === "string" ? data.firstName.trim() : "";
|
|
1891
|
+
const lastName = typeof data.lastName === "string" ? data.lastName.trim() : "";
|
|
1892
|
+
const name = typeof data.name === "string" ? data.name.trim() : "";
|
|
1893
|
+
const email = typeof data.email === "string" ? data.email.trim() : typeof data.contactEmail === "string" ? data.contactEmail.trim() : "";
|
|
1894
|
+
const fullName = [firstName, lastName].filter(Boolean).join(" ").trim();
|
|
1895
|
+
return fullName || name || email || "New submission";
|
|
1896
|
+
};
|
|
1897
|
+
var getFormID = (value) => {
|
|
1898
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
1899
|
+
if (value && typeof value === "object") {
|
|
1900
|
+
const nestedID = value.id;
|
|
1901
|
+
if (typeof nestedID === "string" || typeof nestedID === "number") return String(nestedID);
|
|
1902
|
+
}
|
|
1903
|
+
return "";
|
|
1904
|
+
};
|
|
1905
|
+
var getFormTitle = (value) => {
|
|
1906
|
+
if (!value || typeof value !== "object") {
|
|
1907
|
+
return "";
|
|
1908
|
+
}
|
|
1909
|
+
const title = value.title;
|
|
1910
|
+
if (typeof title === "string" && title.trim().length > 0) {
|
|
1911
|
+
return title.trim();
|
|
1912
|
+
}
|
|
1913
|
+
const slug = value.slug;
|
|
1914
|
+
return typeof slug === "string" && slug.trim().length > 0 ? slug.trim() : "";
|
|
1915
|
+
};
|
|
1916
|
+
var buildSearchParams = (params) => new URLSearchParams(
|
|
1917
|
+
Object.entries(params).filter(([, value]) => typeof value === "string" && value.length > 0)
|
|
1918
|
+
).toString();
|
|
1919
|
+
async function loadCollection(path) {
|
|
1920
|
+
const response = await fetch(path, {
|
|
1921
|
+
cache: "no-store",
|
|
1922
|
+
credentials: "include"
|
|
1923
|
+
});
|
|
1924
|
+
if (!response.ok) {
|
|
1925
|
+
const body = await response.text();
|
|
1926
|
+
throw new Error(body || `Request failed: ${response.status}`);
|
|
1927
|
+
}
|
|
1928
|
+
return await response.json();
|
|
1929
|
+
}
|
|
1930
|
+
async function loadPages(collectionSlug) {
|
|
1931
|
+
const params = buildSearchParams({
|
|
1932
|
+
depth: "0",
|
|
1933
|
+
draft: "true",
|
|
1934
|
+
limit: "200",
|
|
1935
|
+
sort: "-updatedAt"
|
|
1936
|
+
});
|
|
1937
|
+
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
1938
|
+
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
1939
|
+
return {
|
|
1940
|
+
draftCount: docs.filter((doc) => doc._status === "draft").length,
|
|
1941
|
+
recent: docs.slice(0, 8),
|
|
1942
|
+
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
1943
|
+
updatedThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1946
|
+
async function loadForms(formsCollectionSlug, submissionsCollectionSlug) {
|
|
1947
|
+
const [formsResult, submissionsResult] = await Promise.all([
|
|
1948
|
+
loadCollection(
|
|
1949
|
+
`/api/${formsCollectionSlug}?${buildSearchParams({
|
|
1950
|
+
depth: "0",
|
|
1951
|
+
draft: "true",
|
|
1952
|
+
limit: "80",
|
|
1953
|
+
sort: "-updatedAt"
|
|
1954
|
+
})}`
|
|
1955
|
+
),
|
|
1956
|
+
loadCollection(
|
|
1957
|
+
`/api/${submissionsCollectionSlug}?${buildSearchParams({
|
|
1958
|
+
depth: "1",
|
|
1959
|
+
limit: "40",
|
|
1960
|
+
sort: "-submittedAt"
|
|
1961
|
+
})}`
|
|
1962
|
+
)
|
|
1963
|
+
]);
|
|
1964
|
+
const forms = Array.isArray(formsResult.docs) ? formsResult.docs : [];
|
|
1965
|
+
const recentSubmissions = Array.isArray(submissionsResult.docs) ? submissionsResult.docs : [];
|
|
1966
|
+
const submissionsByForm = /* @__PURE__ */ new Map();
|
|
1967
|
+
for (const submission of recentSubmissions) {
|
|
1968
|
+
const formID = getFormID(submission.form);
|
|
1969
|
+
if (!formID) continue;
|
|
1970
|
+
submissionsByForm.set(formID, (submissionsByForm.get(formID) || 0) + 1);
|
|
1971
|
+
}
|
|
1972
|
+
let busiestFormTitle = null;
|
|
1973
|
+
let busiestFormCount = 0;
|
|
1974
|
+
for (const form of forms) {
|
|
1975
|
+
const formID = asID(form.id);
|
|
1976
|
+
if (!formID) continue;
|
|
1977
|
+
const submissionCount = submissionsByForm.get(formID) || 0;
|
|
1978
|
+
if (submissionCount > busiestFormCount) {
|
|
1979
|
+
busiestFormCount = submissionCount;
|
|
1980
|
+
busiestFormTitle = asText(form.title, "Untitled form");
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
return {
|
|
1984
|
+
busiestFormTitle,
|
|
1985
|
+
forms,
|
|
1986
|
+
recentSubmissions,
|
|
1987
|
+
submissionsThisWeek: recentSubmissions.filter((submission) => isRecent(submission.submittedAt)).length,
|
|
1988
|
+
totalForms: typeof formsResult.totalDocs === "number" ? formsResult.totalDocs : forms.length
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
async function loadMedia(collectionSlug) {
|
|
1992
|
+
const params = buildSearchParams({
|
|
1993
|
+
depth: "0",
|
|
1994
|
+
limit: "24",
|
|
1995
|
+
sort: "-updatedAt"
|
|
1996
|
+
});
|
|
1997
|
+
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
1998
|
+
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
1999
|
+
return {
|
|
2000
|
+
recent: docs.slice(0, 8),
|
|
2001
|
+
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
2002
|
+
uploadsThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
2003
|
+
};
|
|
2004
|
+
}
|
|
2005
|
+
var loadingState = {
|
|
2006
|
+
forms: null,
|
|
2007
|
+
media: { status: "loading" },
|
|
2008
|
+
pages: { status: "loading" }
|
|
2009
|
+
};
|
|
2010
|
+
function ModuleStatus({ message }) {
|
|
2011
|
+
return /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-inline-note", children: message });
|
|
2012
|
+
}
|
|
2013
|
+
function EmptyState2({
|
|
2014
|
+
body,
|
|
2015
|
+
title
|
|
2016
|
+
}) {
|
|
2017
|
+
return /* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-empty-state", children: [
|
|
2018
|
+
/* @__PURE__ */ jsx16("strong", { children: title }),
|
|
2019
|
+
/* @__PURE__ */ jsx16("span", { children: body })
|
|
2020
|
+
] });
|
|
2021
|
+
}
|
|
2022
|
+
function SnapshotMetric({ card }) {
|
|
2023
|
+
return /* @__PURE__ */ jsxs14("article", { className: "orion-dashboard-snapshot-card", children: [
|
|
2024
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-snapshot-kicker", children: card.kicker }),
|
|
2025
|
+
/* @__PURE__ */ jsx16("strong", { children: card.value }),
|
|
2026
|
+
/* @__PURE__ */ jsx16("p", { children: card.detail })
|
|
2027
|
+
] });
|
|
2028
|
+
}
|
|
2029
|
+
function AdminStudioDashboardClient({
|
|
2030
|
+
formSubmissionsCollectionSlug,
|
|
2031
|
+
formsCollectionSlug,
|
|
2032
|
+
formsEnabled,
|
|
2033
|
+
formsPath,
|
|
2034
|
+
globalsBasePath,
|
|
2035
|
+
mediaCollectionSlug,
|
|
2036
|
+
mediaPath,
|
|
2037
|
+
pagesCollectionSlug,
|
|
2038
|
+
pagesPath,
|
|
2039
|
+
sectionLinks,
|
|
2040
|
+
toolsPath,
|
|
2041
|
+
userRole,
|
|
2042
|
+
children
|
|
2043
|
+
}) {
|
|
2044
|
+
const role = isRole(userRole) ? userRole : void 0;
|
|
2045
|
+
const [state, setState] = useState7(
|
|
2046
|
+
() => formsEnabled && canReviewForms(role) ? {
|
|
2047
|
+
forms: { status: "loading" },
|
|
2048
|
+
media: { status: "loading" },
|
|
2049
|
+
pages: { status: "loading" }
|
|
2050
|
+
} : loadingState
|
|
2051
|
+
);
|
|
2052
|
+
useEffect7(() => {
|
|
2053
|
+
let cancelled = false;
|
|
2054
|
+
const run = async () => {
|
|
2055
|
+
const includeForms = formsEnabled && canReviewForms(role);
|
|
2056
|
+
startTransition(() => {
|
|
2057
|
+
setState({
|
|
2058
|
+
forms: includeForms ? { status: "loading" } : null,
|
|
2059
|
+
media: { status: "loading" },
|
|
2060
|
+
pages: { status: "loading" }
|
|
2061
|
+
});
|
|
2062
|
+
});
|
|
2063
|
+
const [pagesResult, formsResult, mediaResult] = await Promise.allSettled([
|
|
2064
|
+
loadPages(pagesCollectionSlug),
|
|
2065
|
+
includeForms ? loadForms(formsCollectionSlug, formSubmissionsCollectionSlug) : Promise.resolve(null),
|
|
2066
|
+
loadMedia(mediaCollectionSlug)
|
|
2067
|
+
]);
|
|
2068
|
+
if (cancelled) return;
|
|
2069
|
+
startTransition(() => {
|
|
2070
|
+
setState({
|
|
2071
|
+
forms: includeForms && formsResult.status === "rejected" ? {
|
|
2072
|
+
error: formsResult.reason instanceof Error ? formsResult.reason.message : "Unable to load form activity.",
|
|
2073
|
+
status: "error"
|
|
2074
|
+
} : includeForms && formsResult.status === "fulfilled" && formsResult.value ? {
|
|
2075
|
+
data: formsResult.value,
|
|
2076
|
+
status: "success"
|
|
2077
|
+
} : null,
|
|
2078
|
+
media: mediaResult.status === "rejected" ? {
|
|
2079
|
+
error: mediaResult.reason instanceof Error ? mediaResult.reason.message : "Unable to load media activity.",
|
|
2080
|
+
status: "error"
|
|
2081
|
+
} : {
|
|
2082
|
+
data: mediaResult.value,
|
|
2083
|
+
status: "success"
|
|
2084
|
+
},
|
|
2085
|
+
pages: pagesResult.status === "rejected" ? {
|
|
2086
|
+
error: pagesResult.reason instanceof Error ? pagesResult.reason.message : "Unable to load page activity.",
|
|
2087
|
+
status: "error"
|
|
2088
|
+
} : {
|
|
2089
|
+
data: pagesResult.value,
|
|
2090
|
+
status: "success"
|
|
2091
|
+
}
|
|
2092
|
+
});
|
|
2093
|
+
});
|
|
2094
|
+
};
|
|
2095
|
+
void run();
|
|
2096
|
+
return () => {
|
|
2097
|
+
cancelled = true;
|
|
2098
|
+
};
|
|
2099
|
+
}, [
|
|
2100
|
+
formSubmissionsCollectionSlug,
|
|
2101
|
+
formsCollectionSlug,
|
|
2102
|
+
formsEnabled,
|
|
2103
|
+
mediaCollectionSlug,
|
|
2104
|
+
pagesCollectionSlug,
|
|
2105
|
+
role
|
|
2106
|
+
]);
|
|
2107
|
+
const visibleWorkspaceLinks = useMemo3(
|
|
2108
|
+
() => sectionLinks.filter((section) => canAccess(role, section.roles)),
|
|
2109
|
+
[role, sectionLinks]
|
|
2110
|
+
);
|
|
2111
|
+
const activityItems = useMemo3(() => {
|
|
2112
|
+
const items = [];
|
|
2113
|
+
if (state.pages.status === "success") {
|
|
2114
|
+
for (const doc of state.pages.data.recent) {
|
|
2115
|
+
const id = asID(doc.id);
|
|
2116
|
+
if (!id) continue;
|
|
2117
|
+
const timestamp = toTimestamp(doc.updatedAt);
|
|
2118
|
+
items.push({
|
|
2119
|
+
href: `${pagesPath}/${id}`,
|
|
2120
|
+
id: `page-${id}`,
|
|
2121
|
+
kind: "page",
|
|
2122
|
+
label: typeof doc._status === "string" ? doc._status : "page",
|
|
2123
|
+
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
2124
|
+
timestamp,
|
|
2125
|
+
title: asText(doc.title, "Untitled page")
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
if (state.forms?.status === "success") {
|
|
2130
|
+
for (const submission of state.forms.data.recentSubmissions) {
|
|
2131
|
+
const id = asID(submission.id);
|
|
2132
|
+
const formID = getFormID(submission.form);
|
|
2133
|
+
if (!id || !formID) continue;
|
|
2134
|
+
const timestamp = toTimestamp(submission.submittedAt);
|
|
2135
|
+
const formTitle = getFormTitle(submission.form) || "Form response";
|
|
2136
|
+
items.push({
|
|
2137
|
+
href: `${formsPath}?form=${encodeURIComponent(formID)}`,
|
|
2138
|
+
id: `submission-${id}`,
|
|
2139
|
+
kind: "submission",
|
|
2140
|
+
label: formTitle,
|
|
2141
|
+
meta: Number.isFinite(timestamp) ? `${readSubmissionIdentity(submission.data)} \xB7 ${formatDateTime(submission.submittedAt)}` : readSubmissionIdentity(submission.data),
|
|
2142
|
+
timestamp,
|
|
2143
|
+
title: "New submission"
|
|
2144
|
+
});
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
if (state.media.status === "success") {
|
|
2148
|
+
for (const doc of state.media.data.recent) {
|
|
2149
|
+
const id = asID(doc.id);
|
|
2150
|
+
if (!id) continue;
|
|
2151
|
+
const timestamp = toTimestamp(doc.updatedAt);
|
|
2152
|
+
items.push({
|
|
2153
|
+
href: `${mediaPath}/${id}`,
|
|
2154
|
+
id: `media-${id}`,
|
|
2155
|
+
kind: "media",
|
|
2156
|
+
label: asText(doc.mimeType, "Media asset"),
|
|
2157
|
+
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
2158
|
+
timestamp,
|
|
2159
|
+
title: asText(doc.filename, "Untitled asset")
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
return items.filter((item) => Number.isFinite(item.timestamp)).sort((a, b) => b.timestamp - a.timestamp).slice(0, 10);
|
|
2164
|
+
}, [formsPath, mediaPath, pagesPath, state.forms, state.media, state.pages]);
|
|
2165
|
+
const attentionItems = useMemo3(() => {
|
|
2166
|
+
if (role === "client") {
|
|
2167
|
+
const items2 = [];
|
|
2168
|
+
if (state.pages.status === "success" && state.pages.data.updatedThisWeek > 0) {
|
|
2169
|
+
items2.push({
|
|
2170
|
+
href: pagesPath,
|
|
2171
|
+
id: "pages-updated",
|
|
2172
|
+
label: `${state.pages.data.updatedThisWeek} page${state.pages.data.updatedThisWeek === 1 ? "" : "s"} changed in the last 7 days.`
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
if (state.media.status === "success" && state.media.data.uploadsThisWeek > 0) {
|
|
2176
|
+
items2.push({
|
|
2177
|
+
href: mediaPath,
|
|
2178
|
+
id: "media-updated",
|
|
2179
|
+
label: `${state.media.data.uploadsThisWeek} new media asset${state.media.data.uploadsThisWeek === 1 ? "" : "s"} landed this week.`
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
return items2;
|
|
2183
|
+
}
|
|
2184
|
+
const items = [];
|
|
2185
|
+
if (state.pages.status === "success" && state.pages.data.draftCount > 0) {
|
|
2186
|
+
items.push({
|
|
2187
|
+
href: pagesPath,
|
|
2188
|
+
id: "draft-pages",
|
|
2189
|
+
label: `${state.pages.data.draftCount} page${state.pages.data.draftCount === 1 ? "" : "s"} still need publishing review.`,
|
|
2190
|
+
tone: "accent"
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
if (state.forms?.status === "success" && state.forms.data.submissionsThisWeek > 0) {
|
|
2194
|
+
items.push({
|
|
2195
|
+
href: formsPath,
|
|
2196
|
+
id: "recent-submissions",
|
|
2197
|
+
label: `${state.forms.data.submissionsThisWeek} form submission${state.forms.data.submissionsThisWeek === 1 ? "" : "s"} arrived in the last 7 days.`,
|
|
2198
|
+
tone: "accent"
|
|
2199
|
+
});
|
|
2200
|
+
}
|
|
2201
|
+
if (state.media.status === "success" && state.media.data.total === 0) {
|
|
2202
|
+
items.push({
|
|
2203
|
+
href: mediaPath,
|
|
2204
|
+
id: "empty-media",
|
|
2205
|
+
label: "The media library is still empty. Add brand assets before content expands."
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
if (state.pages.status === "error") {
|
|
2209
|
+
items.push({
|
|
2210
|
+
href: pagesPath,
|
|
2211
|
+
id: "pages-error",
|
|
2212
|
+
label: "Page activity could not be loaded for the dashboard.",
|
|
2213
|
+
tone: "muted"
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
if (state.forms?.status === "error") {
|
|
2217
|
+
items.push({
|
|
2218
|
+
href: formsPath,
|
|
2219
|
+
id: "forms-error",
|
|
2220
|
+
label: "Form activity could not be loaded for the dashboard.",
|
|
2221
|
+
tone: "muted"
|
|
2222
|
+
});
|
|
2223
|
+
}
|
|
2224
|
+
if (state.media.status === "error") {
|
|
2225
|
+
items.push({
|
|
2226
|
+
href: mediaPath,
|
|
2227
|
+
id: "media-error",
|
|
2228
|
+
label: "Media activity could not be loaded for the dashboard.",
|
|
2229
|
+
tone: "muted"
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
return items;
|
|
2233
|
+
}, [formsPath, mediaPath, pagesPath, role, state.forms, state.media, state.pages]);
|
|
2234
|
+
const snapshotCards = useMemo3(() => {
|
|
2235
|
+
const cards = [];
|
|
2236
|
+
if (state.pages.status === "success") {
|
|
2237
|
+
cards.push(
|
|
2238
|
+
role === "client" ? {
|
|
2239
|
+
detail: `${state.pages.data.updatedThisWeek} updated this week`,
|
|
2240
|
+
kicker: "Pages",
|
|
2241
|
+
value: `${state.pages.data.total}`
|
|
2242
|
+
} : {
|
|
2243
|
+
detail: `${state.pages.data.draftCount} draft${state.pages.data.draftCount === 1 ? "" : "s"} waiting`,
|
|
2244
|
+
kicker: "Pages",
|
|
2245
|
+
value: `${state.pages.data.total}`
|
|
2246
|
+
}
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2249
|
+
if (state.forms?.status === "success") {
|
|
2250
|
+
cards.push({
|
|
2251
|
+
detail: state.forms.data.busiestFormTitle ? `Most active: ${state.forms.data.busiestFormTitle}` : "Waiting on the first submission",
|
|
2252
|
+
kicker: "Forms",
|
|
2253
|
+
value: `${state.forms.data.submissionsThisWeek}`
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
if (state.media.status === "success") {
|
|
2257
|
+
cards.push({
|
|
2258
|
+
detail: `${state.media.data.uploadsThisWeek} uploaded this week`,
|
|
2259
|
+
kicker: "Media",
|
|
2260
|
+
value: `${state.media.data.total}`
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
cards.push({
|
|
2264
|
+
detail: `${visibleWorkspaceLinks.length} section${visibleWorkspaceLinks.length === 1 ? "" : "s"} available`,
|
|
2265
|
+
kicker: "Workspace",
|
|
2266
|
+
value: role ? role.toUpperCase() : "CMS"
|
|
2267
|
+
});
|
|
2268
|
+
return cards.slice(0, 4);
|
|
2269
|
+
}, [role, state.forms, state.media, state.pages, visibleWorkspaceLinks.length]);
|
|
2270
|
+
const primaryActions = useMemo3(() => {
|
|
2271
|
+
const actions = [];
|
|
2272
|
+
if (canCreatePages(role)) {
|
|
2273
|
+
actions.push({
|
|
2274
|
+
description: "Create or revise content in the visual builder.",
|
|
2275
|
+
href: `${pagesPath}/new`,
|
|
2276
|
+
label: "New Page"
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
actions.push({
|
|
2280
|
+
description: "Review live pages and recent edits.",
|
|
2281
|
+
href: pagesPath,
|
|
2282
|
+
label: "Open Pages",
|
|
2283
|
+
tone: "ghost"
|
|
2284
|
+
});
|
|
2285
|
+
if (formsEnabled && canReviewForms(role)) {
|
|
2286
|
+
actions.push({
|
|
2287
|
+
description: "Check submissions and form performance.",
|
|
2288
|
+
href: formsPath,
|
|
2289
|
+
label: "Review Forms",
|
|
2290
|
+
tone: "soft"
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
actions.push({
|
|
2294
|
+
description: "Update site settings, navigation, and footer content.",
|
|
2295
|
+
href: globalsBasePath,
|
|
2296
|
+
label: "Open Globals",
|
|
2297
|
+
tone: "ghost"
|
|
2298
|
+
});
|
|
2299
|
+
actions.push({
|
|
2300
|
+
description: "Upload or organize brand and campaign assets.",
|
|
2301
|
+
href: mediaPath,
|
|
2302
|
+
label: "Manage Media",
|
|
2303
|
+
tone: "ghost"
|
|
2304
|
+
});
|
|
2305
|
+
if (role === "admin") {
|
|
2306
|
+
actions.push({
|
|
2307
|
+
description: "Manage users, roles, and fallback tools.",
|
|
2308
|
+
href: toolsPath,
|
|
2309
|
+
label: "Admin Tools",
|
|
2310
|
+
tone: "ghost"
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
return actions;
|
|
2314
|
+
}, [formsEnabled, formsPath, globalsBasePath, mediaPath, pagesPath, role, toolsPath]);
|
|
2315
|
+
const attentionTitle = role === "client" ? "What Changed" : "Needs Attention";
|
|
2316
|
+
const attentionDescription = role === "client" ? "A quick read on recent content and asset changes." : "The highest-signal items that still need review.";
|
|
2317
|
+
return /* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-layout", children: [
|
|
2318
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--attention", children: [
|
|
2319
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2320
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2321
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: attentionTitle }),
|
|
2322
|
+
/* @__PURE__ */ jsx16("h2", { children: attentionDescription })
|
|
2323
|
+
] }),
|
|
2324
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-meta", children: "Last 7 days" })
|
|
2325
|
+
] }),
|
|
2326
|
+
attentionItems.length > 0 ? /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-attention-list", children: attentionItems.map(
|
|
2327
|
+
(item) => item.href ? /* @__PURE__ */ jsxs14(
|
|
2328
|
+
Link,
|
|
2329
|
+
{
|
|
2330
|
+
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
2331
|
+
href: item.href,
|
|
2332
|
+
children: [
|
|
2333
|
+
/* @__PURE__ */ jsx16("strong", { children: item.label }),
|
|
2334
|
+
/* @__PURE__ */ jsx16("span", { children: "Open" })
|
|
2335
|
+
]
|
|
2336
|
+
},
|
|
2337
|
+
item.id
|
|
2338
|
+
) : /* @__PURE__ */ jsx16(
|
|
2339
|
+
"div",
|
|
2340
|
+
{
|
|
2341
|
+
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
2342
|
+
children: /* @__PURE__ */ jsx16("strong", { children: item.label })
|
|
2343
|
+
},
|
|
2344
|
+
item.id
|
|
2345
|
+
)
|
|
2346
|
+
) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ jsx16(ModuleStatus, { message: "Loading attention items..." }) : /* @__PURE__ */ jsx16(
|
|
2347
|
+
EmptyState2,
|
|
2348
|
+
{
|
|
2349
|
+
body: role === "client" ? "No major changes landed during the current review window." : "No urgent follow-up surfaced from content, forms, or media activity.",
|
|
2350
|
+
title: "Everything looks steady"
|
|
2351
|
+
}
|
|
2352
|
+
)
|
|
2353
|
+
] }),
|
|
2354
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--actions", children: [
|
|
2355
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2356
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2357
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: "Quick Actions" }),
|
|
2358
|
+
/* @__PURE__ */ jsx16("h2", { children: "Jump into the work that matters most." })
|
|
2359
|
+
] }),
|
|
2360
|
+
/* @__PURE__ */ jsxs14("span", { className: "orion-dashboard-panel-meta", children: [
|
|
2361
|
+
role || "studio",
|
|
2362
|
+
" mode"
|
|
2363
|
+
] })
|
|
2364
|
+
] }),
|
|
2365
|
+
/* @__PURE__ */ jsx16("div", { className: "orion-dashboard-action-list", children: primaryActions.map((action) => /* @__PURE__ */ jsxs14(
|
|
2366
|
+
Link,
|
|
2367
|
+
{
|
|
2368
|
+
className: [
|
|
2369
|
+
"orion-dashboard-action",
|
|
2370
|
+
action.tone === "ghost" ? "is-ghost" : action.tone === "soft" ? "is-soft" : ""
|
|
2371
|
+
].filter(Boolean).join(" "),
|
|
2372
|
+
href: action.href,
|
|
2373
|
+
children: [
|
|
2374
|
+
/* @__PURE__ */ jsx16("strong", { children: action.label }),
|
|
2375
|
+
/* @__PURE__ */ jsx16("span", { children: action.description })
|
|
2376
|
+
]
|
|
2377
|
+
},
|
|
2378
|
+
action.label
|
|
2379
|
+
)) }),
|
|
2380
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-workspace-strip", children: [
|
|
2381
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-workspace-label", children: "Workspace" }),
|
|
2382
|
+
/* @__PURE__ */ jsx16("div", { className: "orion-dashboard-workspace-pills", children: visibleWorkspaceLinks.map((section) => /* @__PURE__ */ jsx16(Link, { className: "orion-dashboard-workspace-pill", href: section.href, children: section.label }, section.id)) })
|
|
2383
|
+
] })
|
|
2384
|
+
] }),
|
|
2385
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--activity", children: [
|
|
2386
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2387
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2388
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: "Recent Activity" }),
|
|
2389
|
+
/* @__PURE__ */ jsx16("h2", { children: "The freshest edits, responses, and uploads across the studio." })
|
|
2390
|
+
] }),
|
|
2391
|
+
/* @__PURE__ */ jsxs14("span", { className: "orion-dashboard-panel-meta", children: [
|
|
2392
|
+
activityItems.length,
|
|
2393
|
+
" items"
|
|
2394
|
+
] })
|
|
2395
|
+
] }),
|
|
2396
|
+
activityItems.length > 0 ? /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-activity-list", children: activityItems.map((item) => /* @__PURE__ */ jsxs14(Link, { className: `orion-dashboard-activity-item is-${item.kind}`, href: item.href, children: [
|
|
2397
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-activity-copy", children: [
|
|
2398
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-activity-topline", children: [
|
|
2399
|
+
/* @__PURE__ */ jsx16("strong", { children: item.title }),
|
|
2400
|
+
/* @__PURE__ */ jsx16("span", { children: formatRelativeTime2(item.timestamp) })
|
|
2401
|
+
] }),
|
|
2402
|
+
/* @__PURE__ */ jsx16("p", { children: item.meta })
|
|
2403
|
+
] }),
|
|
2404
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-activity-pill", children: item.label })
|
|
2405
|
+
] }, item.id)) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ jsx16(ModuleStatus, { message: "Loading activity feed..." }) : /* @__PURE__ */ jsx16(
|
|
2406
|
+
EmptyState2,
|
|
2407
|
+
{
|
|
2408
|
+
body: "Recent page edits, submissions, and uploads will start stacking here as soon as the team gets moving.",
|
|
2409
|
+
title: "No recent activity yet"
|
|
2410
|
+
}
|
|
2411
|
+
)
|
|
2412
|
+
] }),
|
|
2413
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--snapshot", children: [
|
|
2414
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2415
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2416
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: "Business Snapshot" }),
|
|
2417
|
+
/* @__PURE__ */ jsx16("h2", { children: "A compact read on content momentum and performance." })
|
|
2418
|
+
] }),
|
|
2419
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-meta", children: "30-day lens" })
|
|
2420
|
+
] }),
|
|
2421
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-snapshot-grid", children: [
|
|
2422
|
+
snapshotCards.map((card) => /* @__PURE__ */ jsx16(SnapshotMetric, { card }, card.kicker)),
|
|
2423
|
+
children
|
|
2424
|
+
] }),
|
|
2425
|
+
state.pages.status === "error" || state.media.status === "error" ? /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-inline-note", children: "Some dashboard modules could not be loaded. The rest of the workspace remains available." }) : null
|
|
2426
|
+
] })
|
|
2427
|
+
] });
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
2431
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2432
|
+
var DEFAULT_ADMIN_BASE_PATH2 = "/admin";
|
|
2433
|
+
var normalizePath2 = (value) => {
|
|
2434
|
+
if (!value || value === "/") return "/";
|
|
2435
|
+
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
2436
|
+
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
2437
|
+
return trimmed.length > 0 ? trimmed : "/";
|
|
2438
|
+
};
|
|
2439
|
+
var normalizeAdminBasePath2 = (value) => {
|
|
2440
|
+
const normalized = normalizePath2(value);
|
|
2441
|
+
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH2 : normalized;
|
|
2442
|
+
};
|
|
2443
|
+
var isAbsoluteExternalURL3 = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
2444
|
+
var resolveAdminPath2 = (adminBasePath, targetPath) => {
|
|
2445
|
+
if (!targetPath) return adminBasePath;
|
|
2446
|
+
if (isAbsoluteExternalURL3(targetPath)) return targetPath;
|
|
2447
|
+
const normalizedBasePath = normalizeAdminBasePath2(adminBasePath);
|
|
2448
|
+
const normalizedTargetPath = normalizePath2(targetPath);
|
|
2449
|
+
if (normalizedTargetPath === "/admin") {
|
|
2450
|
+
return normalizedBasePath;
|
|
2451
|
+
}
|
|
2452
|
+
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
2453
|
+
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
2454
|
+
}
|
|
2455
|
+
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
2456
|
+
return normalizedTargetPath;
|
|
2457
|
+
}
|
|
2458
|
+
if (normalizedTargetPath === "/") {
|
|
2459
|
+
return normalizedBasePath;
|
|
2460
|
+
}
|
|
2461
|
+
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
2462
|
+
};
|
|
1568
2463
|
var getPropString2 = (props, key, fallback) => {
|
|
1569
2464
|
if (!props || typeof props !== "object") return fallback;
|
|
1570
2465
|
const direct = props[key];
|
|
@@ -1597,237 +2492,165 @@ var getPropSections2 = (props) => {
|
|
|
1597
2492
|
}
|
|
1598
2493
|
return [];
|
|
1599
2494
|
};
|
|
1600
|
-
|
|
2495
|
+
var readUserRole2 = (props) => {
|
|
2496
|
+
if (!props || typeof props !== "object") return void 0;
|
|
2497
|
+
const user = props.user;
|
|
2498
|
+
if (user && typeof user === "object") {
|
|
2499
|
+
const role = user.role;
|
|
2500
|
+
if (typeof role === "string") {
|
|
2501
|
+
return role;
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
const initPageResult = props.initPageResult;
|
|
2505
|
+
if (initPageResult && typeof initPageResult === "object") {
|
|
2506
|
+
const req = initPageResult.req;
|
|
2507
|
+
if (req && typeof req === "object") {
|
|
2508
|
+
const nestedUser = req.user;
|
|
2509
|
+
if (nestedUser && typeof nestedUser === "object") {
|
|
2510
|
+
const role = nestedUser.role;
|
|
2511
|
+
if (typeof role === "string") {
|
|
2512
|
+
return role;
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
return void 0;
|
|
2518
|
+
};
|
|
2519
|
+
var readAdminBasePath = (props) => {
|
|
2520
|
+
if (!props || typeof props !== "object") {
|
|
2521
|
+
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2522
|
+
}
|
|
2523
|
+
const payloadLike = props.payload;
|
|
2524
|
+
if (payloadLike && typeof payloadLike === "object") {
|
|
2525
|
+
const config = payloadLike.config;
|
|
2526
|
+
const routes = config && typeof config === "object" ? config.routes : null;
|
|
2527
|
+
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
2528
|
+
if (typeof admin === "string" && admin.length > 0) {
|
|
2529
|
+
return normalizeAdminBasePath2(admin);
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
const initPageResult = props.initPageResult;
|
|
2533
|
+
if (initPageResult && typeof initPageResult === "object") {
|
|
2534
|
+
const req = initPageResult.req;
|
|
2535
|
+
if (req && typeof req === "object") {
|
|
2536
|
+
const nestedPayload = req.payload;
|
|
2537
|
+
if (nestedPayload && typeof nestedPayload === "object") {
|
|
2538
|
+
const config = nestedPayload.config;
|
|
2539
|
+
const routes = config && typeof config === "object" ? config.routes : null;
|
|
2540
|
+
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
2541
|
+
if (typeof admin === "string" && admin.length > 0) {
|
|
2542
|
+
return normalizeAdminBasePath2(admin);
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2548
|
+
};
|
|
2549
|
+
var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
|
|
2550
|
+
const links = [
|
|
2551
|
+
{
|
|
2552
|
+
href: resolveAdminPath2(adminBasePath, "/pages"),
|
|
2553
|
+
id: "pages",
|
|
2554
|
+
label: "Pages"
|
|
2555
|
+
},
|
|
2556
|
+
...formsEnabled ? [
|
|
2557
|
+
{
|
|
2558
|
+
href: resolveAdminPath2(adminBasePath, "/forms"),
|
|
2559
|
+
id: "forms",
|
|
2560
|
+
label: "Forms",
|
|
2561
|
+
roles: ["admin", "editor"]
|
|
2562
|
+
}
|
|
2563
|
+
] : [],
|
|
2564
|
+
{
|
|
2565
|
+
href: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
2566
|
+
id: "globals",
|
|
2567
|
+
label: "Globals"
|
|
2568
|
+
},
|
|
2569
|
+
{
|
|
2570
|
+
href: resolveAdminPath2(adminBasePath, "/media"),
|
|
2571
|
+
id: "media",
|
|
2572
|
+
label: "Media"
|
|
2573
|
+
},
|
|
2574
|
+
...sections.map((section) => ({
|
|
2575
|
+
href: resolveAdminPath2(adminBasePath, section.href),
|
|
2576
|
+
id: section.id,
|
|
2577
|
+
label: section.label,
|
|
2578
|
+
...section.roles ? { roles: section.roles } : {}
|
|
2579
|
+
})),
|
|
2580
|
+
{
|
|
2581
|
+
href: resolveAdminPath2(adminBasePath, "/tools"),
|
|
2582
|
+
id: "admin-tools",
|
|
2583
|
+
label: "Admin Tools",
|
|
2584
|
+
roles: ["admin"]
|
|
2585
|
+
}
|
|
2586
|
+
];
|
|
2587
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2588
|
+
return links.filter((link) => {
|
|
2589
|
+
if (seen.has(link.id)) {
|
|
2590
|
+
return false;
|
|
2591
|
+
}
|
|
2592
|
+
seen.add(link.id);
|
|
2593
|
+
return true;
|
|
2594
|
+
});
|
|
2595
|
+
};
|
|
2596
|
+
function AdminStudioDashboard(rawProps) {
|
|
2597
|
+
const props = rawProps || {};
|
|
1601
2598
|
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
1602
2599
|
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
1603
2600
|
const sections = getPropSections2(props);
|
|
1604
|
-
const
|
|
1605
|
-
const
|
|
1606
|
-
const
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
2601
|
+
const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
|
|
2602
|
+
const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
|
|
2603
|
+
const formSubmissionsCollectionSlug = getPropString2(
|
|
2604
|
+
props,
|
|
2605
|
+
"formSubmissionsCollectionSlug",
|
|
2606
|
+
"form-submissions"
|
|
2607
|
+
);
|
|
2608
|
+
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
2609
|
+
const adminBasePath = readAdminBasePath(props);
|
|
2610
|
+
const userRole = readUserRole2(props);
|
|
2611
|
+
const navProps = {
|
|
2612
|
+
brandName: getPropString2(props, "brandName", "Orion Studio"),
|
|
2613
|
+
formSubmissionsCollectionSlug,
|
|
2614
|
+
formsCollectionSlug,
|
|
2615
|
+
formsEnabled,
|
|
2616
|
+
globalsBasePath,
|
|
2617
|
+
logoUrl: getPropString2(props, "logoUrl", ""),
|
|
2618
|
+
mediaCollectionSlug,
|
|
2619
|
+
pagesCollectionSlug,
|
|
2620
|
+
sections
|
|
2621
|
+
};
|
|
2622
|
+
return /* @__PURE__ */ jsx17(StudioSectionLayout, { navProps, children: /* @__PURE__ */ jsx17(
|
|
1616
2623
|
AdminPage,
|
|
1617
2624
|
{
|
|
1618
2625
|
breadcrumbs: [{ label: "Dashboard" }],
|
|
1619
|
-
description: "
|
|
2626
|
+
description: "What needs attention, what changed recently, and how the site is performing.",
|
|
1620
2627
|
title: "Studio",
|
|
1621
|
-
children: /* @__PURE__ */
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
/* @__PURE__ */ jsxs12(Link, { className: "orion-admin-card", href: mediaPath, children: [
|
|
1639
|
-
/* @__PURE__ */ jsx14("strong", { children: "Media" }),
|
|
1640
|
-
/* @__PURE__ */ jsx14("span", { children: "Upload and manage all site media assets." })
|
|
1641
|
-
] }),
|
|
1642
|
-
/* @__PURE__ */ jsxs12(Link, { className: "orion-admin-card", href: toolsPath, children: [
|
|
1643
|
-
/* @__PURE__ */ jsx14("strong", { children: "Admin Tools" }),
|
|
1644
|
-
/* @__PURE__ */ jsx14("span", { children: "Manage users, roles, and system fallback links." })
|
|
1645
|
-
] })
|
|
1646
|
-
] })
|
|
2628
|
+
children: /* @__PURE__ */ jsx17(
|
|
2629
|
+
AdminStudioDashboardClient,
|
|
2630
|
+
{
|
|
2631
|
+
formSubmissionsCollectionSlug,
|
|
2632
|
+
formsCollectionSlug,
|
|
2633
|
+
formsEnabled,
|
|
2634
|
+
formsPath: resolveAdminPath2(adminBasePath, "/forms"),
|
|
2635
|
+
globalsBasePath: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
2636
|
+
mediaCollectionSlug,
|
|
2637
|
+
mediaPath: resolveAdminPath2(adminBasePath, "/media"),
|
|
2638
|
+
pagesCollectionSlug,
|
|
2639
|
+
pagesPath: resolveAdminPath2(adminBasePath, "/pages"),
|
|
2640
|
+
sectionLinks: buildSectionLinks(adminBasePath, sections, formsEnabled, globalsBasePath),
|
|
2641
|
+
toolsPath: resolveAdminPath2(adminBasePath, "/tools"),
|
|
2642
|
+
userRole
|
|
2643
|
+
}
|
|
2644
|
+
)
|
|
1647
2645
|
}
|
|
1648
2646
|
) });
|
|
1649
2647
|
}
|
|
1650
2648
|
|
|
1651
|
-
// src/admin/components/studio/AdminStudioNav.tsx
|
|
1652
|
-
import { useMemo as useMemo2 } from "react";
|
|
1653
|
-
import { usePathname as usePathname2 } from "next/navigation";
|
|
1654
|
-
import { Logout, useAuth as useAuth2 } from "@payloadcms/ui";
|
|
1655
|
-
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1656
|
-
var iconSize2 = 18;
|
|
1657
|
-
function NavIcon({ sectionID }) {
|
|
1658
|
-
const props = {
|
|
1659
|
-
fill: "none",
|
|
1660
|
-
height: iconSize2,
|
|
1661
|
-
stroke: "currentColor",
|
|
1662
|
-
strokeLinecap: "round",
|
|
1663
|
-
strokeLinejoin: "round",
|
|
1664
|
-
strokeWidth: 2,
|
|
1665
|
-
viewBox: "0 0 24 24",
|
|
1666
|
-
width: iconSize2
|
|
1667
|
-
};
|
|
1668
|
-
switch (sectionID) {
|
|
1669
|
-
case "dashboard":
|
|
1670
|
-
return /* @__PURE__ */ jsxs13("svg", { ...props, children: [
|
|
1671
|
-
/* @__PURE__ */ jsx15("rect", { x: "3", y: "3", width: "7", height: "9", rx: "1" }),
|
|
1672
|
-
/* @__PURE__ */ jsx15("rect", { x: "14", y: "3", width: "7", height: "5", rx: "1" }),
|
|
1673
|
-
/* @__PURE__ */ jsx15("rect", { x: "14", y: "12", width: "7", height: "9", rx: "1" }),
|
|
1674
|
-
/* @__PURE__ */ jsx15("rect", { x: "3", y: "16", width: "7", height: "5", rx: "1" })
|
|
1675
|
-
] });
|
|
1676
|
-
case "pages":
|
|
1677
|
-
return /* @__PURE__ */ jsxs13("svg", { ...props, children: [
|
|
1678
|
-
/* @__PURE__ */ jsx15("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
|
|
1679
|
-
/* @__PURE__ */ jsx15("polyline", { points: "14 2 14 8 20 8" }),
|
|
1680
|
-
/* @__PURE__ */ jsx15("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
|
|
1681
|
-
/* @__PURE__ */ jsx15("line", { x1: "8", y1: "17", x2: "12", y2: "17" })
|
|
1682
|
-
] });
|
|
1683
|
-
case "forms":
|
|
1684
|
-
return /* @__PURE__ */ jsxs13("svg", { ...props, children: [
|
|
1685
|
-
/* @__PURE__ */ jsx15("path", { d: "M9 3h6" }),
|
|
1686
|
-
/* @__PURE__ */ jsx15("path", { d: "M12 3v18" }),
|
|
1687
|
-
/* @__PURE__ */ jsx15("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" }),
|
|
1688
|
-
/* @__PURE__ */ jsx15("path", { d: "M7 11h10" }),
|
|
1689
|
-
/* @__PURE__ */ jsx15("path", { d: "M7 15h6" })
|
|
1690
|
-
] });
|
|
1691
|
-
case "globals":
|
|
1692
|
-
return /* @__PURE__ */ jsxs13("svg", { ...props, children: [
|
|
1693
|
-
/* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "3" }),
|
|
1694
|
-
/* @__PURE__ */ jsx15("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" })
|
|
1695
|
-
] });
|
|
1696
|
-
case "media":
|
|
1697
|
-
return /* @__PURE__ */ jsxs13("svg", { ...props, children: [
|
|
1698
|
-
/* @__PURE__ */ jsx15("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
1699
|
-
/* @__PURE__ */ jsx15("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
1700
|
-
/* @__PURE__ */ jsx15("polyline", { points: "21 15 16 10 5 21" })
|
|
1701
|
-
] });
|
|
1702
|
-
case "analytics":
|
|
1703
|
-
return /* @__PURE__ */ jsxs13("svg", { ...props, children: [
|
|
1704
|
-
/* @__PURE__ */ jsx15("path", { d: "M4 19V5" }),
|
|
1705
|
-
/* @__PURE__ */ jsx15("path", { d: "M10 19V10" }),
|
|
1706
|
-
/* @__PURE__ */ jsx15("path", { d: "M16 19v-6" }),
|
|
1707
|
-
/* @__PURE__ */ jsx15("path", { d: "M22 19V3" })
|
|
1708
|
-
] });
|
|
1709
|
-
case "admin-tools":
|
|
1710
|
-
return /* @__PURE__ */ jsx15("svg", { ...props, children: /* @__PURE__ */ jsx15("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" }) });
|
|
1711
|
-
default:
|
|
1712
|
-
return null;
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
function AdminStudioNav(props) {
|
|
1716
|
-
const { user } = useAuth2();
|
|
1717
|
-
const brandName = getPropString(props, "brandName", "Orion Studio");
|
|
1718
|
-
const logoUrl = getPropString(props, "logoUrl", "");
|
|
1719
|
-
const compact = getPropBoolean(props, "compact", false);
|
|
1720
|
-
const adminBasePath = useAdminBasePath();
|
|
1721
|
-
const pathname = usePathname2() || "";
|
|
1722
|
-
const branding = useSiteBranding(brandName, logoUrl || void 0);
|
|
1723
|
-
const resolvedName = branding.siteName || brandName;
|
|
1724
|
-
const dashboardPath = adminBasePath;
|
|
1725
|
-
const userRole = readUserRole(user);
|
|
1726
|
-
const links = useMemo2(() => buildStudioNavItems(props, adminBasePath), [adminBasePath, props]);
|
|
1727
|
-
if (isStudioShellRoute(pathname, props, adminBasePath)) {
|
|
1728
|
-
return null;
|
|
1729
|
-
}
|
|
1730
|
-
const linkStyle = (active) => ({
|
|
1731
|
-
alignItems: "center",
|
|
1732
|
-
background: active ? "var(--theme-elevation-100)" : "transparent",
|
|
1733
|
-
borderRadius: 10,
|
|
1734
|
-
color: "var(--theme-elevation-900)",
|
|
1735
|
-
display: "flex",
|
|
1736
|
-
fontSize: "0.95rem",
|
|
1737
|
-
fontWeight: active ? 800 : 650,
|
|
1738
|
-
justifyContent: compact ? "center" : "flex-start",
|
|
1739
|
-
minHeight: 40,
|
|
1740
|
-
padding: compact ? "0.6rem" : "0.6rem 0.75rem",
|
|
1741
|
-
textDecoration: "none"
|
|
1742
|
-
});
|
|
1743
|
-
return /* @__PURE__ */ jsxs13(
|
|
1744
|
-
"div",
|
|
1745
|
-
{
|
|
1746
|
-
style: {
|
|
1747
|
-
display: "flex",
|
|
1748
|
-
flexDirection: "column",
|
|
1749
|
-
gap: "0.85rem",
|
|
1750
|
-
height: "100%",
|
|
1751
|
-
padding: compact ? "0.8rem 0.5rem" : "1rem 0.85rem"
|
|
1752
|
-
},
|
|
1753
|
-
children: [
|
|
1754
|
-
/* @__PURE__ */ jsxs13("div", { className: "admin-studio-brand", style: { padding: compact ? "0" : "0 0.35rem 0 2.4rem" }, children: [
|
|
1755
|
-
branding.logoUrl ? /* @__PURE__ */ jsx15(
|
|
1756
|
-
"div",
|
|
1757
|
-
{
|
|
1758
|
-
style: {
|
|
1759
|
-
borderRadius: 8,
|
|
1760
|
-
height: compact ? 34 : 40,
|
|
1761
|
-
marginBottom: compact ? 0 : "0.35rem",
|
|
1762
|
-
overflow: "hidden",
|
|
1763
|
-
width: compact ? 34 : 40
|
|
1764
|
-
},
|
|
1765
|
-
children: /* @__PURE__ */ jsx15("img", { alt: `${resolvedName} logo`, src: branding.logoUrl, style: { height: "100%", objectFit: "cover", width: "100%" } })
|
|
1766
|
-
}
|
|
1767
|
-
) : null,
|
|
1768
|
-
/* @__PURE__ */ jsx15(
|
|
1769
|
-
"div",
|
|
1770
|
-
{
|
|
1771
|
-
style: {
|
|
1772
|
-
fontSize: compact ? "0.95rem" : "1.05rem",
|
|
1773
|
-
fontWeight: 900,
|
|
1774
|
-
letterSpacing: "-0.01em",
|
|
1775
|
-
overflow: "hidden",
|
|
1776
|
-
textOverflow: "ellipsis",
|
|
1777
|
-
whiteSpace: "nowrap"
|
|
1778
|
-
},
|
|
1779
|
-
title: resolvedName,
|
|
1780
|
-
children: compact ? resolvedName.slice(0, 1).toUpperCase() : resolvedName
|
|
1781
|
-
}
|
|
1782
|
-
),
|
|
1783
|
-
!compact ? /* @__PURE__ */ jsx15("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.85rem" }, children: "Studio" }) : null
|
|
1784
|
-
] }),
|
|
1785
|
-
/* @__PURE__ */ jsx15("nav", { style: { display: "grid", gap: "0.25rem" }, children: links.filter((link) => !link.roles || userRole && link.roles.includes(userRole)).map((link) => {
|
|
1786
|
-
const active = link.href === dashboardPath ? pathname === dashboardPath : link.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
1787
|
-
return /* @__PURE__ */ jsx15("a", { href: link.href, style: linkStyle(active), title: link.label, children: (() => {
|
|
1788
|
-
const icon = /* @__PURE__ */ jsx15(
|
|
1789
|
-
NavIcon,
|
|
1790
|
-
{
|
|
1791
|
-
sectionID: link.icon === "tools" ? "admin-tools" : link.icon || ""
|
|
1792
|
-
}
|
|
1793
|
-
);
|
|
1794
|
-
if (compact) {
|
|
1795
|
-
return icon || link.label.slice(0, 1);
|
|
1796
|
-
}
|
|
1797
|
-
return /* @__PURE__ */ jsxs13("span", { style: { alignItems: "center", display: "inline-flex", gap: "0.6rem" }, children: [
|
|
1798
|
-
icon,
|
|
1799
|
-
/* @__PURE__ */ jsx15("span", { children: link.label })
|
|
1800
|
-
] });
|
|
1801
|
-
})() }, link.href);
|
|
1802
|
-
}) }),
|
|
1803
|
-
/* @__PURE__ */ jsx15("div", { style: { flex: 1 } }),
|
|
1804
|
-
/* @__PURE__ */ jsxs13(
|
|
1805
|
-
"div",
|
|
1806
|
-
{
|
|
1807
|
-
style: {
|
|
1808
|
-
borderTop: "1px solid var(--theme-elevation-150)",
|
|
1809
|
-
paddingTop: "0.85rem",
|
|
1810
|
-
textAlign: compact ? "center" : "left"
|
|
1811
|
-
},
|
|
1812
|
-
children: [
|
|
1813
|
-
!compact ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
1814
|
-
/* @__PURE__ */ jsx15("div", { style: { color: "var(--theme-elevation-700)", fontSize: "0.85rem" }, children: "Signed in as" }),
|
|
1815
|
-
/* @__PURE__ */ jsx15("div", { style: { fontWeight: 800, marginBottom: "0.55rem" }, children: typeof user?.email === "string" ? user.email : "User" })
|
|
1816
|
-
] }) : null,
|
|
1817
|
-
/* @__PURE__ */ jsx15(Logout, {})
|
|
1818
|
-
]
|
|
1819
|
-
}
|
|
1820
|
-
)
|
|
1821
|
-
]
|
|
1822
|
-
}
|
|
1823
|
-
);
|
|
1824
|
-
}
|
|
1825
|
-
|
|
1826
2649
|
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
1827
|
-
import { useEffect as
|
|
2650
|
+
import { useEffect as useEffect8, useMemo as useMemo4, useState as useState8 } from "react";
|
|
1828
2651
|
import Link2 from "next/link";
|
|
1829
2652
|
import { useAuth as useAuth3 } from "@payloadcms/ui";
|
|
1830
|
-
import { jsx as
|
|
2653
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1831
2654
|
var isAdmin = (user) => {
|
|
1832
2655
|
if (!user || typeof user !== "object") return false;
|
|
1833
2656
|
const role = user.role;
|
|
@@ -1849,10 +2672,10 @@ function AdminStudioPagesListView(props) {
|
|
|
1849
2672
|
const pagesCollectionSlug = getPropString3(props, "pagesCollectionSlug", "pages");
|
|
1850
2673
|
const adminBasePath = useAdminBasePath();
|
|
1851
2674
|
const newPagePath = resolveAdminPath(adminBasePath, "/pages/new");
|
|
1852
|
-
const [loading, setLoading] =
|
|
1853
|
-
const [error, setError] =
|
|
1854
|
-
const [docs, setDocs] =
|
|
1855
|
-
const apiURL =
|
|
2675
|
+
const [loading, setLoading] = useState8(true);
|
|
2676
|
+
const [error, setError] = useState8(null);
|
|
2677
|
+
const [docs, setDocs] = useState8([]);
|
|
2678
|
+
const apiURL = useMemo4(() => {
|
|
1856
2679
|
const params = new URLSearchParams({
|
|
1857
2680
|
depth: "0",
|
|
1858
2681
|
limit: "100",
|
|
@@ -1861,7 +2684,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1861
2684
|
});
|
|
1862
2685
|
return `/api/${pagesCollectionSlug}?${params.toString()}`;
|
|
1863
2686
|
}, [pagesCollectionSlug]);
|
|
1864
|
-
|
|
2687
|
+
useEffect8(() => {
|
|
1865
2688
|
let cancelled = false;
|
|
1866
2689
|
const run = async () => {
|
|
1867
2690
|
setLoading(true);
|
|
@@ -1891,10 +2714,10 @@ function AdminStudioPagesListView(props) {
|
|
|
1891
2714
|
cancelled = true;
|
|
1892
2715
|
};
|
|
1893
2716
|
}, [apiURL]);
|
|
1894
|
-
return /* @__PURE__ */
|
|
2717
|
+
return /* @__PURE__ */ jsx18(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs15(
|
|
1895
2718
|
AdminPage,
|
|
1896
2719
|
{
|
|
1897
|
-
actions: isAdmin(user) ? /* @__PURE__ */
|
|
2720
|
+
actions: isAdmin(user) ? /* @__PURE__ */ jsx18(Link2, { className: "orion-admin-action-button", href: newPagePath, children: "New Page" }) : null,
|
|
1898
2721
|
breadcrumbs: [
|
|
1899
2722
|
{ label: "Dashboard", href: adminBasePath },
|
|
1900
2723
|
{ label: "Pages" }
|
|
@@ -1902,21 +2725,21 @@ function AdminStudioPagesListView(props) {
|
|
|
1902
2725
|
description: "Open a page to edit it in the inline custom builder.",
|
|
1903
2726
|
title: "Pages",
|
|
1904
2727
|
children: [
|
|
1905
|
-
loading ? /* @__PURE__ */
|
|
1906
|
-
error ? /* @__PURE__ */
|
|
1907
|
-
/* @__PURE__ */
|
|
1908
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
/* @__PURE__ */
|
|
2728
|
+
loading ? /* @__PURE__ */ jsx18("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
2729
|
+
error ? /* @__PURE__ */ jsx18("div", { className: "orion-admin-error", children: error }) : null,
|
|
2730
|
+
/* @__PURE__ */ jsxs15("div", { className: "orion-admin-list", children: [
|
|
2731
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ jsxs15("div", { className: "orion-admin-card", children: [
|
|
2732
|
+
/* @__PURE__ */ jsx18("strong", { children: "No pages yet" }),
|
|
2733
|
+
/* @__PURE__ */ jsx18("span", { children: "Create the first page to start building content." })
|
|
1911
2734
|
] }) : null,
|
|
1912
2735
|
docs.map((doc) => {
|
|
1913
2736
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
1914
2737
|
if (!id) return null;
|
|
1915
2738
|
const title = typeof doc.title === "string" ? doc.title : "Untitled Page";
|
|
1916
2739
|
const status = typeof doc._status === "string" ? doc._status : "draft";
|
|
1917
|
-
return /* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
1919
|
-
/* @__PURE__ */
|
|
2740
|
+
return /* @__PURE__ */ jsxs15(Link2, { className: "orion-admin-list-item", href: resolveAdminPath(adminBasePath, `/pages/${id}`), children: [
|
|
2741
|
+
/* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsx18("strong", { children: title }) }),
|
|
2742
|
+
/* @__PURE__ */ jsx18("span", { className: "orion-admin-pill", children: status })
|
|
1920
2743
|
] }, id);
|
|
1921
2744
|
})
|
|
1922
2745
|
] })
|
|
@@ -1926,9 +2749,9 @@ function AdminStudioPagesListView(props) {
|
|
|
1926
2749
|
}
|
|
1927
2750
|
|
|
1928
2751
|
// src/admin/components/studio/AdminStudioPageEditView.tsx
|
|
1929
|
-
import { useEffect as
|
|
2752
|
+
import { useEffect as useEffect9, useMemo as useMemo5, useRef as useRef3, useState as useState9 } from "react";
|
|
1930
2753
|
import { SetStepNav, toast, useAuth as useAuth4 } from "@payloadcms/ui";
|
|
1931
|
-
import { Fragment as Fragment3, jsx as
|
|
2754
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1932
2755
|
var isAdmin2 = (user) => {
|
|
1933
2756
|
if (!user || typeof user !== "object") return false;
|
|
1934
2757
|
const role = user.role;
|
|
@@ -1969,17 +2792,17 @@ function AdminStudioPageEditView(props) {
|
|
|
1969
2792
|
const { user } = useAuth4();
|
|
1970
2793
|
const adminBasePath = useAdminBasePath();
|
|
1971
2794
|
const iframeRef = useRef3(null);
|
|
1972
|
-
const [saving, setSaving] =
|
|
1973
|
-
const [dirty, setDirty] =
|
|
1974
|
-
const [hasUnpublishedChanges, setHasUnpublishedChanges] =
|
|
1975
|
-
const [canUndo, setCanUndo] =
|
|
1976
|
-
const [canRedo, setCanRedo] =
|
|
2795
|
+
const [saving, setSaving] = useState9(null);
|
|
2796
|
+
const [dirty, setDirty] = useState9(false);
|
|
2797
|
+
const [hasUnpublishedChanges, setHasUnpublishedChanges] = useState9(false);
|
|
2798
|
+
const [canUndo, setCanUndo] = useState9(false);
|
|
2799
|
+
const [canRedo, setCanRedo] = useState9(false);
|
|
1977
2800
|
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
1978
2801
|
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1979
|
-
const pageIDFromParams =
|
|
1980
|
-
const [pageID, setPageID] =
|
|
1981
|
-
const [didResolvePathFallback, setDidResolvePathFallback] =
|
|
1982
|
-
|
|
2802
|
+
const pageIDFromParams = useMemo5(() => getParam(props.params, "id"), [props.params]);
|
|
2803
|
+
const [pageID, setPageID] = useState9(pageIDFromParams);
|
|
2804
|
+
const [didResolvePathFallback, setDidResolvePathFallback] = useState9(false);
|
|
2805
|
+
useEffect9(() => {
|
|
1983
2806
|
if (pageIDFromParams) {
|
|
1984
2807
|
setPageID(pageIDFromParams);
|
|
1985
2808
|
setDidResolvePathFallback(true);
|
|
@@ -2023,7 +2846,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2023
2846
|
} catch {
|
|
2024
2847
|
}
|
|
2025
2848
|
};
|
|
2026
|
-
|
|
2849
|
+
useEffect9(() => {
|
|
2027
2850
|
if (!pageID) {
|
|
2028
2851
|
return;
|
|
2029
2852
|
}
|
|
@@ -2046,7 +2869,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2046
2869
|
}
|
|
2047
2870
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
2048
2871
|
};
|
|
2049
|
-
|
|
2872
|
+
useEffect9(() => {
|
|
2050
2873
|
const onMessage = (event) => {
|
|
2051
2874
|
const data = event.data;
|
|
2052
2875
|
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
@@ -2081,8 +2904,8 @@ function AdminStudioPageEditView(props) {
|
|
|
2081
2904
|
return () => window.removeEventListener("message", onMessage);
|
|
2082
2905
|
}, []);
|
|
2083
2906
|
if (!pageID && !didResolvePathFallback) {
|
|
2084
|
-
return /* @__PURE__ */
|
|
2085
|
-
/* @__PURE__ */
|
|
2907
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
2908
|
+
/* @__PURE__ */ jsx19(
|
|
2086
2909
|
SetStepNav,
|
|
2087
2910
|
{
|
|
2088
2911
|
nav: [
|
|
@@ -2091,13 +2914,13 @@ function AdminStudioPageEditView(props) {
|
|
|
2091
2914
|
]
|
|
2092
2915
|
}
|
|
2093
2916
|
),
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsx19("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
2918
|
+
/* @__PURE__ */ jsx19("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading page editor..." })
|
|
2096
2919
|
] }) });
|
|
2097
2920
|
}
|
|
2098
2921
|
if (!pageID) {
|
|
2099
|
-
return /* @__PURE__ */
|
|
2100
|
-
/* @__PURE__ */
|
|
2922
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
2923
|
+
/* @__PURE__ */ jsx19(
|
|
2101
2924
|
SetStepNav,
|
|
2102
2925
|
{
|
|
2103
2926
|
nav: [
|
|
@@ -2106,12 +2929,12 @@ function AdminStudioPageEditView(props) {
|
|
|
2106
2929
|
]
|
|
2107
2930
|
}
|
|
2108
2931
|
),
|
|
2109
|
-
/* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2932
|
+
/* @__PURE__ */ jsx19("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
2933
|
+
/* @__PURE__ */ jsx19("p", { style: { color: "var(--theme-elevation-600)" }, children: "Missing page ID." })
|
|
2111
2934
|
] }) });
|
|
2112
2935
|
}
|
|
2113
|
-
return /* @__PURE__ */
|
|
2114
|
-
/* @__PURE__ */
|
|
2936
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
2937
|
+
/* @__PURE__ */ jsx19(
|
|
2115
2938
|
SetStepNav,
|
|
2116
2939
|
{
|
|
2117
2940
|
nav: [
|
|
@@ -2120,8 +2943,8 @@ function AdminStudioPageEditView(props) {
|
|
|
2120
2943
|
]
|
|
2121
2944
|
}
|
|
2122
2945
|
),
|
|
2123
|
-
/* @__PURE__ */
|
|
2124
|
-
/* @__PURE__ */
|
|
2946
|
+
/* @__PURE__ */ jsxs16("div", { style: { display: "grid", gridTemplateRows: "auto 1fr", height: "calc(100vh - 120px)" }, children: [
|
|
2947
|
+
/* @__PURE__ */ jsxs16(
|
|
2125
2948
|
"div",
|
|
2126
2949
|
{
|
|
2127
2950
|
style: {
|
|
@@ -2137,9 +2960,9 @@ function AdminStudioPageEditView(props) {
|
|
|
2137
2960
|
zIndex: 20
|
|
2138
2961
|
},
|
|
2139
2962
|
children: [
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2963
|
+
/* @__PURE__ */ jsxs16("div", { style: { minWidth: 0 }, children: [
|
|
2964
|
+
/* @__PURE__ */ jsx19("div", { style: { fontWeight: 900 }, children: "Page Editor" }),
|
|
2965
|
+
/* @__PURE__ */ jsxs16(
|
|
2143
2966
|
"div",
|
|
2144
2967
|
{
|
|
2145
2968
|
style: {
|
|
@@ -2155,9 +2978,9 @@ function AdminStudioPageEditView(props) {
|
|
|
2155
2978
|
}
|
|
2156
2979
|
)
|
|
2157
2980
|
] }),
|
|
2158
|
-
/* @__PURE__ */
|
|
2159
|
-
/* @__PURE__ */
|
|
2160
|
-
/* @__PURE__ */
|
|
2981
|
+
/* @__PURE__ */ jsxs16("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
2982
|
+
/* @__PURE__ */ jsx19("div", { style: { color: dirty ? "var(--theme-elevation-900)" : "var(--theme-elevation-600)", fontSize: "0.85rem", fontWeight: 700 }, children: dirty ? "Unsaved changes" : "All changes saved" }),
|
|
2983
|
+
/* @__PURE__ */ jsx19(
|
|
2161
2984
|
"div",
|
|
2162
2985
|
{
|
|
2163
2986
|
style: {
|
|
@@ -2174,7 +2997,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2174
2997
|
children: hasUnpublishedChanges ? "Unpublished draft changes" : "Live is up to date"
|
|
2175
2998
|
}
|
|
2176
2999
|
),
|
|
2177
|
-
/* @__PURE__ */
|
|
3000
|
+
/* @__PURE__ */ jsx19(
|
|
2178
3001
|
"button",
|
|
2179
3002
|
{
|
|
2180
3003
|
disabled: !canUndo,
|
|
@@ -2190,7 +3013,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2190
3013
|
children: "Undo"
|
|
2191
3014
|
}
|
|
2192
3015
|
),
|
|
2193
|
-
/* @__PURE__ */
|
|
3016
|
+
/* @__PURE__ */ jsx19(
|
|
2194
3017
|
"button",
|
|
2195
3018
|
{
|
|
2196
3019
|
disabled: !canRedo,
|
|
@@ -2206,7 +3029,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2206
3029
|
children: "Redo"
|
|
2207
3030
|
}
|
|
2208
3031
|
),
|
|
2209
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ jsx19(
|
|
2210
3033
|
"button",
|
|
2211
3034
|
{
|
|
2212
3035
|
disabled: saving !== null,
|
|
@@ -2222,7 +3045,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2222
3045
|
children: saving === "draft" ? "Saving\u2026" : "Save Draft"
|
|
2223
3046
|
}
|
|
2224
3047
|
),
|
|
2225
|
-
/* @__PURE__ */
|
|
3048
|
+
/* @__PURE__ */ jsx19(
|
|
2226
3049
|
"button",
|
|
2227
3050
|
{
|
|
2228
3051
|
disabled: !canPublish || saving !== null,
|
|
@@ -2245,7 +3068,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2245
3068
|
]
|
|
2246
3069
|
}
|
|
2247
3070
|
),
|
|
2248
|
-
/* @__PURE__ */
|
|
3071
|
+
/* @__PURE__ */ jsx19(
|
|
2249
3072
|
"iframe",
|
|
2250
3073
|
{
|
|
2251
3074
|
ref: iframeRef,
|
|
@@ -2265,9 +3088,9 @@ function AdminStudioPageEditView(props) {
|
|
|
2265
3088
|
}
|
|
2266
3089
|
|
|
2267
3090
|
// src/admin/components/studio/AdminStudioNewPageView.tsx
|
|
2268
|
-
import { useState as
|
|
3091
|
+
import { useState as useState10 } from "react";
|
|
2269
3092
|
import { useAuth as useAuth5 } from "@payloadcms/ui";
|
|
2270
|
-
import { jsx as
|
|
3093
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2271
3094
|
var pageTemplates = ["standard", "landing", "services", "contact"];
|
|
2272
3095
|
var getPropString5 = (props, key, fallback) => {
|
|
2273
3096
|
if (!props || typeof props !== "object") return fallback;
|
|
@@ -2290,10 +3113,10 @@ function AdminStudioNewPageView(props) {
|
|
|
2290
3113
|
const { user } = useAuth5();
|
|
2291
3114
|
const adminBasePath = useAdminBasePath();
|
|
2292
3115
|
const pagesCollectionSlug = getPropString5(props, "pagesCollectionSlug", "pages");
|
|
2293
|
-
const [submitting, setSubmitting] =
|
|
2294
|
-
const [error, setError] =
|
|
3116
|
+
const [submitting, setSubmitting] = useState10(false);
|
|
3117
|
+
const [error, setError] = useState10(null);
|
|
2295
3118
|
if (!canManagePages(user)) {
|
|
2296
|
-
return /* @__PURE__ */
|
|
3119
|
+
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx20(
|
|
2297
3120
|
AdminPage,
|
|
2298
3121
|
{
|
|
2299
3122
|
breadcrumbs: [
|
|
@@ -2303,9 +3126,9 @@ function AdminStudioNewPageView(props) {
|
|
|
2303
3126
|
],
|
|
2304
3127
|
description: "You do not have access to create pages.",
|
|
2305
3128
|
title: "New Page",
|
|
2306
|
-
children: /* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
/* @__PURE__ */
|
|
3129
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "orion-admin-card", children: [
|
|
3130
|
+
/* @__PURE__ */ jsx20("strong", { children: "Access denied" }),
|
|
3131
|
+
/* @__PURE__ */ jsx20("span", { children: "This section is restricted to administrator and editor accounts." })
|
|
2309
3132
|
] })
|
|
2310
3133
|
}
|
|
2311
3134
|
) });
|
|
@@ -2350,7 +3173,7 @@ function AdminStudioNewPageView(props) {
|
|
|
2350
3173
|
setSubmitting(false);
|
|
2351
3174
|
}
|
|
2352
3175
|
};
|
|
2353
|
-
return /* @__PURE__ */
|
|
3176
|
+
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx20(
|
|
2354
3177
|
AdminPage,
|
|
2355
3178
|
{
|
|
2356
3179
|
breadcrumbs: [
|
|
@@ -2360,33 +3183,33 @@ function AdminStudioNewPageView(props) {
|
|
|
2360
3183
|
],
|
|
2361
3184
|
description: "Create a new page and open it in the custom editor.",
|
|
2362
3185
|
title: "New Page",
|
|
2363
|
-
children: /* @__PURE__ */
|
|
2364
|
-
error ? /* @__PURE__ */
|
|
2365
|
-
/* @__PURE__ */
|
|
3186
|
+
children: /* @__PURE__ */ jsxs17("form", { className: "orion-admin-form", onSubmit: createPage, children: [
|
|
3187
|
+
error ? /* @__PURE__ */ jsx20("div", { className: "orion-admin-error", children: error }) : null,
|
|
3188
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
2366
3189
|
"Title",
|
|
2367
|
-
/* @__PURE__ */
|
|
3190
|
+
/* @__PURE__ */ jsx20("input", { name: "title", placeholder: "Services", required: true, type: "text" })
|
|
2368
3191
|
] }),
|
|
2369
|
-
/* @__PURE__ */
|
|
3192
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
2370
3193
|
"Slug",
|
|
2371
|
-
/* @__PURE__ */
|
|
3194
|
+
/* @__PURE__ */ jsx20("input", { name: "slug", placeholder: "services", type: "text" })
|
|
2372
3195
|
] }),
|
|
2373
|
-
/* @__PURE__ */
|
|
3196
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
2374
3197
|
"Template",
|
|
2375
|
-
/* @__PURE__ */
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
3198
|
+
/* @__PURE__ */ jsxs17("select", { defaultValue: "standard", name: "template", children: [
|
|
3199
|
+
/* @__PURE__ */ jsx20("option", { value: "standard", children: "Standard" }),
|
|
3200
|
+
/* @__PURE__ */ jsx20("option", { value: "landing", children: "Landing" }),
|
|
3201
|
+
/* @__PURE__ */ jsx20("option", { value: "contact", children: "Contact" }),
|
|
3202
|
+
/* @__PURE__ */ jsx20("option", { value: "services", children: "Services" })
|
|
2380
3203
|
] })
|
|
2381
3204
|
] }),
|
|
2382
|
-
/* @__PURE__ */
|
|
3205
|
+
/* @__PURE__ */ jsx20("button", { disabled: submitting, type: "submit", children: submitting ? "Creating..." : "Create Page" })
|
|
2383
3206
|
] })
|
|
2384
3207
|
}
|
|
2385
3208
|
) });
|
|
2386
3209
|
}
|
|
2387
3210
|
|
|
2388
3211
|
// src/admin/components/studio/AdminStudioGlobalsView.tsx
|
|
2389
|
-
import { jsx as
|
|
3212
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2390
3213
|
var getPropGlobals = (props) => {
|
|
2391
3214
|
if (!props || typeof props !== "object") return null;
|
|
2392
3215
|
const direct = props.globals;
|
|
@@ -2406,7 +3229,7 @@ function AdminStudioGlobalsView(props) {
|
|
|
2406
3229
|
{ slug: "footer", label: "Footer" },
|
|
2407
3230
|
{ slug: "social-media", label: "Social Media" }
|
|
2408
3231
|
];
|
|
2409
|
-
return /* @__PURE__ */
|
|
3232
|
+
return /* @__PURE__ */ jsx21(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx21(
|
|
2410
3233
|
AdminPage,
|
|
2411
3234
|
{
|
|
2412
3235
|
breadcrumbs: [
|
|
@@ -2415,17 +3238,17 @@ function AdminStudioGlobalsView(props) {
|
|
|
2415
3238
|
],
|
|
2416
3239
|
description: "Site-wide content and branding settings.",
|
|
2417
3240
|
title: "Globals",
|
|
2418
|
-
children: /* @__PURE__ */
|
|
3241
|
+
children: /* @__PURE__ */ jsx21("div", { className: "orion-admin-list", children: globals.map((global) => {
|
|
2419
3242
|
const href = resolveAdminPath(
|
|
2420
3243
|
adminBasePath,
|
|
2421
3244
|
typeof global.href === "string" ? global.href : `/globals/${global.slug}`
|
|
2422
3245
|
);
|
|
2423
|
-
return /* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
3246
|
+
return /* @__PURE__ */ jsxs18("a", { className: "orion-admin-list-item", href, children: [
|
|
3247
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3248
|
+
/* @__PURE__ */ jsx21("strong", { children: global.label }),
|
|
3249
|
+
/* @__PURE__ */ jsx21("div", { className: "orion-admin-list-meta", children: typeof global.description === "string" && global.description.length > 0 ? global.description : href })
|
|
2427
3250
|
] }),
|
|
2428
|
-
/* @__PURE__ */
|
|
3251
|
+
/* @__PURE__ */ jsx21("span", { className: "orion-admin-list-meta", children: "Open" })
|
|
2429
3252
|
] }, global.slug);
|
|
2430
3253
|
}) })
|
|
2431
3254
|
}
|
|
@@ -2433,8 +3256,8 @@ function AdminStudioGlobalsView(props) {
|
|
|
2433
3256
|
}
|
|
2434
3257
|
|
|
2435
3258
|
// src/admin/components/studio/AdminStudioSiteSettingsGlobalView.tsx
|
|
2436
|
-
import { useEffect as
|
|
2437
|
-
import { jsx as
|
|
3259
|
+
import { useEffect as useEffect10, useMemo as useMemo6, useState as useState11 } from "react";
|
|
3260
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2438
3261
|
var getPropString6 = (props, key, fallback) => {
|
|
2439
3262
|
if (!props || typeof props !== "object") return fallback;
|
|
2440
3263
|
const direct = props[key];
|
|
@@ -2519,13 +3342,13 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2519
3342
|
const mediaCollectionSlug = getPropString6(props, "mediaCollectionSlug", "media");
|
|
2520
3343
|
const adminBasePath = useAdminBasePath();
|
|
2521
3344
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2522
|
-
const [loading, setLoading] =
|
|
2523
|
-
const [saving, setSaving] =
|
|
2524
|
-
const [error, setError] =
|
|
2525
|
-
const [savedMessage, setSavedMessage] =
|
|
2526
|
-
const [globalData, setGlobalData] =
|
|
2527
|
-
const [mediaOptions, setMediaOptions] =
|
|
2528
|
-
|
|
3345
|
+
const [loading, setLoading] = useState11(true);
|
|
3346
|
+
const [saving, setSaving] = useState11(false);
|
|
3347
|
+
const [error, setError] = useState11(null);
|
|
3348
|
+
const [savedMessage, setSavedMessage] = useState11(null);
|
|
3349
|
+
const [globalData, setGlobalData] = useState11({});
|
|
3350
|
+
const [mediaOptions, setMediaOptions] = useState11([]);
|
|
3351
|
+
useEffect10(() => {
|
|
2529
3352
|
let cancelled = false;
|
|
2530
3353
|
const run = async () => {
|
|
2531
3354
|
setLoading(true);
|
|
@@ -2573,15 +3396,15 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2573
3396
|
cancelled = true;
|
|
2574
3397
|
};
|
|
2575
3398
|
}, [globalSlug, mediaCollectionSlug]);
|
|
2576
|
-
const defaultSeo =
|
|
3399
|
+
const defaultSeo = useMemo6(() => {
|
|
2577
3400
|
const value = globalData.defaultSeo;
|
|
2578
3401
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2579
3402
|
}, [globalData.defaultSeo]);
|
|
2580
|
-
const businessProfile =
|
|
3403
|
+
const businessProfile = useMemo6(() => {
|
|
2581
3404
|
const value = globalData.businessProfile;
|
|
2582
3405
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2583
3406
|
}, [globalData.businessProfile]);
|
|
2584
|
-
const openingHoursRows =
|
|
3407
|
+
const openingHoursRows = useMemo6(
|
|
2585
3408
|
() => serializeRows(businessProfile.openingHours, (item) => {
|
|
2586
3409
|
const dayOfWeek = String(item.dayOfWeek || "").trim();
|
|
2587
3410
|
const opens = String(item.opens || "").trim();
|
|
@@ -2593,14 +3416,14 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2593
3416
|
}),
|
|
2594
3417
|
[businessProfile.openingHours]
|
|
2595
3418
|
);
|
|
2596
|
-
const sameAsRows =
|
|
3419
|
+
const sameAsRows = useMemo6(
|
|
2597
3420
|
() => serializeRows(businessProfile.sameAs, (item) => {
|
|
2598
3421
|
const url = String(item.url || "").trim();
|
|
2599
3422
|
return url || null;
|
|
2600
3423
|
}),
|
|
2601
3424
|
[businessProfile.sameAs]
|
|
2602
3425
|
);
|
|
2603
|
-
const serviceCatalogRows =
|
|
3426
|
+
const serviceCatalogRows = useMemo6(
|
|
2604
3427
|
() => serializeRows(businessProfile.serviceCatalog, (item) => {
|
|
2605
3428
|
const name = String(item.name || "").trim();
|
|
2606
3429
|
const description = String(item.description || "").trim();
|
|
@@ -2671,7 +3494,7 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2671
3494
|
};
|
|
2672
3495
|
const logoID = getRelationID(globalData.logo);
|
|
2673
3496
|
const ogImageID = getRelationID(defaultSeo.ogImage);
|
|
2674
|
-
return /* @__PURE__ */
|
|
3497
|
+
return /* @__PURE__ */ jsx22(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs19(
|
|
2675
3498
|
AdminPage,
|
|
2676
3499
|
{
|
|
2677
3500
|
breadcrumbs: [
|
|
@@ -2682,126 +3505,126 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2682
3505
|
description: "Manage site-wide brand, SEO, and business metadata.",
|
|
2683
3506
|
title: "Website Settings",
|
|
2684
3507
|
children: [
|
|
2685
|
-
loading ? /* @__PURE__ */
|
|
2686
|
-
!loading ? /* @__PURE__ */
|
|
2687
|
-
error ? /* @__PURE__ */
|
|
2688
|
-
savedMessage ? /* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
3508
|
+
loading ? /* @__PURE__ */ jsx22("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
3509
|
+
!loading ? /* @__PURE__ */ jsxs19("form", { className: "orion-admin-form", onSubmit: save, children: [
|
|
3510
|
+
error ? /* @__PURE__ */ jsx22("div", { className: "orion-admin-error", children: error }) : null,
|
|
3511
|
+
savedMessage ? /* @__PURE__ */ jsx22("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
3512
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2690
3513
|
"Site Name",
|
|
2691
|
-
/* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(globalData.siteName || ""), name: "siteName", required: true, type: "text" })
|
|
2692
3515
|
] }),
|
|
2693
|
-
/* @__PURE__ */
|
|
3516
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2694
3517
|
"Tagline",
|
|
2695
|
-
/* @__PURE__ */
|
|
3518
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(globalData.tagline || ""), name: "tagline", type: "text" })
|
|
2696
3519
|
] }),
|
|
2697
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2698
3521
|
"Logo (media ID)",
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
3522
|
+
/* @__PURE__ */ jsxs19("select", { defaultValue: logoID ? String(logoID) : "", name: "logo", children: [
|
|
3523
|
+
/* @__PURE__ */ jsx22("option", { value: "", children: "No logo" }),
|
|
2701
3524
|
mediaOptions.map((asset) => {
|
|
2702
3525
|
const id = typeof asset.id === "string" || typeof asset.id === "number" ? String(asset.id) : "";
|
|
2703
3526
|
if (!id) return null;
|
|
2704
|
-
return /* @__PURE__ */
|
|
3527
|
+
return /* @__PURE__ */ jsx22("option", { value: id, children: asset.filename || `Media ${id}` }, id);
|
|
2705
3528
|
})
|
|
2706
3529
|
] })
|
|
2707
3530
|
] }),
|
|
2708
|
-
/* @__PURE__ */
|
|
3531
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2709
3532
|
"SEO Meta Title",
|
|
2710
|
-
/* @__PURE__ */
|
|
3533
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(defaultSeo.metaTitle || ""), name: "metaTitle", type: "text" })
|
|
2711
3534
|
] }),
|
|
2712
|
-
/* @__PURE__ */
|
|
3535
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2713
3536
|
"SEO Meta Description",
|
|
2714
|
-
/* @__PURE__ */
|
|
3537
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: String(defaultSeo.metaDescription || ""), name: "metaDescription", rows: 3 })
|
|
2715
3538
|
] }),
|
|
2716
|
-
/* @__PURE__ */
|
|
3539
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2717
3540
|
"Canonical Base URL",
|
|
2718
|
-
/* @__PURE__ */
|
|
3541
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(defaultSeo.canonicalBaseUrl || ""), name: "canonicalBaseUrl", type: "text" })
|
|
2719
3542
|
] }),
|
|
2720
|
-
/* @__PURE__ */
|
|
3543
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2721
3544
|
"SEO OG Image (media ID)",
|
|
2722
|
-
/* @__PURE__ */
|
|
2723
|
-
/* @__PURE__ */
|
|
3545
|
+
/* @__PURE__ */ jsxs19("select", { defaultValue: ogImageID ? String(ogImageID) : "", name: "ogImage", children: [
|
|
3546
|
+
/* @__PURE__ */ jsx22("option", { value: "", children: "No image" }),
|
|
2724
3547
|
mediaOptions.map((asset) => {
|
|
2725
3548
|
const id = typeof asset.id === "string" || typeof asset.id === "number" ? String(asset.id) : "";
|
|
2726
3549
|
if (!id) return null;
|
|
2727
|
-
return /* @__PURE__ */
|
|
3550
|
+
return /* @__PURE__ */ jsx22("option", { value: id, children: asset.filename || `Media ${id}` }, id);
|
|
2728
3551
|
})
|
|
2729
3552
|
] })
|
|
2730
3553
|
] }),
|
|
2731
|
-
/* @__PURE__ */
|
|
3554
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2732
3555
|
"Business Schema Type",
|
|
2733
|
-
/* @__PURE__ */
|
|
3556
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.schemaType || "Store"), name: "schemaType", type: "text" })
|
|
2734
3557
|
] }),
|
|
2735
|
-
/* @__PURE__ */
|
|
3558
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2736
3559
|
"Business Description",
|
|
2737
|
-
/* @__PURE__ */
|
|
3560
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: String(businessProfile.description || ""), name: "businessDescription", rows: 4 })
|
|
2738
3561
|
] }),
|
|
2739
|
-
/* @__PURE__ */
|
|
3562
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2740
3563
|
"Street Address",
|
|
2741
|
-
/* @__PURE__ */
|
|
3564
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.streetAddress || ""), name: "streetAddress", type: "text" })
|
|
2742
3565
|
] }),
|
|
2743
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2744
3567
|
"City",
|
|
2745
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.addressLocality || ""), name: "addressLocality", type: "text" })
|
|
2746
3569
|
] }),
|
|
2747
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2748
3571
|
"State / Region",
|
|
2749
|
-
/* @__PURE__ */
|
|
3572
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.addressRegion || ""), name: "addressRegion", type: "text" })
|
|
2750
3573
|
] }),
|
|
2751
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2752
3575
|
"Postal Code",
|
|
2753
|
-
/* @__PURE__ */
|
|
3576
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.postalCode || ""), name: "postalCode", type: "text" })
|
|
2754
3577
|
] }),
|
|
2755
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2756
3579
|
"Country Code",
|
|
2757
|
-
/* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.addressCountry || "US"), name: "addressCountry", type: "text" })
|
|
2758
3581
|
] }),
|
|
2759
|
-
/* @__PURE__ */
|
|
3582
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2760
3583
|
"Neighborhood",
|
|
2761
|
-
/* @__PURE__ */
|
|
3584
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.neighborhood || ""), name: "neighborhood", type: "text" })
|
|
2762
3585
|
] }),
|
|
2763
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2764
3587
|
"Latitude",
|
|
2765
|
-
/* @__PURE__ */
|
|
3588
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.latitude || ""), name: "latitude", type: "text" })
|
|
2766
3589
|
] }),
|
|
2767
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2768
3591
|
"Longitude",
|
|
2769
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.longitude || ""), name: "longitude", type: "text" })
|
|
2770
3593
|
] }),
|
|
2771
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2772
3595
|
"Price Range",
|
|
2773
|
-
/* @__PURE__ */
|
|
3596
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.priceRange || ""), name: "priceRange", type: "text" })
|
|
2774
3597
|
] }),
|
|
2775
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2776
3599
|
"Map URL",
|
|
2777
|
-
/* @__PURE__ */
|
|
3600
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.mapUrl || ""), name: "mapUrl", type: "text" })
|
|
2778
3601
|
] }),
|
|
2779
|
-
/* @__PURE__ */
|
|
3602
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2780
3603
|
"LLM Summary",
|
|
2781
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: String(businessProfile.llmsSummary || ""), name: "llmsSummary", rows: 4 })
|
|
2782
3605
|
] }),
|
|
2783
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2784
3607
|
"Opening Hours Rows",
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
3608
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: openingHoursRows, name: "openingHoursRows", rows: 4 }),
|
|
3609
|
+
/* @__PURE__ */ jsxs19("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: [
|
|
2787
3610
|
"One row per line: ",
|
|
2788
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ jsx22("code", { children: "Monday,Tuesday,Wednesday|10:00|19:00" })
|
|
2789
3612
|
] })
|
|
2790
3613
|
] }),
|
|
2791
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2792
3615
|
"Citation / SameAs URLs",
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: sameAsRows, name: "sameAsRows", rows: 4 }),
|
|
3617
|
+
/* @__PURE__ */ jsx22("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: "One absolute URL per line. Social links still come from the Social Media global." })
|
|
2795
3618
|
] }),
|
|
2796
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2797
3620
|
"Service Schema Rows",
|
|
2798
|
-
/* @__PURE__ */
|
|
2799
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: serviceCatalogRows, name: "serviceCatalogRows", rows: 6 }),
|
|
3622
|
+
/* @__PURE__ */ jsxs19("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: [
|
|
2800
3623
|
"One row per line: ",
|
|
2801
|
-
/* @__PURE__ */
|
|
3624
|
+
/* @__PURE__ */ jsx22("code", { children: "Name|Description|Optional price range|/page-path" })
|
|
2802
3625
|
] })
|
|
2803
3626
|
] }),
|
|
2804
|
-
/* @__PURE__ */
|
|
3627
|
+
/* @__PURE__ */ jsx22("button", { disabled: saving, type: "submit", children: saving ? "Saving..." : "Save Global" })
|
|
2805
3628
|
] }) : null
|
|
2806
3629
|
]
|
|
2807
3630
|
}
|
|
@@ -2809,7 +3632,7 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2809
3632
|
}
|
|
2810
3633
|
|
|
2811
3634
|
// src/admin/components/studio/AdminStudioSocialMediaGlobalView.tsx
|
|
2812
|
-
import { useEffect as
|
|
3635
|
+
import { useEffect as useEffect11, useMemo as useMemo7, useState as useState12 } from "react";
|
|
2813
3636
|
|
|
2814
3637
|
// src/shared/socialMedia.ts
|
|
2815
3638
|
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
@@ -2891,7 +3714,7 @@ var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
|
2891
3714
|
);
|
|
2892
3715
|
|
|
2893
3716
|
// src/admin/components/studio/AdminStudioSocialMediaGlobalView.tsx
|
|
2894
|
-
import { jsx as
|
|
3717
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2895
3718
|
var getSocialUrlFieldName = (platform) => `social-${platform}-url`;
|
|
2896
3719
|
var getSocialIconFieldName = (platform) => `social-${platform}-icon`;
|
|
2897
3720
|
var getPropString7 = (props, key, fallback) => {
|
|
@@ -2946,12 +3769,12 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
2946
3769
|
const globalsBasePath = getPropString7(props, "globalsBasePath", "/globals");
|
|
2947
3770
|
const adminBasePath = useAdminBasePath();
|
|
2948
3771
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2949
|
-
const [loading, setLoading] =
|
|
2950
|
-
const [saving, setSaving] =
|
|
2951
|
-
const [error, setError] =
|
|
2952
|
-
const [savedMessage, setSavedMessage] =
|
|
2953
|
-
const [globalData, setGlobalData] =
|
|
2954
|
-
|
|
3772
|
+
const [loading, setLoading] = useState12(true);
|
|
3773
|
+
const [saving, setSaving] = useState12(false);
|
|
3774
|
+
const [error, setError] = useState12(null);
|
|
3775
|
+
const [savedMessage, setSavedMessage] = useState12(null);
|
|
3776
|
+
const [globalData, setGlobalData] = useState12({});
|
|
3777
|
+
useEffect11(() => {
|
|
2955
3778
|
let cancelled = false;
|
|
2956
3779
|
const run = async () => {
|
|
2957
3780
|
setLoading(true);
|
|
@@ -2982,7 +3805,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
2982
3805
|
cancelled = true;
|
|
2983
3806
|
};
|
|
2984
3807
|
}, [globalSlug]);
|
|
2985
|
-
const socialProfiles =
|
|
3808
|
+
const socialProfiles = useMemo7(
|
|
2986
3809
|
() => normalizeSocialMediaProfiles(globalData.profiles),
|
|
2987
3810
|
[globalData.profiles]
|
|
2988
3811
|
);
|
|
@@ -3028,7 +3851,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3028
3851
|
setSaving(false);
|
|
3029
3852
|
}
|
|
3030
3853
|
};
|
|
3031
|
-
return /* @__PURE__ */
|
|
3854
|
+
return /* @__PURE__ */ jsx23(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs20(
|
|
3032
3855
|
AdminPage,
|
|
3033
3856
|
{
|
|
3034
3857
|
breadcrumbs: [
|
|
@@ -3039,16 +3862,16 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3039
3862
|
description: "Control which social profiles appear across the site.",
|
|
3040
3863
|
title: "Social Media",
|
|
3041
3864
|
children: [
|
|
3042
|
-
loading ? /* @__PURE__ */
|
|
3043
|
-
!loading ? /* @__PURE__ */
|
|
3044
|
-
error ? /* @__PURE__ */
|
|
3045
|
-
savedMessage ? /* @__PURE__ */
|
|
3046
|
-
/* @__PURE__ */
|
|
3865
|
+
loading ? /* @__PURE__ */ jsx23("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
3866
|
+
!loading ? /* @__PURE__ */ jsxs20("form", { className: "orion-admin-form", onSubmit: save, children: [
|
|
3867
|
+
error ? /* @__PURE__ */ jsx23("div", { className: "orion-admin-error", children: error }) : null,
|
|
3868
|
+
savedMessage ? /* @__PURE__ */ jsx23("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
3869
|
+
/* @__PURE__ */ jsx23("div", { style: { color: "var(--orion-admin-muted)", fontSize: "0.88rem", fontWeight: 700 }, children: "Add URLs for the platforms you use. Leave a URL blank to hide that platform." }),
|
|
3047
3870
|
SOCIAL_MEDIA_PLATFORMS.map((platform) => {
|
|
3048
3871
|
const profile = socialProfiles[platform];
|
|
3049
3872
|
const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
|
|
3050
3873
|
const placeholderDomain = platform === "x" ? "x.com" : `${platform}.com`;
|
|
3051
|
-
return /* @__PURE__ */
|
|
3874
|
+
return /* @__PURE__ */ jsxs20(
|
|
3052
3875
|
"fieldset",
|
|
3053
3876
|
{
|
|
3054
3877
|
style: {
|
|
@@ -3059,10 +3882,10 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3059
3882
|
padding: "0.85rem"
|
|
3060
3883
|
},
|
|
3061
3884
|
children: [
|
|
3062
|
-
/* @__PURE__ */
|
|
3063
|
-
/* @__PURE__ */
|
|
3885
|
+
/* @__PURE__ */ jsx23("legend", { style: { fontWeight: 700, padding: "0 0.3rem" }, children: platformLabel }),
|
|
3886
|
+
/* @__PURE__ */ jsxs20("label", { children: [
|
|
3064
3887
|
"Profile URL",
|
|
3065
|
-
/* @__PURE__ */
|
|
3888
|
+
/* @__PURE__ */ jsx23(
|
|
3066
3889
|
"input",
|
|
3067
3890
|
{
|
|
3068
3891
|
defaultValue: profile.url,
|
|
@@ -3073,16 +3896,16 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3073
3896
|
}
|
|
3074
3897
|
)
|
|
3075
3898
|
] }),
|
|
3076
|
-
/* @__PURE__ */
|
|
3899
|
+
/* @__PURE__ */ jsxs20("label", { children: [
|
|
3077
3900
|
"Icon Style",
|
|
3078
|
-
/* @__PURE__ */
|
|
3901
|
+
/* @__PURE__ */ jsx23("select", { defaultValue: profile.icon, name: getSocialIconFieldName(platform), children: SOCIAL_MEDIA_ICON_OPTIONS[platform].map((option) => /* @__PURE__ */ jsx23("option", { value: option.value, children: option.label }, option.value)) })
|
|
3079
3902
|
] })
|
|
3080
3903
|
]
|
|
3081
3904
|
},
|
|
3082
3905
|
platform
|
|
3083
3906
|
);
|
|
3084
3907
|
}),
|
|
3085
|
-
/* @__PURE__ */
|
|
3908
|
+
/* @__PURE__ */ jsx23("button", { disabled: saving, type: "submit", children: saving ? "Saving..." : "Save Global" })
|
|
3086
3909
|
] }) : null
|
|
3087
3910
|
]
|
|
3088
3911
|
}
|
|
@@ -3090,7 +3913,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3090
3913
|
}
|
|
3091
3914
|
|
|
3092
3915
|
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
3093
|
-
import { useEffect as
|
|
3916
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useState as useState13 } from "react";
|
|
3094
3917
|
import { SetStepNav as SetStepNav2 } from "@payloadcms/ui";
|
|
3095
3918
|
|
|
3096
3919
|
// src/nextjs/utilities/socialMedia.ts
|
|
@@ -3120,7 +3943,7 @@ function resolveSocialMediaLinks(data) {
|
|
|
3120
3943
|
}
|
|
3121
3944
|
|
|
3122
3945
|
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
3123
|
-
import { jsx as
|
|
3946
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3124
3947
|
var getPropString8 = (props, key, fallback) => {
|
|
3125
3948
|
if (!props || typeof props !== "object") return fallback;
|
|
3126
3949
|
const direct = props[key];
|
|
@@ -3186,16 +4009,16 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3186
4009
|
const adminBasePath = useAdminBasePath();
|
|
3187
4010
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3188
4011
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
3189
|
-
const [loading, setLoading] =
|
|
3190
|
-
const [saving, setSaving] =
|
|
3191
|
-
const [error, setError] =
|
|
3192
|
-
const [savedMessage, setSavedMessage] =
|
|
3193
|
-
const [initialItems, setInitialItems] =
|
|
3194
|
-
const [liveItems, setLiveItems] =
|
|
3195
|
-
const [pages, setPages] =
|
|
3196
|
-
const [siteSettings, setSiteSettings] =
|
|
3197
|
-
const [socialMedia, setSocialMedia] =
|
|
3198
|
-
|
|
4012
|
+
const [loading, setLoading] = useState13(true);
|
|
4013
|
+
const [saving, setSaving] = useState13(false);
|
|
4014
|
+
const [error, setError] = useState13(null);
|
|
4015
|
+
const [savedMessage, setSavedMessage] = useState13(null);
|
|
4016
|
+
const [initialItems, setInitialItems] = useState13([]);
|
|
4017
|
+
const [liveItems, setLiveItems] = useState13([]);
|
|
4018
|
+
const [pages, setPages] = useState13([]);
|
|
4019
|
+
const [siteSettings, setSiteSettings] = useState13({});
|
|
4020
|
+
const [socialMedia, setSocialMedia] = useState13({});
|
|
4021
|
+
useEffect12(() => {
|
|
3199
4022
|
let cancelled = false;
|
|
3200
4023
|
const run = async () => {
|
|
3201
4024
|
setLoading(true);
|
|
@@ -3258,8 +4081,8 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3258
4081
|
cancelled = true;
|
|
3259
4082
|
};
|
|
3260
4083
|
}, [globalSlug, pagesCollectionSlug]);
|
|
3261
|
-
const pageOptions =
|
|
3262
|
-
const previewSocialLinks =
|
|
4084
|
+
const pageOptions = useMemo8(() => buildAdminPageLinkOptions(pages), [pages]);
|
|
4085
|
+
const previewSocialLinks = useMemo8(
|
|
3263
4086
|
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
3264
4087
|
label: item.label,
|
|
3265
4088
|
platform: item.platform,
|
|
@@ -3270,7 +4093,7 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3270
4093
|
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
3271
4094
|
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
3272
4095
|
const previewLogoUrl = resolveMediaURL(siteSettings.logo);
|
|
3273
|
-
const editorKey =
|
|
4096
|
+
const editorKey = useMemo8(() => JSON.stringify(initialItems), [initialItems]);
|
|
3274
4097
|
const save = async () => {
|
|
3275
4098
|
setSaving(true);
|
|
3276
4099
|
setError(null);
|
|
@@ -3304,8 +4127,8 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3304
4127
|
setSaving(false);
|
|
3305
4128
|
}
|
|
3306
4129
|
};
|
|
3307
|
-
return /* @__PURE__ */
|
|
3308
|
-
/* @__PURE__ */
|
|
4130
|
+
return /* @__PURE__ */ jsx24(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs21("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4131
|
+
/* @__PURE__ */ jsx24(
|
|
3309
4132
|
SetStepNav2,
|
|
3310
4133
|
{
|
|
3311
4134
|
nav: [
|
|
@@ -3314,13 +4137,13 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3314
4137
|
]
|
|
3315
4138
|
}
|
|
3316
4139
|
),
|
|
3317
|
-
/* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
loading ? /* @__PURE__ */
|
|
3320
|
-
error ? /* @__PURE__ */
|
|
3321
|
-
savedMessage ? /* @__PURE__ */
|
|
3322
|
-
!loading ? /* @__PURE__ */
|
|
3323
|
-
/* @__PURE__ */
|
|
4140
|
+
/* @__PURE__ */ jsx24("h1", { style: { margin: 0 }, children: "Header & Navigation" }),
|
|
4141
|
+
/* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage the main website navigation and preview it in place." }),
|
|
4142
|
+
loading ? /* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading header settings\u2026" }) : null,
|
|
4143
|
+
error ? /* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4144
|
+
savedMessage ? /* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4145
|
+
!loading ? /* @__PURE__ */ jsxs21("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4146
|
+
/* @__PURE__ */ jsx24(
|
|
3324
4147
|
HeaderNavEditorWithPreview,
|
|
3325
4148
|
{
|
|
3326
4149
|
actionHref,
|
|
@@ -3337,7 +4160,7 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3337
4160
|
},
|
|
3338
4161
|
editorKey
|
|
3339
4162
|
),
|
|
3340
|
-
/* @__PURE__ */
|
|
4163
|
+
/* @__PURE__ */ jsx24("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ jsx24(
|
|
3341
4164
|
"button",
|
|
3342
4165
|
{
|
|
3343
4166
|
disabled: saving,
|
|
@@ -3361,9 +4184,9 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3361
4184
|
}
|
|
3362
4185
|
|
|
3363
4186
|
// src/admin/components/studio/AdminStudioFooterGlobalView.tsx
|
|
3364
|
-
import { useEffect as
|
|
4187
|
+
import { useEffect as useEffect13, useMemo as useMemo9, useState as useState14 } from "react";
|
|
3365
4188
|
import { SetStepNav as SetStepNav3 } from "@payloadcms/ui";
|
|
3366
|
-
import { jsx as
|
|
4189
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3367
4190
|
var getPropString9 = (props, key, fallback) => {
|
|
3368
4191
|
if (!props || typeof props !== "object") return fallback;
|
|
3369
4192
|
const direct = props[key];
|
|
@@ -3469,18 +4292,18 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3469
4292
|
const adminBasePath = useAdminBasePath();
|
|
3470
4293
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3471
4294
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
3472
|
-
const [loading, setLoading] =
|
|
3473
|
-
const [saving, setSaving] =
|
|
3474
|
-
const [error, setError] =
|
|
3475
|
-
const [savedMessage, setSavedMessage] =
|
|
3476
|
-
const [doc, setDoc] =
|
|
4295
|
+
const [loading, setLoading] = useState14(true);
|
|
4296
|
+
const [saving, setSaving] = useState14(false);
|
|
4297
|
+
const [error, setError] = useState14(null);
|
|
4298
|
+
const [savedMessage, setSavedMessage] = useState14(null);
|
|
4299
|
+
const [doc, setDoc] = useState14({
|
|
3477
4300
|
contactEmail: "",
|
|
3478
4301
|
contactPhone: "",
|
|
3479
4302
|
copyright: ""
|
|
3480
4303
|
});
|
|
3481
|
-
const [siteSettings, setSiteSettings] =
|
|
3482
|
-
const [socialMedia, setSocialMedia] =
|
|
3483
|
-
|
|
4304
|
+
const [siteSettings, setSiteSettings] = useState14({});
|
|
4305
|
+
const [socialMedia, setSocialMedia] = useState14({});
|
|
4306
|
+
useEffect13(() => {
|
|
3484
4307
|
let cancelled = false;
|
|
3485
4308
|
const run = async () => {
|
|
3486
4309
|
setLoading(true);
|
|
@@ -3532,7 +4355,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3532
4355
|
cancelled = true;
|
|
3533
4356
|
};
|
|
3534
4357
|
}, [globalSlug]);
|
|
3535
|
-
const previewSocialLinks =
|
|
4358
|
+
const previewSocialLinks = useMemo9(
|
|
3536
4359
|
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
3537
4360
|
label: item.label,
|
|
3538
4361
|
platform: item.platform,
|
|
@@ -3577,8 +4400,8 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3577
4400
|
setSaving(false);
|
|
3578
4401
|
}
|
|
3579
4402
|
};
|
|
3580
|
-
return /* @__PURE__ */
|
|
3581
|
-
/* @__PURE__ */
|
|
4403
|
+
return /* @__PURE__ */ jsx25(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs22("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4404
|
+
/* @__PURE__ */ jsx25(
|
|
3582
4405
|
SetStepNav3,
|
|
3583
4406
|
{
|
|
3584
4407
|
nav: [
|
|
@@ -3587,13 +4410,13 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3587
4410
|
]
|
|
3588
4411
|
}
|
|
3589
4412
|
),
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3592
|
-
loading ? /* @__PURE__ */
|
|
3593
|
-
error ? /* @__PURE__ */
|
|
3594
|
-
savedMessage ? /* @__PURE__ */
|
|
3595
|
-
!loading ? /* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
4413
|
+
/* @__PURE__ */ jsx25("h1", { style: { margin: 0 }, children: "Footer" }),
|
|
4414
|
+
/* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage footer contact details and preview the package footer in place." }),
|
|
4415
|
+
loading ? /* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading footer settings\u2026" }) : null,
|
|
4416
|
+
error ? /* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4417
|
+
savedMessage ? /* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4418
|
+
!loading ? /* @__PURE__ */ jsxs22("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4419
|
+
/* @__PURE__ */ jsxs22(
|
|
3597
4420
|
"label",
|
|
3598
4421
|
{
|
|
3599
4422
|
style: {
|
|
@@ -3605,7 +4428,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3605
4428
|
},
|
|
3606
4429
|
children: [
|
|
3607
4430
|
"Copyright",
|
|
3608
|
-
/* @__PURE__ */
|
|
4431
|
+
/* @__PURE__ */ jsx25(
|
|
3609
4432
|
"input",
|
|
3610
4433
|
{
|
|
3611
4434
|
onChange: (event) => setDoc((current) => ({ ...current, copyright: event.target.value })),
|
|
@@ -3626,7 +4449,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3626
4449
|
]
|
|
3627
4450
|
}
|
|
3628
4451
|
),
|
|
3629
|
-
/* @__PURE__ */
|
|
4452
|
+
/* @__PURE__ */ jsxs22(
|
|
3630
4453
|
"label",
|
|
3631
4454
|
{
|
|
3632
4455
|
style: {
|
|
@@ -3638,7 +4461,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3638
4461
|
},
|
|
3639
4462
|
children: [
|
|
3640
4463
|
"Contact Email",
|
|
3641
|
-
/* @__PURE__ */
|
|
4464
|
+
/* @__PURE__ */ jsx25(
|
|
3642
4465
|
"input",
|
|
3643
4466
|
{
|
|
3644
4467
|
onChange: (event) => setDoc((current) => ({ ...current, contactEmail: event.target.value })),
|
|
@@ -3659,7 +4482,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3659
4482
|
]
|
|
3660
4483
|
}
|
|
3661
4484
|
),
|
|
3662
|
-
/* @__PURE__ */
|
|
4485
|
+
/* @__PURE__ */ jsxs22(
|
|
3663
4486
|
"label",
|
|
3664
4487
|
{
|
|
3665
4488
|
style: {
|
|
@@ -3671,7 +4494,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3671
4494
|
},
|
|
3672
4495
|
children: [
|
|
3673
4496
|
"Contact Phone",
|
|
3674
|
-
/* @__PURE__ */
|
|
4497
|
+
/* @__PURE__ */ jsx25(
|
|
3675
4498
|
"input",
|
|
3676
4499
|
{
|
|
3677
4500
|
onChange: (event) => setDoc((current) => ({ ...current, contactPhone: event.target.value })),
|
|
@@ -3692,8 +4515,8 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3692
4515
|
]
|
|
3693
4516
|
}
|
|
3694
4517
|
),
|
|
3695
|
-
/* @__PURE__ */
|
|
3696
|
-
/* @__PURE__ */
|
|
4518
|
+
/* @__PURE__ */ jsx25("div", { className: "orion-admin-preview-label", children: "Footer Preview" }),
|
|
4519
|
+
/* @__PURE__ */ jsx25("div", { className: "orion-admin-preview-frame", children: /* @__PURE__ */ jsx25("div", { className: "orion-admin-preview-surface", children: /* @__PURE__ */ jsx25(
|
|
3697
4520
|
SiteFooterPreview,
|
|
3698
4521
|
{
|
|
3699
4522
|
site: {
|
|
@@ -3712,7 +4535,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3712
4535
|
}
|
|
3713
4536
|
}
|
|
3714
4537
|
) }) }),
|
|
3715
|
-
/* @__PURE__ */
|
|
4538
|
+
/* @__PURE__ */ jsx25("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ jsx25(
|
|
3716
4539
|
"button",
|
|
3717
4540
|
{
|
|
3718
4541
|
disabled: saving,
|
|
@@ -3736,9 +4559,9 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3736
4559
|
}
|
|
3737
4560
|
|
|
3738
4561
|
// src/admin/components/studio/AdminStudioContactFormView.tsx
|
|
3739
|
-
import { useEffect as
|
|
4562
|
+
import { useEffect as useEffect14, useMemo as useMemo10, useState as useState15 } from "react";
|
|
3740
4563
|
import { SetStepNav as SetStepNav4 } from "@payloadcms/ui";
|
|
3741
|
-
import { jsx as
|
|
4564
|
+
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3742
4565
|
var defaultDoc = {
|
|
3743
4566
|
disabledMessage: "This form is temporarily unavailable. Please call us for immediate service.",
|
|
3744
4567
|
enabled: true,
|
|
@@ -3827,12 +4650,12 @@ function AdminStudioContactFormView(props) {
|
|
|
3827
4650
|
const adminBasePath = useAdminBasePath();
|
|
3828
4651
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3829
4652
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
3830
|
-
const [doc, setDoc] =
|
|
3831
|
-
const [error, setError] =
|
|
3832
|
-
const [isLoading, setIsLoading] =
|
|
3833
|
-
const [isSaving, setIsSaving] =
|
|
3834
|
-
const [savedMessage, setSavedMessage] =
|
|
3835
|
-
|
|
4653
|
+
const [doc, setDoc] = useState15(defaultDoc);
|
|
4654
|
+
const [error, setError] = useState15(null);
|
|
4655
|
+
const [isLoading, setIsLoading] = useState15(true);
|
|
4656
|
+
const [isSaving, setIsSaving] = useState15(false);
|
|
4657
|
+
const [savedMessage, setSavedMessage] = useState15(null);
|
|
4658
|
+
useEffect14(() => {
|
|
3836
4659
|
let mounted = true;
|
|
3837
4660
|
const load = async () => {
|
|
3838
4661
|
setIsLoading(true);
|
|
@@ -3862,7 +4685,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3862
4685
|
mounted = false;
|
|
3863
4686
|
};
|
|
3864
4687
|
}, [globalSlug]);
|
|
3865
|
-
const payload =
|
|
4688
|
+
const payload = useMemo10(
|
|
3866
4689
|
() => ({
|
|
3867
4690
|
disabledMessage: doc.disabledMessage,
|
|
3868
4691
|
enabled: doc.enabled,
|
|
@@ -3899,8 +4722,8 @@ function AdminStudioContactFormView(props) {
|
|
|
3899
4722
|
setIsSaving(false);
|
|
3900
4723
|
}
|
|
3901
4724
|
};
|
|
3902
|
-
return /* @__PURE__ */
|
|
3903
|
-
/* @__PURE__ */
|
|
4725
|
+
return /* @__PURE__ */ jsx26(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs23("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4726
|
+
/* @__PURE__ */ jsx26(
|
|
3904
4727
|
SetStepNav4,
|
|
3905
4728
|
{
|
|
3906
4729
|
nav: [
|
|
@@ -3909,14 +4732,14 @@ function AdminStudioContactFormView(props) {
|
|
|
3909
4732
|
]
|
|
3910
4733
|
}
|
|
3911
4734
|
),
|
|
3912
|
-
/* @__PURE__ */
|
|
3913
|
-
/* @__PURE__ */
|
|
3914
|
-
isLoading ? /* @__PURE__ */
|
|
3915
|
-
error ? /* @__PURE__ */
|
|
3916
|
-
savedMessage ? /* @__PURE__ */
|
|
3917
|
-
!isLoading ? /* @__PURE__ */
|
|
3918
|
-
/* @__PURE__ */
|
|
3919
|
-
/* @__PURE__ */
|
|
4735
|
+
/* @__PURE__ */ jsx26("h1", { style: { margin: 0 }, children: "Contact Form" }),
|
|
4736
|
+
/* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Edit form behavior and submission messaging without leaving Studio." }),
|
|
4737
|
+
isLoading ? /* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading form settings\u2026" }) : null,
|
|
4738
|
+
error ? /* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4739
|
+
savedMessage ? /* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4740
|
+
!isLoading ? /* @__PURE__ */ jsxs23("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem", maxWidth: 900 }, children: [
|
|
4741
|
+
/* @__PURE__ */ jsxs23("label", { style: { ...fieldLabelStyle, alignItems: "center", display: "flex", gap: "0.6rem" }, children: [
|
|
4742
|
+
/* @__PURE__ */ jsx26(
|
|
3920
4743
|
"input",
|
|
3921
4744
|
{
|
|
3922
4745
|
checked: doc.enabled,
|
|
@@ -3926,9 +4749,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3926
4749
|
),
|
|
3927
4750
|
"Form enabled"
|
|
3928
4751
|
] }),
|
|
3929
|
-
/* @__PURE__ */
|
|
4752
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3930
4753
|
"Notification Email",
|
|
3931
|
-
/* @__PURE__ */
|
|
4754
|
+
/* @__PURE__ */ jsx26(
|
|
3932
4755
|
"input",
|
|
3933
4756
|
{
|
|
3934
4757
|
onChange: (event) => setDoc((prev) => ({ ...prev, notificationEmail: event.target.value })),
|
|
@@ -3938,9 +4761,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3938
4761
|
}
|
|
3939
4762
|
)
|
|
3940
4763
|
] }),
|
|
3941
|
-
/* @__PURE__ */
|
|
4764
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3942
4765
|
"Submit Button Label",
|
|
3943
|
-
/* @__PURE__ */
|
|
4766
|
+
/* @__PURE__ */ jsx26(
|
|
3944
4767
|
"input",
|
|
3945
4768
|
{
|
|
3946
4769
|
onChange: (event) => setDoc((prev) => ({ ...prev, submitButtonLabel: event.target.value })),
|
|
@@ -3950,9 +4773,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3950
4773
|
}
|
|
3951
4774
|
)
|
|
3952
4775
|
] }),
|
|
3953
|
-
/* @__PURE__ */
|
|
4776
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3954
4777
|
"Success Message",
|
|
3955
|
-
/* @__PURE__ */
|
|
4778
|
+
/* @__PURE__ */ jsx26(
|
|
3956
4779
|
"input",
|
|
3957
4780
|
{
|
|
3958
4781
|
onChange: (event) => setDoc((prev) => ({ ...prev, successMessage: event.target.value })),
|
|
@@ -3962,9 +4785,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3962
4785
|
}
|
|
3963
4786
|
)
|
|
3964
4787
|
] }),
|
|
3965
|
-
/* @__PURE__ */
|
|
4788
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3966
4789
|
"Error Message",
|
|
3967
|
-
/* @__PURE__ */
|
|
4790
|
+
/* @__PURE__ */ jsx26(
|
|
3968
4791
|
"input",
|
|
3969
4792
|
{
|
|
3970
4793
|
onChange: (event) => setDoc((prev) => ({ ...prev, errorMessage: event.target.value })),
|
|
@@ -3974,9 +4797,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3974
4797
|
}
|
|
3975
4798
|
)
|
|
3976
4799
|
] }),
|
|
3977
|
-
/* @__PURE__ */
|
|
4800
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3978
4801
|
"Disabled Message",
|
|
3979
|
-
/* @__PURE__ */
|
|
4802
|
+
/* @__PURE__ */ jsx26(
|
|
3980
4803
|
"input",
|
|
3981
4804
|
{
|
|
3982
4805
|
onChange: (event) => setDoc((prev) => ({ ...prev, disabledMessage: event.target.value })),
|
|
@@ -3986,7 +4809,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3986
4809
|
}
|
|
3987
4810
|
)
|
|
3988
4811
|
] }),
|
|
3989
|
-
/* @__PURE__ */
|
|
4812
|
+
/* @__PURE__ */ jsxs23(
|
|
3990
4813
|
"div",
|
|
3991
4814
|
{
|
|
3992
4815
|
style: {
|
|
@@ -3996,9 +4819,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3996
4819
|
padding: "0.85rem"
|
|
3997
4820
|
},
|
|
3998
4821
|
children: [
|
|
3999
|
-
/* @__PURE__ */
|
|
4000
|
-
/* @__PURE__ */
|
|
4001
|
-
/* @__PURE__ */
|
|
4822
|
+
/* @__PURE__ */ jsx26("div", { style: { fontWeight: 900, marginBottom: "0.65rem" }, children: "Service Options" }),
|
|
4823
|
+
/* @__PURE__ */ jsx26("div", { style: { display: "grid", gap: "0.55rem" }, children: doc.serviceOptions.map((option, index) => /* @__PURE__ */ jsxs23("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
4824
|
+
/* @__PURE__ */ jsx26(
|
|
4002
4825
|
"input",
|
|
4003
4826
|
{
|
|
4004
4827
|
onChange: (event) => setDoc((prev) => ({
|
|
@@ -4012,7 +4835,7 @@ function AdminStudioContactFormView(props) {
|
|
|
4012
4835
|
value: option.label
|
|
4013
4836
|
}
|
|
4014
4837
|
),
|
|
4015
|
-
/* @__PURE__ */
|
|
4838
|
+
/* @__PURE__ */ jsx26(
|
|
4016
4839
|
"button",
|
|
4017
4840
|
{
|
|
4018
4841
|
onClick: () => setDoc((prev) => ({
|
|
@@ -4025,7 +4848,7 @@ function AdminStudioContactFormView(props) {
|
|
|
4025
4848
|
}
|
|
4026
4849
|
)
|
|
4027
4850
|
] }, `${index}-${option.label}`)) }),
|
|
4028
|
-
/* @__PURE__ */
|
|
4851
|
+
/* @__PURE__ */ jsx26(
|
|
4029
4852
|
"button",
|
|
4030
4853
|
{
|
|
4031
4854
|
onClick: () => setDoc((prev) => ({
|
|
@@ -4040,9 +4863,9 @@ function AdminStudioContactFormView(props) {
|
|
|
4040
4863
|
]
|
|
4041
4864
|
}
|
|
4042
4865
|
),
|
|
4043
|
-
/* @__PURE__ */
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
/* @__PURE__ */
|
|
4866
|
+
/* @__PURE__ */ jsxs23("div", { style: { display: "flex", gap: "0.6rem" }, children: [
|
|
4867
|
+
/* @__PURE__ */ jsx26("button", { disabled: isSaving, onClick: () => void save(), style: buttonStyle, type: "button", children: isSaving ? "Saving\u2026" : "Save Form Settings" }),
|
|
4868
|
+
/* @__PURE__ */ jsx26(
|
|
4046
4869
|
"a",
|
|
4047
4870
|
{
|
|
4048
4871
|
href: rawGlobalPath,
|
|
@@ -4062,8 +4885,8 @@ function AdminStudioContactFormView(props) {
|
|
|
4062
4885
|
}
|
|
4063
4886
|
|
|
4064
4887
|
// src/admin/components/studio/AdminStudioMediaView.tsx
|
|
4065
|
-
import { useEffect as
|
|
4066
|
-
import { jsx as
|
|
4888
|
+
import { useEffect as useEffect15, useMemo as useMemo11, useState as useState16 } from "react";
|
|
4889
|
+
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4067
4890
|
var MEDIA_LIBRARY_SYNC_EVENT = "orion-media-library-updated";
|
|
4068
4891
|
var getPropString11 = (props, key, fallback) => {
|
|
4069
4892
|
if (!props || typeof props !== "object") return fallback;
|
|
@@ -4079,10 +4902,10 @@ var getPropString11 = (props, key, fallback) => {
|
|
|
4079
4902
|
function AdminStudioMediaView(props) {
|
|
4080
4903
|
const mediaCollectionSlug = getPropString11(props, "mediaCollectionSlug", "media");
|
|
4081
4904
|
const adminBasePath = useAdminBasePath();
|
|
4082
|
-
const [docs, setDocs] =
|
|
4083
|
-
const [loading, setLoading] =
|
|
4084
|
-
const [error, setError] =
|
|
4085
|
-
const apiURL =
|
|
4905
|
+
const [docs, setDocs] = useState16([]);
|
|
4906
|
+
const [loading, setLoading] = useState16(true);
|
|
4907
|
+
const [error, setError] = useState16(null);
|
|
4908
|
+
const apiURL = useMemo11(() => {
|
|
4086
4909
|
const params = new URLSearchParams({
|
|
4087
4910
|
depth: "0",
|
|
4088
4911
|
draft: "true",
|
|
@@ -4091,7 +4914,7 @@ function AdminStudioMediaView(props) {
|
|
|
4091
4914
|
});
|
|
4092
4915
|
return `/api/${mediaCollectionSlug}?${params.toString()}`;
|
|
4093
4916
|
}, [mediaCollectionSlug]);
|
|
4094
|
-
|
|
4917
|
+
useEffect15(() => {
|
|
4095
4918
|
let cancelled = false;
|
|
4096
4919
|
const run = async () => {
|
|
4097
4920
|
setLoading(true);
|
|
@@ -4127,7 +4950,7 @@ function AdminStudioMediaView(props) {
|
|
|
4127
4950
|
window.removeEventListener("storage", rerun);
|
|
4128
4951
|
};
|
|
4129
4952
|
}, [apiURL]);
|
|
4130
|
-
return /* @__PURE__ */
|
|
4953
|
+
return /* @__PURE__ */ jsx27(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs24(
|
|
4131
4954
|
AdminPage,
|
|
4132
4955
|
{
|
|
4133
4956
|
breadcrumbs: [
|
|
@@ -4137,18 +4960,18 @@ function AdminStudioMediaView(props) {
|
|
|
4137
4960
|
description: `${docs.length} asset${docs.length === 1 ? "" : "s"} \u2014 Upload assets here, including logos used in Site Settings branding.`,
|
|
4138
4961
|
title: "Media",
|
|
4139
4962
|
children: [
|
|
4140
|
-
/* @__PURE__ */
|
|
4141
|
-
loading ? /* @__PURE__ */
|
|
4142
|
-
error ? /* @__PURE__ */
|
|
4143
|
-
/* @__PURE__ */
|
|
4144
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */
|
|
4145
|
-
/* @__PURE__ */
|
|
4146
|
-
/* @__PURE__ */
|
|
4963
|
+
/* @__PURE__ */ jsx27(MediaUploadForm, {}),
|
|
4964
|
+
loading ? /* @__PURE__ */ jsx27("div", { className: "orion-admin-list-meta", style: { marginTop: "1rem" }, children: "Loading..." }) : null,
|
|
4965
|
+
error ? /* @__PURE__ */ jsx27("div", { className: "orion-admin-error", style: { marginTop: "1rem" }, children: error }) : null,
|
|
4966
|
+
/* @__PURE__ */ jsxs24("div", { className: "orion-admin-list", style: { marginTop: "1rem" }, children: [
|
|
4967
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ jsxs24("div", { className: "orion-admin-card", children: [
|
|
4968
|
+
/* @__PURE__ */ jsx27("strong", { children: "No media found" }),
|
|
4969
|
+
/* @__PURE__ */ jsx27("span", { children: "Upload an image to get started." })
|
|
4147
4970
|
] }) : null,
|
|
4148
4971
|
docs.map((doc) => {
|
|
4149
4972
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
4150
4973
|
if (!id) return null;
|
|
4151
|
-
return /* @__PURE__ */
|
|
4974
|
+
return /* @__PURE__ */ jsx27(
|
|
4152
4975
|
MediaListItem,
|
|
4153
4976
|
{
|
|
4154
4977
|
alt: doc.alt,
|
|
@@ -4171,8 +4994,8 @@ function AdminStudioMediaView(props) {
|
|
|
4171
4994
|
}
|
|
4172
4995
|
|
|
4173
4996
|
// src/admin/components/studio/AdminStudioMediaItemView.tsx
|
|
4174
|
-
import { useEffect as
|
|
4175
|
-
import { jsx as
|
|
4997
|
+
import { useEffect as useEffect16, useMemo as useMemo12, useState as useState17 } from "react";
|
|
4998
|
+
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4176
4999
|
var getPropString12 = (props, key, fallback) => {
|
|
4177
5000
|
if (!props || typeof props !== "object") return fallback;
|
|
4178
5001
|
const direct = props[key];
|
|
@@ -4202,13 +5025,13 @@ function AdminStudioMediaItemView(props) {
|
|
|
4202
5025
|
const mediaCollectionSlug = getPropString12(props, "mediaCollectionSlug", "media");
|
|
4203
5026
|
const adminBasePath = useAdminBasePath();
|
|
4204
5027
|
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
4205
|
-
const mediaIDFromParams =
|
|
4206
|
-
const [mediaID, setMediaID] =
|
|
4207
|
-
const [doc, setDoc] =
|
|
4208
|
-
const [loading, setLoading] =
|
|
4209
|
-
const [error, setError] =
|
|
4210
|
-
const [savedMessage, setSavedMessage] =
|
|
4211
|
-
|
|
5028
|
+
const mediaIDFromParams = useMemo12(() => getParam2(props.params, "id"), [props.params]);
|
|
5029
|
+
const [mediaID, setMediaID] = useState17(mediaIDFromParams);
|
|
5030
|
+
const [doc, setDoc] = useState17(null);
|
|
5031
|
+
const [loading, setLoading] = useState17(true);
|
|
5032
|
+
const [error, setError] = useState17(null);
|
|
5033
|
+
const [savedMessage, setSavedMessage] = useState17(null);
|
|
5034
|
+
useEffect16(() => {
|
|
4212
5035
|
if (mediaIDFromParams) {
|
|
4213
5036
|
setMediaID(mediaIDFromParams);
|
|
4214
5037
|
return;
|
|
@@ -4236,7 +5059,7 @@ function AdminStudioMediaItemView(props) {
|
|
|
4236
5059
|
setLoading(false);
|
|
4237
5060
|
}
|
|
4238
5061
|
};
|
|
4239
|
-
|
|
5062
|
+
useEffect16(() => {
|
|
4240
5063
|
if (!mediaID) return;
|
|
4241
5064
|
void loadDoc(mediaID);
|
|
4242
5065
|
}, [mediaCollectionSlug, mediaID]);
|
|
@@ -4282,7 +5105,7 @@ function AdminStudioMediaItemView(props) {
|
|
|
4282
5105
|
setError(deleteError instanceof Error ? deleteError.message : "Failed to delete media item.");
|
|
4283
5106
|
}
|
|
4284
5107
|
};
|
|
4285
|
-
return /* @__PURE__ */
|
|
5108
|
+
return /* @__PURE__ */ jsx28(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs25(
|
|
4286
5109
|
AdminPage,
|
|
4287
5110
|
{
|
|
4288
5111
|
breadcrumbs: [
|
|
@@ -4293,10 +5116,10 @@ function AdminStudioMediaItemView(props) {
|
|
|
4293
5116
|
description: "Update metadata or remove the selected asset.",
|
|
4294
5117
|
title: "Media Asset",
|
|
4295
5118
|
children: [
|
|
4296
|
-
loading ? /* @__PURE__ */
|
|
4297
|
-
error ? /* @__PURE__ */
|
|
4298
|
-
savedMessage ? /* @__PURE__ */
|
|
4299
|
-
!loading && !error && doc && mediaID ? /* @__PURE__ */
|
|
5119
|
+
loading ? /* @__PURE__ */ jsx28("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5120
|
+
error ? /* @__PURE__ */ jsx28("div", { className: "orion-admin-error", children: error }) : null,
|
|
5121
|
+
savedMessage ? /* @__PURE__ */ jsx28("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
5122
|
+
!loading && !error && doc && mediaID ? /* @__PURE__ */ jsx28(
|
|
4300
5123
|
MediaDetailPanel,
|
|
4301
5124
|
{
|
|
4302
5125
|
alt: doc.alt,
|
|
@@ -4319,9 +5142,9 @@ function AdminStudioMediaItemView(props) {
|
|
|
4319
5142
|
|
|
4320
5143
|
// src/admin/components/studio/AdminStudioFormsView.tsx
|
|
4321
5144
|
import Link3 from "next/link";
|
|
4322
|
-
import { useEffect as
|
|
5145
|
+
import { useEffect as useEffect17, useMemo as useMemo13, useState as useState18 } from "react";
|
|
4323
5146
|
import { useAuth as useAuth6 } from "@payloadcms/ui";
|
|
4324
|
-
import { jsx as
|
|
5147
|
+
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4325
5148
|
var FORM_TONES = [
|
|
4326
5149
|
{
|
|
4327
5150
|
accent: "var(--orion-cms-tone-1, var(--orion-cms-accent, var(--orion-admin-accent)))",
|
|
@@ -4372,7 +5195,7 @@ var isEditor2 = (user) => {
|
|
|
4372
5195
|
const role = user.role;
|
|
4373
5196
|
return typeof role === "string" && role === "editor";
|
|
4374
5197
|
};
|
|
4375
|
-
var
|
|
5198
|
+
var canReviewForms2 = (user) => isAdmin3(user) || isEditor2(user);
|
|
4376
5199
|
var getPropString13 = (props, key, fallback) => {
|
|
4377
5200
|
if (!props || typeof props !== "object") return fallback;
|
|
4378
5201
|
const direct = props[key];
|
|
@@ -4401,7 +5224,7 @@ var getFieldCount = (form) => Array.isArray(form.steps) ? form.steps.reduce((cou
|
|
|
4401
5224
|
const fields = step.fields;
|
|
4402
5225
|
return count + (Array.isArray(fields) ? fields.length : 0);
|
|
4403
5226
|
}, 0) : 0;
|
|
4404
|
-
var
|
|
5227
|
+
var getFormID2 = (value) => {
|
|
4405
5228
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
4406
5229
|
if (value && typeof value === "object") {
|
|
4407
5230
|
const id = value.id;
|
|
@@ -4522,7 +5345,7 @@ var getSecondaryIdentity = (identity, previewFields, uploads) => {
|
|
|
4522
5345
|
if (identity.email) return "Email response";
|
|
4523
5346
|
return "Response preview unavailable";
|
|
4524
5347
|
};
|
|
4525
|
-
var
|
|
5348
|
+
var loadCollection2 = async (slug, params) => {
|
|
4526
5349
|
const response = await fetch(`/api/${slug}?${params.toString()}`, {
|
|
4527
5350
|
credentials: "include"
|
|
4528
5351
|
});
|
|
@@ -4533,9 +5356,9 @@ var loadCollection = async (slug, params) => {
|
|
|
4533
5356
|
const payload = await response.json();
|
|
4534
5357
|
return Array.isArray(payload.docs) ? payload.docs : [];
|
|
4535
5358
|
};
|
|
4536
|
-
var renderEmptyMessage = (message) => /* @__PURE__ */
|
|
4537
|
-
/* @__PURE__ */
|
|
4538
|
-
/* @__PURE__ */
|
|
5359
|
+
var renderEmptyMessage = (message) => /* @__PURE__ */ jsxs26("div", { className: "orion-admin-empty-state", children: [
|
|
5360
|
+
/* @__PURE__ */ jsx29("strong", { children: "No responses yet" }),
|
|
5361
|
+
/* @__PURE__ */ jsx29("span", { children: message })
|
|
4539
5362
|
] });
|
|
4540
5363
|
function AdminStudioFormsView(props) {
|
|
4541
5364
|
const { user } = useAuth6();
|
|
@@ -4553,12 +5376,12 @@ function AdminStudioFormsView(props) {
|
|
|
4553
5376
|
`/collections/${formSubmissionsCollectionSlug}`
|
|
4554
5377
|
);
|
|
4555
5378
|
const rawUploadsPath = resolveAdminPath(adminBasePath, `/collections/${formUploadsCollectionSlug}`);
|
|
4556
|
-
const [forms, setForms] =
|
|
4557
|
-
const [submissions, setSubmissions] =
|
|
4558
|
-
const [loading, setLoading] =
|
|
4559
|
-
const [error, setError] =
|
|
4560
|
-
|
|
4561
|
-
if (!
|
|
5379
|
+
const [forms, setForms] = useState18([]);
|
|
5380
|
+
const [submissions, setSubmissions] = useState18([]);
|
|
5381
|
+
const [loading, setLoading] = useState18(true);
|
|
5382
|
+
const [error, setError] = useState18(null);
|
|
5383
|
+
useEffect17(() => {
|
|
5384
|
+
if (!canReviewForms2(user)) {
|
|
4562
5385
|
return;
|
|
4563
5386
|
}
|
|
4564
5387
|
let cancelled = false;
|
|
@@ -4577,8 +5400,8 @@ function AdminStudioFormsView(props) {
|
|
|
4577
5400
|
sort: "-submittedAt"
|
|
4578
5401
|
});
|
|
4579
5402
|
const [nextForms, nextSubmissions] = await Promise.all([
|
|
4580
|
-
|
|
4581
|
-
|
|
5403
|
+
loadCollection2(formsCollectionSlug, formsParams),
|
|
5404
|
+
loadCollection2(formSubmissionsCollectionSlug, submissionsParams)
|
|
4582
5405
|
]);
|
|
4583
5406
|
if (cancelled) return;
|
|
4584
5407
|
setForms(nextForms);
|
|
@@ -4598,10 +5421,10 @@ function AdminStudioFormsView(props) {
|
|
|
4598
5421
|
cancelled = true;
|
|
4599
5422
|
};
|
|
4600
5423
|
}, [formSubmissionsCollectionSlug, formsCollectionSlug, user]);
|
|
4601
|
-
const submissionsByForm =
|
|
5424
|
+
const submissionsByForm = useMemo13(() => {
|
|
4602
5425
|
const map = /* @__PURE__ */ new Map();
|
|
4603
5426
|
for (const submission of submissions) {
|
|
4604
|
-
const formID =
|
|
5427
|
+
const formID = getFormID2(submission.form);
|
|
4605
5428
|
if (!formID) continue;
|
|
4606
5429
|
const current = map.get(formID) || [];
|
|
4607
5430
|
current.push(submission);
|
|
@@ -4609,7 +5432,7 @@ function AdminStudioFormsView(props) {
|
|
|
4609
5432
|
}
|
|
4610
5433
|
return map;
|
|
4611
5434
|
}, [submissions]);
|
|
4612
|
-
const busiestForm =
|
|
5435
|
+
const busiestForm = useMemo13(
|
|
4613
5436
|
() => forms.reduce((current, form) => {
|
|
4614
5437
|
const title = typeof form.title === "string" && form.title.trim().length > 0 ? form.title : "Untitled Form";
|
|
4615
5438
|
const count = (typeof form.id === "string" || typeof form.id === "number" ? submissionsByForm.get(String(form.id)) : null)?.length || 0;
|
|
@@ -4620,8 +5443,8 @@ function AdminStudioFormsView(props) {
|
|
|
4620
5443
|
}, null),
|
|
4621
5444
|
[forms, submissionsByForm]
|
|
4622
5445
|
);
|
|
4623
|
-
if (!
|
|
4624
|
-
return /* @__PURE__ */
|
|
5446
|
+
if (!canReviewForms2(user)) {
|
|
5447
|
+
return /* @__PURE__ */ jsx29(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx29(
|
|
4625
5448
|
AdminPage,
|
|
4626
5449
|
{
|
|
4627
5450
|
breadcrumbs: [
|
|
@@ -4630,14 +5453,14 @@ function AdminStudioFormsView(props) {
|
|
|
4630
5453
|
],
|
|
4631
5454
|
description: "You do not have access to this section.",
|
|
4632
5455
|
title: "Forms",
|
|
4633
|
-
children: /* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
4635
|
-
/* @__PURE__ */
|
|
5456
|
+
children: /* @__PURE__ */ jsxs26("div", { className: "orion-admin-card", children: [
|
|
5457
|
+
/* @__PURE__ */ jsx29("strong", { children: "Access denied" }),
|
|
5458
|
+
/* @__PURE__ */ jsx29("span", { children: "This section is restricted to editor and administrator accounts." })
|
|
4636
5459
|
] })
|
|
4637
5460
|
}
|
|
4638
5461
|
) });
|
|
4639
5462
|
}
|
|
4640
|
-
return /* @__PURE__ */
|
|
5463
|
+
return /* @__PURE__ */ jsx29(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs26(
|
|
4641
5464
|
AdminPage,
|
|
4642
5465
|
{
|
|
4643
5466
|
breadcrumbs: [
|
|
@@ -4647,30 +5470,30 @@ function AdminStudioFormsView(props) {
|
|
|
4647
5470
|
description: "Review live forms, recent responses, and uploaded files.",
|
|
4648
5471
|
title: "Forms",
|
|
4649
5472
|
children: [
|
|
4650
|
-
loading ? /* @__PURE__ */
|
|
4651
|
-
error ? /* @__PURE__ */
|
|
4652
|
-
!loading && !error ? /* @__PURE__ */
|
|
4653
|
-
/* @__PURE__ */
|
|
4654
|
-
/* @__PURE__ */
|
|
4655
|
-
/* @__PURE__ */
|
|
4656
|
-
/* @__PURE__ */
|
|
4657
|
-
/* @__PURE__ */
|
|
5473
|
+
loading ? /* @__PURE__ */ jsx29("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5474
|
+
error ? /* @__PURE__ */ jsx29("div", { className: "orion-admin-error", children: error }) : null,
|
|
5475
|
+
!loading && !error ? /* @__PURE__ */ jsxs26("div", { className: "orion-admin-forms-dashboard", children: [
|
|
5476
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-forms-summary-grid", children: [
|
|
5477
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-overview-stat", children: [
|
|
5478
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-overview-stat-label", children: "Configured forms" }),
|
|
5479
|
+
/* @__PURE__ */ jsx29("strong", { children: forms.length }),
|
|
5480
|
+
/* @__PURE__ */ jsx29("p", { children: "Published or draft forms currently available inside the CMS." })
|
|
4658
5481
|
] }),
|
|
4659
|
-
/* @__PURE__ */
|
|
4660
|
-
/* @__PURE__ */
|
|
4661
|
-
/* @__PURE__ */
|
|
4662
|
-
/* @__PURE__ */
|
|
5482
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-overview-stat", children: [
|
|
5483
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-overview-stat-label", children: "Recent submissions" }),
|
|
5484
|
+
/* @__PURE__ */ jsx29("strong", { children: submissions.length }),
|
|
5485
|
+
/* @__PURE__ */ jsx29("p", { children: "Latest 200 responses collected across every form." })
|
|
4663
5486
|
] }),
|
|
4664
|
-
/* @__PURE__ */
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4667
|
-
/* @__PURE__ */
|
|
5487
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-overview-stat", children: [
|
|
5488
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-overview-stat-label", children: "Most active form" }),
|
|
5489
|
+
/* @__PURE__ */ jsx29("strong", { children: busiestForm && busiestForm.count > 0 ? busiestForm.title : "No activity yet" }),
|
|
5490
|
+
/* @__PURE__ */ jsx29("p", { children: busiestForm && busiestForm.count > 0 ? `${busiestForm.count} response${busiestForm.count === 1 ? "" : "s"} in this view.` : "Submissions will surface here once a form starts receiving traffic." })
|
|
4668
5491
|
] })
|
|
4669
5492
|
] }),
|
|
4670
|
-
forms.length === 0 ? /* @__PURE__ */
|
|
4671
|
-
/* @__PURE__ */
|
|
4672
|
-
/* @__PURE__ */
|
|
4673
|
-
] }) : /* @__PURE__ */
|
|
5493
|
+
forms.length === 0 ? /* @__PURE__ */ jsxs26("div", { className: "orion-admin-card", children: [
|
|
5494
|
+
/* @__PURE__ */ jsx29("strong", { children: "No forms found" }),
|
|
5495
|
+
/* @__PURE__ */ jsx29("span", { children: "Create a form in Payload to start collecting responses." })
|
|
5496
|
+
] }) : /* @__PURE__ */ jsx29("div", { className: "orion-admin-forms-board-list", children: forms.map((form) => {
|
|
4674
5497
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
4675
5498
|
if (!id) return null;
|
|
4676
5499
|
const title = typeof form.title === "string" && form.title.trim().length > 0 ? form.title : "Untitled Form";
|
|
@@ -4685,30 +5508,30 @@ function AdminStudioFormsView(props) {
|
|
|
4685
5508
|
const updatedMeta = form.updatedAt ? `Updated ${formatDate(form.updatedAt)}` : "Update time unavailable";
|
|
4686
5509
|
const toneStyle = getFormToneStyle(slug, title || id);
|
|
4687
5510
|
const isResponsePanelScrollable = formSubmissions.length > RESPONSE_SCROLL_THRESHOLD;
|
|
4688
|
-
return /* @__PURE__ */
|
|
4689
|
-
/* @__PURE__ */
|
|
4690
|
-
/* @__PURE__ */
|
|
4691
|
-
/* @__PURE__ */
|
|
4692
|
-
/* @__PURE__ */
|
|
4693
|
-
/* @__PURE__ */
|
|
5511
|
+
return /* @__PURE__ */ jsxs26("section", { className: "orion-admin-form-board", style: toneStyle, children: [
|
|
5512
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-header", children: [
|
|
5513
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-heading", children: [
|
|
5514
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-kicker-row", children: [
|
|
5515
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-board-kicker", children: slug || "No slug set" }),
|
|
5516
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-board-meta", children: updatedMeta })
|
|
4694
5517
|
] }),
|
|
4695
|
-
/* @__PURE__ */
|
|
4696
|
-
/* @__PURE__ */
|
|
4697
|
-
/* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
/* @__PURE__ */
|
|
5518
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-title-row", children: [
|
|
5519
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-form-board-mark", children: getInitials(title, slug) }),
|
|
5520
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-copy", children: [
|
|
5521
|
+
/* @__PURE__ */ jsx29("h2", { className: "orion-admin-form-board-title", children: title }),
|
|
5522
|
+
/* @__PURE__ */ jsx29("p", { className: "orion-admin-form-board-subtitle", children: latestResponse ? `Latest response ${latestResponseLabel}` : "Awaiting the first submission" })
|
|
4700
5523
|
] })
|
|
4701
5524
|
] })
|
|
4702
5525
|
] }),
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
/* @__PURE__ */
|
|
4706
|
-
/* @__PURE__ */
|
|
5526
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-actions", children: [
|
|
5527
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-count", children: [
|
|
5528
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-board-count-value", children: formSubmissions.length }),
|
|
5529
|
+
/* @__PURE__ */ jsxs26("span", { className: "orion-admin-form-board-count-label", children: [
|
|
4707
5530
|
"response",
|
|
4708
5531
|
formSubmissions.length === 1 ? "" : "s"
|
|
4709
5532
|
] })
|
|
4710
5533
|
] }),
|
|
4711
|
-
/* @__PURE__ */
|
|
5534
|
+
/* @__PURE__ */ jsx29(
|
|
4712
5535
|
Link3,
|
|
4713
5536
|
{
|
|
4714
5537
|
className: "orion-admin-action-button orion-admin-action-button--soft",
|
|
@@ -4718,35 +5541,35 @@ function AdminStudioFormsView(props) {
|
|
|
4718
5541
|
)
|
|
4719
5542
|
] })
|
|
4720
5543
|
] }),
|
|
4721
|
-
/* @__PURE__ */
|
|
4722
|
-
/* @__PURE__ */
|
|
4723
|
-
/* @__PURE__ */
|
|
4724
|
-
/* @__PURE__ */
|
|
5544
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-metrics", children: [
|
|
5545
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5546
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Workflow steps" }),
|
|
5547
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value", children: stepCount })
|
|
4725
5548
|
] }),
|
|
4726
|
-
/* @__PURE__ */
|
|
4727
|
-
/* @__PURE__ */
|
|
4728
|
-
/* @__PURE__ */
|
|
5549
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5550
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Fields" }),
|
|
5551
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value", children: fieldCount })
|
|
4729
5552
|
] }),
|
|
4730
|
-
/* @__PURE__ */
|
|
4731
|
-
/* @__PURE__ */
|
|
4732
|
-
/* @__PURE__ */
|
|
5553
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5554
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Submit button" }),
|
|
5555
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value is-copy", children: submitLabel })
|
|
4733
5556
|
] }),
|
|
4734
|
-
/* @__PURE__ */
|
|
4735
|
-
/* @__PURE__ */
|
|
4736
|
-
/* @__PURE__ */
|
|
5557
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5558
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Latest response" }),
|
|
5559
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value is-copy", children: latestResponseLabel })
|
|
4737
5560
|
] })
|
|
4738
5561
|
] }),
|
|
4739
|
-
/* @__PURE__ */
|
|
4740
|
-
/* @__PURE__ */
|
|
4741
|
-
/* @__PURE__ */
|
|
4742
|
-
/* @__PURE__ */
|
|
4743
|
-
/* @__PURE__ */
|
|
5562
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-response-panel", children: [
|
|
5563
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-response-panel-header", children: [
|
|
5564
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
5565
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-section-label", children: "Response stream" }),
|
|
5566
|
+
/* @__PURE__ */ jsx29("strong", { children: formSubmissions.length > 0 ? `${formSubmissions.length} recent submission${formSubmissions.length === 1 ? "" : "s"}` : "No responses yet" })
|
|
4744
5567
|
] }),
|
|
4745
|
-
isResponsePanelScrollable ? /* @__PURE__ */
|
|
5568
|
+
isResponsePanelScrollable ? /* @__PURE__ */ jsx29("span", { className: "orion-admin-form-panel-note", children: "Latest 3 visible. Scroll for older responses." }) : formSubmissions.length > 0 ? /* @__PURE__ */ jsx29("span", { className: "orion-admin-form-panel-note", children: "Showing all recent activity" }) : null
|
|
4746
5569
|
] }),
|
|
4747
5570
|
formSubmissions.length === 0 ? renderEmptyMessage(
|
|
4748
5571
|
"This form will start filling this lane as soon as the first submission arrives."
|
|
4749
|
-
) : /* @__PURE__ */
|
|
5572
|
+
) : /* @__PURE__ */ jsx29(
|
|
4750
5573
|
"div",
|
|
4751
5574
|
{
|
|
4752
5575
|
className: [
|
|
@@ -4770,33 +5593,33 @@ function AdminStudioFormsView(props) {
|
|
|
4770
5593
|
);
|
|
4771
5594
|
const visibleUploads = uploads.slice(0, 2);
|
|
4772
5595
|
const hiddenUploadCount = uploads.length - visibleUploads.length;
|
|
4773
|
-
return /* @__PURE__ */
|
|
5596
|
+
return /* @__PURE__ */ jsxs26(
|
|
4774
5597
|
"article",
|
|
4775
5598
|
{
|
|
4776
5599
|
className: "orion-admin-response-card",
|
|
4777
5600
|
children: [
|
|
4778
|
-
/* @__PURE__ */
|
|
4779
|
-
/* @__PURE__ */
|
|
4780
|
-
/* @__PURE__ */
|
|
4781
|
-
/* @__PURE__ */
|
|
4782
|
-
/* @__PURE__ */
|
|
4783
|
-
/* @__PURE__ */
|
|
5601
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-card-main", children: [
|
|
5602
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-card-top", children: [
|
|
5603
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-response-badge", children: getInitials(identity.name, identity.email, title) }),
|
|
5604
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-heading", children: [
|
|
5605
|
+
/* @__PURE__ */ jsx29("strong", { children: primaryIdentity }),
|
|
5606
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-response-secondary", children: secondaryIdentity })
|
|
4784
5607
|
] }),
|
|
4785
|
-
/* @__PURE__ */
|
|
5608
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-response-date", children: formatDate(submission.submittedAt) })
|
|
4786
5609
|
] }),
|
|
4787
|
-
previewFields.length > 0 ? /* @__PURE__ */
|
|
5610
|
+
previewFields.length > 0 ? /* @__PURE__ */ jsx29("div", { className: "orion-admin-response-chip-row", children: previewFields.map((field, index) => /* @__PURE__ */ jsxs26(
|
|
4788
5611
|
"div",
|
|
4789
5612
|
{
|
|
4790
5613
|
className: "orion-admin-response-chip",
|
|
4791
5614
|
children: [
|
|
4792
|
-
/* @__PURE__ */
|
|
4793
|
-
/* @__PURE__ */
|
|
5615
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-response-chip-label", children: field.label }),
|
|
5616
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-response-chip-value", children: field.value })
|
|
4794
5617
|
]
|
|
4795
5618
|
},
|
|
4796
5619
|
`${submissionID}-${field.label}-${index}`
|
|
4797
|
-
)) }) : /* @__PURE__ */
|
|
4798
|
-
uploads.length > 0 ? /* @__PURE__ */
|
|
4799
|
-
/* @__PURE__ */
|
|
5620
|
+
)) }) : /* @__PURE__ */ jsx29("div", { className: "orion-admin-response-empty", children: "No preview fields are available for this submission." }),
|
|
5621
|
+
uploads.length > 0 ? /* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-upload-row", children: [
|
|
5622
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-upload-label", children: "Uploads" }),
|
|
4800
5623
|
visibleUploads.map((upload) => {
|
|
4801
5624
|
const uploadID = typeof upload.id === "string" || typeof upload.id === "number" ? String(upload.id) : "";
|
|
4802
5625
|
if (!uploadID) return null;
|
|
@@ -4810,7 +5633,7 @@ function AdminStudioFormsView(props) {
|
|
|
4810
5633
|
),
|
|
4811
5634
|
38
|
|
4812
5635
|
);
|
|
4813
|
-
return /* @__PURE__ */
|
|
5636
|
+
return /* @__PURE__ */ jsx29(
|
|
4814
5637
|
Link3,
|
|
4815
5638
|
{
|
|
4816
5639
|
className: "orion-admin-upload-chip",
|
|
@@ -4820,14 +5643,14 @@ function AdminStudioFormsView(props) {
|
|
|
4820
5643
|
uploadID
|
|
4821
5644
|
);
|
|
4822
5645
|
}),
|
|
4823
|
-
hiddenUploadCount > 0 ? /* @__PURE__ */
|
|
5646
|
+
hiddenUploadCount > 0 ? /* @__PURE__ */ jsxs26("span", { className: "orion-admin-upload-chip is-passive", children: [
|
|
4824
5647
|
"+",
|
|
4825
5648
|
hiddenUploadCount,
|
|
4826
5649
|
" more"
|
|
4827
5650
|
] }) : null
|
|
4828
5651
|
] }) : null
|
|
4829
5652
|
] }),
|
|
4830
|
-
/* @__PURE__ */
|
|
5653
|
+
/* @__PURE__ */ jsx29(
|
|
4831
5654
|
Link3,
|
|
4832
5655
|
{
|
|
4833
5656
|
className: "orion-admin-action-button orion-admin-action-button--ghost",
|
|
@@ -4852,9 +5675,9 @@ function AdminStudioFormsView(props) {
|
|
|
4852
5675
|
}
|
|
4853
5676
|
|
|
4854
5677
|
// src/admin/components/studio/AdminStudioToolsView.tsx
|
|
4855
|
-
import { useEffect as
|
|
5678
|
+
import { useEffect as useEffect18, useState as useState19 } from "react";
|
|
4856
5679
|
import { useAuth as useAuth7 } from "@payloadcms/ui";
|
|
4857
|
-
import { jsx as
|
|
5680
|
+
import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4858
5681
|
var userRoles = ["admin", "client", "editor"];
|
|
4859
5682
|
var isAdmin4 = (user) => {
|
|
4860
5683
|
if (!user || typeof user !== "object") return false;
|
|
@@ -4865,14 +5688,14 @@ var normalizeRole = (value) => userRoles.includes(value) ? value : "editor";
|
|
|
4865
5688
|
function AdminStudioToolsView(props) {
|
|
4866
5689
|
const { user } = useAuth7();
|
|
4867
5690
|
const adminBasePath = useAdminBasePath();
|
|
4868
|
-
const [docs, setDocs] =
|
|
4869
|
-
const [loading, setLoading] =
|
|
4870
|
-
const [error, setError] =
|
|
4871
|
-
const [savedMessage, setSavedMessage] =
|
|
4872
|
-
const [createSubmitting, setCreateSubmitting] =
|
|
4873
|
-
const [updatingUserID, setUpdatingUserID] =
|
|
5691
|
+
const [docs, setDocs] = useState19([]);
|
|
5692
|
+
const [loading, setLoading] = useState19(true);
|
|
5693
|
+
const [error, setError] = useState19(null);
|
|
5694
|
+
const [savedMessage, setSavedMessage] = useState19(null);
|
|
5695
|
+
const [createSubmitting, setCreateSubmitting] = useState19(false);
|
|
5696
|
+
const [updatingUserID, setUpdatingUserID] = useState19(null);
|
|
4874
5697
|
if (!isAdmin4(user)) {
|
|
4875
|
-
return /* @__PURE__ */
|
|
5698
|
+
return /* @__PURE__ */ jsx30(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx30(
|
|
4876
5699
|
AdminPage,
|
|
4877
5700
|
{
|
|
4878
5701
|
breadcrumbs: [
|
|
@@ -4881,9 +5704,9 @@ function AdminStudioToolsView(props) {
|
|
|
4881
5704
|
],
|
|
4882
5705
|
description: "You do not have access to this section.",
|
|
4883
5706
|
title: "Admin Tools",
|
|
4884
|
-
children: /* @__PURE__ */
|
|
4885
|
-
/* @__PURE__ */
|
|
4886
|
-
/* @__PURE__ */
|
|
5707
|
+
children: /* @__PURE__ */ jsxs27("div", { className: "orion-admin-card", children: [
|
|
5708
|
+
/* @__PURE__ */ jsx30("strong", { children: "Access denied" }),
|
|
5709
|
+
/* @__PURE__ */ jsx30("span", { children: "This section is restricted to administrator accounts." })
|
|
4887
5710
|
] })
|
|
4888
5711
|
}
|
|
4889
5712
|
) });
|
|
@@ -4912,7 +5735,7 @@ function AdminStudioToolsView(props) {
|
|
|
4912
5735
|
setLoading(false);
|
|
4913
5736
|
}
|
|
4914
5737
|
};
|
|
4915
|
-
|
|
5738
|
+
useEffect18(() => {
|
|
4916
5739
|
void loadUsers();
|
|
4917
5740
|
}, []);
|
|
4918
5741
|
const createUser = async (event) => {
|
|
@@ -4983,7 +5806,7 @@ function AdminStudioToolsView(props) {
|
|
|
4983
5806
|
setUpdatingUserID(null);
|
|
4984
5807
|
}
|
|
4985
5808
|
};
|
|
4986
|
-
return /* @__PURE__ */
|
|
5809
|
+
return /* @__PURE__ */ jsx30(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs27(
|
|
4987
5810
|
AdminPage,
|
|
4988
5811
|
{
|
|
4989
5812
|
breadcrumbs: [
|
|
@@ -4993,53 +5816,53 @@ function AdminStudioToolsView(props) {
|
|
|
4993
5816
|
description: "Manage users and fallback links to Payload native admin.",
|
|
4994
5817
|
title: "Admin Tools",
|
|
4995
5818
|
children: [
|
|
4996
|
-
/* @__PURE__ */
|
|
4997
|
-
error ? /* @__PURE__ */
|
|
4998
|
-
savedMessage ? /* @__PURE__ */
|
|
4999
|
-
/* @__PURE__ */
|
|
5000
|
-
/* @__PURE__ */
|
|
5001
|
-
/* @__PURE__ */
|
|
5819
|
+
/* @__PURE__ */ jsx30("div", { className: "orion-admin-inline-actions", style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsx30("a", { className: "orion-admin-action-button", href: "/admin-core", target: "_blank", children: "Open Payload Core Admin" }) }),
|
|
5820
|
+
error ? /* @__PURE__ */ jsx30("div", { className: "orion-admin-error", style: { marginBottom: "1rem" }, children: error }) : null,
|
|
5821
|
+
savedMessage ? /* @__PURE__ */ jsx30("div", { className: "orion-admin-success", style: { marginBottom: "1rem" }, children: savedMessage }) : null,
|
|
5822
|
+
/* @__PURE__ */ jsxs27("form", { className: "orion-admin-form", onSubmit: createUser, style: { marginBottom: "1rem" }, children: [
|
|
5823
|
+
/* @__PURE__ */ jsx30("strong", { children: "Create User" }),
|
|
5824
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5002
5825
|
"Email",
|
|
5003
|
-
/* @__PURE__ */
|
|
5826
|
+
/* @__PURE__ */ jsx30("input", { name: "email", required: true, type: "email" })
|
|
5004
5827
|
] }),
|
|
5005
|
-
/* @__PURE__ */
|
|
5828
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5006
5829
|
"Full Name",
|
|
5007
|
-
/* @__PURE__ */
|
|
5830
|
+
/* @__PURE__ */ jsx30("input", { name: "fullName", type: "text" })
|
|
5008
5831
|
] }),
|
|
5009
|
-
/* @__PURE__ */
|
|
5832
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5010
5833
|
"Password",
|
|
5011
|
-
/* @__PURE__ */
|
|
5834
|
+
/* @__PURE__ */ jsx30("input", { name: "password", required: true, type: "password" })
|
|
5012
5835
|
] }),
|
|
5013
|
-
/* @__PURE__ */
|
|
5836
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5014
5837
|
"Role",
|
|
5015
|
-
/* @__PURE__ */
|
|
5016
|
-
/* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5018
|
-
/* @__PURE__ */
|
|
5838
|
+
/* @__PURE__ */ jsxs27("select", { defaultValue: "editor", name: "role", children: [
|
|
5839
|
+
/* @__PURE__ */ jsx30("option", { value: "admin", children: "admin" }),
|
|
5840
|
+
/* @__PURE__ */ jsx30("option", { value: "editor", children: "editor" }),
|
|
5841
|
+
/* @__PURE__ */ jsx30("option", { value: "client", children: "client" })
|
|
5019
5842
|
] })
|
|
5020
5843
|
] }),
|
|
5021
|
-
/* @__PURE__ */
|
|
5844
|
+
/* @__PURE__ */ jsx30("button", { disabled: createSubmitting, type: "submit", children: createSubmitting ? "Creating..." : "Create User" })
|
|
5022
5845
|
] }),
|
|
5023
|
-
loading ? /* @__PURE__ */
|
|
5024
|
-
/* @__PURE__ */
|
|
5846
|
+
loading ? /* @__PURE__ */ jsx30("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5847
|
+
/* @__PURE__ */ jsx30("div", { className: "orion-admin-list", children: docs.map((doc) => {
|
|
5025
5848
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
5026
5849
|
if (!id) return null;
|
|
5027
5850
|
const email = typeof doc.email === "string" ? doc.email : `user-${id}`;
|
|
5028
5851
|
const fullName = typeof doc.fullName === "string" ? doc.fullName : "";
|
|
5029
5852
|
const currentRole = typeof doc.role === "string" ? normalizeRole(doc.role) : "editor";
|
|
5030
|
-
return /* @__PURE__ */
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
/* @__PURE__ */
|
|
5033
|
-
/* @__PURE__ */
|
|
5853
|
+
return /* @__PURE__ */ jsxs27("div", { className: "orion-admin-list-item", children: [
|
|
5854
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
5855
|
+
/* @__PURE__ */ jsx30("strong", { children: email }),
|
|
5856
|
+
/* @__PURE__ */ jsx30("div", { className: "orion-admin-list-meta", children: fullName || "No full name set" })
|
|
5034
5857
|
] }),
|
|
5035
|
-
/* @__PURE__ */
|
|
5036
|
-
/* @__PURE__ */
|
|
5037
|
-
/* @__PURE__ */
|
|
5038
|
-
/* @__PURE__ */
|
|
5039
|
-
/* @__PURE__ */
|
|
5040
|
-
/* @__PURE__ */
|
|
5858
|
+
/* @__PURE__ */ jsxs27("form", { className: "orion-admin-inline-actions", onSubmit: updateUserRole, children: [
|
|
5859
|
+
/* @__PURE__ */ jsx30("input", { name: "id", type: "hidden", value: id }),
|
|
5860
|
+
/* @__PURE__ */ jsxs27("select", { defaultValue: currentRole, name: "role", children: [
|
|
5861
|
+
/* @__PURE__ */ jsx30("option", { value: "admin", children: "admin" }),
|
|
5862
|
+
/* @__PURE__ */ jsx30("option", { value: "editor", children: "editor" }),
|
|
5863
|
+
/* @__PURE__ */ jsx30("option", { value: "client", children: "client" })
|
|
5041
5864
|
] }),
|
|
5042
|
-
/* @__PURE__ */
|
|
5865
|
+
/* @__PURE__ */ jsx30("button", { disabled: updatingUserID === id, type: "submit", children: updatingUserID === id ? "Updating..." : "Update" })
|
|
5043
5866
|
] })
|
|
5044
5867
|
] }, id);
|
|
5045
5868
|
}) })
|
|
@@ -5050,14 +5873,14 @@ function AdminStudioToolsView(props) {
|
|
|
5050
5873
|
|
|
5051
5874
|
// src/admin/components/studio/OpenInStudioMenuItem.tsx
|
|
5052
5875
|
import { useDocumentInfo } from "@payloadcms/ui";
|
|
5053
|
-
import { jsx as
|
|
5876
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
5054
5877
|
function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
5055
5878
|
const documentInfo = useDocumentInfo();
|
|
5056
5879
|
const id = documentInfo?.id;
|
|
5057
5880
|
if (!id) {
|
|
5058
5881
|
return null;
|
|
5059
5882
|
}
|
|
5060
|
-
return /* @__PURE__ */
|
|
5883
|
+
return /* @__PURE__ */ jsx31(
|
|
5061
5884
|
"a",
|
|
5062
5885
|
{
|
|
5063
5886
|
href: `${pagesPathBase}/${id}`,
|
|
@@ -5076,19 +5899,19 @@ function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
|
5076
5899
|
}
|
|
5077
5900
|
|
|
5078
5901
|
// src/admin/components/studio/PageEditRedirectToStudio.tsx
|
|
5079
|
-
import { useEffect as
|
|
5902
|
+
import { useEffect as useEffect19 } from "react";
|
|
5080
5903
|
import { useDocumentInfo as useDocumentInfo2 } from "@payloadcms/ui";
|
|
5081
|
-
import { jsx as
|
|
5904
|
+
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5082
5905
|
function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
5083
5906
|
const documentInfo = useDocumentInfo2();
|
|
5084
5907
|
const id = documentInfo?.id;
|
|
5085
|
-
|
|
5908
|
+
useEffect19(() => {
|
|
5086
5909
|
if (!id) {
|
|
5087
5910
|
return;
|
|
5088
5911
|
}
|
|
5089
5912
|
window.location.replace(`${pagesPathBase}/${id}`);
|
|
5090
5913
|
}, [id, pagesPathBase]);
|
|
5091
|
-
return /* @__PURE__ */
|
|
5914
|
+
return /* @__PURE__ */ jsxs28(
|
|
5092
5915
|
"div",
|
|
5093
5916
|
{
|
|
5094
5917
|
style: {
|
|
@@ -5100,18 +5923,18 @@ function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
|
5100
5923
|
minHeight: "50vh"
|
|
5101
5924
|
},
|
|
5102
5925
|
children: [
|
|
5103
|
-
/* @__PURE__ */
|
|
5104
|
-
/* @__PURE__ */
|
|
5105
|
-
id ? /* @__PURE__ */
|
|
5926
|
+
/* @__PURE__ */ jsx32("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
|
|
5927
|
+
/* @__PURE__ */ jsx32("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
|
|
5928
|
+
id ? /* @__PURE__ */ jsx32("a", { href: `${pagesPathBase}/${id}`, children: "Continue to Editor" }) : /* @__PURE__ */ jsx32("a", { href: pagesPathBase, children: "Open Pages" })
|
|
5106
5929
|
]
|
|
5107
5930
|
}
|
|
5108
5931
|
);
|
|
5109
5932
|
}
|
|
5110
5933
|
|
|
5111
5934
|
// src/admin/components/studio/StudioBackBreadcrumb.tsx
|
|
5112
|
-
import { useEffect as
|
|
5935
|
+
import { useEffect as useEffect20, useState as useState20 } from "react";
|
|
5113
5936
|
import { SetStepNav as SetStepNav5 } from "@payloadcms/ui";
|
|
5114
|
-
import { jsx as
|
|
5937
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
5115
5938
|
var toTitle = (slug) => slug.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
5116
5939
|
var buildNav = (pathname, adminBasePath) => {
|
|
5117
5940
|
if (pathname.includes("/globals/")) {
|
|
@@ -5156,8 +5979,8 @@ var buildNav = (pathname, adminBasePath) => {
|
|
|
5156
5979
|
};
|
|
5157
5980
|
function StudioBackBreadcrumb() {
|
|
5158
5981
|
const adminBasePath = useAdminBasePath();
|
|
5159
|
-
const [pathname, setPathname] =
|
|
5160
|
-
|
|
5982
|
+
const [pathname, setPathname] = useState20("");
|
|
5983
|
+
useEffect20(() => {
|
|
5161
5984
|
const update = () => setPathname(window.location.pathname);
|
|
5162
5985
|
update();
|
|
5163
5986
|
window.addEventListener("popstate", update);
|
|
@@ -5165,12 +5988,12 @@ function StudioBackBreadcrumb() {
|
|
|
5165
5988
|
}, []);
|
|
5166
5989
|
const nav = buildNav(pathname, adminBasePath);
|
|
5167
5990
|
if (!nav) return null;
|
|
5168
|
-
return /* @__PURE__ */
|
|
5991
|
+
return /* @__PURE__ */ jsx33(SetStepNav5, { nav });
|
|
5169
5992
|
}
|
|
5170
5993
|
|
|
5171
5994
|
// src/admin/components/studio/StudioContactFormRedirect.tsx
|
|
5172
|
-
import { useEffect as
|
|
5173
|
-
import { jsx as
|
|
5995
|
+
import { useEffect as useEffect21 } from "react";
|
|
5996
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5174
5997
|
var getPropString14 = (props, key, fallback) => {
|
|
5175
5998
|
if (!props || typeof props !== "object") return fallback;
|
|
5176
5999
|
const direct = props[key];
|
|
@@ -5186,11 +6009,11 @@ function StudioContactFormRedirect(props) {
|
|
|
5186
6009
|
const adminBasePath = useAdminBasePath();
|
|
5187
6010
|
const studioContactFormPath = getPropString14(props, "studioContactFormPath", "/contact-form");
|
|
5188
6011
|
const targetPath = resolveAdminPath(adminBasePath, studioContactFormPath);
|
|
5189
|
-
|
|
6012
|
+
useEffect21(() => {
|
|
5190
6013
|
if (window.location.pathname === targetPath) return;
|
|
5191
6014
|
window.location.replace(targetPath);
|
|
5192
6015
|
}, [targetPath]);
|
|
5193
|
-
return /* @__PURE__ */
|
|
6016
|
+
return /* @__PURE__ */ jsxs29(
|
|
5194
6017
|
"div",
|
|
5195
6018
|
{
|
|
5196
6019
|
style: {
|
|
@@ -5203,14 +6026,15 @@ function StudioContactFormRedirect(props) {
|
|
|
5203
6026
|
minHeight: "40vh"
|
|
5204
6027
|
},
|
|
5205
6028
|
children: [
|
|
5206
|
-
/* @__PURE__ */
|
|
5207
|
-
/* @__PURE__ */
|
|
6029
|
+
/* @__PURE__ */ jsx34("h2", { style: { margin: 0 }, children: "Opening Contact Form Editor..." }),
|
|
6030
|
+
/* @__PURE__ */ jsx34("a", { href: targetPath, children: "Continue" })
|
|
5208
6031
|
]
|
|
5209
6032
|
}
|
|
5210
6033
|
);
|
|
5211
6034
|
}
|
|
5212
6035
|
export {
|
|
5213
6036
|
AdminLoginIntro,
|
|
6037
|
+
AdminLoginPasswordToggle,
|
|
5214
6038
|
AdminStudioContactFormView,
|
|
5215
6039
|
AdminStudioDashboard,
|
|
5216
6040
|
AdminStudioFooterGlobalView,
|