@orion-studios/payload-studio 0.6.0-beta.1 → 0.6.0-beta.11
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 +2262 -1415
- package/dist/admin/client.mjs +1821 -977
- package/dist/admin/index.d.mts +1 -1
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/index.js +21 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin-app/styles.css +505 -40
- package/dist/{chunk-Q2HGC67S.mjs → chunk-T4OH6KI6.mjs} +21 -1
- package/dist/index-Xt3Ep8WV.d.mts +188 -0
- package/dist/index-yhpAgqDS.d.ts +188 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +21 -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
|
@@ -41,17 +41,22 @@ var resolveUploadUrl = (value) => {
|
|
|
41
41
|
var resolveLogoUrl = (settings) => {
|
|
42
42
|
return resolveUploadUrl(settings.logo) || resolveUploadUrl(settings.adminLogo) || resolveUploadUrl(settings.brandLogo) || null;
|
|
43
43
|
};
|
|
44
|
+
var resolveLogoOnDarkUrl = (settings) => {
|
|
45
|
+
return resolveUploadUrl(settings.logoOnDark) || resolveUploadUrl(settings.logoDark) || resolveUploadUrl(settings.adminLogoDark) || resolveUploadUrl(settings.adminLogoOnDark) || resolveUploadUrl(settings.brandLogoDark) || null;
|
|
46
|
+
};
|
|
44
47
|
var cachedBranding = null;
|
|
45
|
-
function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
48
|
+
function useSiteBranding(defaultName, defaultLogoUrl, defaultLogoOnDarkUrl) {
|
|
46
49
|
const [branding, setBranding] = useState(() => {
|
|
47
50
|
if (cachedBranding) {
|
|
48
51
|
return {
|
|
49
52
|
logoUrl: cachedBranding.logoUrl || defaultLogoUrl || null,
|
|
53
|
+
logoOnDarkUrl: cachedBranding.logoOnDarkUrl || defaultLogoOnDarkUrl || null,
|
|
50
54
|
siteName: cachedBranding.siteName || defaultName || null
|
|
51
55
|
};
|
|
52
56
|
}
|
|
53
57
|
return {
|
|
54
58
|
logoUrl: defaultLogoUrl || null,
|
|
59
|
+
logoOnDarkUrl: defaultLogoOnDarkUrl || null,
|
|
55
60
|
siteName: defaultName || null
|
|
56
61
|
};
|
|
57
62
|
});
|
|
@@ -59,7 +64,7 @@ function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
|
59
64
|
let cancelled = false;
|
|
60
65
|
const run = async () => {
|
|
61
66
|
try {
|
|
62
|
-
const res = await fetch("/api/globals/site-settings?depth=1
|
|
67
|
+
const res = await fetch("/api/globals/site-settings?depth=1", {
|
|
63
68
|
credentials: "include"
|
|
64
69
|
});
|
|
65
70
|
if (!res.ok) return;
|
|
@@ -68,9 +73,11 @@ function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
|
68
73
|
if (!record) return;
|
|
69
74
|
const siteName = pickString(record.siteName);
|
|
70
75
|
const logoUrl = resolveLogoUrl(record);
|
|
71
|
-
|
|
76
|
+
const logoOnDarkUrl = resolveLogoOnDarkUrl(record);
|
|
77
|
+
cachedBranding = { logoOnDarkUrl, logoUrl, siteName };
|
|
72
78
|
if (!cancelled) {
|
|
73
79
|
setBranding({
|
|
80
|
+
logoOnDarkUrl: logoOnDarkUrl || defaultLogoOnDarkUrl || null,
|
|
74
81
|
logoUrl: logoUrl || defaultLogoUrl || null,
|
|
75
82
|
siteName: siteName || defaultName || null
|
|
76
83
|
});
|
|
@@ -82,16 +89,20 @@ function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
|
82
89
|
return () => {
|
|
83
90
|
cancelled = true;
|
|
84
91
|
};
|
|
85
|
-
}, [defaultLogoUrl, defaultName]);
|
|
92
|
+
}, [defaultLogoOnDarkUrl, defaultLogoUrl, defaultName]);
|
|
86
93
|
return branding;
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
// src/admin/components/Logo.tsx
|
|
90
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
91
|
-
function Logo({ brandName = "Orion Studio", logoUrl } = {}) {
|
|
92
|
-
const branding = useSiteBranding(brandName, logoUrl);
|
|
97
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
98
|
+
function Logo({ brandName = "Orion Studio", logoOnDarkUrl, logoUrl } = {}) {
|
|
99
|
+
const branding = useSiteBranding(brandName, logoUrl, logoOnDarkUrl);
|
|
93
100
|
const resolvedName = branding.siteName || brandName;
|
|
94
101
|
const resolvedLogo = branding.logoUrl || logoUrl || null;
|
|
102
|
+
const resolvedLogoOnDark = branding.logoOnDarkUrl || logoOnDarkUrl || resolvedLogo;
|
|
103
|
+
const hasDarkLogoVariant = Boolean(
|
|
104
|
+
resolvedLogo && resolvedLogoOnDark && resolvedLogoOnDark.trim().length > 0 && resolvedLogoOnDark !== resolvedLogo
|
|
105
|
+
);
|
|
95
106
|
return /* @__PURE__ */ jsxs(
|
|
96
107
|
"div",
|
|
97
108
|
{
|
|
@@ -110,8 +121,6 @@ function Logo({ brandName = "Orion Studio", logoUrl } = {}) {
|
|
|
110
121
|
className: "orion-admin-logo-mark",
|
|
111
122
|
style: {
|
|
112
123
|
alignItems: "center",
|
|
113
|
-
background: "var(--orion-cms-logo-bg, var(--admin-accent, #3b82f6))",
|
|
114
|
-
borderRadius: "var(--orion-cms-logo-radius, var(--admin-radius-md, 8px))",
|
|
115
124
|
display: "flex",
|
|
116
125
|
flexShrink: 0,
|
|
117
126
|
height: 32,
|
|
@@ -119,14 +128,25 @@ function Logo({ brandName = "Orion Studio", logoUrl } = {}) {
|
|
|
119
128
|
overflow: "hidden",
|
|
120
129
|
width: 32
|
|
121
130
|
},
|
|
122
|
-
children: resolvedLogo ? /* @__PURE__ */
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
children: resolvedLogo ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
"img",
|
|
134
|
+
{
|
|
135
|
+
alt: `${resolvedName} logo`,
|
|
136
|
+
className: `orion-admin-logo-image orion-admin-logo-image--default${hasDarkLogoVariant ? "" : " is-only-logo"}`,
|
|
137
|
+
src: resolvedLogo
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
hasDarkLogoVariant ? /* @__PURE__ */ jsx(
|
|
141
|
+
"img",
|
|
142
|
+
{
|
|
143
|
+
alt: "",
|
|
144
|
+
"aria-hidden": "true",
|
|
145
|
+
className: "orion-admin-logo-image orion-admin-logo-image--dark",
|
|
146
|
+
src: resolvedLogoOnDark
|
|
147
|
+
}
|
|
148
|
+
) : null
|
|
149
|
+
] }) : /* @__PURE__ */ jsxs(
|
|
130
150
|
"svg",
|
|
131
151
|
{
|
|
132
152
|
fill: "none",
|
|
@@ -234,38 +254,122 @@ function AdminLoginIntro({ brandName = "Orion Studio", logoUrl } = {}) {
|
|
|
234
254
|
const branding = useSiteBranding(brandName, logoUrl);
|
|
235
255
|
const resolvedName = branding.siteName || brandName;
|
|
236
256
|
return /* @__PURE__ */ jsxs3("div", { className: "orion-admin-login-intro", children: [
|
|
237
|
-
/* @__PURE__ */ jsx3("span", { className: "orion-admin-login-eyebrow", children: "
|
|
257
|
+
/* @__PURE__ */ jsx3("span", { className: "orion-admin-login-eyebrow", children: "Private Admin" }),
|
|
238
258
|
/* @__PURE__ */ jsxs3("h1", { children: [
|
|
239
|
-
"Manage ",
|
|
240
259
|
resolvedName,
|
|
241
|
-
"
|
|
260
|
+
" admin"
|
|
242
261
|
] }),
|
|
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
|
-
] })
|
|
262
|
+
/* @__PURE__ */ jsx3("p", { children: "Sign in to update pages, review forms, manage media, and adjust site settings." }),
|
|
263
|
+
/* @__PURE__ */ jsx3("p", { className: "orion-admin-login-caption", children: "For owners and authorized team members." })
|
|
258
264
|
] });
|
|
259
265
|
}
|
|
260
266
|
|
|
267
|
+
// src/admin/components/AdminLoginPasswordToggle.tsx
|
|
268
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
269
|
+
import { createPortal } from "react-dom";
|
|
270
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
271
|
+
var loginPasswordSelector = '.template-minimal.login .login__form input[name="password"]';
|
|
272
|
+
function EyeIcon({ crossed = false }) {
|
|
273
|
+
return /* @__PURE__ */ jsxs4(
|
|
274
|
+
"svg",
|
|
275
|
+
{
|
|
276
|
+
"aria-hidden": "true",
|
|
277
|
+
fill: "none",
|
|
278
|
+
height: "18",
|
|
279
|
+
stroke: "currentColor",
|
|
280
|
+
strokeLinecap: "round",
|
|
281
|
+
strokeLinejoin: "round",
|
|
282
|
+
strokeWidth: "1.9",
|
|
283
|
+
viewBox: "0 0 24 24",
|
|
284
|
+
width: "18",
|
|
285
|
+
children: [
|
|
286
|
+
/* @__PURE__ */ jsx4("path", { d: "M2 12s3.6-6 10-6 10 6 10 6-3.6 6-10 6S2 12 2 12Z" }),
|
|
287
|
+
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "2.75" }),
|
|
288
|
+
crossed ? /* @__PURE__ */ jsx4("path", { d: "M4 4l16 16" }) : null
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
function AdminLoginPasswordToggle() {
|
|
294
|
+
const [hostEl, setHostEl] = useState2(null);
|
|
295
|
+
const [inputEl, setInputEl] = useState2(null);
|
|
296
|
+
const [portalEl, setPortalEl] = useState2(null);
|
|
297
|
+
const [visible, setVisible] = useState2(false);
|
|
298
|
+
useEffect2(() => {
|
|
299
|
+
const sync = () => {
|
|
300
|
+
const nextInput = document.querySelector(loginPasswordSelector);
|
|
301
|
+
const nextHost = nextInput?.parentElement ?? null;
|
|
302
|
+
setInputEl((current) => current === nextInput ? current : nextInput);
|
|
303
|
+
setHostEl((current) => current === nextHost ? current : nextHost);
|
|
304
|
+
};
|
|
305
|
+
sync();
|
|
306
|
+
const observer = new MutationObserver(sync);
|
|
307
|
+
observer.observe(document.body, {
|
|
308
|
+
childList: true,
|
|
309
|
+
subtree: true
|
|
310
|
+
});
|
|
311
|
+
return () => observer.disconnect();
|
|
312
|
+
}, []);
|
|
313
|
+
useEffect2(() => {
|
|
314
|
+
setVisible(false);
|
|
315
|
+
}, [inputEl]);
|
|
316
|
+
useEffect2(() => {
|
|
317
|
+
if (!inputEl) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
inputEl.type = visible ? "text" : "password";
|
|
321
|
+
return () => {
|
|
322
|
+
inputEl.type = "password";
|
|
323
|
+
};
|
|
324
|
+
}, [inputEl, visible]);
|
|
325
|
+
useEffect2(() => {
|
|
326
|
+
if (!hostEl) {
|
|
327
|
+
setPortalEl(null);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const existing = hostEl.querySelector(".orion-admin-password-toggle-slot");
|
|
331
|
+
const slot = existing || document.createElement("div");
|
|
332
|
+
slot.className = "orion-admin-password-toggle-slot";
|
|
333
|
+
if (!slot.parentElement) {
|
|
334
|
+
hostEl.appendChild(slot);
|
|
335
|
+
}
|
|
336
|
+
setPortalEl(slot);
|
|
337
|
+
return () => {
|
|
338
|
+
if (slot.parentElement === hostEl) {
|
|
339
|
+
slot.remove();
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}, [hostEl]);
|
|
343
|
+
if (!inputEl || inputEl.disabled || !portalEl) {
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
return createPortal(
|
|
347
|
+
/* @__PURE__ */ jsx4(
|
|
348
|
+
"button",
|
|
349
|
+
{
|
|
350
|
+
"aria-label": visible ? "Hide password" : "Show password",
|
|
351
|
+
"aria-pressed": visible,
|
|
352
|
+
className: "orion-admin-password-toggle",
|
|
353
|
+
"data-visible": visible ? "true" : "false",
|
|
354
|
+
onClick: () => setVisible((current) => !current),
|
|
355
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
356
|
+
title: visible ? "Hide password" : "Show password",
|
|
357
|
+
type: "button",
|
|
358
|
+
children: /* @__PURE__ */ jsx4(EyeIcon, { crossed: visible })
|
|
359
|
+
}
|
|
360
|
+
),
|
|
361
|
+
portalEl
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
|
|
261
365
|
// src/admin/components/Dashboard.tsx
|
|
262
|
-
import { useEffect as
|
|
366
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
263
367
|
|
|
264
368
|
// src/admin/components/ThemeSwitcher.tsx
|
|
265
369
|
import { useLayoutEffect } from "react";
|
|
266
370
|
|
|
267
371
|
// src/admin/hooks/useTheme.ts
|
|
268
|
-
import { useCallback, useEffect as
|
|
372
|
+
import { useCallback, useEffect as useEffect3, useRef, useState as useState3 } from "react";
|
|
269
373
|
var STORAGE_KEY = "orion-admin-theme";
|
|
270
374
|
function applyTheme(theme) {
|
|
271
375
|
const html = document.documentElement;
|
|
@@ -299,12 +403,12 @@ function cacheTheme(theme) {
|
|
|
299
403
|
}
|
|
300
404
|
}
|
|
301
405
|
function useTheme(defaultTheme = "brand-light") {
|
|
302
|
-
const [theme, setThemeState] =
|
|
303
|
-
const [isLoading, setIsLoading] =
|
|
304
|
-
const [hasMounted, setHasMounted] =
|
|
406
|
+
const [theme, setThemeState] = useState3(defaultTheme);
|
|
407
|
+
const [isLoading, setIsLoading] = useState3(true);
|
|
408
|
+
const [hasMounted, setHasMounted] = useState3(false);
|
|
305
409
|
const debounceRef = useRef(null);
|
|
306
410
|
const userIdRef = useRef(null);
|
|
307
|
-
|
|
411
|
+
useEffect3(() => {
|
|
308
412
|
setHasMounted(true);
|
|
309
413
|
const cached = getCachedTheme();
|
|
310
414
|
if (cached) {
|
|
@@ -379,31 +483,31 @@ function useTheme(defaultTheme = "brand-light") {
|
|
|
379
483
|
}
|
|
380
484
|
|
|
381
485
|
// src/admin/components/ThemeSwitcher.tsx
|
|
382
|
-
import { Fragment, jsx as
|
|
486
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
383
487
|
var iconSize = 16;
|
|
384
488
|
function SunIcon() {
|
|
385
|
-
return /* @__PURE__ */
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
/* @__PURE__ */
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
489
|
+
return /* @__PURE__ */ jsxs5("svg", { width: iconSize, height: iconSize, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
490
|
+
/* @__PURE__ */ jsx5("circle", { cx: "12", cy: "12", r: "5" }),
|
|
491
|
+
/* @__PURE__ */ jsx5("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
492
|
+
/* @__PURE__ */ jsx5("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
493
|
+
/* @__PURE__ */ jsx5("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
|
|
494
|
+
/* @__PURE__ */ jsx5("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
|
|
495
|
+
/* @__PURE__ */ jsx5("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
|
|
496
|
+
/* @__PURE__ */ jsx5("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
|
|
497
|
+
/* @__PURE__ */ jsx5("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
498
|
+
/* @__PURE__ */ jsx5("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
395
499
|
] });
|
|
396
500
|
}
|
|
397
501
|
function MoonIcon() {
|
|
398
|
-
return /* @__PURE__ */
|
|
502
|
+
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
503
|
}
|
|
400
504
|
function PaletteIcon() {
|
|
401
|
-
return /* @__PURE__ */
|
|
402
|
-
/* @__PURE__ */
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
-
/* @__PURE__ */
|
|
505
|
+
return /* @__PURE__ */ jsxs5("svg", { width: iconSize, height: iconSize, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
506
|
+
/* @__PURE__ */ jsx5("circle", { cx: "13.5", cy: "6.5", r: "0.5", fill: "currentColor" }),
|
|
507
|
+
/* @__PURE__ */ jsx5("circle", { cx: "17.5", cy: "10.5", r: "0.5", fill: "currentColor" }),
|
|
508
|
+
/* @__PURE__ */ jsx5("circle", { cx: "8.5", cy: "7.5", r: "0.5", fill: "currentColor" }),
|
|
509
|
+
/* @__PURE__ */ jsx5("circle", { cx: "6.5", cy: "12", r: "0.5", fill: "currentColor" }),
|
|
510
|
+
/* @__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
511
|
] });
|
|
408
512
|
}
|
|
409
513
|
var buttonBase = {
|
|
@@ -438,7 +542,7 @@ function ThemeSwitcher({
|
|
|
438
542
|
const { isDark, isBrand, hasMounted, toggleDarkMode, toggleBrandMode } = useTheme(defaultTheme);
|
|
439
543
|
const showDark = hasMounted && isDark;
|
|
440
544
|
const showBrand = hasMounted && isBrand;
|
|
441
|
-
return /* @__PURE__ */
|
|
545
|
+
return /* @__PURE__ */ jsxs5(
|
|
442
546
|
"div",
|
|
443
547
|
{
|
|
444
548
|
style: {
|
|
@@ -448,7 +552,7 @@ function ThemeSwitcher({
|
|
|
448
552
|
padding: "8px 12px"
|
|
449
553
|
},
|
|
450
554
|
children: [
|
|
451
|
-
/* @__PURE__ */
|
|
555
|
+
/* @__PURE__ */ jsx5(
|
|
452
556
|
"button",
|
|
453
557
|
{
|
|
454
558
|
type: "button",
|
|
@@ -456,10 +560,10 @@ function ThemeSwitcher({
|
|
|
456
560
|
style: showDark ? buttonActive : buttonBase,
|
|
457
561
|
title: showDark ? "Switch to light mode" : "Switch to dark mode",
|
|
458
562
|
"aria-label": showDark ? "Switch to light mode" : "Switch to dark mode",
|
|
459
|
-
children: showDark ? /* @__PURE__ */
|
|
563
|
+
children: showDark ? /* @__PURE__ */ jsx5(MoonIcon, {}) : /* @__PURE__ */ jsx5(SunIcon, {})
|
|
460
564
|
}
|
|
461
565
|
),
|
|
462
|
-
/* @__PURE__ */
|
|
566
|
+
/* @__PURE__ */ jsx5(
|
|
463
567
|
"button",
|
|
464
568
|
{
|
|
465
569
|
type: "button",
|
|
@@ -467,7 +571,7 @@ function ThemeSwitcher({
|
|
|
467
571
|
style: showBrand ? buttonActive : buttonBase,
|
|
468
572
|
title: showBrand ? "Switch to standard colors" : "Switch to brand colors",
|
|
469
573
|
"aria-label": showBrand ? "Switch to standard colors" : "Switch to brand colors",
|
|
470
|
-
children: /* @__PURE__ */
|
|
574
|
+
children: /* @__PURE__ */ jsx5(PaletteIcon, {})
|
|
471
575
|
}
|
|
472
576
|
)
|
|
473
577
|
]
|
|
@@ -519,24 +623,24 @@ function ThemeProvider({
|
|
|
519
623
|
} catch {
|
|
520
624
|
}
|
|
521
625
|
}, [allowThemePreference, defaultTheme]);
|
|
522
|
-
return /* @__PURE__ */
|
|
626
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children });
|
|
523
627
|
}
|
|
524
628
|
|
|
525
629
|
// src/admin/components/HelpTooltip.tsx
|
|
526
|
-
import { useCallback as useCallback2, useEffect as
|
|
527
|
-
import { jsx as
|
|
630
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
|
|
631
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
528
632
|
function HelpTooltip({
|
|
529
633
|
content,
|
|
530
634
|
position = "top"
|
|
531
635
|
}) {
|
|
532
|
-
const [isVisible, setIsVisible] =
|
|
636
|
+
const [isVisible, setIsVisible] = useState4(false);
|
|
533
637
|
const triggerRef = useRef2(null);
|
|
534
638
|
const tooltipRef = useRef2(null);
|
|
535
639
|
const tooltipId = useRef2(`tooltip-${Math.random().toString(36).slice(2, 9)}`);
|
|
536
640
|
const show = useCallback2(() => setIsVisible(true), []);
|
|
537
641
|
const hide = useCallback2(() => setIsVisible(false), []);
|
|
538
642
|
const toggle = useCallback2(() => setIsVisible((v) => !v), []);
|
|
539
|
-
|
|
643
|
+
useEffect4(() => {
|
|
540
644
|
if (!isVisible) return;
|
|
541
645
|
const handleKeyDown = (e) => {
|
|
542
646
|
if (e.key === "Escape") setIsVisible(false);
|
|
@@ -544,7 +648,7 @@ function HelpTooltip({
|
|
|
544
648
|
document.addEventListener("keydown", handleKeyDown);
|
|
545
649
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
546
650
|
}, [isVisible]);
|
|
547
|
-
|
|
651
|
+
useEffect4(() => {
|
|
548
652
|
if (!isVisible) return;
|
|
549
653
|
const handleClick = (e) => {
|
|
550
654
|
if (triggerRef.current && !triggerRef.current.contains(e.target) && tooltipRef.current && !tooltipRef.current.contains(e.target)) {
|
|
@@ -560,8 +664,8 @@ function HelpTooltip({
|
|
|
560
664
|
left: { right: "100%", top: "50%", transform: "translateY(-50%)", marginRight: 8 },
|
|
561
665
|
right: { left: "100%", top: "50%", transform: "translateY(-50%)", marginLeft: 8 }
|
|
562
666
|
};
|
|
563
|
-
return /* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
667
|
+
return /* @__PURE__ */ jsxs6("span", { style: { position: "relative", display: "inline-flex", verticalAlign: "middle", marginLeft: 6 }, children: [
|
|
668
|
+
/* @__PURE__ */ jsx6(
|
|
565
669
|
"button",
|
|
566
670
|
{
|
|
567
671
|
ref: triggerRef,
|
|
@@ -597,7 +701,7 @@ function HelpTooltip({
|
|
|
597
701
|
children: "?"
|
|
598
702
|
}
|
|
599
703
|
),
|
|
600
|
-
isVisible && /* @__PURE__ */
|
|
704
|
+
isVisible && /* @__PURE__ */ jsx6(
|
|
601
705
|
"div",
|
|
602
706
|
{
|
|
603
707
|
ref: tooltipRef,
|
|
@@ -627,7 +731,7 @@ function HelpTooltip({
|
|
|
627
731
|
}
|
|
628
732
|
|
|
629
733
|
// src/admin/components/StatusBadge.tsx
|
|
630
|
-
import { jsx as
|
|
734
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
631
735
|
var statusConfig = {
|
|
632
736
|
draft: { label: "Draft" },
|
|
633
737
|
published: { label: "Published" },
|
|
@@ -639,7 +743,7 @@ function StatusBadge({
|
|
|
639
743
|
}) {
|
|
640
744
|
const config = statusConfig[status];
|
|
641
745
|
const isSm = size === "sm";
|
|
642
|
-
return /* @__PURE__ */
|
|
746
|
+
return /* @__PURE__ */ jsxs7(
|
|
643
747
|
"span",
|
|
644
748
|
{
|
|
645
749
|
style: {
|
|
@@ -656,7 +760,7 @@ function StatusBadge({
|
|
|
656
760
|
whiteSpace: "nowrap"
|
|
657
761
|
},
|
|
658
762
|
children: [
|
|
659
|
-
/* @__PURE__ */
|
|
763
|
+
/* @__PURE__ */ jsx7(
|
|
660
764
|
"span",
|
|
661
765
|
{
|
|
662
766
|
style: {
|
|
@@ -675,46 +779,46 @@ function StatusBadge({
|
|
|
675
779
|
}
|
|
676
780
|
|
|
677
781
|
// src/admin/components/Dashboard.tsx
|
|
678
|
-
import { jsx as
|
|
782
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
679
783
|
function PagesIcon({ size = 24 }) {
|
|
680
|
-
return /* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
784
|
+
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: [
|
|
785
|
+
/* @__PURE__ */ jsx8("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
786
|
+
/* @__PURE__ */ jsx8("polyline", { points: "14 2 14 8 20 8" }),
|
|
787
|
+
/* @__PURE__ */ jsx8("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
|
|
788
|
+
/* @__PURE__ */ jsx8("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
|
|
789
|
+
/* @__PURE__ */ jsx8("polyline", { points: "10 9 9 9 8 9" })
|
|
686
790
|
] });
|
|
687
791
|
}
|
|
688
792
|
function MediaIcon({ size = 24 }) {
|
|
689
|
-
return /* @__PURE__ */
|
|
690
|
-
/* @__PURE__ */
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
793
|
+
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: [
|
|
794
|
+
/* @__PURE__ */ jsx8("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
795
|
+
/* @__PURE__ */ jsx8("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
796
|
+
/* @__PURE__ */ jsx8("polyline", { points: "21 15 16 10 5 21" })
|
|
693
797
|
] });
|
|
694
798
|
}
|
|
695
799
|
function SettingsIcon({ size = 24 }) {
|
|
696
|
-
return /* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
800
|
+
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: [
|
|
801
|
+
/* @__PURE__ */ jsx8("circle", { cx: "12", cy: "12", r: "3" }),
|
|
802
|
+
/* @__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
803
|
] });
|
|
700
804
|
}
|
|
701
805
|
function LayoutIcon({ size = 24 }) {
|
|
702
|
-
return /* @__PURE__ */
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
806
|
+
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: [
|
|
807
|
+
/* @__PURE__ */ jsx8("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
808
|
+
/* @__PURE__ */ jsx8("line", { x1: "3", y1: "9", x2: "21", y2: "9" }),
|
|
809
|
+
/* @__PURE__ */ jsx8("line", { x1: "3", y1: "15", x2: "21", y2: "15" })
|
|
706
810
|
] });
|
|
707
811
|
}
|
|
708
812
|
function PlusIcon({ size = 16 }) {
|
|
709
|
-
return /* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
813
|
+
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: [
|
|
814
|
+
/* @__PURE__ */ jsx8("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
815
|
+
/* @__PURE__ */ jsx8("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
712
816
|
] });
|
|
713
817
|
}
|
|
714
818
|
function ClockIcon({ size = 14 }) {
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
819
|
+
return /* @__PURE__ */ jsxs8("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
820
|
+
/* @__PURE__ */ jsx8("circle", { cx: "12", cy: "12", r: "10" }),
|
|
821
|
+
/* @__PURE__ */ jsx8("polyline", { points: "12 6 12 12 16 14" })
|
|
718
822
|
] });
|
|
719
823
|
}
|
|
720
824
|
function getGreeting() {
|
|
@@ -737,11 +841,11 @@ function formatRelativeTime(dateStr) {
|
|
|
737
841
|
return date.toLocaleDateString();
|
|
738
842
|
}
|
|
739
843
|
function Dashboard() {
|
|
740
|
-
const [userName, setUserName] =
|
|
741
|
-
const [recentPages, setRecentPages] =
|
|
742
|
-
const [pageCount, setPageCount] =
|
|
743
|
-
const [mediaCount, setMediaCount] =
|
|
744
|
-
|
|
844
|
+
const [userName, setUserName] = useState5("");
|
|
845
|
+
const [recentPages, setRecentPages] = useState5([]);
|
|
846
|
+
const [pageCount, setPageCount] = useState5(null);
|
|
847
|
+
const [mediaCount, setMediaCount] = useState5(null);
|
|
848
|
+
useEffect5(() => {
|
|
745
849
|
fetch("/api/users/me", { credentials: "include" }).then((res) => res.json()).then((data) => {
|
|
746
850
|
const user = data?.user || data;
|
|
747
851
|
setUserName(user?.fullName || user?.email?.split("@")[0] || "");
|
|
@@ -757,24 +861,24 @@ function Dashboard() {
|
|
|
757
861
|
}).catch(() => {
|
|
758
862
|
});
|
|
759
863
|
}, []);
|
|
760
|
-
return /* @__PURE__ */
|
|
761
|
-
/* @__PURE__ */
|
|
762
|
-
/* @__PURE__ */
|
|
763
|
-
/* @__PURE__ */
|
|
864
|
+
return /* @__PURE__ */ jsxs8("div", { style: { padding: "32px", maxWidth: 1200, margin: "0 auto" }, children: [
|
|
865
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", marginBottom: 32 }, children: [
|
|
866
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
867
|
+
/* @__PURE__ */ jsxs8("h1", { style: { fontSize: 28, fontWeight: 700, color: "var(--admin-text)", margin: "0 0 6px" }, children: [
|
|
764
868
|
getGreeting(),
|
|
765
869
|
userName ? `, ${userName}` : ""
|
|
766
870
|
] }),
|
|
767
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ jsx8("p", { style: { fontSize: 15, color: "var(--admin-text-muted)", margin: 0 }, children: "Manage your website content and settings from here." })
|
|
768
872
|
] }),
|
|
769
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ jsx8(ThemeSwitcher, {})
|
|
770
874
|
] }),
|
|
771
|
-
/* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", gap: 10, marginBottom: 32, flexWrap: "wrap" }, children: [
|
|
876
|
+
/* @__PURE__ */ jsx8(QuickAction, { href: "/admin/collections/pages/create", icon: /* @__PURE__ */ jsx8(PlusIcon, {}), label: "New Page" }),
|
|
877
|
+
/* @__PURE__ */ jsx8(QuickAction, { href: "/admin/collections/media/create", icon: /* @__PURE__ */ jsx8(PlusIcon, {}), label: "Upload Media" }),
|
|
878
|
+
/* @__PURE__ */ jsx8(QuickAction, { href: "/admin/globals/header", icon: /* @__PURE__ */ jsx8(LayoutIcon, { size: 16 }), label: "Edit Navigation" }),
|
|
879
|
+
/* @__PURE__ */ jsx8(QuickAction, { href: "/admin/globals/site-settings", icon: /* @__PURE__ */ jsx8(SettingsIcon, { size: 16 }), label: "Website Settings" })
|
|
776
880
|
] }),
|
|
777
|
-
/* @__PURE__ */
|
|
881
|
+
/* @__PURE__ */ jsxs8(
|
|
778
882
|
"div",
|
|
779
883
|
{
|
|
780
884
|
style: {
|
|
@@ -784,10 +888,10 @@ function Dashboard() {
|
|
|
784
888
|
marginBottom: 32
|
|
785
889
|
},
|
|
786
890
|
children: [
|
|
787
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ jsx8(
|
|
788
892
|
ContentCard,
|
|
789
893
|
{
|
|
790
|
-
icon: /* @__PURE__ */
|
|
894
|
+
icon: /* @__PURE__ */ jsx8(PagesIcon, {}),
|
|
791
895
|
title: "Pages",
|
|
792
896
|
description: "Create and manage your website pages",
|
|
793
897
|
count: pageCount,
|
|
@@ -799,10 +903,10 @@ function Dashboard() {
|
|
|
799
903
|
]
|
|
800
904
|
}
|
|
801
905
|
),
|
|
802
|
-
/* @__PURE__ */
|
|
906
|
+
/* @__PURE__ */ jsx8(
|
|
803
907
|
ContentCard,
|
|
804
908
|
{
|
|
805
|
-
icon: /* @__PURE__ */
|
|
909
|
+
icon: /* @__PURE__ */ jsx8(MediaIcon, {}),
|
|
806
910
|
title: "Media Library",
|
|
807
911
|
description: "Upload and organize images and files",
|
|
808
912
|
count: mediaCount,
|
|
@@ -814,10 +918,10 @@ function Dashboard() {
|
|
|
814
918
|
]
|
|
815
919
|
}
|
|
816
920
|
),
|
|
817
|
-
/* @__PURE__ */
|
|
921
|
+
/* @__PURE__ */ jsx8(
|
|
818
922
|
ContentCard,
|
|
819
923
|
{
|
|
820
|
-
icon: /* @__PURE__ */
|
|
924
|
+
icon: /* @__PURE__ */ jsx8(LayoutIcon, {}),
|
|
821
925
|
title: "Site Design",
|
|
822
926
|
description: "Customize your header, footer, and site-wide settings",
|
|
823
927
|
tooltip: "These settings apply to every page on your website \u2014 your navigation menu, footer information, and global SEO settings.",
|
|
@@ -831,7 +935,7 @@ function Dashboard() {
|
|
|
831
935
|
]
|
|
832
936
|
}
|
|
833
937
|
),
|
|
834
|
-
recentPages.length > 0 && /* @__PURE__ */
|
|
938
|
+
recentPages.length > 0 && /* @__PURE__ */ jsxs8(
|
|
835
939
|
"div",
|
|
836
940
|
{
|
|
837
941
|
style: {
|
|
@@ -841,7 +945,7 @@ function Dashboard() {
|
|
|
841
945
|
overflow: "hidden"
|
|
842
946
|
},
|
|
843
947
|
children: [
|
|
844
|
-
/* @__PURE__ */
|
|
948
|
+
/* @__PURE__ */ jsxs8(
|
|
845
949
|
"div",
|
|
846
950
|
{
|
|
847
951
|
style: {
|
|
@@ -852,11 +956,11 @@ function Dashboard() {
|
|
|
852
956
|
justifyContent: "space-between"
|
|
853
957
|
},
|
|
854
958
|
children: [
|
|
855
|
-
/* @__PURE__ */
|
|
856
|
-
/* @__PURE__ */
|
|
959
|
+
/* @__PURE__ */ jsxs8("h3", { style: { fontSize: 15, fontWeight: 600, color: "var(--admin-text)", margin: 0, display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
960
|
+
/* @__PURE__ */ jsx8(ClockIcon, {}),
|
|
857
961
|
" Recently Edited"
|
|
858
962
|
] }),
|
|
859
|
-
/* @__PURE__ */
|
|
963
|
+
/* @__PURE__ */ jsx8(
|
|
860
964
|
"a",
|
|
861
965
|
{
|
|
862
966
|
href: "/admin/collections/pages",
|
|
@@ -867,7 +971,7 @@ function Dashboard() {
|
|
|
867
971
|
]
|
|
868
972
|
}
|
|
869
973
|
),
|
|
870
|
-
recentPages.map((page, i) => /* @__PURE__ */
|
|
974
|
+
recentPages.map((page, i) => /* @__PURE__ */ jsxs8(
|
|
871
975
|
"a",
|
|
872
976
|
{
|
|
873
977
|
href: `/admin/collections/pages/${page.id}`,
|
|
@@ -887,13 +991,13 @@ function Dashboard() {
|
|
|
887
991
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
888
992
|
},
|
|
889
993
|
children: [
|
|
890
|
-
/* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: 12, minWidth: 0 }, children: [
|
|
995
|
+
/* @__PURE__ */ jsx8(PagesIcon, { size: 16 }),
|
|
996
|
+
/* @__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
997
|
] }),
|
|
894
|
-
/* @__PURE__ */
|
|
895
|
-
page._status && /* @__PURE__ */
|
|
896
|
-
/* @__PURE__ */
|
|
998
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: 12, flexShrink: 0 }, children: [
|
|
999
|
+
page._status && /* @__PURE__ */ jsx8(StatusBadge, { status: page._status, size: "sm" }),
|
|
1000
|
+
/* @__PURE__ */ jsx8("span", { style: { fontSize: 12, color: "var(--admin-text-muted)", whiteSpace: "nowrap" }, children: formatRelativeTime(page.updatedAt) })
|
|
897
1001
|
] })
|
|
898
1002
|
]
|
|
899
1003
|
},
|
|
@@ -905,7 +1009,7 @@ function Dashboard() {
|
|
|
905
1009
|
] });
|
|
906
1010
|
}
|
|
907
1011
|
function QuickAction({ href, icon, label }) {
|
|
908
|
-
return /* @__PURE__ */
|
|
1012
|
+
return /* @__PURE__ */ jsxs8(
|
|
909
1013
|
"a",
|
|
910
1014
|
{
|
|
911
1015
|
href,
|
|
@@ -950,7 +1054,7 @@ function ContentCard({
|
|
|
950
1054
|
tooltip,
|
|
951
1055
|
actions
|
|
952
1056
|
}) {
|
|
953
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ jsxs8(
|
|
954
1058
|
"div",
|
|
955
1059
|
{
|
|
956
1060
|
style: {
|
|
@@ -965,8 +1069,8 @@ function ContentCard({
|
|
|
965
1069
|
transition: "all 0.2s ease"
|
|
966
1070
|
},
|
|
967
1071
|
children: [
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ jsx8("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between" }, children: /* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
1073
|
+
/* @__PURE__ */ jsx8(
|
|
970
1074
|
"div",
|
|
971
1075
|
{
|
|
972
1076
|
style: {
|
|
@@ -982,20 +1086,20 @@ function ContentCard({
|
|
|
982
1086
|
children: icon
|
|
983
1087
|
}
|
|
984
1088
|
),
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
/* @__PURE__ */
|
|
1089
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
1090
|
+
/* @__PURE__ */ jsxs8("h3", { style: { fontSize: 16, fontWeight: 600, color: "var(--admin-text)", margin: 0, display: "flex", alignItems: "center" }, children: [
|
|
987
1091
|
title,
|
|
988
|
-
tooltip && /* @__PURE__ */
|
|
1092
|
+
tooltip && /* @__PURE__ */ jsx8(HelpTooltip, { content: tooltip, position: "right" })
|
|
989
1093
|
] }),
|
|
990
|
-
count !== void 0 && count !== null && /* @__PURE__ */
|
|
1094
|
+
count !== void 0 && count !== null && /* @__PURE__ */ jsxs8("span", { style: { fontSize: 12, color: "var(--admin-text-muted)" }, children: [
|
|
991
1095
|
count,
|
|
992
1096
|
" ",
|
|
993
1097
|
countLabel
|
|
994
1098
|
] })
|
|
995
1099
|
] })
|
|
996
1100
|
] }) }),
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
actions && actions.length > 0 && /* @__PURE__ */
|
|
1101
|
+
/* @__PURE__ */ jsx8("p", { style: { fontSize: 13, color: "var(--admin-text-muted)", margin: 0, lineHeight: 1.5 }, children: description }),
|
|
1102
|
+
actions && actions.length > 0 && /* @__PURE__ */ jsx8("div", { style: { display: "flex", gap: 8, marginTop: "auto", flexWrap: "wrap" }, children: actions.map((action) => /* @__PURE__ */ jsx8(
|
|
999
1103
|
"a",
|
|
1000
1104
|
{
|
|
1001
1105
|
href: action.href,
|
|
@@ -1027,7 +1131,7 @@ function ContentCard({
|
|
|
1027
1131
|
}
|
|
1028
1132
|
|
|
1029
1133
|
// src/admin/components/EmptyState.tsx
|
|
1030
|
-
import { jsx as
|
|
1134
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1031
1135
|
function EmptyState({
|
|
1032
1136
|
icon,
|
|
1033
1137
|
title,
|
|
@@ -1035,7 +1139,7 @@ function EmptyState({
|
|
|
1035
1139
|
actionLabel,
|
|
1036
1140
|
actionHref
|
|
1037
1141
|
}) {
|
|
1038
|
-
return /* @__PURE__ */
|
|
1142
|
+
return /* @__PURE__ */ jsxs9(
|
|
1039
1143
|
"div",
|
|
1040
1144
|
{
|
|
1041
1145
|
style: {
|
|
@@ -1050,7 +1154,7 @@ function EmptyState({
|
|
|
1050
1154
|
border: "1px dashed var(--admin-border)"
|
|
1051
1155
|
},
|
|
1052
1156
|
children: [
|
|
1053
|
-
icon && /* @__PURE__ */
|
|
1157
|
+
icon && /* @__PURE__ */ jsx9(
|
|
1054
1158
|
"div",
|
|
1055
1159
|
{
|
|
1056
1160
|
style: {
|
|
@@ -1061,7 +1165,7 @@ function EmptyState({
|
|
|
1061
1165
|
children: icon
|
|
1062
1166
|
}
|
|
1063
1167
|
),
|
|
1064
|
-
/* @__PURE__ */
|
|
1168
|
+
/* @__PURE__ */ jsx9(
|
|
1065
1169
|
"h3",
|
|
1066
1170
|
{
|
|
1067
1171
|
style: {
|
|
@@ -1073,7 +1177,7 @@ function EmptyState({
|
|
|
1073
1177
|
children: title
|
|
1074
1178
|
}
|
|
1075
1179
|
),
|
|
1076
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ jsx9(
|
|
1077
1181
|
"p",
|
|
1078
1182
|
{
|
|
1079
1183
|
style: {
|
|
@@ -1086,7 +1190,7 @@ function EmptyState({
|
|
|
1086
1190
|
children: description
|
|
1087
1191
|
}
|
|
1088
1192
|
),
|
|
1089
|
-
actionLabel && actionHref && /* @__PURE__ */
|
|
1193
|
+
actionLabel && actionHref && /* @__PURE__ */ jsx9(
|
|
1090
1194
|
"a",
|
|
1091
1195
|
{
|
|
1092
1196
|
href: actionHref,
|
|
@@ -1113,24 +1217,24 @@ function EmptyState({
|
|
|
1113
1217
|
|
|
1114
1218
|
// src/admin/components/OrionBlocksField.tsx
|
|
1115
1219
|
import { lazy, Suspense } from "react";
|
|
1116
|
-
import { jsx as
|
|
1220
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1117
1221
|
var OrionBlocksFieldImpl = lazy(async () => {
|
|
1118
1222
|
const mod = await import("../OrionBlocksFieldImpl-QX5GTMQZ.mjs");
|
|
1119
1223
|
return { default: mod.OrionBlocksFieldImpl };
|
|
1120
1224
|
});
|
|
1121
1225
|
function OrionBlocksField(props) {
|
|
1122
|
-
return /* @__PURE__ */
|
|
1226
|
+
return /* @__PURE__ */ jsx10(Suspense, { fallback: null, children: /* @__PURE__ */ jsx10(OrionBlocksFieldImpl, { ...props }) });
|
|
1123
1227
|
}
|
|
1124
1228
|
|
|
1125
1229
|
// src/admin/components/WelcomeHeader.tsx
|
|
1126
|
-
import { jsx as
|
|
1230
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1127
1231
|
function WelcomeHeader({
|
|
1128
1232
|
title,
|
|
1129
1233
|
description,
|
|
1130
1234
|
tooltip,
|
|
1131
1235
|
actions
|
|
1132
1236
|
}) {
|
|
1133
|
-
return /* @__PURE__ */
|
|
1237
|
+
return /* @__PURE__ */ jsxs10(
|
|
1134
1238
|
"div",
|
|
1135
1239
|
{
|
|
1136
1240
|
style: {
|
|
@@ -1142,8 +1246,8 @@ function WelcomeHeader({
|
|
|
1142
1246
|
marginBottom: 24
|
|
1143
1247
|
},
|
|
1144
1248
|
children: [
|
|
1145
|
-
/* @__PURE__ */
|
|
1146
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
1250
|
+
/* @__PURE__ */ jsxs10(
|
|
1147
1251
|
"h1",
|
|
1148
1252
|
{
|
|
1149
1253
|
style: {
|
|
@@ -1156,62 +1260,109 @@ function WelcomeHeader({
|
|
|
1156
1260
|
},
|
|
1157
1261
|
children: [
|
|
1158
1262
|
title,
|
|
1159
|
-
tooltip && /* @__PURE__ */
|
|
1263
|
+
tooltip && /* @__PURE__ */ jsx11(HelpTooltip, { content: tooltip, position: "right" })
|
|
1160
1264
|
]
|
|
1161
1265
|
}
|
|
1162
1266
|
),
|
|
1163
|
-
description && /* @__PURE__ */
|
|
1267
|
+
description && /* @__PURE__ */ jsx11("p", { style: { fontSize: 14, color: "var(--admin-text-muted)", margin: "6px 0 0" }, children: description })
|
|
1164
1268
|
] }),
|
|
1165
|
-
actions && /* @__PURE__ */
|
|
1269
|
+
actions && /* @__PURE__ */ jsx11("div", { style: { display: "flex", gap: 8 }, children: actions })
|
|
1166
1270
|
]
|
|
1167
1271
|
}
|
|
1168
1272
|
);
|
|
1169
1273
|
}
|
|
1170
1274
|
|
|
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
|
-
}
|
|
1275
|
+
// src/admin/components/studio/AdminStudioNav.tsx
|
|
1276
|
+
import { useMemo } from "react";
|
|
1277
|
+
import { usePathname } from "next/navigation";
|
|
1278
|
+
import { Logout, useAuth } from "@payloadcms/ui";
|
|
1185
1279
|
|
|
1186
|
-
// src/admin
|
|
1187
|
-
import {
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1280
|
+
// src/admin/components/studio/adminPathUtils.ts
|
|
1281
|
+
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1282
|
+
var DEFAULT_ADMIN_BASE_PATH = "/admin";
|
|
1283
|
+
var normalizePath = (value) => {
|
|
1284
|
+
if (!value || value === "/") return "/";
|
|
1285
|
+
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
1286
|
+
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
1287
|
+
return trimmed.length > 0 ? trimmed : "/";
|
|
1288
|
+
};
|
|
1289
|
+
var normalizeAdminBasePath = (value) => {
|
|
1290
|
+
const normalized = normalizePath(value);
|
|
1291
|
+
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH : normalized;
|
|
1292
|
+
};
|
|
1293
|
+
var detectAdminBasePath = (pathname, fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1294
|
+
const normalizedPathname = normalizePath(pathname);
|
|
1295
|
+
const normalizedFallback = normalizeAdminBasePath(fallback);
|
|
1296
|
+
const markers = [
|
|
1297
|
+
"/contact-form",
|
|
1298
|
+
"/collections/",
|
|
1299
|
+
"/globals/",
|
|
1300
|
+
"/forms",
|
|
1301
|
+
"/pages/",
|
|
1302
|
+
"/tools",
|
|
1303
|
+
"/media",
|
|
1304
|
+
"/logout",
|
|
1305
|
+
"/login"
|
|
1306
|
+
];
|
|
1307
|
+
for (const marker of markers) {
|
|
1308
|
+
const index = normalizedPathname.indexOf(marker);
|
|
1309
|
+
if (index > 0) {
|
|
1310
|
+
return normalizeAdminBasePath(normalizedPathname.slice(0, index));
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if (normalizedPathname === normalizedFallback || normalizedPathname.startsWith(`${normalizedFallback}/`)) {
|
|
1314
|
+
return normalizedFallback;
|
|
1315
|
+
}
|
|
1316
|
+
const segments = normalizedPathname.split("/").filter(Boolean);
|
|
1317
|
+
if (segments.length > 0) {
|
|
1318
|
+
return normalizeAdminBasePath(`/${segments[0]}`);
|
|
1319
|
+
}
|
|
1320
|
+
return normalizedFallback;
|
|
1321
|
+
};
|
|
1322
|
+
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
1323
|
+
var resolveAdminPath = (adminBasePath, targetPath) => {
|
|
1324
|
+
if (!targetPath) return adminBasePath;
|
|
1325
|
+
if (isAbsoluteExternalURL(targetPath)) return targetPath;
|
|
1326
|
+
const normalizedBasePath = normalizeAdminBasePath(adminBasePath);
|
|
1327
|
+
const normalizedTargetPath = normalizePath(targetPath);
|
|
1328
|
+
if (normalizedTargetPath === "/admin") {
|
|
1329
|
+
return normalizedBasePath;
|
|
1330
|
+
}
|
|
1331
|
+
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
1332
|
+
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
1333
|
+
}
|
|
1334
|
+
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
1335
|
+
return normalizedTargetPath;
|
|
1336
|
+
}
|
|
1337
|
+
if (normalizedTargetPath === "/") {
|
|
1338
|
+
return normalizedBasePath;
|
|
1339
|
+
}
|
|
1340
|
+
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
1341
|
+
};
|
|
1342
|
+
var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1343
|
+
const [adminBasePath, setAdminBasePath] = useState6(normalizeAdminBasePath(fallback));
|
|
1344
|
+
useEffect6(() => {
|
|
1345
|
+
const update = () => {
|
|
1346
|
+
setAdminBasePath(detectAdminBasePath(window.location.pathname, fallback));
|
|
1347
|
+
};
|
|
1348
|
+
update();
|
|
1349
|
+
window.addEventListener("popstate", update);
|
|
1350
|
+
return () => window.removeEventListener("popstate", update);
|
|
1351
|
+
}, [fallback]);
|
|
1352
|
+
return adminBasePath;
|
|
1353
|
+
};
|
|
1203
1354
|
|
|
1204
1355
|
// src/shared/studioSections.ts
|
|
1205
1356
|
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
1206
1357
|
var studioIcons = new Set(adminNavIcons);
|
|
1207
1358
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1208
|
-
var
|
|
1359
|
+
var isAbsoluteExternalURL2 = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
1209
1360
|
var normalizePathLikeValue = (value) => {
|
|
1210
1361
|
const trimmed = value.trim();
|
|
1211
1362
|
if (!trimmed) {
|
|
1212
1363
|
return "";
|
|
1213
1364
|
}
|
|
1214
|
-
if (
|
|
1365
|
+
if (isAbsoluteExternalURL2(trimmed)) {
|
|
1215
1366
|
return trimmed;
|
|
1216
1367
|
}
|
|
1217
1368
|
const withLeadingSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
@@ -1279,86 +1430,6 @@ var resolveStudioSections = (value) => {
|
|
|
1279
1430
|
return sections;
|
|
1280
1431
|
};
|
|
1281
1432
|
|
|
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
1433
|
// src/admin/components/studio/studioNavModel.ts
|
|
1363
1434
|
var getPropString = (props, key, fallback) => {
|
|
1364
1435
|
if (!props || typeof props !== "object") return fallback;
|
|
@@ -1432,7 +1503,7 @@ var buildStudioNavItems = (props, adminBasePath) => {
|
|
|
1432
1503
|
const resolvedGlobalsExtraMatchPrefixes = globalsExtraMatchPrefixes.map(
|
|
1433
1504
|
(prefix) => resolveAdminPath(adminBasePath, prefix)
|
|
1434
1505
|
);
|
|
1435
|
-
const
|
|
1506
|
+
const baseItemsBeforeTools = [
|
|
1436
1507
|
{
|
|
1437
1508
|
href: adminBasePath,
|
|
1438
1509
|
icon: "dashboard",
|
|
@@ -1473,15 +1544,15 @@ var buildStudioNavItems = (props, adminBasePath) => {
|
|
|
1473
1544
|
icon: "media",
|
|
1474
1545
|
label: "Media",
|
|
1475
1546
|
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
1547
|
}
|
|
1484
1548
|
];
|
|
1549
|
+
const adminToolsItem = {
|
|
1550
|
+
href: toolsPath,
|
|
1551
|
+
icon: "tools",
|
|
1552
|
+
label: "Admin Tools",
|
|
1553
|
+
matchPrefixes: [toolsPath, resolveAdminPath(adminBasePath, "/collections/users")],
|
|
1554
|
+
roles: ["admin"]
|
|
1555
|
+
};
|
|
1485
1556
|
const extensionItems = sections.map((section) => ({
|
|
1486
1557
|
href: resolveAdminPath(adminBasePath, section.href),
|
|
1487
1558
|
...section.icon ? { icon: section.icon } : {},
|
|
@@ -1489,7 +1560,7 @@ var buildStudioNavItems = (props, adminBasePath) => {
|
|
|
1489
1560
|
matchPrefixes: section.matchPrefixes.map((prefix) => resolveAdminPath(adminBasePath, prefix)),
|
|
1490
1561
|
roles: section.roles
|
|
1491
1562
|
}));
|
|
1492
|
-
return [...
|
|
1563
|
+
return [...baseItemsBeforeTools, ...extensionItems, adminToolsItem];
|
|
1493
1564
|
};
|
|
1494
1565
|
var isStudioShellRoute = (pathname, props, adminBasePath) => {
|
|
1495
1566
|
const globalsBasePath = getPropString(props, "globalsBasePath", "/globals");
|
|
@@ -1516,19 +1587,194 @@ var isStudioShellRoute = (pathname, props, adminBasePath) => {
|
|
|
1516
1587
|
return shellPrefixes.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`));
|
|
1517
1588
|
};
|
|
1518
1589
|
|
|
1519
|
-
// src/admin/components/studio/
|
|
1520
|
-
import { jsx as
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1590
|
+
// src/admin/components/studio/AdminStudioNav.tsx
|
|
1591
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1592
|
+
var iconSize2 = 18;
|
|
1593
|
+
function NavIcon({ sectionID }) {
|
|
1594
|
+
const props = {
|
|
1595
|
+
fill: "none",
|
|
1596
|
+
height: iconSize2,
|
|
1597
|
+
stroke: "currentColor",
|
|
1598
|
+
strokeLinecap: "round",
|
|
1599
|
+
strokeLinejoin: "round",
|
|
1600
|
+
strokeWidth: 2,
|
|
1601
|
+
viewBox: "0 0 24 24",
|
|
1602
|
+
width: iconSize2
|
|
1603
|
+
};
|
|
1604
|
+
switch (sectionID) {
|
|
1605
|
+
case "dashboard":
|
|
1606
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1607
|
+
/* @__PURE__ */ jsx12("rect", { x: "3", y: "3", width: "7", height: "9", rx: "1" }),
|
|
1608
|
+
/* @__PURE__ */ jsx12("rect", { x: "14", y: "3", width: "7", height: "5", rx: "1" }),
|
|
1609
|
+
/* @__PURE__ */ jsx12("rect", { x: "14", y: "12", width: "7", height: "9", rx: "1" }),
|
|
1610
|
+
/* @__PURE__ */ jsx12("rect", { x: "3", y: "16", width: "7", height: "5", rx: "1" })
|
|
1611
|
+
] });
|
|
1612
|
+
case "pages":
|
|
1613
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1614
|
+
/* @__PURE__ */ jsx12("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
|
|
1615
|
+
/* @__PURE__ */ jsx12("polyline", { points: "14 2 14 8 20 8" }),
|
|
1616
|
+
/* @__PURE__ */ jsx12("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
|
|
1617
|
+
/* @__PURE__ */ jsx12("line", { x1: "8", y1: "17", x2: "12", y2: "17" })
|
|
1618
|
+
] });
|
|
1619
|
+
case "forms":
|
|
1620
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1621
|
+
/* @__PURE__ */ jsx12("path", { d: "M9 3h6" }),
|
|
1622
|
+
/* @__PURE__ */ jsx12("path", { d: "M12 3v18" }),
|
|
1623
|
+
/* @__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" }),
|
|
1624
|
+
/* @__PURE__ */ jsx12("path", { d: "M7 11h10" }),
|
|
1625
|
+
/* @__PURE__ */ jsx12("path", { d: "M7 15h6" })
|
|
1626
|
+
] });
|
|
1627
|
+
case "globals":
|
|
1628
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1629
|
+
/* @__PURE__ */ jsx12("circle", { cx: "12", cy: "12", r: "3" }),
|
|
1630
|
+
/* @__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" })
|
|
1631
|
+
] });
|
|
1632
|
+
case "media":
|
|
1633
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1634
|
+
/* @__PURE__ */ jsx12("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
1635
|
+
/* @__PURE__ */ jsx12("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
1636
|
+
/* @__PURE__ */ jsx12("polyline", { points: "21 15 16 10 5 21" })
|
|
1637
|
+
] });
|
|
1638
|
+
case "analytics":
|
|
1639
|
+
return /* @__PURE__ */ jsxs11("svg", { ...props, children: [
|
|
1640
|
+
/* @__PURE__ */ jsx12("path", { d: "M4 19V5" }),
|
|
1641
|
+
/* @__PURE__ */ jsx12("path", { d: "M10 19V10" }),
|
|
1642
|
+
/* @__PURE__ */ jsx12("path", { d: "M16 19v-6" }),
|
|
1643
|
+
/* @__PURE__ */ jsx12("path", { d: "M22 19V3" })
|
|
1644
|
+
] });
|
|
1645
|
+
case "admin-tools":
|
|
1646
|
+
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" }) });
|
|
1647
|
+
default:
|
|
1648
|
+
return null;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
function AdminStudioNav(props) {
|
|
1652
|
+
const { user } = useAuth();
|
|
1653
|
+
const brandName = getPropString(props, "brandName", "Orion Studio");
|
|
1654
|
+
const logoUrl = getPropString(props, "logoUrl", "");
|
|
1655
|
+
const compact = getPropBoolean(props, "compact", false);
|
|
1656
|
+
const adminBasePath = useAdminBasePath();
|
|
1657
|
+
const pathname = usePathname() || "";
|
|
1658
|
+
const branding = useSiteBranding(brandName, logoUrl || void 0);
|
|
1659
|
+
const resolvedName = branding.siteName || brandName;
|
|
1660
|
+
const dashboardPath = adminBasePath;
|
|
1661
|
+
const userRole = readUserRole(user);
|
|
1662
|
+
const links = useMemo(() => buildStudioNavItems(props, adminBasePath), [adminBasePath, props]);
|
|
1663
|
+
if (isStudioShellRoute(pathname, props, adminBasePath)) {
|
|
1664
|
+
return null;
|
|
1665
|
+
}
|
|
1666
|
+
const linkStyle = (active) => ({
|
|
1667
|
+
alignItems: "center",
|
|
1668
|
+
background: active ? "var(--theme-elevation-100)" : "transparent",
|
|
1669
|
+
borderRadius: 10,
|
|
1670
|
+
color: "var(--theme-elevation-900)",
|
|
1671
|
+
display: "flex",
|
|
1672
|
+
fontSize: "0.95rem",
|
|
1673
|
+
fontWeight: active ? 800 : 650,
|
|
1674
|
+
justifyContent: compact ? "center" : "flex-start",
|
|
1675
|
+
minHeight: 40,
|
|
1676
|
+
padding: compact ? "0.6rem" : "0.6rem 0.75rem",
|
|
1677
|
+
textDecoration: "none"
|
|
1678
|
+
});
|
|
1679
|
+
return /* @__PURE__ */ jsxs11(
|
|
1680
|
+
"div",
|
|
1681
|
+
{
|
|
1682
|
+
style: {
|
|
1683
|
+
display: "flex",
|
|
1684
|
+
flexDirection: "column",
|
|
1685
|
+
gap: "0.85rem",
|
|
1686
|
+
height: "100%",
|
|
1687
|
+
padding: compact ? "0.8rem 0.5rem" : "1rem 0.85rem"
|
|
1688
|
+
},
|
|
1689
|
+
children: [
|
|
1690
|
+
/* @__PURE__ */ jsxs11("div", { className: "admin-studio-brand", style: { padding: compact ? "0" : "0 0.35rem 0 2.4rem" }, children: [
|
|
1691
|
+
branding.logoUrl ? /* @__PURE__ */ jsx12(
|
|
1692
|
+
"div",
|
|
1693
|
+
{
|
|
1694
|
+
style: {
|
|
1695
|
+
borderRadius: 8,
|
|
1696
|
+
height: compact ? 34 : 40,
|
|
1697
|
+
marginBottom: compact ? 0 : "0.35rem",
|
|
1698
|
+
overflow: "hidden",
|
|
1699
|
+
width: compact ? 34 : 40
|
|
1700
|
+
},
|
|
1701
|
+
children: /* @__PURE__ */ jsx12("img", { alt: `${resolvedName} logo`, src: branding.logoUrl, style: { height: "100%", objectFit: "cover", width: "100%" } })
|
|
1702
|
+
}
|
|
1703
|
+
) : null,
|
|
1704
|
+
/* @__PURE__ */ jsx12(
|
|
1705
|
+
"div",
|
|
1706
|
+
{
|
|
1707
|
+
style: {
|
|
1708
|
+
fontSize: compact ? "0.95rem" : "1.05rem",
|
|
1709
|
+
fontWeight: 900,
|
|
1710
|
+
letterSpacing: "-0.01em",
|
|
1711
|
+
overflow: "hidden",
|
|
1712
|
+
textOverflow: "ellipsis",
|
|
1713
|
+
whiteSpace: "nowrap"
|
|
1714
|
+
},
|
|
1715
|
+
title: resolvedName,
|
|
1716
|
+
children: compact ? resolvedName.slice(0, 1).toUpperCase() : resolvedName
|
|
1717
|
+
}
|
|
1718
|
+
),
|
|
1719
|
+
!compact ? /* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.85rem" }, children: "Studio" }) : null
|
|
1720
|
+
] }),
|
|
1721
|
+
/* @__PURE__ */ jsx12("nav", { style: { display: "grid", gap: "0.25rem" }, children: links.filter((link) => !link.roles || userRole && link.roles.includes(userRole)).map((link) => {
|
|
1722
|
+
const active = link.href === dashboardPath ? pathname === dashboardPath : link.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
1723
|
+
return /* @__PURE__ */ jsx12("a", { href: link.href, style: linkStyle(active), title: link.label, children: (() => {
|
|
1724
|
+
const icon = /* @__PURE__ */ jsx12(
|
|
1725
|
+
NavIcon,
|
|
1726
|
+
{
|
|
1727
|
+
sectionID: link.icon === "tools" ? "admin-tools" : link.icon || ""
|
|
1728
|
+
}
|
|
1729
|
+
);
|
|
1730
|
+
if (compact) {
|
|
1731
|
+
return icon || link.label.slice(0, 1);
|
|
1732
|
+
}
|
|
1733
|
+
return /* @__PURE__ */ jsxs11("span", { style: { alignItems: "center", display: "inline-flex", gap: "0.6rem" }, children: [
|
|
1734
|
+
icon,
|
|
1735
|
+
/* @__PURE__ */ jsx12("span", { children: link.label })
|
|
1736
|
+
] });
|
|
1737
|
+
})() }, link.href);
|
|
1738
|
+
}) }),
|
|
1739
|
+
/* @__PURE__ */ jsx12("div", { style: { flex: 1 } }),
|
|
1740
|
+
/* @__PURE__ */ jsxs11(
|
|
1741
|
+
"div",
|
|
1742
|
+
{
|
|
1743
|
+
style: {
|
|
1744
|
+
borderTop: "1px solid var(--theme-elevation-150)",
|
|
1745
|
+
paddingTop: "0.85rem",
|
|
1746
|
+
textAlign: compact ? "center" : "left"
|
|
1747
|
+
},
|
|
1748
|
+
children: [
|
|
1749
|
+
!compact ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
1750
|
+
/* @__PURE__ */ jsx12("div", { style: { color: "var(--theme-elevation-700)", fontSize: "0.85rem" }, children: "Signed in as" }),
|
|
1751
|
+
/* @__PURE__ */ jsx12("div", { style: { fontWeight: 800, marginBottom: "0.55rem" }, children: typeof user?.email === "string" ? user.email : "User" })
|
|
1752
|
+
] }) : null,
|
|
1753
|
+
/* @__PURE__ */ jsx12(Logout, {})
|
|
1754
|
+
]
|
|
1755
|
+
}
|
|
1756
|
+
)
|
|
1757
|
+
]
|
|
1758
|
+
}
|
|
1759
|
+
);
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
1763
|
+
import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo2 } from "react";
|
|
1764
|
+
import { usePathname as usePathname2, useRouter } from "next/navigation";
|
|
1765
|
+
import { useAuth as useAuth2 } from "@payloadcms/ui";
|
|
1766
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1767
|
+
function StudioSectionLayout({ children, navProps }) {
|
|
1768
|
+
const { user } = useAuth2();
|
|
1769
|
+
const pathname = usePathname2() || "";
|
|
1770
|
+
const router = useRouter();
|
|
1771
|
+
const adminBasePath = useAdminBasePath();
|
|
1772
|
+
const defaultBrandName = getPropString(navProps, "brandName", "Orion Studio");
|
|
1773
|
+
const defaultLogoUrl = getPropString(navProps, "logoUrl", "");
|
|
1774
|
+
const navItems = useMemo2(
|
|
1775
|
+
() => buildStudioNavItems(navProps, adminBasePath),
|
|
1776
|
+
[adminBasePath, navProps]
|
|
1777
|
+
);
|
|
1532
1778
|
const branding = useSiteBranding(defaultBrandName, defaultLogoUrl || void 0);
|
|
1533
1779
|
useLayoutEffect2(() => {
|
|
1534
1780
|
document.body.classList.add("orion-studio-shell-active");
|
|
@@ -1536,7 +1782,7 @@ function StudioSectionLayout({ children, navProps }) {
|
|
|
1536
1782
|
document.body.classList.remove("orion-studio-shell-active");
|
|
1537
1783
|
};
|
|
1538
1784
|
}, []);
|
|
1539
|
-
const logout =
|
|
1785
|
+
const logout = useMemo2(
|
|
1540
1786
|
() => async () => {
|
|
1541
1787
|
await fetch("/api/users/logout", {
|
|
1542
1788
|
credentials: "include",
|
|
@@ -1563,8 +1809,677 @@ function StudioSectionLayout({ children, navProps }) {
|
|
|
1563
1809
|
);
|
|
1564
1810
|
}
|
|
1565
1811
|
|
|
1566
|
-
// src/admin/components/
|
|
1812
|
+
// src/admin-app/components/AdminBreadcrumbs.tsx
|
|
1567
1813
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1814
|
+
function AdminBreadcrumbs({ items }) {
|
|
1815
|
+
return /* @__PURE__ */ jsx14("nav", { "aria-label": "Breadcrumb", className: "orion-admin-breadcrumbs", children: items.map((item, index) => {
|
|
1816
|
+
const isLast = index === items.length - 1;
|
|
1817
|
+
return /* @__PURE__ */ jsxs12("span", { children: [
|
|
1818
|
+
item.href && !isLast ? /* @__PURE__ */ jsx14("a", { href: item.href, children: item.label }) : /* @__PURE__ */ jsx14("span", { children: item.label }),
|
|
1819
|
+
!isLast ? /* @__PURE__ */ jsx14("span", { className: "orion-admin-breadcrumb-sep", children: "/" }) : null
|
|
1820
|
+
] }, `${item.label}-${index}`);
|
|
1821
|
+
}) });
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
// src/admin-app/components/AdminPage.tsx
|
|
1825
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1826
|
+
function AdminPage({ title, description, breadcrumbs, actions, children }) {
|
|
1827
|
+
return /* @__PURE__ */ jsxs13("div", { className: "orion-admin-page", children: [
|
|
1828
|
+
/* @__PURE__ */ jsxs13("div", { className: "orion-admin-page-header", children: [
|
|
1829
|
+
/* @__PURE__ */ jsx15(AdminBreadcrumbs, { items: breadcrumbs }),
|
|
1830
|
+
/* @__PURE__ */ jsxs13("div", { className: "orion-admin-page-title-row", children: [
|
|
1831
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
1832
|
+
/* @__PURE__ */ jsx15("h1", { children: title }),
|
|
1833
|
+
description ? /* @__PURE__ */ jsx15("p", { children: description }) : null
|
|
1834
|
+
] }),
|
|
1835
|
+
actions ? /* @__PURE__ */ jsx15("div", { className: "orion-admin-page-actions", children: actions }) : null
|
|
1836
|
+
] })
|
|
1837
|
+
] }),
|
|
1838
|
+
/* @__PURE__ */ jsx15("div", { className: "orion-admin-page-content", children })
|
|
1839
|
+
] });
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
// src/admin/components/studio/AdminStudioDashboardClient.tsx
|
|
1843
|
+
import { startTransition, useEffect as useEffect7, useMemo as useMemo3, useState as useState7 } from "react";
|
|
1844
|
+
import Link from "next/link";
|
|
1845
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1846
|
+
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
1847
|
+
var isRole = (value) => value === "admin" || value === "editor" || value === "client";
|
|
1848
|
+
var canReviewForms = (role) => role === "admin" || role === "editor";
|
|
1849
|
+
var canCreatePages = (role) => role === "admin" || role === "editor";
|
|
1850
|
+
var canAccess = (role, roles) => {
|
|
1851
|
+
if (!roles || roles.length === 0) {
|
|
1852
|
+
return true;
|
|
1853
|
+
}
|
|
1854
|
+
if (!role) {
|
|
1855
|
+
return false;
|
|
1856
|
+
}
|
|
1857
|
+
return roles.includes(role);
|
|
1858
|
+
};
|
|
1859
|
+
var asText = (value, fallback) => typeof value === "string" && value.trim().length > 0 ? value.trim() : fallback;
|
|
1860
|
+
var asID = (value) => {
|
|
1861
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
1862
|
+
return "";
|
|
1863
|
+
};
|
|
1864
|
+
var toTimestamp = (value) => {
|
|
1865
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
1866
|
+
return Number.NaN;
|
|
1867
|
+
}
|
|
1868
|
+
const timestamp = Date.parse(value);
|
|
1869
|
+
return Number.isFinite(timestamp) ? timestamp : Number.NaN;
|
|
1870
|
+
};
|
|
1871
|
+
var isRecent = (value) => {
|
|
1872
|
+
const timestamp = toTimestamp(value);
|
|
1873
|
+
return Number.isFinite(timestamp) && Date.now() - timestamp <= SEVEN_DAYS_MS;
|
|
1874
|
+
};
|
|
1875
|
+
var formatDateTime = (value) => {
|
|
1876
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
1877
|
+
return "Unknown time";
|
|
1878
|
+
}
|
|
1879
|
+
const date = new Date(value);
|
|
1880
|
+
if (Number.isNaN(date.getTime())) {
|
|
1881
|
+
return value;
|
|
1882
|
+
}
|
|
1883
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1884
|
+
dateStyle: "medium",
|
|
1885
|
+
timeStyle: "short"
|
|
1886
|
+
}).format(date);
|
|
1887
|
+
};
|
|
1888
|
+
var formatRelativeTime2 = (timestamp) => {
|
|
1889
|
+
if (!Number.isFinite(timestamp)) {
|
|
1890
|
+
return "Unknown time";
|
|
1891
|
+
}
|
|
1892
|
+
const diffMs = timestamp - Date.now();
|
|
1893
|
+
const diffMinutes = Math.round(diffMs / (60 * 1e3));
|
|
1894
|
+
const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
1895
|
+
if (Math.abs(diffMinutes) < 60) {
|
|
1896
|
+
return rtf.format(diffMinutes, "minute");
|
|
1897
|
+
}
|
|
1898
|
+
const diffHours = Math.round(diffMinutes / 60);
|
|
1899
|
+
if (Math.abs(diffHours) < 24) {
|
|
1900
|
+
return rtf.format(diffHours, "hour");
|
|
1901
|
+
}
|
|
1902
|
+
const diffDays = Math.round(diffHours / 24);
|
|
1903
|
+
return rtf.format(diffDays, "day");
|
|
1904
|
+
};
|
|
1905
|
+
var readSubmissionIdentity = (value) => {
|
|
1906
|
+
if (!value || typeof value !== "object") {
|
|
1907
|
+
return "New submission";
|
|
1908
|
+
}
|
|
1909
|
+
const data = value;
|
|
1910
|
+
const firstName = typeof data.firstName === "string" ? data.firstName.trim() : "";
|
|
1911
|
+
const lastName = typeof data.lastName === "string" ? data.lastName.trim() : "";
|
|
1912
|
+
const name = typeof data.name === "string" ? data.name.trim() : "";
|
|
1913
|
+
const email = typeof data.email === "string" ? data.email.trim() : typeof data.contactEmail === "string" ? data.contactEmail.trim() : "";
|
|
1914
|
+
const fullName = [firstName, lastName].filter(Boolean).join(" ").trim();
|
|
1915
|
+
return fullName || name || email || "New submission";
|
|
1916
|
+
};
|
|
1917
|
+
var getFormID = (value) => {
|
|
1918
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
1919
|
+
if (value && typeof value === "object") {
|
|
1920
|
+
const nestedID = value.id;
|
|
1921
|
+
if (typeof nestedID === "string" || typeof nestedID === "number") return String(nestedID);
|
|
1922
|
+
}
|
|
1923
|
+
return "";
|
|
1924
|
+
};
|
|
1925
|
+
var getFormTitle = (value) => {
|
|
1926
|
+
if (!value || typeof value !== "object") {
|
|
1927
|
+
return "";
|
|
1928
|
+
}
|
|
1929
|
+
const title = value.title;
|
|
1930
|
+
if (typeof title === "string" && title.trim().length > 0) {
|
|
1931
|
+
return title.trim();
|
|
1932
|
+
}
|
|
1933
|
+
const slug = value.slug;
|
|
1934
|
+
return typeof slug === "string" && slug.trim().length > 0 ? slug.trim() : "";
|
|
1935
|
+
};
|
|
1936
|
+
var buildSearchParams = (params) => new URLSearchParams(
|
|
1937
|
+
Object.entries(params).filter(([, value]) => typeof value === "string" && value.length > 0)
|
|
1938
|
+
).toString();
|
|
1939
|
+
async function loadCollection(path) {
|
|
1940
|
+
const response = await fetch(path, {
|
|
1941
|
+
cache: "no-store",
|
|
1942
|
+
credentials: "include"
|
|
1943
|
+
});
|
|
1944
|
+
if (!response.ok) {
|
|
1945
|
+
const body = await response.text();
|
|
1946
|
+
throw new Error(body || `Request failed: ${response.status}`);
|
|
1947
|
+
}
|
|
1948
|
+
return await response.json();
|
|
1949
|
+
}
|
|
1950
|
+
async function loadPages(collectionSlug) {
|
|
1951
|
+
const params = buildSearchParams({
|
|
1952
|
+
depth: "0",
|
|
1953
|
+
draft: "true",
|
|
1954
|
+
limit: "200",
|
|
1955
|
+
sort: "-updatedAt"
|
|
1956
|
+
});
|
|
1957
|
+
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
1958
|
+
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
1959
|
+
return {
|
|
1960
|
+
draftCount: docs.filter((doc) => doc._status === "draft").length,
|
|
1961
|
+
recent: docs.slice(0, 8),
|
|
1962
|
+
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
1963
|
+
updatedThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
1964
|
+
};
|
|
1965
|
+
}
|
|
1966
|
+
async function loadForms(formsCollectionSlug, submissionsCollectionSlug) {
|
|
1967
|
+
const [formsResult, submissionsResult] = await Promise.all([
|
|
1968
|
+
loadCollection(
|
|
1969
|
+
`/api/${formsCollectionSlug}?${buildSearchParams({
|
|
1970
|
+
depth: "0",
|
|
1971
|
+
draft: "true",
|
|
1972
|
+
limit: "80",
|
|
1973
|
+
sort: "-updatedAt"
|
|
1974
|
+
})}`
|
|
1975
|
+
),
|
|
1976
|
+
loadCollection(
|
|
1977
|
+
`/api/${submissionsCollectionSlug}?${buildSearchParams({
|
|
1978
|
+
depth: "1",
|
|
1979
|
+
limit: "40",
|
|
1980
|
+
sort: "-submittedAt"
|
|
1981
|
+
})}`
|
|
1982
|
+
)
|
|
1983
|
+
]);
|
|
1984
|
+
const forms = Array.isArray(formsResult.docs) ? formsResult.docs : [];
|
|
1985
|
+
const recentSubmissions = Array.isArray(submissionsResult.docs) ? submissionsResult.docs : [];
|
|
1986
|
+
const submissionsByForm = /* @__PURE__ */ new Map();
|
|
1987
|
+
for (const submission of recentSubmissions) {
|
|
1988
|
+
const formID = getFormID(submission.form);
|
|
1989
|
+
if (!formID) continue;
|
|
1990
|
+
submissionsByForm.set(formID, (submissionsByForm.get(formID) || 0) + 1);
|
|
1991
|
+
}
|
|
1992
|
+
let busiestFormTitle = null;
|
|
1993
|
+
let busiestFormCount = 0;
|
|
1994
|
+
for (const form of forms) {
|
|
1995
|
+
const formID = asID(form.id);
|
|
1996
|
+
if (!formID) continue;
|
|
1997
|
+
const submissionCount = submissionsByForm.get(formID) || 0;
|
|
1998
|
+
if (submissionCount > busiestFormCount) {
|
|
1999
|
+
busiestFormCount = submissionCount;
|
|
2000
|
+
busiestFormTitle = asText(form.title, "Untitled form");
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
return {
|
|
2004
|
+
busiestFormTitle,
|
|
2005
|
+
forms,
|
|
2006
|
+
recentSubmissions,
|
|
2007
|
+
submissionsThisWeek: recentSubmissions.filter((submission) => isRecent(submission.submittedAt)).length,
|
|
2008
|
+
totalForms: typeof formsResult.totalDocs === "number" ? formsResult.totalDocs : forms.length
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
2011
|
+
async function loadMedia(collectionSlug) {
|
|
2012
|
+
const params = buildSearchParams({
|
|
2013
|
+
depth: "0",
|
|
2014
|
+
limit: "24",
|
|
2015
|
+
sort: "-updatedAt"
|
|
2016
|
+
});
|
|
2017
|
+
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
2018
|
+
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
2019
|
+
return {
|
|
2020
|
+
recent: docs.slice(0, 8),
|
|
2021
|
+
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
2022
|
+
uploadsThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
var loadingState = {
|
|
2026
|
+
forms: null,
|
|
2027
|
+
media: { status: "loading" },
|
|
2028
|
+
pages: { status: "loading" }
|
|
2029
|
+
};
|
|
2030
|
+
function ModuleStatus({ message }) {
|
|
2031
|
+
return /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-inline-note", children: message });
|
|
2032
|
+
}
|
|
2033
|
+
function EmptyState2({
|
|
2034
|
+
body,
|
|
2035
|
+
title
|
|
2036
|
+
}) {
|
|
2037
|
+
return /* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-empty-state", children: [
|
|
2038
|
+
/* @__PURE__ */ jsx16("strong", { children: title }),
|
|
2039
|
+
/* @__PURE__ */ jsx16("span", { children: body })
|
|
2040
|
+
] });
|
|
2041
|
+
}
|
|
2042
|
+
function SnapshotMetric({ card }) {
|
|
2043
|
+
return /* @__PURE__ */ jsxs14("article", { className: "orion-dashboard-snapshot-card", children: [
|
|
2044
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-snapshot-kicker", children: card.kicker }),
|
|
2045
|
+
/* @__PURE__ */ jsx16("strong", { children: card.value }),
|
|
2046
|
+
/* @__PURE__ */ jsx16("p", { children: card.detail })
|
|
2047
|
+
] });
|
|
2048
|
+
}
|
|
2049
|
+
function AdminStudioDashboardClient({
|
|
2050
|
+
formSubmissionsCollectionSlug,
|
|
2051
|
+
formsCollectionSlug,
|
|
2052
|
+
formsEnabled,
|
|
2053
|
+
formsPath,
|
|
2054
|
+
globalsBasePath,
|
|
2055
|
+
mediaCollectionSlug,
|
|
2056
|
+
mediaPath,
|
|
2057
|
+
pagesCollectionSlug,
|
|
2058
|
+
pagesPath,
|
|
2059
|
+
sectionLinks,
|
|
2060
|
+
toolsPath,
|
|
2061
|
+
userRole,
|
|
2062
|
+
children
|
|
2063
|
+
}) {
|
|
2064
|
+
const role = isRole(userRole) ? userRole : void 0;
|
|
2065
|
+
const [state, setState] = useState7(
|
|
2066
|
+
() => formsEnabled && canReviewForms(role) ? {
|
|
2067
|
+
forms: { status: "loading" },
|
|
2068
|
+
media: { status: "loading" },
|
|
2069
|
+
pages: { status: "loading" }
|
|
2070
|
+
} : loadingState
|
|
2071
|
+
);
|
|
2072
|
+
useEffect7(() => {
|
|
2073
|
+
let cancelled = false;
|
|
2074
|
+
const run = async () => {
|
|
2075
|
+
const includeForms = formsEnabled && canReviewForms(role);
|
|
2076
|
+
startTransition(() => {
|
|
2077
|
+
setState({
|
|
2078
|
+
forms: includeForms ? { status: "loading" } : null,
|
|
2079
|
+
media: { status: "loading" },
|
|
2080
|
+
pages: { status: "loading" }
|
|
2081
|
+
});
|
|
2082
|
+
});
|
|
2083
|
+
const [pagesResult, formsResult, mediaResult] = await Promise.allSettled([
|
|
2084
|
+
loadPages(pagesCollectionSlug),
|
|
2085
|
+
includeForms ? loadForms(formsCollectionSlug, formSubmissionsCollectionSlug) : Promise.resolve(null),
|
|
2086
|
+
loadMedia(mediaCollectionSlug)
|
|
2087
|
+
]);
|
|
2088
|
+
if (cancelled) return;
|
|
2089
|
+
startTransition(() => {
|
|
2090
|
+
setState({
|
|
2091
|
+
forms: includeForms && formsResult.status === "rejected" ? {
|
|
2092
|
+
error: formsResult.reason instanceof Error ? formsResult.reason.message : "Unable to load form activity.",
|
|
2093
|
+
status: "error"
|
|
2094
|
+
} : includeForms && formsResult.status === "fulfilled" && formsResult.value ? {
|
|
2095
|
+
data: formsResult.value,
|
|
2096
|
+
status: "success"
|
|
2097
|
+
} : null,
|
|
2098
|
+
media: mediaResult.status === "rejected" ? {
|
|
2099
|
+
error: mediaResult.reason instanceof Error ? mediaResult.reason.message : "Unable to load media activity.",
|
|
2100
|
+
status: "error"
|
|
2101
|
+
} : {
|
|
2102
|
+
data: mediaResult.value,
|
|
2103
|
+
status: "success"
|
|
2104
|
+
},
|
|
2105
|
+
pages: pagesResult.status === "rejected" ? {
|
|
2106
|
+
error: pagesResult.reason instanceof Error ? pagesResult.reason.message : "Unable to load page activity.",
|
|
2107
|
+
status: "error"
|
|
2108
|
+
} : {
|
|
2109
|
+
data: pagesResult.value,
|
|
2110
|
+
status: "success"
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
});
|
|
2114
|
+
};
|
|
2115
|
+
void run();
|
|
2116
|
+
return () => {
|
|
2117
|
+
cancelled = true;
|
|
2118
|
+
};
|
|
2119
|
+
}, [
|
|
2120
|
+
formSubmissionsCollectionSlug,
|
|
2121
|
+
formsCollectionSlug,
|
|
2122
|
+
formsEnabled,
|
|
2123
|
+
mediaCollectionSlug,
|
|
2124
|
+
pagesCollectionSlug,
|
|
2125
|
+
role
|
|
2126
|
+
]);
|
|
2127
|
+
const visibleWorkspaceLinks = useMemo3(
|
|
2128
|
+
() => sectionLinks.filter((section) => canAccess(role, section.roles)),
|
|
2129
|
+
[role, sectionLinks]
|
|
2130
|
+
);
|
|
2131
|
+
const activityItems = useMemo3(() => {
|
|
2132
|
+
const items = [];
|
|
2133
|
+
if (state.pages.status === "success") {
|
|
2134
|
+
for (const doc of state.pages.data.recent) {
|
|
2135
|
+
const id = asID(doc.id);
|
|
2136
|
+
if (!id) continue;
|
|
2137
|
+
const timestamp = toTimestamp(doc.updatedAt);
|
|
2138
|
+
items.push({
|
|
2139
|
+
href: `${pagesPath}/${id}`,
|
|
2140
|
+
id: `page-${id}`,
|
|
2141
|
+
kind: "page",
|
|
2142
|
+
label: typeof doc._status === "string" ? doc._status : "page",
|
|
2143
|
+
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
2144
|
+
timestamp,
|
|
2145
|
+
title: asText(doc.title, "Untitled page")
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
if (state.forms?.status === "success") {
|
|
2150
|
+
for (const submission of state.forms.data.recentSubmissions) {
|
|
2151
|
+
const id = asID(submission.id);
|
|
2152
|
+
const formID = getFormID(submission.form);
|
|
2153
|
+
if (!id || !formID) continue;
|
|
2154
|
+
const timestamp = toTimestamp(submission.submittedAt);
|
|
2155
|
+
const formTitle = getFormTitle(submission.form) || "Form response";
|
|
2156
|
+
items.push({
|
|
2157
|
+
href: `${formsPath}?form=${encodeURIComponent(formID)}`,
|
|
2158
|
+
id: `submission-${id}`,
|
|
2159
|
+
kind: "submission",
|
|
2160
|
+
label: formTitle,
|
|
2161
|
+
meta: Number.isFinite(timestamp) ? `${readSubmissionIdentity(submission.data)} \xB7 ${formatDateTime(submission.submittedAt)}` : readSubmissionIdentity(submission.data),
|
|
2162
|
+
timestamp,
|
|
2163
|
+
title: "New submission"
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
if (state.media.status === "success") {
|
|
2168
|
+
for (const doc of state.media.data.recent) {
|
|
2169
|
+
const id = asID(doc.id);
|
|
2170
|
+
if (!id) continue;
|
|
2171
|
+
const timestamp = toTimestamp(doc.updatedAt);
|
|
2172
|
+
items.push({
|
|
2173
|
+
href: `${mediaPath}/${id}`,
|
|
2174
|
+
id: `media-${id}`,
|
|
2175
|
+
kind: "media",
|
|
2176
|
+
label: asText(doc.mimeType, "Media asset"),
|
|
2177
|
+
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
2178
|
+
timestamp,
|
|
2179
|
+
title: asText(doc.filename, "Untitled asset")
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
return items.filter((item) => Number.isFinite(item.timestamp)).sort((a, b) => b.timestamp - a.timestamp).slice(0, 10);
|
|
2184
|
+
}, [formsPath, mediaPath, pagesPath, state.forms, state.media, state.pages]);
|
|
2185
|
+
const attentionItems = useMemo3(() => {
|
|
2186
|
+
if (role === "client") {
|
|
2187
|
+
const items2 = [];
|
|
2188
|
+
if (state.pages.status === "success" && state.pages.data.updatedThisWeek > 0) {
|
|
2189
|
+
items2.push({
|
|
2190
|
+
href: pagesPath,
|
|
2191
|
+
id: "pages-updated",
|
|
2192
|
+
label: `${state.pages.data.updatedThisWeek} page${state.pages.data.updatedThisWeek === 1 ? "" : "s"} changed in the last 7 days.`
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
if (state.media.status === "success" && state.media.data.uploadsThisWeek > 0) {
|
|
2196
|
+
items2.push({
|
|
2197
|
+
href: mediaPath,
|
|
2198
|
+
id: "media-updated",
|
|
2199
|
+
label: `${state.media.data.uploadsThisWeek} new media asset${state.media.data.uploadsThisWeek === 1 ? "" : "s"} landed this week.`
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2202
|
+
return items2;
|
|
2203
|
+
}
|
|
2204
|
+
const items = [];
|
|
2205
|
+
if (state.pages.status === "success" && state.pages.data.draftCount > 0) {
|
|
2206
|
+
items.push({
|
|
2207
|
+
href: pagesPath,
|
|
2208
|
+
id: "draft-pages",
|
|
2209
|
+
label: `${state.pages.data.draftCount} page${state.pages.data.draftCount === 1 ? "" : "s"} still need publishing review.`,
|
|
2210
|
+
tone: "accent"
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2213
|
+
if (state.forms?.status === "success" && state.forms.data.submissionsThisWeek > 0) {
|
|
2214
|
+
items.push({
|
|
2215
|
+
href: formsPath,
|
|
2216
|
+
id: "recent-submissions",
|
|
2217
|
+
label: `${state.forms.data.submissionsThisWeek} form submission${state.forms.data.submissionsThisWeek === 1 ? "" : "s"} arrived in the last 7 days.`,
|
|
2218
|
+
tone: "accent"
|
|
2219
|
+
});
|
|
2220
|
+
}
|
|
2221
|
+
if (state.media.status === "success" && state.media.data.total === 0) {
|
|
2222
|
+
items.push({
|
|
2223
|
+
href: mediaPath,
|
|
2224
|
+
id: "empty-media",
|
|
2225
|
+
label: "The media library is still empty. Add brand assets before content expands."
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2228
|
+
if (state.pages.status === "error") {
|
|
2229
|
+
items.push({
|
|
2230
|
+
href: pagesPath,
|
|
2231
|
+
id: "pages-error",
|
|
2232
|
+
label: "Page activity could not be loaded for the dashboard.",
|
|
2233
|
+
tone: "muted"
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
if (state.forms?.status === "error") {
|
|
2237
|
+
items.push({
|
|
2238
|
+
href: formsPath,
|
|
2239
|
+
id: "forms-error",
|
|
2240
|
+
label: "Form activity could not be loaded for the dashboard.",
|
|
2241
|
+
tone: "muted"
|
|
2242
|
+
});
|
|
2243
|
+
}
|
|
2244
|
+
if (state.media.status === "error") {
|
|
2245
|
+
items.push({
|
|
2246
|
+
href: mediaPath,
|
|
2247
|
+
id: "media-error",
|
|
2248
|
+
label: "Media activity could not be loaded for the dashboard.",
|
|
2249
|
+
tone: "muted"
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
return items;
|
|
2253
|
+
}, [formsPath, mediaPath, pagesPath, role, state.forms, state.media, state.pages]);
|
|
2254
|
+
const snapshotCards = useMemo3(() => {
|
|
2255
|
+
const cards = [];
|
|
2256
|
+
if (state.pages.status === "success") {
|
|
2257
|
+
cards.push(
|
|
2258
|
+
role === "client" ? {
|
|
2259
|
+
detail: `${state.pages.data.updatedThisWeek} updated this week`,
|
|
2260
|
+
kicker: "Pages",
|
|
2261
|
+
value: `${state.pages.data.total}`
|
|
2262
|
+
} : {
|
|
2263
|
+
detail: `${state.pages.data.draftCount} draft${state.pages.data.draftCount === 1 ? "" : "s"} waiting`,
|
|
2264
|
+
kicker: "Pages",
|
|
2265
|
+
value: `${state.pages.data.total}`
|
|
2266
|
+
}
|
|
2267
|
+
);
|
|
2268
|
+
}
|
|
2269
|
+
if (state.forms?.status === "success") {
|
|
2270
|
+
cards.push({
|
|
2271
|
+
detail: state.forms.data.busiestFormTitle ? `Most active: ${state.forms.data.busiestFormTitle}` : "Waiting on the first submission",
|
|
2272
|
+
kicker: "Forms",
|
|
2273
|
+
value: `${state.forms.data.submissionsThisWeek}`
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2276
|
+
if (state.media.status === "success") {
|
|
2277
|
+
cards.push({
|
|
2278
|
+
detail: `${state.media.data.uploadsThisWeek} uploaded this week`,
|
|
2279
|
+
kicker: "Media",
|
|
2280
|
+
value: `${state.media.data.total}`
|
|
2281
|
+
});
|
|
2282
|
+
}
|
|
2283
|
+
cards.push({
|
|
2284
|
+
detail: `${visibleWorkspaceLinks.length} section${visibleWorkspaceLinks.length === 1 ? "" : "s"} available`,
|
|
2285
|
+
kicker: "Workspace",
|
|
2286
|
+
value: role ? role.toUpperCase() : "CMS"
|
|
2287
|
+
});
|
|
2288
|
+
return cards.slice(0, 4);
|
|
2289
|
+
}, [role, state.forms, state.media, state.pages, visibleWorkspaceLinks.length]);
|
|
2290
|
+
const primaryActions = useMemo3(() => {
|
|
2291
|
+
const actions = [];
|
|
2292
|
+
if (canCreatePages(role)) {
|
|
2293
|
+
actions.push({
|
|
2294
|
+
description: "Create or revise content in the visual builder.",
|
|
2295
|
+
href: `${pagesPath}/new`,
|
|
2296
|
+
label: "New Page"
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2299
|
+
actions.push({
|
|
2300
|
+
description: "Review live pages and recent edits.",
|
|
2301
|
+
href: pagesPath,
|
|
2302
|
+
label: "Open Pages",
|
|
2303
|
+
tone: "ghost"
|
|
2304
|
+
});
|
|
2305
|
+
if (formsEnabled && canReviewForms(role)) {
|
|
2306
|
+
actions.push({
|
|
2307
|
+
description: "Check submissions and form performance.",
|
|
2308
|
+
href: formsPath,
|
|
2309
|
+
label: "Review Forms",
|
|
2310
|
+
tone: "soft"
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
actions.push({
|
|
2314
|
+
description: "Update site settings, navigation, and footer content.",
|
|
2315
|
+
href: globalsBasePath,
|
|
2316
|
+
label: "Open Globals",
|
|
2317
|
+
tone: "ghost"
|
|
2318
|
+
});
|
|
2319
|
+
actions.push({
|
|
2320
|
+
description: "Upload or organize brand and campaign assets.",
|
|
2321
|
+
href: mediaPath,
|
|
2322
|
+
label: "Manage Media",
|
|
2323
|
+
tone: "ghost"
|
|
2324
|
+
});
|
|
2325
|
+
if (role === "admin") {
|
|
2326
|
+
actions.push({
|
|
2327
|
+
description: "Manage users, roles, and fallback tools.",
|
|
2328
|
+
href: toolsPath,
|
|
2329
|
+
label: "Admin Tools",
|
|
2330
|
+
tone: "ghost"
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
return actions;
|
|
2334
|
+
}, [formsEnabled, formsPath, globalsBasePath, mediaPath, pagesPath, role, toolsPath]);
|
|
2335
|
+
const attentionTitle = role === "client" ? "What Changed" : "Needs Attention";
|
|
2336
|
+
const attentionDescription = role === "client" ? "A quick read on recent content and asset changes." : "The highest-signal items that still need review.";
|
|
2337
|
+
return /* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-layout", children: [
|
|
2338
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--attention", children: [
|
|
2339
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2340
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2341
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: attentionTitle }),
|
|
2342
|
+
/* @__PURE__ */ jsx16("h2", { children: attentionDescription })
|
|
2343
|
+
] }),
|
|
2344
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-meta", children: "Last 7 days" })
|
|
2345
|
+
] }),
|
|
2346
|
+
attentionItems.length > 0 ? /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-attention-list", children: attentionItems.map(
|
|
2347
|
+
(item) => item.href ? /* @__PURE__ */ jsxs14(
|
|
2348
|
+
Link,
|
|
2349
|
+
{
|
|
2350
|
+
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
2351
|
+
href: item.href,
|
|
2352
|
+
children: [
|
|
2353
|
+
/* @__PURE__ */ jsx16("strong", { children: item.label }),
|
|
2354
|
+
/* @__PURE__ */ jsx16("span", { children: "Open" })
|
|
2355
|
+
]
|
|
2356
|
+
},
|
|
2357
|
+
item.id
|
|
2358
|
+
) : /* @__PURE__ */ jsx16(
|
|
2359
|
+
"div",
|
|
2360
|
+
{
|
|
2361
|
+
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
2362
|
+
children: /* @__PURE__ */ jsx16("strong", { children: item.label })
|
|
2363
|
+
},
|
|
2364
|
+
item.id
|
|
2365
|
+
)
|
|
2366
|
+
) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ jsx16(ModuleStatus, { message: "Loading attention items..." }) : /* @__PURE__ */ jsx16(
|
|
2367
|
+
EmptyState2,
|
|
2368
|
+
{
|
|
2369
|
+
body: role === "client" ? "No major changes landed during the current review window." : "No urgent follow-up surfaced from content, forms, or media activity.",
|
|
2370
|
+
title: "Everything looks steady"
|
|
2371
|
+
}
|
|
2372
|
+
)
|
|
2373
|
+
] }),
|
|
2374
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--actions", children: [
|
|
2375
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2376
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2377
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: "Quick Actions" }),
|
|
2378
|
+
/* @__PURE__ */ jsx16("h2", { children: "Jump into the work that matters most." })
|
|
2379
|
+
] }),
|
|
2380
|
+
/* @__PURE__ */ jsxs14("span", { className: "orion-dashboard-panel-meta", children: [
|
|
2381
|
+
role || "studio",
|
|
2382
|
+
" mode"
|
|
2383
|
+
] })
|
|
2384
|
+
] }),
|
|
2385
|
+
/* @__PURE__ */ jsx16("div", { className: "orion-dashboard-action-list", children: primaryActions.map((action) => /* @__PURE__ */ jsxs14(
|
|
2386
|
+
Link,
|
|
2387
|
+
{
|
|
2388
|
+
className: [
|
|
2389
|
+
"orion-dashboard-action",
|
|
2390
|
+
action.tone === "ghost" ? "is-ghost" : action.tone === "soft" ? "is-soft" : ""
|
|
2391
|
+
].filter(Boolean).join(" "),
|
|
2392
|
+
href: action.href,
|
|
2393
|
+
children: [
|
|
2394
|
+
/* @__PURE__ */ jsx16("strong", { children: action.label }),
|
|
2395
|
+
/* @__PURE__ */ jsx16("span", { children: action.description })
|
|
2396
|
+
]
|
|
2397
|
+
},
|
|
2398
|
+
action.label
|
|
2399
|
+
)) }),
|
|
2400
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-workspace-strip", children: [
|
|
2401
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-workspace-label", children: "Workspace" }),
|
|
2402
|
+
/* @__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)) })
|
|
2403
|
+
] })
|
|
2404
|
+
] }),
|
|
2405
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--activity", children: [
|
|
2406
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2407
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2408
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: "Recent Activity" }),
|
|
2409
|
+
/* @__PURE__ */ jsx16("h2", { children: "The freshest edits, responses, and uploads across the studio." })
|
|
2410
|
+
] }),
|
|
2411
|
+
/* @__PURE__ */ jsxs14("span", { className: "orion-dashboard-panel-meta", children: [
|
|
2412
|
+
activityItems.length,
|
|
2413
|
+
" items"
|
|
2414
|
+
] })
|
|
2415
|
+
] }),
|
|
2416
|
+
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: [
|
|
2417
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-activity-copy", children: [
|
|
2418
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-activity-topline", children: [
|
|
2419
|
+
/* @__PURE__ */ jsx16("strong", { children: item.title }),
|
|
2420
|
+
/* @__PURE__ */ jsx16("span", { children: formatRelativeTime2(item.timestamp) })
|
|
2421
|
+
] }),
|
|
2422
|
+
/* @__PURE__ */ jsx16("p", { children: item.meta })
|
|
2423
|
+
] }),
|
|
2424
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-activity-pill", children: item.label })
|
|
2425
|
+
] }, item.id)) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ jsx16(ModuleStatus, { message: "Loading activity feed..." }) : /* @__PURE__ */ jsx16(
|
|
2426
|
+
EmptyState2,
|
|
2427
|
+
{
|
|
2428
|
+
body: "Recent page edits, submissions, and uploads will start stacking here as soon as the team gets moving.",
|
|
2429
|
+
title: "No recent activity yet"
|
|
2430
|
+
}
|
|
2431
|
+
)
|
|
2432
|
+
] }),
|
|
2433
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--snapshot", children: [
|
|
2434
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2435
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2436
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: "Business Snapshot" }),
|
|
2437
|
+
/* @__PURE__ */ jsx16("h2", { children: "A compact read on content momentum and performance." })
|
|
2438
|
+
] }),
|
|
2439
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-meta", children: "30-day lens" })
|
|
2440
|
+
] }),
|
|
2441
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-snapshot-grid", children: [
|
|
2442
|
+
snapshotCards.map((card) => /* @__PURE__ */ jsx16(SnapshotMetric, { card }, card.kicker)),
|
|
2443
|
+
children
|
|
2444
|
+
] }),
|
|
2445
|
+
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
|
|
2446
|
+
] })
|
|
2447
|
+
] });
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
2451
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2452
|
+
var DEFAULT_ADMIN_BASE_PATH2 = "/admin";
|
|
2453
|
+
var normalizePath2 = (value) => {
|
|
2454
|
+
if (!value || value === "/") return "/";
|
|
2455
|
+
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
2456
|
+
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
2457
|
+
return trimmed.length > 0 ? trimmed : "/";
|
|
2458
|
+
};
|
|
2459
|
+
var normalizeAdminBasePath2 = (value) => {
|
|
2460
|
+
const normalized = normalizePath2(value);
|
|
2461
|
+
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH2 : normalized;
|
|
2462
|
+
};
|
|
2463
|
+
var isAbsoluteExternalURL3 = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
2464
|
+
var resolveAdminPath2 = (adminBasePath, targetPath) => {
|
|
2465
|
+
if (!targetPath) return adminBasePath;
|
|
2466
|
+
if (isAbsoluteExternalURL3(targetPath)) return targetPath;
|
|
2467
|
+
const normalizedBasePath = normalizeAdminBasePath2(adminBasePath);
|
|
2468
|
+
const normalizedTargetPath = normalizePath2(targetPath);
|
|
2469
|
+
if (normalizedTargetPath === "/admin") {
|
|
2470
|
+
return normalizedBasePath;
|
|
2471
|
+
}
|
|
2472
|
+
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
2473
|
+
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
2474
|
+
}
|
|
2475
|
+
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
2476
|
+
return normalizedTargetPath;
|
|
2477
|
+
}
|
|
2478
|
+
if (normalizedTargetPath === "/") {
|
|
2479
|
+
return normalizedBasePath;
|
|
2480
|
+
}
|
|
2481
|
+
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
2482
|
+
};
|
|
1568
2483
|
var getPropString2 = (props, key, fallback) => {
|
|
1569
2484
|
if (!props || typeof props !== "object") return fallback;
|
|
1570
2485
|
const direct = props[key];
|
|
@@ -1597,237 +2512,165 @@ var getPropSections2 = (props) => {
|
|
|
1597
2512
|
}
|
|
1598
2513
|
return [];
|
|
1599
2514
|
};
|
|
1600
|
-
|
|
2515
|
+
var readUserRole2 = (props) => {
|
|
2516
|
+
if (!props || typeof props !== "object") return void 0;
|
|
2517
|
+
const user = props.user;
|
|
2518
|
+
if (user && typeof user === "object") {
|
|
2519
|
+
const role = user.role;
|
|
2520
|
+
if (typeof role === "string") {
|
|
2521
|
+
return role;
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
const initPageResult = props.initPageResult;
|
|
2525
|
+
if (initPageResult && typeof initPageResult === "object") {
|
|
2526
|
+
const req = initPageResult.req;
|
|
2527
|
+
if (req && typeof req === "object") {
|
|
2528
|
+
const nestedUser = req.user;
|
|
2529
|
+
if (nestedUser && typeof nestedUser === "object") {
|
|
2530
|
+
const role = nestedUser.role;
|
|
2531
|
+
if (typeof role === "string") {
|
|
2532
|
+
return role;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
return void 0;
|
|
2538
|
+
};
|
|
2539
|
+
var readAdminBasePath = (props) => {
|
|
2540
|
+
if (!props || typeof props !== "object") {
|
|
2541
|
+
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2542
|
+
}
|
|
2543
|
+
const payloadLike = props.payload;
|
|
2544
|
+
if (payloadLike && typeof payloadLike === "object") {
|
|
2545
|
+
const config = payloadLike.config;
|
|
2546
|
+
const routes = config && typeof config === "object" ? config.routes : null;
|
|
2547
|
+
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
2548
|
+
if (typeof admin === "string" && admin.length > 0) {
|
|
2549
|
+
return normalizeAdminBasePath2(admin);
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
const initPageResult = props.initPageResult;
|
|
2553
|
+
if (initPageResult && typeof initPageResult === "object") {
|
|
2554
|
+
const req = initPageResult.req;
|
|
2555
|
+
if (req && typeof req === "object") {
|
|
2556
|
+
const nestedPayload = req.payload;
|
|
2557
|
+
if (nestedPayload && typeof nestedPayload === "object") {
|
|
2558
|
+
const config = nestedPayload.config;
|
|
2559
|
+
const routes = config && typeof config === "object" ? config.routes : null;
|
|
2560
|
+
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
2561
|
+
if (typeof admin === "string" && admin.length > 0) {
|
|
2562
|
+
return normalizeAdminBasePath2(admin);
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2568
|
+
};
|
|
2569
|
+
var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
|
|
2570
|
+
const links = [
|
|
2571
|
+
{
|
|
2572
|
+
href: resolveAdminPath2(adminBasePath, "/pages"),
|
|
2573
|
+
id: "pages",
|
|
2574
|
+
label: "Pages"
|
|
2575
|
+
},
|
|
2576
|
+
...formsEnabled ? [
|
|
2577
|
+
{
|
|
2578
|
+
href: resolveAdminPath2(adminBasePath, "/forms"),
|
|
2579
|
+
id: "forms",
|
|
2580
|
+
label: "Forms",
|
|
2581
|
+
roles: ["admin", "editor"]
|
|
2582
|
+
}
|
|
2583
|
+
] : [],
|
|
2584
|
+
{
|
|
2585
|
+
href: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
2586
|
+
id: "globals",
|
|
2587
|
+
label: "Globals"
|
|
2588
|
+
},
|
|
2589
|
+
{
|
|
2590
|
+
href: resolveAdminPath2(adminBasePath, "/media"),
|
|
2591
|
+
id: "media",
|
|
2592
|
+
label: "Media"
|
|
2593
|
+
},
|
|
2594
|
+
...sections.map((section) => ({
|
|
2595
|
+
href: resolveAdminPath2(adminBasePath, section.href),
|
|
2596
|
+
id: section.id,
|
|
2597
|
+
label: section.label,
|
|
2598
|
+
...section.roles ? { roles: section.roles } : {}
|
|
2599
|
+
})),
|
|
2600
|
+
{
|
|
2601
|
+
href: resolveAdminPath2(adminBasePath, "/tools"),
|
|
2602
|
+
id: "admin-tools",
|
|
2603
|
+
label: "Admin Tools",
|
|
2604
|
+
roles: ["admin"]
|
|
2605
|
+
}
|
|
2606
|
+
];
|
|
2607
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2608
|
+
return links.filter((link) => {
|
|
2609
|
+
if (seen.has(link.id)) {
|
|
2610
|
+
return false;
|
|
2611
|
+
}
|
|
2612
|
+
seen.add(link.id);
|
|
2613
|
+
return true;
|
|
2614
|
+
});
|
|
2615
|
+
};
|
|
2616
|
+
function AdminStudioDashboard(rawProps) {
|
|
2617
|
+
const props = rawProps || {};
|
|
1601
2618
|
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
1602
2619
|
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
1603
2620
|
const sections = getPropSections2(props);
|
|
1604
|
-
const
|
|
1605
|
-
const
|
|
1606
|
-
const
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
2621
|
+
const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
|
|
2622
|
+
const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
|
|
2623
|
+
const formSubmissionsCollectionSlug = getPropString2(
|
|
2624
|
+
props,
|
|
2625
|
+
"formSubmissionsCollectionSlug",
|
|
2626
|
+
"form-submissions"
|
|
2627
|
+
);
|
|
2628
|
+
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
2629
|
+
const adminBasePath = readAdminBasePath(props);
|
|
2630
|
+
const userRole = readUserRole2(props);
|
|
2631
|
+
const navProps = {
|
|
2632
|
+
brandName: getPropString2(props, "brandName", "Orion Studio"),
|
|
2633
|
+
formSubmissionsCollectionSlug,
|
|
2634
|
+
formsCollectionSlug,
|
|
2635
|
+
formsEnabled,
|
|
2636
|
+
globalsBasePath,
|
|
2637
|
+
logoUrl: getPropString2(props, "logoUrl", ""),
|
|
2638
|
+
mediaCollectionSlug,
|
|
2639
|
+
pagesCollectionSlug,
|
|
2640
|
+
sections
|
|
2641
|
+
};
|
|
2642
|
+
return /* @__PURE__ */ jsx17(StudioSectionLayout, { navProps, children: /* @__PURE__ */ jsx17(
|
|
1616
2643
|
AdminPage,
|
|
1617
2644
|
{
|
|
1618
2645
|
breadcrumbs: [{ label: "Dashboard" }],
|
|
1619
|
-
description: "
|
|
2646
|
+
description: "What needs attention, what changed recently, and how the site is performing.",
|
|
1620
2647
|
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
|
-
] })
|
|
2648
|
+
children: /* @__PURE__ */ jsx17(
|
|
2649
|
+
AdminStudioDashboardClient,
|
|
2650
|
+
{
|
|
2651
|
+
formSubmissionsCollectionSlug,
|
|
2652
|
+
formsCollectionSlug,
|
|
2653
|
+
formsEnabled,
|
|
2654
|
+
formsPath: resolveAdminPath2(adminBasePath, "/forms"),
|
|
2655
|
+
globalsBasePath: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
2656
|
+
mediaCollectionSlug,
|
|
2657
|
+
mediaPath: resolveAdminPath2(adminBasePath, "/media"),
|
|
2658
|
+
pagesCollectionSlug,
|
|
2659
|
+
pagesPath: resolveAdminPath2(adminBasePath, "/pages"),
|
|
2660
|
+
sectionLinks: buildSectionLinks(adminBasePath, sections, formsEnabled, globalsBasePath),
|
|
2661
|
+
toolsPath: resolveAdminPath2(adminBasePath, "/tools"),
|
|
2662
|
+
userRole
|
|
2663
|
+
}
|
|
2664
|
+
)
|
|
1647
2665
|
}
|
|
1648
2666
|
) });
|
|
1649
2667
|
}
|
|
1650
2668
|
|
|
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
2669
|
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
1827
|
-
import { useEffect as
|
|
2670
|
+
import { useEffect as useEffect8, useMemo as useMemo4, useState as useState8 } from "react";
|
|
1828
2671
|
import Link2 from "next/link";
|
|
1829
2672
|
import { useAuth as useAuth3 } from "@payloadcms/ui";
|
|
1830
|
-
import { jsx as
|
|
2673
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1831
2674
|
var isAdmin = (user) => {
|
|
1832
2675
|
if (!user || typeof user !== "object") return false;
|
|
1833
2676
|
const role = user.role;
|
|
@@ -1849,10 +2692,10 @@ function AdminStudioPagesListView(props) {
|
|
|
1849
2692
|
const pagesCollectionSlug = getPropString3(props, "pagesCollectionSlug", "pages");
|
|
1850
2693
|
const adminBasePath = useAdminBasePath();
|
|
1851
2694
|
const newPagePath = resolveAdminPath(adminBasePath, "/pages/new");
|
|
1852
|
-
const [loading, setLoading] =
|
|
1853
|
-
const [error, setError] =
|
|
1854
|
-
const [docs, setDocs] =
|
|
1855
|
-
const apiURL =
|
|
2695
|
+
const [loading, setLoading] = useState8(true);
|
|
2696
|
+
const [error, setError] = useState8(null);
|
|
2697
|
+
const [docs, setDocs] = useState8([]);
|
|
2698
|
+
const apiURL = useMemo4(() => {
|
|
1856
2699
|
const params = new URLSearchParams({
|
|
1857
2700
|
depth: "0",
|
|
1858
2701
|
limit: "100",
|
|
@@ -1861,7 +2704,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1861
2704
|
});
|
|
1862
2705
|
return `/api/${pagesCollectionSlug}?${params.toString()}`;
|
|
1863
2706
|
}, [pagesCollectionSlug]);
|
|
1864
|
-
|
|
2707
|
+
useEffect8(() => {
|
|
1865
2708
|
let cancelled = false;
|
|
1866
2709
|
const run = async () => {
|
|
1867
2710
|
setLoading(true);
|
|
@@ -1891,10 +2734,10 @@ function AdminStudioPagesListView(props) {
|
|
|
1891
2734
|
cancelled = true;
|
|
1892
2735
|
};
|
|
1893
2736
|
}, [apiURL]);
|
|
1894
|
-
return /* @__PURE__ */
|
|
2737
|
+
return /* @__PURE__ */ jsx18(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs15(
|
|
1895
2738
|
AdminPage,
|
|
1896
2739
|
{
|
|
1897
|
-
actions: isAdmin(user) ? /* @__PURE__ */
|
|
2740
|
+
actions: isAdmin(user) ? /* @__PURE__ */ jsx18(Link2, { className: "orion-admin-action-button", href: newPagePath, children: "New Page" }) : null,
|
|
1898
2741
|
breadcrumbs: [
|
|
1899
2742
|
{ label: "Dashboard", href: adminBasePath },
|
|
1900
2743
|
{ label: "Pages" }
|
|
@@ -1902,21 +2745,21 @@ function AdminStudioPagesListView(props) {
|
|
|
1902
2745
|
description: "Open a page to edit it in the inline custom builder.",
|
|
1903
2746
|
title: "Pages",
|
|
1904
2747
|
children: [
|
|
1905
|
-
loading ? /* @__PURE__ */
|
|
1906
|
-
error ? /* @__PURE__ */
|
|
1907
|
-
/* @__PURE__ */
|
|
1908
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
/* @__PURE__ */
|
|
2748
|
+
loading ? /* @__PURE__ */ jsx18("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
2749
|
+
error ? /* @__PURE__ */ jsx18("div", { className: "orion-admin-error", children: error }) : null,
|
|
2750
|
+
/* @__PURE__ */ jsxs15("div", { className: "orion-admin-list", children: [
|
|
2751
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ jsxs15("div", { className: "orion-admin-card", children: [
|
|
2752
|
+
/* @__PURE__ */ jsx18("strong", { children: "No pages yet" }),
|
|
2753
|
+
/* @__PURE__ */ jsx18("span", { children: "Create the first page to start building content." })
|
|
1911
2754
|
] }) : null,
|
|
1912
2755
|
docs.map((doc) => {
|
|
1913
2756
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
1914
2757
|
if (!id) return null;
|
|
1915
2758
|
const title = typeof doc.title === "string" ? doc.title : "Untitled Page";
|
|
1916
2759
|
const status = typeof doc._status === "string" ? doc._status : "draft";
|
|
1917
|
-
return /* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
1919
|
-
/* @__PURE__ */
|
|
2760
|
+
return /* @__PURE__ */ jsxs15(Link2, { className: "orion-admin-list-item", href: resolveAdminPath(adminBasePath, `/pages/${id}`), children: [
|
|
2761
|
+
/* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsx18("strong", { children: title }) }),
|
|
2762
|
+
/* @__PURE__ */ jsx18("span", { className: "orion-admin-pill", children: status })
|
|
1920
2763
|
] }, id);
|
|
1921
2764
|
})
|
|
1922
2765
|
] })
|
|
@@ -1926,9 +2769,9 @@ function AdminStudioPagesListView(props) {
|
|
|
1926
2769
|
}
|
|
1927
2770
|
|
|
1928
2771
|
// src/admin/components/studio/AdminStudioPageEditView.tsx
|
|
1929
|
-
import { useEffect as
|
|
2772
|
+
import { useEffect as useEffect9, useMemo as useMemo5, useRef as useRef3, useState as useState9 } from "react";
|
|
1930
2773
|
import { SetStepNav, toast, useAuth as useAuth4 } from "@payloadcms/ui";
|
|
1931
|
-
import { Fragment as
|
|
2774
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1932
2775
|
var isAdmin2 = (user) => {
|
|
1933
2776
|
if (!user || typeof user !== "object") return false;
|
|
1934
2777
|
const role = user.role;
|
|
@@ -1969,17 +2812,17 @@ function AdminStudioPageEditView(props) {
|
|
|
1969
2812
|
const { user } = useAuth4();
|
|
1970
2813
|
const adminBasePath = useAdminBasePath();
|
|
1971
2814
|
const iframeRef = useRef3(null);
|
|
1972
|
-
const [saving, setSaving] =
|
|
1973
|
-
const [dirty, setDirty] =
|
|
1974
|
-
const [hasUnpublishedChanges, setHasUnpublishedChanges] =
|
|
1975
|
-
const [canUndo, setCanUndo] =
|
|
1976
|
-
const [canRedo, setCanRedo] =
|
|
2815
|
+
const [saving, setSaving] = useState9(null);
|
|
2816
|
+
const [dirty, setDirty] = useState9(false);
|
|
2817
|
+
const [hasUnpublishedChanges, setHasUnpublishedChanges] = useState9(false);
|
|
2818
|
+
const [canUndo, setCanUndo] = useState9(false);
|
|
2819
|
+
const [canRedo, setCanRedo] = useState9(false);
|
|
1977
2820
|
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
1978
2821
|
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1979
|
-
const pageIDFromParams =
|
|
1980
|
-
const [pageID, setPageID] =
|
|
1981
|
-
const [didResolvePathFallback, setDidResolvePathFallback] =
|
|
1982
|
-
|
|
2822
|
+
const pageIDFromParams = useMemo5(() => getParam(props.params, "id"), [props.params]);
|
|
2823
|
+
const [pageID, setPageID] = useState9(pageIDFromParams);
|
|
2824
|
+
const [didResolvePathFallback, setDidResolvePathFallback] = useState9(false);
|
|
2825
|
+
useEffect9(() => {
|
|
1983
2826
|
if (pageIDFromParams) {
|
|
1984
2827
|
setPageID(pageIDFromParams);
|
|
1985
2828
|
setDidResolvePathFallback(true);
|
|
@@ -2023,7 +2866,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2023
2866
|
} catch {
|
|
2024
2867
|
}
|
|
2025
2868
|
};
|
|
2026
|
-
|
|
2869
|
+
useEffect9(() => {
|
|
2027
2870
|
if (!pageID) {
|
|
2028
2871
|
return;
|
|
2029
2872
|
}
|
|
@@ -2046,7 +2889,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2046
2889
|
}
|
|
2047
2890
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
2048
2891
|
};
|
|
2049
|
-
|
|
2892
|
+
useEffect9(() => {
|
|
2050
2893
|
const onMessage = (event) => {
|
|
2051
2894
|
const data = event.data;
|
|
2052
2895
|
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
@@ -2081,8 +2924,8 @@ function AdminStudioPageEditView(props) {
|
|
|
2081
2924
|
return () => window.removeEventListener("message", onMessage);
|
|
2082
2925
|
}, []);
|
|
2083
2926
|
if (!pageID && !didResolvePathFallback) {
|
|
2084
|
-
return /* @__PURE__ */
|
|
2085
|
-
/* @__PURE__ */
|
|
2927
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
2928
|
+
/* @__PURE__ */ jsx19(
|
|
2086
2929
|
SetStepNav,
|
|
2087
2930
|
{
|
|
2088
2931
|
nav: [
|
|
@@ -2091,13 +2934,13 @@ function AdminStudioPageEditView(props) {
|
|
|
2091
2934
|
]
|
|
2092
2935
|
}
|
|
2093
2936
|
),
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2937
|
+
/* @__PURE__ */ jsx19("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
2938
|
+
/* @__PURE__ */ jsx19("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading page editor..." })
|
|
2096
2939
|
] }) });
|
|
2097
2940
|
}
|
|
2098
2941
|
if (!pageID) {
|
|
2099
|
-
return /* @__PURE__ */
|
|
2100
|
-
/* @__PURE__ */
|
|
2942
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
2943
|
+
/* @__PURE__ */ jsx19(
|
|
2101
2944
|
SetStepNav,
|
|
2102
2945
|
{
|
|
2103
2946
|
nav: [
|
|
@@ -2106,12 +2949,12 @@ function AdminStudioPageEditView(props) {
|
|
|
2106
2949
|
]
|
|
2107
2950
|
}
|
|
2108
2951
|
),
|
|
2109
|
-
/* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ jsx19("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
2953
|
+
/* @__PURE__ */ jsx19("p", { style: { color: "var(--theme-elevation-600)" }, children: "Missing page ID." })
|
|
2111
2954
|
] }) });
|
|
2112
2955
|
}
|
|
2113
|
-
return /* @__PURE__ */
|
|
2114
|
-
/* @__PURE__ */
|
|
2956
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
2957
|
+
/* @__PURE__ */ jsx19(
|
|
2115
2958
|
SetStepNav,
|
|
2116
2959
|
{
|
|
2117
2960
|
nav: [
|
|
@@ -2120,8 +2963,8 @@ function AdminStudioPageEditView(props) {
|
|
|
2120
2963
|
]
|
|
2121
2964
|
}
|
|
2122
2965
|
),
|
|
2123
|
-
/* @__PURE__ */
|
|
2124
|
-
/* @__PURE__ */
|
|
2966
|
+
/* @__PURE__ */ jsxs16("div", { style: { display: "grid", gridTemplateRows: "auto 1fr", height: "calc(100vh - 120px)" }, children: [
|
|
2967
|
+
/* @__PURE__ */ jsxs16(
|
|
2125
2968
|
"div",
|
|
2126
2969
|
{
|
|
2127
2970
|
style: {
|
|
@@ -2137,9 +2980,9 @@ function AdminStudioPageEditView(props) {
|
|
|
2137
2980
|
zIndex: 20
|
|
2138
2981
|
},
|
|
2139
2982
|
children: [
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2983
|
+
/* @__PURE__ */ jsxs16("div", { style: { minWidth: 0 }, children: [
|
|
2984
|
+
/* @__PURE__ */ jsx19("div", { style: { fontWeight: 900 }, children: "Page Editor" }),
|
|
2985
|
+
/* @__PURE__ */ jsxs16(
|
|
2143
2986
|
"div",
|
|
2144
2987
|
{
|
|
2145
2988
|
style: {
|
|
@@ -2155,9 +2998,9 @@ function AdminStudioPageEditView(props) {
|
|
|
2155
2998
|
}
|
|
2156
2999
|
)
|
|
2157
3000
|
] }),
|
|
2158
|
-
/* @__PURE__ */
|
|
2159
|
-
/* @__PURE__ */
|
|
2160
|
-
/* @__PURE__ */
|
|
3001
|
+
/* @__PURE__ */ jsxs16("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
3002
|
+
/* @__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" }),
|
|
3003
|
+
/* @__PURE__ */ jsx19(
|
|
2161
3004
|
"div",
|
|
2162
3005
|
{
|
|
2163
3006
|
style: {
|
|
@@ -2174,7 +3017,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2174
3017
|
children: hasUnpublishedChanges ? "Unpublished draft changes" : "Live is up to date"
|
|
2175
3018
|
}
|
|
2176
3019
|
),
|
|
2177
|
-
/* @__PURE__ */
|
|
3020
|
+
/* @__PURE__ */ jsx19(
|
|
2178
3021
|
"button",
|
|
2179
3022
|
{
|
|
2180
3023
|
disabled: !canUndo,
|
|
@@ -2190,7 +3033,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2190
3033
|
children: "Undo"
|
|
2191
3034
|
}
|
|
2192
3035
|
),
|
|
2193
|
-
/* @__PURE__ */
|
|
3036
|
+
/* @__PURE__ */ jsx19(
|
|
2194
3037
|
"button",
|
|
2195
3038
|
{
|
|
2196
3039
|
disabled: !canRedo,
|
|
@@ -2206,7 +3049,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2206
3049
|
children: "Redo"
|
|
2207
3050
|
}
|
|
2208
3051
|
),
|
|
2209
|
-
/* @__PURE__ */
|
|
3052
|
+
/* @__PURE__ */ jsx19(
|
|
2210
3053
|
"button",
|
|
2211
3054
|
{
|
|
2212
3055
|
disabled: saving !== null,
|
|
@@ -2222,7 +3065,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2222
3065
|
children: saving === "draft" ? "Saving\u2026" : "Save Draft"
|
|
2223
3066
|
}
|
|
2224
3067
|
),
|
|
2225
|
-
/* @__PURE__ */
|
|
3068
|
+
/* @__PURE__ */ jsx19(
|
|
2226
3069
|
"button",
|
|
2227
3070
|
{
|
|
2228
3071
|
disabled: !canPublish || saving !== null,
|
|
@@ -2245,7 +3088,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2245
3088
|
]
|
|
2246
3089
|
}
|
|
2247
3090
|
),
|
|
2248
|
-
/* @__PURE__ */
|
|
3091
|
+
/* @__PURE__ */ jsx19(
|
|
2249
3092
|
"iframe",
|
|
2250
3093
|
{
|
|
2251
3094
|
ref: iframeRef,
|
|
@@ -2265,9 +3108,9 @@ function AdminStudioPageEditView(props) {
|
|
|
2265
3108
|
}
|
|
2266
3109
|
|
|
2267
3110
|
// src/admin/components/studio/AdminStudioNewPageView.tsx
|
|
2268
|
-
import { useState as
|
|
3111
|
+
import { useState as useState10 } from "react";
|
|
2269
3112
|
import { useAuth as useAuth5 } from "@payloadcms/ui";
|
|
2270
|
-
import { jsx as
|
|
3113
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2271
3114
|
var pageTemplates = ["standard", "landing", "services", "contact"];
|
|
2272
3115
|
var getPropString5 = (props, key, fallback) => {
|
|
2273
3116
|
if (!props || typeof props !== "object") return fallback;
|
|
@@ -2290,10 +3133,10 @@ function AdminStudioNewPageView(props) {
|
|
|
2290
3133
|
const { user } = useAuth5();
|
|
2291
3134
|
const adminBasePath = useAdminBasePath();
|
|
2292
3135
|
const pagesCollectionSlug = getPropString5(props, "pagesCollectionSlug", "pages");
|
|
2293
|
-
const [submitting, setSubmitting] =
|
|
2294
|
-
const [error, setError] =
|
|
3136
|
+
const [submitting, setSubmitting] = useState10(false);
|
|
3137
|
+
const [error, setError] = useState10(null);
|
|
2295
3138
|
if (!canManagePages(user)) {
|
|
2296
|
-
return /* @__PURE__ */
|
|
3139
|
+
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx20(
|
|
2297
3140
|
AdminPage,
|
|
2298
3141
|
{
|
|
2299
3142
|
breadcrumbs: [
|
|
@@ -2303,9 +3146,9 @@ function AdminStudioNewPageView(props) {
|
|
|
2303
3146
|
],
|
|
2304
3147
|
description: "You do not have access to create pages.",
|
|
2305
3148
|
title: "New Page",
|
|
2306
|
-
children: /* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
/* @__PURE__ */
|
|
3149
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "orion-admin-card", children: [
|
|
3150
|
+
/* @__PURE__ */ jsx20("strong", { children: "Access denied" }),
|
|
3151
|
+
/* @__PURE__ */ jsx20("span", { children: "This section is restricted to administrator and editor accounts." })
|
|
2309
3152
|
] })
|
|
2310
3153
|
}
|
|
2311
3154
|
) });
|
|
@@ -2350,7 +3193,7 @@ function AdminStudioNewPageView(props) {
|
|
|
2350
3193
|
setSubmitting(false);
|
|
2351
3194
|
}
|
|
2352
3195
|
};
|
|
2353
|
-
return /* @__PURE__ */
|
|
3196
|
+
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx20(
|
|
2354
3197
|
AdminPage,
|
|
2355
3198
|
{
|
|
2356
3199
|
breadcrumbs: [
|
|
@@ -2360,33 +3203,33 @@ function AdminStudioNewPageView(props) {
|
|
|
2360
3203
|
],
|
|
2361
3204
|
description: "Create a new page and open it in the custom editor.",
|
|
2362
3205
|
title: "New Page",
|
|
2363
|
-
children: /* @__PURE__ */
|
|
2364
|
-
error ? /* @__PURE__ */
|
|
2365
|
-
/* @__PURE__ */
|
|
3206
|
+
children: /* @__PURE__ */ jsxs17("form", { className: "orion-admin-form", onSubmit: createPage, children: [
|
|
3207
|
+
error ? /* @__PURE__ */ jsx20("div", { className: "orion-admin-error", children: error }) : null,
|
|
3208
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
2366
3209
|
"Title",
|
|
2367
|
-
/* @__PURE__ */
|
|
3210
|
+
/* @__PURE__ */ jsx20("input", { name: "title", placeholder: "Services", required: true, type: "text" })
|
|
2368
3211
|
] }),
|
|
2369
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
2370
3213
|
"Slug",
|
|
2371
|
-
/* @__PURE__ */
|
|
3214
|
+
/* @__PURE__ */ jsx20("input", { name: "slug", placeholder: "services", type: "text" })
|
|
2372
3215
|
] }),
|
|
2373
|
-
/* @__PURE__ */
|
|
3216
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
2374
3217
|
"Template",
|
|
2375
|
-
/* @__PURE__ */
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
3218
|
+
/* @__PURE__ */ jsxs17("select", { defaultValue: "standard", name: "template", children: [
|
|
3219
|
+
/* @__PURE__ */ jsx20("option", { value: "standard", children: "Standard" }),
|
|
3220
|
+
/* @__PURE__ */ jsx20("option", { value: "landing", children: "Landing" }),
|
|
3221
|
+
/* @__PURE__ */ jsx20("option", { value: "contact", children: "Contact" }),
|
|
3222
|
+
/* @__PURE__ */ jsx20("option", { value: "services", children: "Services" })
|
|
2380
3223
|
] })
|
|
2381
3224
|
] }),
|
|
2382
|
-
/* @__PURE__ */
|
|
3225
|
+
/* @__PURE__ */ jsx20("button", { disabled: submitting, type: "submit", children: submitting ? "Creating..." : "Create Page" })
|
|
2383
3226
|
] })
|
|
2384
3227
|
}
|
|
2385
3228
|
) });
|
|
2386
3229
|
}
|
|
2387
3230
|
|
|
2388
3231
|
// src/admin/components/studio/AdminStudioGlobalsView.tsx
|
|
2389
|
-
import { jsx as
|
|
3232
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2390
3233
|
var getPropGlobals = (props) => {
|
|
2391
3234
|
if (!props || typeof props !== "object") return null;
|
|
2392
3235
|
const direct = props.globals;
|
|
@@ -2406,7 +3249,7 @@ function AdminStudioGlobalsView(props) {
|
|
|
2406
3249
|
{ slug: "footer", label: "Footer" },
|
|
2407
3250
|
{ slug: "social-media", label: "Social Media" }
|
|
2408
3251
|
];
|
|
2409
|
-
return /* @__PURE__ */
|
|
3252
|
+
return /* @__PURE__ */ jsx21(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx21(
|
|
2410
3253
|
AdminPage,
|
|
2411
3254
|
{
|
|
2412
3255
|
breadcrumbs: [
|
|
@@ -2415,17 +3258,17 @@ function AdminStudioGlobalsView(props) {
|
|
|
2415
3258
|
],
|
|
2416
3259
|
description: "Site-wide content and branding settings.",
|
|
2417
3260
|
title: "Globals",
|
|
2418
|
-
children: /* @__PURE__ */
|
|
3261
|
+
children: /* @__PURE__ */ jsx21("div", { className: "orion-admin-list", children: globals.map((global) => {
|
|
2419
3262
|
const href = resolveAdminPath(
|
|
2420
3263
|
adminBasePath,
|
|
2421
3264
|
typeof global.href === "string" ? global.href : `/globals/${global.slug}`
|
|
2422
3265
|
);
|
|
2423
|
-
return /* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
3266
|
+
return /* @__PURE__ */ jsxs18("a", { className: "orion-admin-list-item", href, children: [
|
|
3267
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3268
|
+
/* @__PURE__ */ jsx21("strong", { children: global.label }),
|
|
3269
|
+
/* @__PURE__ */ jsx21("div", { className: "orion-admin-list-meta", children: typeof global.description === "string" && global.description.length > 0 ? global.description : href })
|
|
2427
3270
|
] }),
|
|
2428
|
-
/* @__PURE__ */
|
|
3271
|
+
/* @__PURE__ */ jsx21("span", { className: "orion-admin-list-meta", children: "Open" })
|
|
2429
3272
|
] }, global.slug);
|
|
2430
3273
|
}) })
|
|
2431
3274
|
}
|
|
@@ -2433,8 +3276,8 @@ function AdminStudioGlobalsView(props) {
|
|
|
2433
3276
|
}
|
|
2434
3277
|
|
|
2435
3278
|
// src/admin/components/studio/AdminStudioSiteSettingsGlobalView.tsx
|
|
2436
|
-
import { useEffect as
|
|
2437
|
-
import { jsx as
|
|
3279
|
+
import { useEffect as useEffect10, useMemo as useMemo6, useState as useState11 } from "react";
|
|
3280
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2438
3281
|
var getPropString6 = (props, key, fallback) => {
|
|
2439
3282
|
if (!props || typeof props !== "object") return fallback;
|
|
2440
3283
|
const direct = props[key];
|
|
@@ -2519,13 +3362,13 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2519
3362
|
const mediaCollectionSlug = getPropString6(props, "mediaCollectionSlug", "media");
|
|
2520
3363
|
const adminBasePath = useAdminBasePath();
|
|
2521
3364
|
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
|
-
|
|
3365
|
+
const [loading, setLoading] = useState11(true);
|
|
3366
|
+
const [saving, setSaving] = useState11(false);
|
|
3367
|
+
const [error, setError] = useState11(null);
|
|
3368
|
+
const [savedMessage, setSavedMessage] = useState11(null);
|
|
3369
|
+
const [globalData, setGlobalData] = useState11({});
|
|
3370
|
+
const [mediaOptions, setMediaOptions] = useState11([]);
|
|
3371
|
+
useEffect10(() => {
|
|
2529
3372
|
let cancelled = false;
|
|
2530
3373
|
const run = async () => {
|
|
2531
3374
|
setLoading(true);
|
|
@@ -2573,15 +3416,15 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2573
3416
|
cancelled = true;
|
|
2574
3417
|
};
|
|
2575
3418
|
}, [globalSlug, mediaCollectionSlug]);
|
|
2576
|
-
const defaultSeo =
|
|
3419
|
+
const defaultSeo = useMemo6(() => {
|
|
2577
3420
|
const value = globalData.defaultSeo;
|
|
2578
3421
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2579
3422
|
}, [globalData.defaultSeo]);
|
|
2580
|
-
const businessProfile =
|
|
3423
|
+
const businessProfile = useMemo6(() => {
|
|
2581
3424
|
const value = globalData.businessProfile;
|
|
2582
3425
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2583
3426
|
}, [globalData.businessProfile]);
|
|
2584
|
-
const openingHoursRows =
|
|
3427
|
+
const openingHoursRows = useMemo6(
|
|
2585
3428
|
() => serializeRows(businessProfile.openingHours, (item) => {
|
|
2586
3429
|
const dayOfWeek = String(item.dayOfWeek || "").trim();
|
|
2587
3430
|
const opens = String(item.opens || "").trim();
|
|
@@ -2593,14 +3436,14 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2593
3436
|
}),
|
|
2594
3437
|
[businessProfile.openingHours]
|
|
2595
3438
|
);
|
|
2596
|
-
const sameAsRows =
|
|
3439
|
+
const sameAsRows = useMemo6(
|
|
2597
3440
|
() => serializeRows(businessProfile.sameAs, (item) => {
|
|
2598
3441
|
const url = String(item.url || "").trim();
|
|
2599
3442
|
return url || null;
|
|
2600
3443
|
}),
|
|
2601
3444
|
[businessProfile.sameAs]
|
|
2602
3445
|
);
|
|
2603
|
-
const serviceCatalogRows =
|
|
3446
|
+
const serviceCatalogRows = useMemo6(
|
|
2604
3447
|
() => serializeRows(businessProfile.serviceCatalog, (item) => {
|
|
2605
3448
|
const name = String(item.name || "").trim();
|
|
2606
3449
|
const description = String(item.description || "").trim();
|
|
@@ -2671,7 +3514,7 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2671
3514
|
};
|
|
2672
3515
|
const logoID = getRelationID(globalData.logo);
|
|
2673
3516
|
const ogImageID = getRelationID(defaultSeo.ogImage);
|
|
2674
|
-
return /* @__PURE__ */
|
|
3517
|
+
return /* @__PURE__ */ jsx22(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs19(
|
|
2675
3518
|
AdminPage,
|
|
2676
3519
|
{
|
|
2677
3520
|
breadcrumbs: [
|
|
@@ -2682,126 +3525,126 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2682
3525
|
description: "Manage site-wide brand, SEO, and business metadata.",
|
|
2683
3526
|
title: "Website Settings",
|
|
2684
3527
|
children: [
|
|
2685
|
-
loading ? /* @__PURE__ */
|
|
2686
|
-
!loading ? /* @__PURE__ */
|
|
2687
|
-
error ? /* @__PURE__ */
|
|
2688
|
-
savedMessage ? /* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
3528
|
+
loading ? /* @__PURE__ */ jsx22("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
3529
|
+
!loading ? /* @__PURE__ */ jsxs19("form", { className: "orion-admin-form", onSubmit: save, children: [
|
|
3530
|
+
error ? /* @__PURE__ */ jsx22("div", { className: "orion-admin-error", children: error }) : null,
|
|
3531
|
+
savedMessage ? /* @__PURE__ */ jsx22("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
3532
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2690
3533
|
"Site Name",
|
|
2691
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(globalData.siteName || ""), name: "siteName", required: true, type: "text" })
|
|
2692
3535
|
] }),
|
|
2693
|
-
/* @__PURE__ */
|
|
3536
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2694
3537
|
"Tagline",
|
|
2695
|
-
/* @__PURE__ */
|
|
3538
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(globalData.tagline || ""), name: "tagline", type: "text" })
|
|
2696
3539
|
] }),
|
|
2697
|
-
/* @__PURE__ */
|
|
3540
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2698
3541
|
"Logo (media ID)",
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ jsxs19("select", { defaultValue: logoID ? String(logoID) : "", name: "logo", children: [
|
|
3543
|
+
/* @__PURE__ */ jsx22("option", { value: "", children: "No logo" }),
|
|
2701
3544
|
mediaOptions.map((asset) => {
|
|
2702
3545
|
const id = typeof asset.id === "string" || typeof asset.id === "number" ? String(asset.id) : "";
|
|
2703
3546
|
if (!id) return null;
|
|
2704
|
-
return /* @__PURE__ */
|
|
3547
|
+
return /* @__PURE__ */ jsx22("option", { value: id, children: asset.filename || `Media ${id}` }, id);
|
|
2705
3548
|
})
|
|
2706
3549
|
] })
|
|
2707
3550
|
] }),
|
|
2708
|
-
/* @__PURE__ */
|
|
3551
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2709
3552
|
"SEO Meta Title",
|
|
2710
|
-
/* @__PURE__ */
|
|
3553
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(defaultSeo.metaTitle || ""), name: "metaTitle", type: "text" })
|
|
2711
3554
|
] }),
|
|
2712
|
-
/* @__PURE__ */
|
|
3555
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2713
3556
|
"SEO Meta Description",
|
|
2714
|
-
/* @__PURE__ */
|
|
3557
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: String(defaultSeo.metaDescription || ""), name: "metaDescription", rows: 3 })
|
|
2715
3558
|
] }),
|
|
2716
|
-
/* @__PURE__ */
|
|
3559
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2717
3560
|
"Canonical Base URL",
|
|
2718
|
-
/* @__PURE__ */
|
|
3561
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(defaultSeo.canonicalBaseUrl || ""), name: "canonicalBaseUrl", type: "text" })
|
|
2719
3562
|
] }),
|
|
2720
|
-
/* @__PURE__ */
|
|
3563
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2721
3564
|
"SEO OG Image (media ID)",
|
|
2722
|
-
/* @__PURE__ */
|
|
2723
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsxs19("select", { defaultValue: ogImageID ? String(ogImageID) : "", name: "ogImage", children: [
|
|
3566
|
+
/* @__PURE__ */ jsx22("option", { value: "", children: "No image" }),
|
|
2724
3567
|
mediaOptions.map((asset) => {
|
|
2725
3568
|
const id = typeof asset.id === "string" || typeof asset.id === "number" ? String(asset.id) : "";
|
|
2726
3569
|
if (!id) return null;
|
|
2727
|
-
return /* @__PURE__ */
|
|
3570
|
+
return /* @__PURE__ */ jsx22("option", { value: id, children: asset.filename || `Media ${id}` }, id);
|
|
2728
3571
|
})
|
|
2729
3572
|
] })
|
|
2730
3573
|
] }),
|
|
2731
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2732
3575
|
"Business Schema Type",
|
|
2733
|
-
/* @__PURE__ */
|
|
3576
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.schemaType || "Store"), name: "schemaType", type: "text" })
|
|
2734
3577
|
] }),
|
|
2735
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2736
3579
|
"Business Description",
|
|
2737
|
-
/* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: String(businessProfile.description || ""), name: "businessDescription", rows: 4 })
|
|
2738
3581
|
] }),
|
|
2739
|
-
/* @__PURE__ */
|
|
3582
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2740
3583
|
"Street Address",
|
|
2741
|
-
/* @__PURE__ */
|
|
3584
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.streetAddress || ""), name: "streetAddress", type: "text" })
|
|
2742
3585
|
] }),
|
|
2743
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2744
3587
|
"City",
|
|
2745
|
-
/* @__PURE__ */
|
|
3588
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.addressLocality || ""), name: "addressLocality", type: "text" })
|
|
2746
3589
|
] }),
|
|
2747
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2748
3591
|
"State / Region",
|
|
2749
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.addressRegion || ""), name: "addressRegion", type: "text" })
|
|
2750
3593
|
] }),
|
|
2751
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2752
3595
|
"Postal Code",
|
|
2753
|
-
/* @__PURE__ */
|
|
3596
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.postalCode || ""), name: "postalCode", type: "text" })
|
|
2754
3597
|
] }),
|
|
2755
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2756
3599
|
"Country Code",
|
|
2757
|
-
/* @__PURE__ */
|
|
3600
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.addressCountry || "US"), name: "addressCountry", type: "text" })
|
|
2758
3601
|
] }),
|
|
2759
|
-
/* @__PURE__ */
|
|
3602
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2760
3603
|
"Neighborhood",
|
|
2761
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.neighborhood || ""), name: "neighborhood", type: "text" })
|
|
2762
3605
|
] }),
|
|
2763
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2764
3607
|
"Latitude",
|
|
2765
|
-
/* @__PURE__ */
|
|
3608
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.latitude || ""), name: "latitude", type: "text" })
|
|
2766
3609
|
] }),
|
|
2767
|
-
/* @__PURE__ */
|
|
3610
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2768
3611
|
"Longitude",
|
|
2769
|
-
/* @__PURE__ */
|
|
3612
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.longitude || ""), name: "longitude", type: "text" })
|
|
2770
3613
|
] }),
|
|
2771
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2772
3615
|
"Price Range",
|
|
2773
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.priceRange || ""), name: "priceRange", type: "text" })
|
|
2774
3617
|
] }),
|
|
2775
|
-
/* @__PURE__ */
|
|
3618
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2776
3619
|
"Map URL",
|
|
2777
|
-
/* @__PURE__ */
|
|
3620
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.mapUrl || ""), name: "mapUrl", type: "text" })
|
|
2778
3621
|
] }),
|
|
2779
|
-
/* @__PURE__ */
|
|
3622
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2780
3623
|
"LLM Summary",
|
|
2781
|
-
/* @__PURE__ */
|
|
3624
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: String(businessProfile.llmsSummary || ""), name: "llmsSummary", rows: 4 })
|
|
2782
3625
|
] }),
|
|
2783
|
-
/* @__PURE__ */
|
|
3626
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2784
3627
|
"Opening Hours Rows",
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: openingHoursRows, name: "openingHoursRows", rows: 4 }),
|
|
3629
|
+
/* @__PURE__ */ jsxs19("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: [
|
|
2787
3630
|
"One row per line: ",
|
|
2788
|
-
/* @__PURE__ */
|
|
3631
|
+
/* @__PURE__ */ jsx22("code", { children: "Monday,Tuesday,Wednesday|10:00|19:00" })
|
|
2789
3632
|
] })
|
|
2790
3633
|
] }),
|
|
2791
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2792
3635
|
"Citation / SameAs URLs",
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
/* @__PURE__ */
|
|
3636
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: sameAsRows, name: "sameAsRows", rows: 4 }),
|
|
3637
|
+
/* @__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
3638
|
] }),
|
|
2796
|
-
/* @__PURE__ */
|
|
3639
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2797
3640
|
"Service Schema Rows",
|
|
2798
|
-
/* @__PURE__ */
|
|
2799
|
-
/* @__PURE__ */
|
|
3641
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: serviceCatalogRows, name: "serviceCatalogRows", rows: 6 }),
|
|
3642
|
+
/* @__PURE__ */ jsxs19("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: [
|
|
2800
3643
|
"One row per line: ",
|
|
2801
|
-
/* @__PURE__ */
|
|
3644
|
+
/* @__PURE__ */ jsx22("code", { children: "Name|Description|Optional price range|/page-path" })
|
|
2802
3645
|
] })
|
|
2803
3646
|
] }),
|
|
2804
|
-
/* @__PURE__ */
|
|
3647
|
+
/* @__PURE__ */ jsx22("button", { disabled: saving, type: "submit", children: saving ? "Saving..." : "Save Global" })
|
|
2805
3648
|
] }) : null
|
|
2806
3649
|
]
|
|
2807
3650
|
}
|
|
@@ -2809,7 +3652,7 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2809
3652
|
}
|
|
2810
3653
|
|
|
2811
3654
|
// src/admin/components/studio/AdminStudioSocialMediaGlobalView.tsx
|
|
2812
|
-
import { useEffect as
|
|
3655
|
+
import { useEffect as useEffect11, useMemo as useMemo7, useState as useState12 } from "react";
|
|
2813
3656
|
|
|
2814
3657
|
// src/shared/socialMedia.ts
|
|
2815
3658
|
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
@@ -2891,7 +3734,7 @@ var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
|
2891
3734
|
);
|
|
2892
3735
|
|
|
2893
3736
|
// src/admin/components/studio/AdminStudioSocialMediaGlobalView.tsx
|
|
2894
|
-
import { jsx as
|
|
3737
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2895
3738
|
var getSocialUrlFieldName = (platform) => `social-${platform}-url`;
|
|
2896
3739
|
var getSocialIconFieldName = (platform) => `social-${platform}-icon`;
|
|
2897
3740
|
var getPropString7 = (props, key, fallback) => {
|
|
@@ -2946,12 +3789,12 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
2946
3789
|
const globalsBasePath = getPropString7(props, "globalsBasePath", "/globals");
|
|
2947
3790
|
const adminBasePath = useAdminBasePath();
|
|
2948
3791
|
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
|
-
|
|
3792
|
+
const [loading, setLoading] = useState12(true);
|
|
3793
|
+
const [saving, setSaving] = useState12(false);
|
|
3794
|
+
const [error, setError] = useState12(null);
|
|
3795
|
+
const [savedMessage, setSavedMessage] = useState12(null);
|
|
3796
|
+
const [globalData, setGlobalData] = useState12({});
|
|
3797
|
+
useEffect11(() => {
|
|
2955
3798
|
let cancelled = false;
|
|
2956
3799
|
const run = async () => {
|
|
2957
3800
|
setLoading(true);
|
|
@@ -2982,7 +3825,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
2982
3825
|
cancelled = true;
|
|
2983
3826
|
};
|
|
2984
3827
|
}, [globalSlug]);
|
|
2985
|
-
const socialProfiles =
|
|
3828
|
+
const socialProfiles = useMemo7(
|
|
2986
3829
|
() => normalizeSocialMediaProfiles(globalData.profiles),
|
|
2987
3830
|
[globalData.profiles]
|
|
2988
3831
|
);
|
|
@@ -3028,7 +3871,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3028
3871
|
setSaving(false);
|
|
3029
3872
|
}
|
|
3030
3873
|
};
|
|
3031
|
-
return /* @__PURE__ */
|
|
3874
|
+
return /* @__PURE__ */ jsx23(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs20(
|
|
3032
3875
|
AdminPage,
|
|
3033
3876
|
{
|
|
3034
3877
|
breadcrumbs: [
|
|
@@ -3039,16 +3882,16 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3039
3882
|
description: "Control which social profiles appear across the site.",
|
|
3040
3883
|
title: "Social Media",
|
|
3041
3884
|
children: [
|
|
3042
|
-
loading ? /* @__PURE__ */
|
|
3043
|
-
!loading ? /* @__PURE__ */
|
|
3044
|
-
error ? /* @__PURE__ */
|
|
3045
|
-
savedMessage ? /* @__PURE__ */
|
|
3046
|
-
/* @__PURE__ */
|
|
3885
|
+
loading ? /* @__PURE__ */ jsx23("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
3886
|
+
!loading ? /* @__PURE__ */ jsxs20("form", { className: "orion-admin-form", onSubmit: save, children: [
|
|
3887
|
+
error ? /* @__PURE__ */ jsx23("div", { className: "orion-admin-error", children: error }) : null,
|
|
3888
|
+
savedMessage ? /* @__PURE__ */ jsx23("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
3889
|
+
/* @__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
3890
|
SOCIAL_MEDIA_PLATFORMS.map((platform) => {
|
|
3048
3891
|
const profile = socialProfiles[platform];
|
|
3049
3892
|
const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
|
|
3050
3893
|
const placeholderDomain = platform === "x" ? "x.com" : `${platform}.com`;
|
|
3051
|
-
return /* @__PURE__ */
|
|
3894
|
+
return /* @__PURE__ */ jsxs20(
|
|
3052
3895
|
"fieldset",
|
|
3053
3896
|
{
|
|
3054
3897
|
style: {
|
|
@@ -3059,10 +3902,10 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3059
3902
|
padding: "0.85rem"
|
|
3060
3903
|
},
|
|
3061
3904
|
children: [
|
|
3062
|
-
/* @__PURE__ */
|
|
3063
|
-
/* @__PURE__ */
|
|
3905
|
+
/* @__PURE__ */ jsx23("legend", { style: { fontWeight: 700, padding: "0 0.3rem" }, children: platformLabel }),
|
|
3906
|
+
/* @__PURE__ */ jsxs20("label", { children: [
|
|
3064
3907
|
"Profile URL",
|
|
3065
|
-
/* @__PURE__ */
|
|
3908
|
+
/* @__PURE__ */ jsx23(
|
|
3066
3909
|
"input",
|
|
3067
3910
|
{
|
|
3068
3911
|
defaultValue: profile.url,
|
|
@@ -3073,16 +3916,16 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3073
3916
|
}
|
|
3074
3917
|
)
|
|
3075
3918
|
] }),
|
|
3076
|
-
/* @__PURE__ */
|
|
3919
|
+
/* @__PURE__ */ jsxs20("label", { children: [
|
|
3077
3920
|
"Icon Style",
|
|
3078
|
-
/* @__PURE__ */
|
|
3921
|
+
/* @__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
3922
|
] })
|
|
3080
3923
|
]
|
|
3081
3924
|
},
|
|
3082
3925
|
platform
|
|
3083
3926
|
);
|
|
3084
3927
|
}),
|
|
3085
|
-
/* @__PURE__ */
|
|
3928
|
+
/* @__PURE__ */ jsx23("button", { disabled: saving, type: "submit", children: saving ? "Saving..." : "Save Global" })
|
|
3086
3929
|
] }) : null
|
|
3087
3930
|
]
|
|
3088
3931
|
}
|
|
@@ -3090,7 +3933,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3090
3933
|
}
|
|
3091
3934
|
|
|
3092
3935
|
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
3093
|
-
import { useEffect as
|
|
3936
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useState as useState13 } from "react";
|
|
3094
3937
|
import { SetStepNav as SetStepNav2 } from "@payloadcms/ui";
|
|
3095
3938
|
|
|
3096
3939
|
// src/nextjs/utilities/socialMedia.ts
|
|
@@ -3120,7 +3963,7 @@ function resolveSocialMediaLinks(data) {
|
|
|
3120
3963
|
}
|
|
3121
3964
|
|
|
3122
3965
|
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
3123
|
-
import { jsx as
|
|
3966
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3124
3967
|
var getPropString8 = (props, key, fallback) => {
|
|
3125
3968
|
if (!props || typeof props !== "object") return fallback;
|
|
3126
3969
|
const direct = props[key];
|
|
@@ -3186,16 +4029,16 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3186
4029
|
const adminBasePath = useAdminBasePath();
|
|
3187
4030
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3188
4031
|
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
|
-
|
|
4032
|
+
const [loading, setLoading] = useState13(true);
|
|
4033
|
+
const [saving, setSaving] = useState13(false);
|
|
4034
|
+
const [error, setError] = useState13(null);
|
|
4035
|
+
const [savedMessage, setSavedMessage] = useState13(null);
|
|
4036
|
+
const [initialItems, setInitialItems] = useState13([]);
|
|
4037
|
+
const [liveItems, setLiveItems] = useState13([]);
|
|
4038
|
+
const [pages, setPages] = useState13([]);
|
|
4039
|
+
const [siteSettings, setSiteSettings] = useState13({});
|
|
4040
|
+
const [socialMedia, setSocialMedia] = useState13({});
|
|
4041
|
+
useEffect12(() => {
|
|
3199
4042
|
let cancelled = false;
|
|
3200
4043
|
const run = async () => {
|
|
3201
4044
|
setLoading(true);
|
|
@@ -3258,8 +4101,8 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3258
4101
|
cancelled = true;
|
|
3259
4102
|
};
|
|
3260
4103
|
}, [globalSlug, pagesCollectionSlug]);
|
|
3261
|
-
const pageOptions =
|
|
3262
|
-
const previewSocialLinks =
|
|
4104
|
+
const pageOptions = useMemo8(() => buildAdminPageLinkOptions(pages), [pages]);
|
|
4105
|
+
const previewSocialLinks = useMemo8(
|
|
3263
4106
|
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
3264
4107
|
label: item.label,
|
|
3265
4108
|
platform: item.platform,
|
|
@@ -3270,7 +4113,7 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3270
4113
|
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
3271
4114
|
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
3272
4115
|
const previewLogoUrl = resolveMediaURL(siteSettings.logo);
|
|
3273
|
-
const editorKey =
|
|
4116
|
+
const editorKey = useMemo8(() => JSON.stringify(initialItems), [initialItems]);
|
|
3274
4117
|
const save = async () => {
|
|
3275
4118
|
setSaving(true);
|
|
3276
4119
|
setError(null);
|
|
@@ -3304,8 +4147,8 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3304
4147
|
setSaving(false);
|
|
3305
4148
|
}
|
|
3306
4149
|
};
|
|
3307
|
-
return /* @__PURE__ */
|
|
3308
|
-
/* @__PURE__ */
|
|
4150
|
+
return /* @__PURE__ */ jsx24(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs21("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4151
|
+
/* @__PURE__ */ jsx24(
|
|
3309
4152
|
SetStepNav2,
|
|
3310
4153
|
{
|
|
3311
4154
|
nav: [
|
|
@@ -3314,13 +4157,13 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3314
4157
|
]
|
|
3315
4158
|
}
|
|
3316
4159
|
),
|
|
3317
|
-
/* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
loading ? /* @__PURE__ */
|
|
3320
|
-
error ? /* @__PURE__ */
|
|
3321
|
-
savedMessage ? /* @__PURE__ */
|
|
3322
|
-
!loading ? /* @__PURE__ */
|
|
3323
|
-
/* @__PURE__ */
|
|
4160
|
+
/* @__PURE__ */ jsx24("h1", { style: { margin: 0 }, children: "Header & Navigation" }),
|
|
4161
|
+
/* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage the main website navigation and preview it in place." }),
|
|
4162
|
+
loading ? /* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading header settings\u2026" }) : null,
|
|
4163
|
+
error ? /* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4164
|
+
savedMessage ? /* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4165
|
+
!loading ? /* @__PURE__ */ jsxs21("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4166
|
+
/* @__PURE__ */ jsx24(
|
|
3324
4167
|
HeaderNavEditorWithPreview,
|
|
3325
4168
|
{
|
|
3326
4169
|
actionHref,
|
|
@@ -3337,7 +4180,7 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3337
4180
|
},
|
|
3338
4181
|
editorKey
|
|
3339
4182
|
),
|
|
3340
|
-
/* @__PURE__ */
|
|
4183
|
+
/* @__PURE__ */ jsx24("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ jsx24(
|
|
3341
4184
|
"button",
|
|
3342
4185
|
{
|
|
3343
4186
|
disabled: saving,
|
|
@@ -3361,9 +4204,9 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3361
4204
|
}
|
|
3362
4205
|
|
|
3363
4206
|
// src/admin/components/studio/AdminStudioFooterGlobalView.tsx
|
|
3364
|
-
import { useEffect as
|
|
4207
|
+
import { useEffect as useEffect13, useMemo as useMemo9, useState as useState14 } from "react";
|
|
3365
4208
|
import { SetStepNav as SetStepNav3 } from "@payloadcms/ui";
|
|
3366
|
-
import { jsx as
|
|
4209
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3367
4210
|
var getPropString9 = (props, key, fallback) => {
|
|
3368
4211
|
if (!props || typeof props !== "object") return fallback;
|
|
3369
4212
|
const direct = props[key];
|
|
@@ -3469,18 +4312,18 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3469
4312
|
const adminBasePath = useAdminBasePath();
|
|
3470
4313
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3471
4314
|
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] =
|
|
4315
|
+
const [loading, setLoading] = useState14(true);
|
|
4316
|
+
const [saving, setSaving] = useState14(false);
|
|
4317
|
+
const [error, setError] = useState14(null);
|
|
4318
|
+
const [savedMessage, setSavedMessage] = useState14(null);
|
|
4319
|
+
const [doc, setDoc] = useState14({
|
|
3477
4320
|
contactEmail: "",
|
|
3478
4321
|
contactPhone: "",
|
|
3479
4322
|
copyright: ""
|
|
3480
4323
|
});
|
|
3481
|
-
const [siteSettings, setSiteSettings] =
|
|
3482
|
-
const [socialMedia, setSocialMedia] =
|
|
3483
|
-
|
|
4324
|
+
const [siteSettings, setSiteSettings] = useState14({});
|
|
4325
|
+
const [socialMedia, setSocialMedia] = useState14({});
|
|
4326
|
+
useEffect13(() => {
|
|
3484
4327
|
let cancelled = false;
|
|
3485
4328
|
const run = async () => {
|
|
3486
4329
|
setLoading(true);
|
|
@@ -3532,7 +4375,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3532
4375
|
cancelled = true;
|
|
3533
4376
|
};
|
|
3534
4377
|
}, [globalSlug]);
|
|
3535
|
-
const previewSocialLinks =
|
|
4378
|
+
const previewSocialLinks = useMemo9(
|
|
3536
4379
|
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
3537
4380
|
label: item.label,
|
|
3538
4381
|
platform: item.platform,
|
|
@@ -3577,8 +4420,8 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3577
4420
|
setSaving(false);
|
|
3578
4421
|
}
|
|
3579
4422
|
};
|
|
3580
|
-
return /* @__PURE__ */
|
|
3581
|
-
/* @__PURE__ */
|
|
4423
|
+
return /* @__PURE__ */ jsx25(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs22("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4424
|
+
/* @__PURE__ */ jsx25(
|
|
3582
4425
|
SetStepNav3,
|
|
3583
4426
|
{
|
|
3584
4427
|
nav: [
|
|
@@ -3587,13 +4430,13 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3587
4430
|
]
|
|
3588
4431
|
}
|
|
3589
4432
|
),
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3592
|
-
loading ? /* @__PURE__ */
|
|
3593
|
-
error ? /* @__PURE__ */
|
|
3594
|
-
savedMessage ? /* @__PURE__ */
|
|
3595
|
-
!loading ? /* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
4433
|
+
/* @__PURE__ */ jsx25("h1", { style: { margin: 0 }, children: "Footer" }),
|
|
4434
|
+
/* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage footer contact details and preview the package footer in place." }),
|
|
4435
|
+
loading ? /* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading footer settings\u2026" }) : null,
|
|
4436
|
+
error ? /* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4437
|
+
savedMessage ? /* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4438
|
+
!loading ? /* @__PURE__ */ jsxs22("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4439
|
+
/* @__PURE__ */ jsxs22(
|
|
3597
4440
|
"label",
|
|
3598
4441
|
{
|
|
3599
4442
|
style: {
|
|
@@ -3605,7 +4448,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3605
4448
|
},
|
|
3606
4449
|
children: [
|
|
3607
4450
|
"Copyright",
|
|
3608
|
-
/* @__PURE__ */
|
|
4451
|
+
/* @__PURE__ */ jsx25(
|
|
3609
4452
|
"input",
|
|
3610
4453
|
{
|
|
3611
4454
|
onChange: (event) => setDoc((current) => ({ ...current, copyright: event.target.value })),
|
|
@@ -3626,7 +4469,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3626
4469
|
]
|
|
3627
4470
|
}
|
|
3628
4471
|
),
|
|
3629
|
-
/* @__PURE__ */
|
|
4472
|
+
/* @__PURE__ */ jsxs22(
|
|
3630
4473
|
"label",
|
|
3631
4474
|
{
|
|
3632
4475
|
style: {
|
|
@@ -3638,7 +4481,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3638
4481
|
},
|
|
3639
4482
|
children: [
|
|
3640
4483
|
"Contact Email",
|
|
3641
|
-
/* @__PURE__ */
|
|
4484
|
+
/* @__PURE__ */ jsx25(
|
|
3642
4485
|
"input",
|
|
3643
4486
|
{
|
|
3644
4487
|
onChange: (event) => setDoc((current) => ({ ...current, contactEmail: event.target.value })),
|
|
@@ -3659,7 +4502,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3659
4502
|
]
|
|
3660
4503
|
}
|
|
3661
4504
|
),
|
|
3662
|
-
/* @__PURE__ */
|
|
4505
|
+
/* @__PURE__ */ jsxs22(
|
|
3663
4506
|
"label",
|
|
3664
4507
|
{
|
|
3665
4508
|
style: {
|
|
@@ -3671,7 +4514,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3671
4514
|
},
|
|
3672
4515
|
children: [
|
|
3673
4516
|
"Contact Phone",
|
|
3674
|
-
/* @__PURE__ */
|
|
4517
|
+
/* @__PURE__ */ jsx25(
|
|
3675
4518
|
"input",
|
|
3676
4519
|
{
|
|
3677
4520
|
onChange: (event) => setDoc((current) => ({ ...current, contactPhone: event.target.value })),
|
|
@@ -3692,8 +4535,8 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3692
4535
|
]
|
|
3693
4536
|
}
|
|
3694
4537
|
),
|
|
3695
|
-
/* @__PURE__ */
|
|
3696
|
-
/* @__PURE__ */
|
|
4538
|
+
/* @__PURE__ */ jsx25("div", { className: "orion-admin-preview-label", children: "Footer Preview" }),
|
|
4539
|
+
/* @__PURE__ */ jsx25("div", { className: "orion-admin-preview-frame", children: /* @__PURE__ */ jsx25("div", { className: "orion-admin-preview-surface", children: /* @__PURE__ */ jsx25(
|
|
3697
4540
|
SiteFooterPreview,
|
|
3698
4541
|
{
|
|
3699
4542
|
site: {
|
|
@@ -3712,7 +4555,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3712
4555
|
}
|
|
3713
4556
|
}
|
|
3714
4557
|
) }) }),
|
|
3715
|
-
/* @__PURE__ */
|
|
4558
|
+
/* @__PURE__ */ jsx25("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ jsx25(
|
|
3716
4559
|
"button",
|
|
3717
4560
|
{
|
|
3718
4561
|
disabled: saving,
|
|
@@ -3736,9 +4579,9 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3736
4579
|
}
|
|
3737
4580
|
|
|
3738
4581
|
// src/admin/components/studio/AdminStudioContactFormView.tsx
|
|
3739
|
-
import { useEffect as
|
|
4582
|
+
import { useEffect as useEffect14, useMemo as useMemo10, useState as useState15 } from "react";
|
|
3740
4583
|
import { SetStepNav as SetStepNav4 } from "@payloadcms/ui";
|
|
3741
|
-
import { jsx as
|
|
4584
|
+
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3742
4585
|
var defaultDoc = {
|
|
3743
4586
|
disabledMessage: "This form is temporarily unavailable. Please call us for immediate service.",
|
|
3744
4587
|
enabled: true,
|
|
@@ -3827,12 +4670,12 @@ function AdminStudioContactFormView(props) {
|
|
|
3827
4670
|
const adminBasePath = useAdminBasePath();
|
|
3828
4671
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3829
4672
|
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
|
-
|
|
4673
|
+
const [doc, setDoc] = useState15(defaultDoc);
|
|
4674
|
+
const [error, setError] = useState15(null);
|
|
4675
|
+
const [isLoading, setIsLoading] = useState15(true);
|
|
4676
|
+
const [isSaving, setIsSaving] = useState15(false);
|
|
4677
|
+
const [savedMessage, setSavedMessage] = useState15(null);
|
|
4678
|
+
useEffect14(() => {
|
|
3836
4679
|
let mounted = true;
|
|
3837
4680
|
const load = async () => {
|
|
3838
4681
|
setIsLoading(true);
|
|
@@ -3862,7 +4705,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3862
4705
|
mounted = false;
|
|
3863
4706
|
};
|
|
3864
4707
|
}, [globalSlug]);
|
|
3865
|
-
const payload =
|
|
4708
|
+
const payload = useMemo10(
|
|
3866
4709
|
() => ({
|
|
3867
4710
|
disabledMessage: doc.disabledMessage,
|
|
3868
4711
|
enabled: doc.enabled,
|
|
@@ -3899,8 +4742,8 @@ function AdminStudioContactFormView(props) {
|
|
|
3899
4742
|
setIsSaving(false);
|
|
3900
4743
|
}
|
|
3901
4744
|
};
|
|
3902
|
-
return /* @__PURE__ */
|
|
3903
|
-
/* @__PURE__ */
|
|
4745
|
+
return /* @__PURE__ */ jsx26(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs23("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4746
|
+
/* @__PURE__ */ jsx26(
|
|
3904
4747
|
SetStepNav4,
|
|
3905
4748
|
{
|
|
3906
4749
|
nav: [
|
|
@@ -3909,14 +4752,14 @@ function AdminStudioContactFormView(props) {
|
|
|
3909
4752
|
]
|
|
3910
4753
|
}
|
|
3911
4754
|
),
|
|
3912
|
-
/* @__PURE__ */
|
|
3913
|
-
/* @__PURE__ */
|
|
3914
|
-
isLoading ? /* @__PURE__ */
|
|
3915
|
-
error ? /* @__PURE__ */
|
|
3916
|
-
savedMessage ? /* @__PURE__ */
|
|
3917
|
-
!isLoading ? /* @__PURE__ */
|
|
3918
|
-
/* @__PURE__ */
|
|
3919
|
-
/* @__PURE__ */
|
|
4755
|
+
/* @__PURE__ */ jsx26("h1", { style: { margin: 0 }, children: "Contact Form" }),
|
|
4756
|
+
/* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Edit form behavior and submission messaging without leaving Studio." }),
|
|
4757
|
+
isLoading ? /* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading form settings\u2026" }) : null,
|
|
4758
|
+
error ? /* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4759
|
+
savedMessage ? /* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4760
|
+
!isLoading ? /* @__PURE__ */ jsxs23("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem", maxWidth: 900 }, children: [
|
|
4761
|
+
/* @__PURE__ */ jsxs23("label", { style: { ...fieldLabelStyle, alignItems: "center", display: "flex", gap: "0.6rem" }, children: [
|
|
4762
|
+
/* @__PURE__ */ jsx26(
|
|
3920
4763
|
"input",
|
|
3921
4764
|
{
|
|
3922
4765
|
checked: doc.enabled,
|
|
@@ -3926,9 +4769,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3926
4769
|
),
|
|
3927
4770
|
"Form enabled"
|
|
3928
4771
|
] }),
|
|
3929
|
-
/* @__PURE__ */
|
|
4772
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3930
4773
|
"Notification Email",
|
|
3931
|
-
/* @__PURE__ */
|
|
4774
|
+
/* @__PURE__ */ jsx26(
|
|
3932
4775
|
"input",
|
|
3933
4776
|
{
|
|
3934
4777
|
onChange: (event) => setDoc((prev) => ({ ...prev, notificationEmail: event.target.value })),
|
|
@@ -3938,9 +4781,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3938
4781
|
}
|
|
3939
4782
|
)
|
|
3940
4783
|
] }),
|
|
3941
|
-
/* @__PURE__ */
|
|
4784
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3942
4785
|
"Submit Button Label",
|
|
3943
|
-
/* @__PURE__ */
|
|
4786
|
+
/* @__PURE__ */ jsx26(
|
|
3944
4787
|
"input",
|
|
3945
4788
|
{
|
|
3946
4789
|
onChange: (event) => setDoc((prev) => ({ ...prev, submitButtonLabel: event.target.value })),
|
|
@@ -3950,9 +4793,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3950
4793
|
}
|
|
3951
4794
|
)
|
|
3952
4795
|
] }),
|
|
3953
|
-
/* @__PURE__ */
|
|
4796
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3954
4797
|
"Success Message",
|
|
3955
|
-
/* @__PURE__ */
|
|
4798
|
+
/* @__PURE__ */ jsx26(
|
|
3956
4799
|
"input",
|
|
3957
4800
|
{
|
|
3958
4801
|
onChange: (event) => setDoc((prev) => ({ ...prev, successMessage: event.target.value })),
|
|
@@ -3962,9 +4805,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3962
4805
|
}
|
|
3963
4806
|
)
|
|
3964
4807
|
] }),
|
|
3965
|
-
/* @__PURE__ */
|
|
4808
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3966
4809
|
"Error Message",
|
|
3967
|
-
/* @__PURE__ */
|
|
4810
|
+
/* @__PURE__ */ jsx26(
|
|
3968
4811
|
"input",
|
|
3969
4812
|
{
|
|
3970
4813
|
onChange: (event) => setDoc((prev) => ({ ...prev, errorMessage: event.target.value })),
|
|
@@ -3974,9 +4817,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3974
4817
|
}
|
|
3975
4818
|
)
|
|
3976
4819
|
] }),
|
|
3977
|
-
/* @__PURE__ */
|
|
4820
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3978
4821
|
"Disabled Message",
|
|
3979
|
-
/* @__PURE__ */
|
|
4822
|
+
/* @__PURE__ */ jsx26(
|
|
3980
4823
|
"input",
|
|
3981
4824
|
{
|
|
3982
4825
|
onChange: (event) => setDoc((prev) => ({ ...prev, disabledMessage: event.target.value })),
|
|
@@ -3986,7 +4829,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3986
4829
|
}
|
|
3987
4830
|
)
|
|
3988
4831
|
] }),
|
|
3989
|
-
/* @__PURE__ */
|
|
4832
|
+
/* @__PURE__ */ jsxs23(
|
|
3990
4833
|
"div",
|
|
3991
4834
|
{
|
|
3992
4835
|
style: {
|
|
@@ -3996,9 +4839,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3996
4839
|
padding: "0.85rem"
|
|
3997
4840
|
},
|
|
3998
4841
|
children: [
|
|
3999
|
-
/* @__PURE__ */
|
|
4000
|
-
/* @__PURE__ */
|
|
4001
|
-
/* @__PURE__ */
|
|
4842
|
+
/* @__PURE__ */ jsx26("div", { style: { fontWeight: 900, marginBottom: "0.65rem" }, children: "Service Options" }),
|
|
4843
|
+
/* @__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: [
|
|
4844
|
+
/* @__PURE__ */ jsx26(
|
|
4002
4845
|
"input",
|
|
4003
4846
|
{
|
|
4004
4847
|
onChange: (event) => setDoc((prev) => ({
|
|
@@ -4012,7 +4855,7 @@ function AdminStudioContactFormView(props) {
|
|
|
4012
4855
|
value: option.label
|
|
4013
4856
|
}
|
|
4014
4857
|
),
|
|
4015
|
-
/* @__PURE__ */
|
|
4858
|
+
/* @__PURE__ */ jsx26(
|
|
4016
4859
|
"button",
|
|
4017
4860
|
{
|
|
4018
4861
|
onClick: () => setDoc((prev) => ({
|
|
@@ -4025,7 +4868,7 @@ function AdminStudioContactFormView(props) {
|
|
|
4025
4868
|
}
|
|
4026
4869
|
)
|
|
4027
4870
|
] }, `${index}-${option.label}`)) }),
|
|
4028
|
-
/* @__PURE__ */
|
|
4871
|
+
/* @__PURE__ */ jsx26(
|
|
4029
4872
|
"button",
|
|
4030
4873
|
{
|
|
4031
4874
|
onClick: () => setDoc((prev) => ({
|
|
@@ -4040,9 +4883,9 @@ function AdminStudioContactFormView(props) {
|
|
|
4040
4883
|
]
|
|
4041
4884
|
}
|
|
4042
4885
|
),
|
|
4043
|
-
/* @__PURE__ */
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
/* @__PURE__ */
|
|
4886
|
+
/* @__PURE__ */ jsxs23("div", { style: { display: "flex", gap: "0.6rem" }, children: [
|
|
4887
|
+
/* @__PURE__ */ jsx26("button", { disabled: isSaving, onClick: () => void save(), style: buttonStyle, type: "button", children: isSaving ? "Saving\u2026" : "Save Form Settings" }),
|
|
4888
|
+
/* @__PURE__ */ jsx26(
|
|
4046
4889
|
"a",
|
|
4047
4890
|
{
|
|
4048
4891
|
href: rawGlobalPath,
|
|
@@ -4062,8 +4905,8 @@ function AdminStudioContactFormView(props) {
|
|
|
4062
4905
|
}
|
|
4063
4906
|
|
|
4064
4907
|
// src/admin/components/studio/AdminStudioMediaView.tsx
|
|
4065
|
-
import { useEffect as
|
|
4066
|
-
import { jsx as
|
|
4908
|
+
import { useEffect as useEffect15, useMemo as useMemo11, useState as useState16 } from "react";
|
|
4909
|
+
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4067
4910
|
var MEDIA_LIBRARY_SYNC_EVENT = "orion-media-library-updated";
|
|
4068
4911
|
var getPropString11 = (props, key, fallback) => {
|
|
4069
4912
|
if (!props || typeof props !== "object") return fallback;
|
|
@@ -4079,10 +4922,10 @@ var getPropString11 = (props, key, fallback) => {
|
|
|
4079
4922
|
function AdminStudioMediaView(props) {
|
|
4080
4923
|
const mediaCollectionSlug = getPropString11(props, "mediaCollectionSlug", "media");
|
|
4081
4924
|
const adminBasePath = useAdminBasePath();
|
|
4082
|
-
const [docs, setDocs] =
|
|
4083
|
-
const [loading, setLoading] =
|
|
4084
|
-
const [error, setError] =
|
|
4085
|
-
const apiURL =
|
|
4925
|
+
const [docs, setDocs] = useState16([]);
|
|
4926
|
+
const [loading, setLoading] = useState16(true);
|
|
4927
|
+
const [error, setError] = useState16(null);
|
|
4928
|
+
const apiURL = useMemo11(() => {
|
|
4086
4929
|
const params = new URLSearchParams({
|
|
4087
4930
|
depth: "0",
|
|
4088
4931
|
draft: "true",
|
|
@@ -4091,7 +4934,7 @@ function AdminStudioMediaView(props) {
|
|
|
4091
4934
|
});
|
|
4092
4935
|
return `/api/${mediaCollectionSlug}?${params.toString()}`;
|
|
4093
4936
|
}, [mediaCollectionSlug]);
|
|
4094
|
-
|
|
4937
|
+
useEffect15(() => {
|
|
4095
4938
|
let cancelled = false;
|
|
4096
4939
|
const run = async () => {
|
|
4097
4940
|
setLoading(true);
|
|
@@ -4127,7 +4970,7 @@ function AdminStudioMediaView(props) {
|
|
|
4127
4970
|
window.removeEventListener("storage", rerun);
|
|
4128
4971
|
};
|
|
4129
4972
|
}, [apiURL]);
|
|
4130
|
-
return /* @__PURE__ */
|
|
4973
|
+
return /* @__PURE__ */ jsx27(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs24(
|
|
4131
4974
|
AdminPage,
|
|
4132
4975
|
{
|
|
4133
4976
|
breadcrumbs: [
|
|
@@ -4137,18 +4980,18 @@ function AdminStudioMediaView(props) {
|
|
|
4137
4980
|
description: `${docs.length} asset${docs.length === 1 ? "" : "s"} \u2014 Upload assets here, including logos used in Site Settings branding.`,
|
|
4138
4981
|
title: "Media",
|
|
4139
4982
|
children: [
|
|
4140
|
-
/* @__PURE__ */
|
|
4141
|
-
loading ? /* @__PURE__ */
|
|
4142
|
-
error ? /* @__PURE__ */
|
|
4143
|
-
/* @__PURE__ */
|
|
4144
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */
|
|
4145
|
-
/* @__PURE__ */
|
|
4146
|
-
/* @__PURE__ */
|
|
4983
|
+
/* @__PURE__ */ jsx27(MediaUploadForm, {}),
|
|
4984
|
+
loading ? /* @__PURE__ */ jsx27("div", { className: "orion-admin-list-meta", style: { marginTop: "1rem" }, children: "Loading..." }) : null,
|
|
4985
|
+
error ? /* @__PURE__ */ jsx27("div", { className: "orion-admin-error", style: { marginTop: "1rem" }, children: error }) : null,
|
|
4986
|
+
/* @__PURE__ */ jsxs24("div", { className: "orion-admin-list", style: { marginTop: "1rem" }, children: [
|
|
4987
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ jsxs24("div", { className: "orion-admin-card", children: [
|
|
4988
|
+
/* @__PURE__ */ jsx27("strong", { children: "No media found" }),
|
|
4989
|
+
/* @__PURE__ */ jsx27("span", { children: "Upload an image to get started." })
|
|
4147
4990
|
] }) : null,
|
|
4148
4991
|
docs.map((doc) => {
|
|
4149
4992
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
4150
4993
|
if (!id) return null;
|
|
4151
|
-
return /* @__PURE__ */
|
|
4994
|
+
return /* @__PURE__ */ jsx27(
|
|
4152
4995
|
MediaListItem,
|
|
4153
4996
|
{
|
|
4154
4997
|
alt: doc.alt,
|
|
@@ -4171,8 +5014,8 @@ function AdminStudioMediaView(props) {
|
|
|
4171
5014
|
}
|
|
4172
5015
|
|
|
4173
5016
|
// src/admin/components/studio/AdminStudioMediaItemView.tsx
|
|
4174
|
-
import { useEffect as
|
|
4175
|
-
import { jsx as
|
|
5017
|
+
import { useEffect as useEffect16, useMemo as useMemo12, useState as useState17 } from "react";
|
|
5018
|
+
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4176
5019
|
var getPropString12 = (props, key, fallback) => {
|
|
4177
5020
|
if (!props || typeof props !== "object") return fallback;
|
|
4178
5021
|
const direct = props[key];
|
|
@@ -4202,13 +5045,13 @@ function AdminStudioMediaItemView(props) {
|
|
|
4202
5045
|
const mediaCollectionSlug = getPropString12(props, "mediaCollectionSlug", "media");
|
|
4203
5046
|
const adminBasePath = useAdminBasePath();
|
|
4204
5047
|
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
|
-
|
|
5048
|
+
const mediaIDFromParams = useMemo12(() => getParam2(props.params, "id"), [props.params]);
|
|
5049
|
+
const [mediaID, setMediaID] = useState17(mediaIDFromParams);
|
|
5050
|
+
const [doc, setDoc] = useState17(null);
|
|
5051
|
+
const [loading, setLoading] = useState17(true);
|
|
5052
|
+
const [error, setError] = useState17(null);
|
|
5053
|
+
const [savedMessage, setSavedMessage] = useState17(null);
|
|
5054
|
+
useEffect16(() => {
|
|
4212
5055
|
if (mediaIDFromParams) {
|
|
4213
5056
|
setMediaID(mediaIDFromParams);
|
|
4214
5057
|
return;
|
|
@@ -4236,7 +5079,7 @@ function AdminStudioMediaItemView(props) {
|
|
|
4236
5079
|
setLoading(false);
|
|
4237
5080
|
}
|
|
4238
5081
|
};
|
|
4239
|
-
|
|
5082
|
+
useEffect16(() => {
|
|
4240
5083
|
if (!mediaID) return;
|
|
4241
5084
|
void loadDoc(mediaID);
|
|
4242
5085
|
}, [mediaCollectionSlug, mediaID]);
|
|
@@ -4282,7 +5125,7 @@ function AdminStudioMediaItemView(props) {
|
|
|
4282
5125
|
setError(deleteError instanceof Error ? deleteError.message : "Failed to delete media item.");
|
|
4283
5126
|
}
|
|
4284
5127
|
};
|
|
4285
|
-
return /* @__PURE__ */
|
|
5128
|
+
return /* @__PURE__ */ jsx28(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs25(
|
|
4286
5129
|
AdminPage,
|
|
4287
5130
|
{
|
|
4288
5131
|
breadcrumbs: [
|
|
@@ -4293,10 +5136,10 @@ function AdminStudioMediaItemView(props) {
|
|
|
4293
5136
|
description: "Update metadata or remove the selected asset.",
|
|
4294
5137
|
title: "Media Asset",
|
|
4295
5138
|
children: [
|
|
4296
|
-
loading ? /* @__PURE__ */
|
|
4297
|
-
error ? /* @__PURE__ */
|
|
4298
|
-
savedMessage ? /* @__PURE__ */
|
|
4299
|
-
!loading && !error && doc && mediaID ? /* @__PURE__ */
|
|
5139
|
+
loading ? /* @__PURE__ */ jsx28("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5140
|
+
error ? /* @__PURE__ */ jsx28("div", { className: "orion-admin-error", children: error }) : null,
|
|
5141
|
+
savedMessage ? /* @__PURE__ */ jsx28("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
5142
|
+
!loading && !error && doc && mediaID ? /* @__PURE__ */ jsx28(
|
|
4300
5143
|
MediaDetailPanel,
|
|
4301
5144
|
{
|
|
4302
5145
|
alt: doc.alt,
|
|
@@ -4319,9 +5162,9 @@ function AdminStudioMediaItemView(props) {
|
|
|
4319
5162
|
|
|
4320
5163
|
// src/admin/components/studio/AdminStudioFormsView.tsx
|
|
4321
5164
|
import Link3 from "next/link";
|
|
4322
|
-
import { useEffect as
|
|
5165
|
+
import { useEffect as useEffect17, useMemo as useMemo13, useState as useState18 } from "react";
|
|
4323
5166
|
import { useAuth as useAuth6 } from "@payloadcms/ui";
|
|
4324
|
-
import { jsx as
|
|
5167
|
+
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4325
5168
|
var FORM_TONES = [
|
|
4326
5169
|
{
|
|
4327
5170
|
accent: "var(--orion-cms-tone-1, var(--orion-cms-accent, var(--orion-admin-accent)))",
|
|
@@ -4372,7 +5215,7 @@ var isEditor2 = (user) => {
|
|
|
4372
5215
|
const role = user.role;
|
|
4373
5216
|
return typeof role === "string" && role === "editor";
|
|
4374
5217
|
};
|
|
4375
|
-
var
|
|
5218
|
+
var canReviewForms2 = (user) => isAdmin3(user) || isEditor2(user);
|
|
4376
5219
|
var getPropString13 = (props, key, fallback) => {
|
|
4377
5220
|
if (!props || typeof props !== "object") return fallback;
|
|
4378
5221
|
const direct = props[key];
|
|
@@ -4401,7 +5244,7 @@ var getFieldCount = (form) => Array.isArray(form.steps) ? form.steps.reduce((cou
|
|
|
4401
5244
|
const fields = step.fields;
|
|
4402
5245
|
return count + (Array.isArray(fields) ? fields.length : 0);
|
|
4403
5246
|
}, 0) : 0;
|
|
4404
|
-
var
|
|
5247
|
+
var getFormID2 = (value) => {
|
|
4405
5248
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
4406
5249
|
if (value && typeof value === "object") {
|
|
4407
5250
|
const id = value.id;
|
|
@@ -4522,7 +5365,7 @@ var getSecondaryIdentity = (identity, previewFields, uploads) => {
|
|
|
4522
5365
|
if (identity.email) return "Email response";
|
|
4523
5366
|
return "Response preview unavailable";
|
|
4524
5367
|
};
|
|
4525
|
-
var
|
|
5368
|
+
var loadCollection2 = async (slug, params) => {
|
|
4526
5369
|
const response = await fetch(`/api/${slug}?${params.toString()}`, {
|
|
4527
5370
|
credentials: "include"
|
|
4528
5371
|
});
|
|
@@ -4533,9 +5376,9 @@ var loadCollection = async (slug, params) => {
|
|
|
4533
5376
|
const payload = await response.json();
|
|
4534
5377
|
return Array.isArray(payload.docs) ? payload.docs : [];
|
|
4535
5378
|
};
|
|
4536
|
-
var renderEmptyMessage = (message) => /* @__PURE__ */
|
|
4537
|
-
/* @__PURE__ */
|
|
4538
|
-
/* @__PURE__ */
|
|
5379
|
+
var renderEmptyMessage = (message) => /* @__PURE__ */ jsxs26("div", { className: "orion-admin-empty-state", children: [
|
|
5380
|
+
/* @__PURE__ */ jsx29("strong", { children: "No responses yet" }),
|
|
5381
|
+
/* @__PURE__ */ jsx29("span", { children: message })
|
|
4539
5382
|
] });
|
|
4540
5383
|
function AdminStudioFormsView(props) {
|
|
4541
5384
|
const { user } = useAuth6();
|
|
@@ -4553,12 +5396,12 @@ function AdminStudioFormsView(props) {
|
|
|
4553
5396
|
`/collections/${formSubmissionsCollectionSlug}`
|
|
4554
5397
|
);
|
|
4555
5398
|
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 (!
|
|
5399
|
+
const [forms, setForms] = useState18([]);
|
|
5400
|
+
const [submissions, setSubmissions] = useState18([]);
|
|
5401
|
+
const [loading, setLoading] = useState18(true);
|
|
5402
|
+
const [error, setError] = useState18(null);
|
|
5403
|
+
useEffect17(() => {
|
|
5404
|
+
if (!canReviewForms2(user)) {
|
|
4562
5405
|
return;
|
|
4563
5406
|
}
|
|
4564
5407
|
let cancelled = false;
|
|
@@ -4577,8 +5420,8 @@ function AdminStudioFormsView(props) {
|
|
|
4577
5420
|
sort: "-submittedAt"
|
|
4578
5421
|
});
|
|
4579
5422
|
const [nextForms, nextSubmissions] = await Promise.all([
|
|
4580
|
-
|
|
4581
|
-
|
|
5423
|
+
loadCollection2(formsCollectionSlug, formsParams),
|
|
5424
|
+
loadCollection2(formSubmissionsCollectionSlug, submissionsParams)
|
|
4582
5425
|
]);
|
|
4583
5426
|
if (cancelled) return;
|
|
4584
5427
|
setForms(nextForms);
|
|
@@ -4598,10 +5441,10 @@ function AdminStudioFormsView(props) {
|
|
|
4598
5441
|
cancelled = true;
|
|
4599
5442
|
};
|
|
4600
5443
|
}, [formSubmissionsCollectionSlug, formsCollectionSlug, user]);
|
|
4601
|
-
const submissionsByForm =
|
|
5444
|
+
const submissionsByForm = useMemo13(() => {
|
|
4602
5445
|
const map = /* @__PURE__ */ new Map();
|
|
4603
5446
|
for (const submission of submissions) {
|
|
4604
|
-
const formID =
|
|
5447
|
+
const formID = getFormID2(submission.form);
|
|
4605
5448
|
if (!formID) continue;
|
|
4606
5449
|
const current = map.get(formID) || [];
|
|
4607
5450
|
current.push(submission);
|
|
@@ -4609,7 +5452,7 @@ function AdminStudioFormsView(props) {
|
|
|
4609
5452
|
}
|
|
4610
5453
|
return map;
|
|
4611
5454
|
}, [submissions]);
|
|
4612
|
-
const busiestForm =
|
|
5455
|
+
const busiestForm = useMemo13(
|
|
4613
5456
|
() => forms.reduce((current, form) => {
|
|
4614
5457
|
const title = typeof form.title === "string" && form.title.trim().length > 0 ? form.title : "Untitled Form";
|
|
4615
5458
|
const count = (typeof form.id === "string" || typeof form.id === "number" ? submissionsByForm.get(String(form.id)) : null)?.length || 0;
|
|
@@ -4620,8 +5463,8 @@ function AdminStudioFormsView(props) {
|
|
|
4620
5463
|
}, null),
|
|
4621
5464
|
[forms, submissionsByForm]
|
|
4622
5465
|
);
|
|
4623
|
-
if (!
|
|
4624
|
-
return /* @__PURE__ */
|
|
5466
|
+
if (!canReviewForms2(user)) {
|
|
5467
|
+
return /* @__PURE__ */ jsx29(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx29(
|
|
4625
5468
|
AdminPage,
|
|
4626
5469
|
{
|
|
4627
5470
|
breadcrumbs: [
|
|
@@ -4630,14 +5473,14 @@ function AdminStudioFormsView(props) {
|
|
|
4630
5473
|
],
|
|
4631
5474
|
description: "You do not have access to this section.",
|
|
4632
5475
|
title: "Forms",
|
|
4633
|
-
children: /* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
4635
|
-
/* @__PURE__ */
|
|
5476
|
+
children: /* @__PURE__ */ jsxs26("div", { className: "orion-admin-card", children: [
|
|
5477
|
+
/* @__PURE__ */ jsx29("strong", { children: "Access denied" }),
|
|
5478
|
+
/* @__PURE__ */ jsx29("span", { children: "This section is restricted to editor and administrator accounts." })
|
|
4636
5479
|
] })
|
|
4637
5480
|
}
|
|
4638
5481
|
) });
|
|
4639
5482
|
}
|
|
4640
|
-
return /* @__PURE__ */
|
|
5483
|
+
return /* @__PURE__ */ jsx29(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs26(
|
|
4641
5484
|
AdminPage,
|
|
4642
5485
|
{
|
|
4643
5486
|
breadcrumbs: [
|
|
@@ -4647,30 +5490,30 @@ function AdminStudioFormsView(props) {
|
|
|
4647
5490
|
description: "Review live forms, recent responses, and uploaded files.",
|
|
4648
5491
|
title: "Forms",
|
|
4649
5492
|
children: [
|
|
4650
|
-
loading ? /* @__PURE__ */
|
|
4651
|
-
error ? /* @__PURE__ */
|
|
4652
|
-
!loading && !error ? /* @__PURE__ */
|
|
4653
|
-
/* @__PURE__ */
|
|
4654
|
-
/* @__PURE__ */
|
|
4655
|
-
/* @__PURE__ */
|
|
4656
|
-
/* @__PURE__ */
|
|
4657
|
-
/* @__PURE__ */
|
|
5493
|
+
loading ? /* @__PURE__ */ jsx29("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5494
|
+
error ? /* @__PURE__ */ jsx29("div", { className: "orion-admin-error", children: error }) : null,
|
|
5495
|
+
!loading && !error ? /* @__PURE__ */ jsxs26("div", { className: "orion-admin-forms-dashboard", children: [
|
|
5496
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-forms-summary-grid", children: [
|
|
5497
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-overview-stat", children: [
|
|
5498
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-overview-stat-label", children: "Configured forms" }),
|
|
5499
|
+
/* @__PURE__ */ jsx29("strong", { children: forms.length }),
|
|
5500
|
+
/* @__PURE__ */ jsx29("p", { children: "Published or draft forms currently available inside the CMS." })
|
|
4658
5501
|
] }),
|
|
4659
|
-
/* @__PURE__ */
|
|
4660
|
-
/* @__PURE__ */
|
|
4661
|
-
/* @__PURE__ */
|
|
4662
|
-
/* @__PURE__ */
|
|
5502
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-overview-stat", children: [
|
|
5503
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-overview-stat-label", children: "Recent submissions" }),
|
|
5504
|
+
/* @__PURE__ */ jsx29("strong", { children: submissions.length }),
|
|
5505
|
+
/* @__PURE__ */ jsx29("p", { children: "Latest 200 responses collected across every form." })
|
|
4663
5506
|
] }),
|
|
4664
|
-
/* @__PURE__ */
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4667
|
-
/* @__PURE__ */
|
|
5507
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-overview-stat", children: [
|
|
5508
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-overview-stat-label", children: "Most active form" }),
|
|
5509
|
+
/* @__PURE__ */ jsx29("strong", { children: busiestForm && busiestForm.count > 0 ? busiestForm.title : "No activity yet" }),
|
|
5510
|
+
/* @__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
5511
|
] })
|
|
4669
5512
|
] }),
|
|
4670
|
-
forms.length === 0 ? /* @__PURE__ */
|
|
4671
|
-
/* @__PURE__ */
|
|
4672
|
-
/* @__PURE__ */
|
|
4673
|
-
] }) : /* @__PURE__ */
|
|
5513
|
+
forms.length === 0 ? /* @__PURE__ */ jsxs26("div", { className: "orion-admin-card", children: [
|
|
5514
|
+
/* @__PURE__ */ jsx29("strong", { children: "No forms found" }),
|
|
5515
|
+
/* @__PURE__ */ jsx29("span", { children: "Create a form in Payload to start collecting responses." })
|
|
5516
|
+
] }) : /* @__PURE__ */ jsx29("div", { className: "orion-admin-forms-board-list", children: forms.map((form) => {
|
|
4674
5517
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
4675
5518
|
if (!id) return null;
|
|
4676
5519
|
const title = typeof form.title === "string" && form.title.trim().length > 0 ? form.title : "Untitled Form";
|
|
@@ -4685,30 +5528,30 @@ function AdminStudioFormsView(props) {
|
|
|
4685
5528
|
const updatedMeta = form.updatedAt ? `Updated ${formatDate(form.updatedAt)}` : "Update time unavailable";
|
|
4686
5529
|
const toneStyle = getFormToneStyle(slug, title || id);
|
|
4687
5530
|
const isResponsePanelScrollable = formSubmissions.length > RESPONSE_SCROLL_THRESHOLD;
|
|
4688
|
-
return /* @__PURE__ */
|
|
4689
|
-
/* @__PURE__ */
|
|
4690
|
-
/* @__PURE__ */
|
|
4691
|
-
/* @__PURE__ */
|
|
4692
|
-
/* @__PURE__ */
|
|
4693
|
-
/* @__PURE__ */
|
|
5531
|
+
return /* @__PURE__ */ jsxs26("section", { className: "orion-admin-form-board", style: toneStyle, children: [
|
|
5532
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-header", children: [
|
|
5533
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-heading", children: [
|
|
5534
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-kicker-row", children: [
|
|
5535
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-board-kicker", children: slug || "No slug set" }),
|
|
5536
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-board-meta", children: updatedMeta })
|
|
4694
5537
|
] }),
|
|
4695
|
-
/* @__PURE__ */
|
|
4696
|
-
/* @__PURE__ */
|
|
4697
|
-
/* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
/* @__PURE__ */
|
|
5538
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-title-row", children: [
|
|
5539
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-form-board-mark", children: getInitials(title, slug) }),
|
|
5540
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-copy", children: [
|
|
5541
|
+
/* @__PURE__ */ jsx29("h2", { className: "orion-admin-form-board-title", children: title }),
|
|
5542
|
+
/* @__PURE__ */ jsx29("p", { className: "orion-admin-form-board-subtitle", children: latestResponse ? `Latest response ${latestResponseLabel}` : "Awaiting the first submission" })
|
|
4700
5543
|
] })
|
|
4701
5544
|
] })
|
|
4702
5545
|
] }),
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
/* @__PURE__ */
|
|
4706
|
-
/* @__PURE__ */
|
|
5546
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-actions", children: [
|
|
5547
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-count", children: [
|
|
5548
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-board-count-value", children: formSubmissions.length }),
|
|
5549
|
+
/* @__PURE__ */ jsxs26("span", { className: "orion-admin-form-board-count-label", children: [
|
|
4707
5550
|
"response",
|
|
4708
5551
|
formSubmissions.length === 1 ? "" : "s"
|
|
4709
5552
|
] })
|
|
4710
5553
|
] }),
|
|
4711
|
-
/* @__PURE__ */
|
|
5554
|
+
/* @__PURE__ */ jsx29(
|
|
4712
5555
|
Link3,
|
|
4713
5556
|
{
|
|
4714
5557
|
className: "orion-admin-action-button orion-admin-action-button--soft",
|
|
@@ -4718,35 +5561,35 @@ function AdminStudioFormsView(props) {
|
|
|
4718
5561
|
)
|
|
4719
5562
|
] })
|
|
4720
5563
|
] }),
|
|
4721
|
-
/* @__PURE__ */
|
|
4722
|
-
/* @__PURE__ */
|
|
4723
|
-
/* @__PURE__ */
|
|
4724
|
-
/* @__PURE__ */
|
|
5564
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-metrics", children: [
|
|
5565
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5566
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Workflow steps" }),
|
|
5567
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value", children: stepCount })
|
|
4725
5568
|
] }),
|
|
4726
|
-
/* @__PURE__ */
|
|
4727
|
-
/* @__PURE__ */
|
|
4728
|
-
/* @__PURE__ */
|
|
5569
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5570
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Fields" }),
|
|
5571
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value", children: fieldCount })
|
|
4729
5572
|
] }),
|
|
4730
|
-
/* @__PURE__ */
|
|
4731
|
-
/* @__PURE__ */
|
|
4732
|
-
/* @__PURE__ */
|
|
5573
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5574
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Submit button" }),
|
|
5575
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value is-copy", children: submitLabel })
|
|
4733
5576
|
] }),
|
|
4734
|
-
/* @__PURE__ */
|
|
4735
|
-
/* @__PURE__ */
|
|
4736
|
-
/* @__PURE__ */
|
|
5577
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5578
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Latest response" }),
|
|
5579
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value is-copy", children: latestResponseLabel })
|
|
4737
5580
|
] })
|
|
4738
5581
|
] }),
|
|
4739
|
-
/* @__PURE__ */
|
|
4740
|
-
/* @__PURE__ */
|
|
4741
|
-
/* @__PURE__ */
|
|
4742
|
-
/* @__PURE__ */
|
|
4743
|
-
/* @__PURE__ */
|
|
5582
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-response-panel", children: [
|
|
5583
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-response-panel-header", children: [
|
|
5584
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
5585
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-section-label", children: "Response stream" }),
|
|
5586
|
+
/* @__PURE__ */ jsx29("strong", { children: formSubmissions.length > 0 ? `${formSubmissions.length} recent submission${formSubmissions.length === 1 ? "" : "s"}` : "No responses yet" })
|
|
4744
5587
|
] }),
|
|
4745
|
-
isResponsePanelScrollable ? /* @__PURE__ */
|
|
5588
|
+
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
5589
|
] }),
|
|
4747
5590
|
formSubmissions.length === 0 ? renderEmptyMessage(
|
|
4748
5591
|
"This form will start filling this lane as soon as the first submission arrives."
|
|
4749
|
-
) : /* @__PURE__ */
|
|
5592
|
+
) : /* @__PURE__ */ jsx29(
|
|
4750
5593
|
"div",
|
|
4751
5594
|
{
|
|
4752
5595
|
className: [
|
|
@@ -4770,33 +5613,33 @@ function AdminStudioFormsView(props) {
|
|
|
4770
5613
|
);
|
|
4771
5614
|
const visibleUploads = uploads.slice(0, 2);
|
|
4772
5615
|
const hiddenUploadCount = uploads.length - visibleUploads.length;
|
|
4773
|
-
return /* @__PURE__ */
|
|
5616
|
+
return /* @__PURE__ */ jsxs26(
|
|
4774
5617
|
"article",
|
|
4775
5618
|
{
|
|
4776
5619
|
className: "orion-admin-response-card",
|
|
4777
5620
|
children: [
|
|
4778
|
-
/* @__PURE__ */
|
|
4779
|
-
/* @__PURE__ */
|
|
4780
|
-
/* @__PURE__ */
|
|
4781
|
-
/* @__PURE__ */
|
|
4782
|
-
/* @__PURE__ */
|
|
4783
|
-
/* @__PURE__ */
|
|
5621
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-card-main", children: [
|
|
5622
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-card-top", children: [
|
|
5623
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-response-badge", children: getInitials(identity.name, identity.email, title) }),
|
|
5624
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-heading", children: [
|
|
5625
|
+
/* @__PURE__ */ jsx29("strong", { children: primaryIdentity }),
|
|
5626
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-response-secondary", children: secondaryIdentity })
|
|
4784
5627
|
] }),
|
|
4785
|
-
/* @__PURE__ */
|
|
5628
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-response-date", children: formatDate(submission.submittedAt) })
|
|
4786
5629
|
] }),
|
|
4787
|
-
previewFields.length > 0 ? /* @__PURE__ */
|
|
5630
|
+
previewFields.length > 0 ? /* @__PURE__ */ jsx29("div", { className: "orion-admin-response-chip-row", children: previewFields.map((field, index) => /* @__PURE__ */ jsxs26(
|
|
4788
5631
|
"div",
|
|
4789
5632
|
{
|
|
4790
5633
|
className: "orion-admin-response-chip",
|
|
4791
5634
|
children: [
|
|
4792
|
-
/* @__PURE__ */
|
|
4793
|
-
/* @__PURE__ */
|
|
5635
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-response-chip-label", children: field.label }),
|
|
5636
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-response-chip-value", children: field.value })
|
|
4794
5637
|
]
|
|
4795
5638
|
},
|
|
4796
5639
|
`${submissionID}-${field.label}-${index}`
|
|
4797
|
-
)) }) : /* @__PURE__ */
|
|
4798
|
-
uploads.length > 0 ? /* @__PURE__ */
|
|
4799
|
-
/* @__PURE__ */
|
|
5640
|
+
)) }) : /* @__PURE__ */ jsx29("div", { className: "orion-admin-response-empty", children: "No preview fields are available for this submission." }),
|
|
5641
|
+
uploads.length > 0 ? /* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-upload-row", children: [
|
|
5642
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-upload-label", children: "Uploads" }),
|
|
4800
5643
|
visibleUploads.map((upload) => {
|
|
4801
5644
|
const uploadID = typeof upload.id === "string" || typeof upload.id === "number" ? String(upload.id) : "";
|
|
4802
5645
|
if (!uploadID) return null;
|
|
@@ -4810,7 +5653,7 @@ function AdminStudioFormsView(props) {
|
|
|
4810
5653
|
),
|
|
4811
5654
|
38
|
|
4812
5655
|
);
|
|
4813
|
-
return /* @__PURE__ */
|
|
5656
|
+
return /* @__PURE__ */ jsx29(
|
|
4814
5657
|
Link3,
|
|
4815
5658
|
{
|
|
4816
5659
|
className: "orion-admin-upload-chip",
|
|
@@ -4820,14 +5663,14 @@ function AdminStudioFormsView(props) {
|
|
|
4820
5663
|
uploadID
|
|
4821
5664
|
);
|
|
4822
5665
|
}),
|
|
4823
|
-
hiddenUploadCount > 0 ? /* @__PURE__ */
|
|
5666
|
+
hiddenUploadCount > 0 ? /* @__PURE__ */ jsxs26("span", { className: "orion-admin-upload-chip is-passive", children: [
|
|
4824
5667
|
"+",
|
|
4825
5668
|
hiddenUploadCount,
|
|
4826
5669
|
" more"
|
|
4827
5670
|
] }) : null
|
|
4828
5671
|
] }) : null
|
|
4829
5672
|
] }),
|
|
4830
|
-
/* @__PURE__ */
|
|
5673
|
+
/* @__PURE__ */ jsx29(
|
|
4831
5674
|
Link3,
|
|
4832
5675
|
{
|
|
4833
5676
|
className: "orion-admin-action-button orion-admin-action-button--ghost",
|
|
@@ -4852,9 +5695,9 @@ function AdminStudioFormsView(props) {
|
|
|
4852
5695
|
}
|
|
4853
5696
|
|
|
4854
5697
|
// src/admin/components/studio/AdminStudioToolsView.tsx
|
|
4855
|
-
import { useEffect as
|
|
5698
|
+
import { useEffect as useEffect18, useState as useState19 } from "react";
|
|
4856
5699
|
import { useAuth as useAuth7 } from "@payloadcms/ui";
|
|
4857
|
-
import { jsx as
|
|
5700
|
+
import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4858
5701
|
var userRoles = ["admin", "client", "editor"];
|
|
4859
5702
|
var isAdmin4 = (user) => {
|
|
4860
5703
|
if (!user || typeof user !== "object") return false;
|
|
@@ -4865,14 +5708,14 @@ var normalizeRole = (value) => userRoles.includes(value) ? value : "editor";
|
|
|
4865
5708
|
function AdminStudioToolsView(props) {
|
|
4866
5709
|
const { user } = useAuth7();
|
|
4867
5710
|
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] =
|
|
5711
|
+
const [docs, setDocs] = useState19([]);
|
|
5712
|
+
const [loading, setLoading] = useState19(true);
|
|
5713
|
+
const [error, setError] = useState19(null);
|
|
5714
|
+
const [savedMessage, setSavedMessage] = useState19(null);
|
|
5715
|
+
const [createSubmitting, setCreateSubmitting] = useState19(false);
|
|
5716
|
+
const [updatingUserID, setUpdatingUserID] = useState19(null);
|
|
4874
5717
|
if (!isAdmin4(user)) {
|
|
4875
|
-
return /* @__PURE__ */
|
|
5718
|
+
return /* @__PURE__ */ jsx30(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx30(
|
|
4876
5719
|
AdminPage,
|
|
4877
5720
|
{
|
|
4878
5721
|
breadcrumbs: [
|
|
@@ -4881,9 +5724,9 @@ function AdminStudioToolsView(props) {
|
|
|
4881
5724
|
],
|
|
4882
5725
|
description: "You do not have access to this section.",
|
|
4883
5726
|
title: "Admin Tools",
|
|
4884
|
-
children: /* @__PURE__ */
|
|
4885
|
-
/* @__PURE__ */
|
|
4886
|
-
/* @__PURE__ */
|
|
5727
|
+
children: /* @__PURE__ */ jsxs27("div", { className: "orion-admin-card", children: [
|
|
5728
|
+
/* @__PURE__ */ jsx30("strong", { children: "Access denied" }),
|
|
5729
|
+
/* @__PURE__ */ jsx30("span", { children: "This section is restricted to administrator accounts." })
|
|
4887
5730
|
] })
|
|
4888
5731
|
}
|
|
4889
5732
|
) });
|
|
@@ -4912,7 +5755,7 @@ function AdminStudioToolsView(props) {
|
|
|
4912
5755
|
setLoading(false);
|
|
4913
5756
|
}
|
|
4914
5757
|
};
|
|
4915
|
-
|
|
5758
|
+
useEffect18(() => {
|
|
4916
5759
|
void loadUsers();
|
|
4917
5760
|
}, []);
|
|
4918
5761
|
const createUser = async (event) => {
|
|
@@ -4983,7 +5826,7 @@ function AdminStudioToolsView(props) {
|
|
|
4983
5826
|
setUpdatingUserID(null);
|
|
4984
5827
|
}
|
|
4985
5828
|
};
|
|
4986
|
-
return /* @__PURE__ */
|
|
5829
|
+
return /* @__PURE__ */ jsx30(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs27(
|
|
4987
5830
|
AdminPage,
|
|
4988
5831
|
{
|
|
4989
5832
|
breadcrumbs: [
|
|
@@ -4993,53 +5836,53 @@ function AdminStudioToolsView(props) {
|
|
|
4993
5836
|
description: "Manage users and fallback links to Payload native admin.",
|
|
4994
5837
|
title: "Admin Tools",
|
|
4995
5838
|
children: [
|
|
4996
|
-
/* @__PURE__ */
|
|
4997
|
-
error ? /* @__PURE__ */
|
|
4998
|
-
savedMessage ? /* @__PURE__ */
|
|
4999
|
-
/* @__PURE__ */
|
|
5000
|
-
/* @__PURE__ */
|
|
5001
|
-
/* @__PURE__ */
|
|
5839
|
+
/* @__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" }) }),
|
|
5840
|
+
error ? /* @__PURE__ */ jsx30("div", { className: "orion-admin-error", style: { marginBottom: "1rem" }, children: error }) : null,
|
|
5841
|
+
savedMessage ? /* @__PURE__ */ jsx30("div", { className: "orion-admin-success", style: { marginBottom: "1rem" }, children: savedMessage }) : null,
|
|
5842
|
+
/* @__PURE__ */ jsxs27("form", { className: "orion-admin-form", onSubmit: createUser, style: { marginBottom: "1rem" }, children: [
|
|
5843
|
+
/* @__PURE__ */ jsx30("strong", { children: "Create User" }),
|
|
5844
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5002
5845
|
"Email",
|
|
5003
|
-
/* @__PURE__ */
|
|
5846
|
+
/* @__PURE__ */ jsx30("input", { name: "email", required: true, type: "email" })
|
|
5004
5847
|
] }),
|
|
5005
|
-
/* @__PURE__ */
|
|
5848
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5006
5849
|
"Full Name",
|
|
5007
|
-
/* @__PURE__ */
|
|
5850
|
+
/* @__PURE__ */ jsx30("input", { name: "fullName", type: "text" })
|
|
5008
5851
|
] }),
|
|
5009
|
-
/* @__PURE__ */
|
|
5852
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5010
5853
|
"Password",
|
|
5011
|
-
/* @__PURE__ */
|
|
5854
|
+
/* @__PURE__ */ jsx30("input", { name: "password", required: true, type: "password" })
|
|
5012
5855
|
] }),
|
|
5013
|
-
/* @__PURE__ */
|
|
5856
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5014
5857
|
"Role",
|
|
5015
|
-
/* @__PURE__ */
|
|
5016
|
-
/* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5018
|
-
/* @__PURE__ */
|
|
5858
|
+
/* @__PURE__ */ jsxs27("select", { defaultValue: "editor", name: "role", children: [
|
|
5859
|
+
/* @__PURE__ */ jsx30("option", { value: "admin", children: "admin" }),
|
|
5860
|
+
/* @__PURE__ */ jsx30("option", { value: "editor", children: "editor" }),
|
|
5861
|
+
/* @__PURE__ */ jsx30("option", { value: "client", children: "client" })
|
|
5019
5862
|
] })
|
|
5020
5863
|
] }),
|
|
5021
|
-
/* @__PURE__ */
|
|
5864
|
+
/* @__PURE__ */ jsx30("button", { disabled: createSubmitting, type: "submit", children: createSubmitting ? "Creating..." : "Create User" })
|
|
5022
5865
|
] }),
|
|
5023
|
-
loading ? /* @__PURE__ */
|
|
5024
|
-
/* @__PURE__ */
|
|
5866
|
+
loading ? /* @__PURE__ */ jsx30("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5867
|
+
/* @__PURE__ */ jsx30("div", { className: "orion-admin-list", children: docs.map((doc) => {
|
|
5025
5868
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
5026
5869
|
if (!id) return null;
|
|
5027
5870
|
const email = typeof doc.email === "string" ? doc.email : `user-${id}`;
|
|
5028
5871
|
const fullName = typeof doc.fullName === "string" ? doc.fullName : "";
|
|
5029
5872
|
const currentRole = typeof doc.role === "string" ? normalizeRole(doc.role) : "editor";
|
|
5030
|
-
return /* @__PURE__ */
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
/* @__PURE__ */
|
|
5033
|
-
/* @__PURE__ */
|
|
5873
|
+
return /* @__PURE__ */ jsxs27("div", { className: "orion-admin-list-item", children: [
|
|
5874
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
5875
|
+
/* @__PURE__ */ jsx30("strong", { children: email }),
|
|
5876
|
+
/* @__PURE__ */ jsx30("div", { className: "orion-admin-list-meta", children: fullName || "No full name set" })
|
|
5034
5877
|
] }),
|
|
5035
|
-
/* @__PURE__ */
|
|
5036
|
-
/* @__PURE__ */
|
|
5037
|
-
/* @__PURE__ */
|
|
5038
|
-
/* @__PURE__ */
|
|
5039
|
-
/* @__PURE__ */
|
|
5040
|
-
/* @__PURE__ */
|
|
5878
|
+
/* @__PURE__ */ jsxs27("form", { className: "orion-admin-inline-actions", onSubmit: updateUserRole, children: [
|
|
5879
|
+
/* @__PURE__ */ jsx30("input", { name: "id", type: "hidden", value: id }),
|
|
5880
|
+
/* @__PURE__ */ jsxs27("select", { defaultValue: currentRole, name: "role", children: [
|
|
5881
|
+
/* @__PURE__ */ jsx30("option", { value: "admin", children: "admin" }),
|
|
5882
|
+
/* @__PURE__ */ jsx30("option", { value: "editor", children: "editor" }),
|
|
5883
|
+
/* @__PURE__ */ jsx30("option", { value: "client", children: "client" })
|
|
5041
5884
|
] }),
|
|
5042
|
-
/* @__PURE__ */
|
|
5885
|
+
/* @__PURE__ */ jsx30("button", { disabled: updatingUserID === id, type: "submit", children: updatingUserID === id ? "Updating..." : "Update" })
|
|
5043
5886
|
] })
|
|
5044
5887
|
] }, id);
|
|
5045
5888
|
}) })
|
|
@@ -5050,14 +5893,14 @@ function AdminStudioToolsView(props) {
|
|
|
5050
5893
|
|
|
5051
5894
|
// src/admin/components/studio/OpenInStudioMenuItem.tsx
|
|
5052
5895
|
import { useDocumentInfo } from "@payloadcms/ui";
|
|
5053
|
-
import { jsx as
|
|
5896
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
5054
5897
|
function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
5055
5898
|
const documentInfo = useDocumentInfo();
|
|
5056
5899
|
const id = documentInfo?.id;
|
|
5057
5900
|
if (!id) {
|
|
5058
5901
|
return null;
|
|
5059
5902
|
}
|
|
5060
|
-
return /* @__PURE__ */
|
|
5903
|
+
return /* @__PURE__ */ jsx31(
|
|
5061
5904
|
"a",
|
|
5062
5905
|
{
|
|
5063
5906
|
href: `${pagesPathBase}/${id}`,
|
|
@@ -5076,19 +5919,19 @@ function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
|
5076
5919
|
}
|
|
5077
5920
|
|
|
5078
5921
|
// src/admin/components/studio/PageEditRedirectToStudio.tsx
|
|
5079
|
-
import { useEffect as
|
|
5922
|
+
import { useEffect as useEffect19 } from "react";
|
|
5080
5923
|
import { useDocumentInfo as useDocumentInfo2 } from "@payloadcms/ui";
|
|
5081
|
-
import { jsx as
|
|
5924
|
+
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5082
5925
|
function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
5083
5926
|
const documentInfo = useDocumentInfo2();
|
|
5084
5927
|
const id = documentInfo?.id;
|
|
5085
|
-
|
|
5928
|
+
useEffect19(() => {
|
|
5086
5929
|
if (!id) {
|
|
5087
5930
|
return;
|
|
5088
5931
|
}
|
|
5089
5932
|
window.location.replace(`${pagesPathBase}/${id}`);
|
|
5090
5933
|
}, [id, pagesPathBase]);
|
|
5091
|
-
return /* @__PURE__ */
|
|
5934
|
+
return /* @__PURE__ */ jsxs28(
|
|
5092
5935
|
"div",
|
|
5093
5936
|
{
|
|
5094
5937
|
style: {
|
|
@@ -5100,18 +5943,18 @@ function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
|
5100
5943
|
minHeight: "50vh"
|
|
5101
5944
|
},
|
|
5102
5945
|
children: [
|
|
5103
|
-
/* @__PURE__ */
|
|
5104
|
-
/* @__PURE__ */
|
|
5105
|
-
id ? /* @__PURE__ */
|
|
5946
|
+
/* @__PURE__ */ jsx32("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
|
|
5947
|
+
/* @__PURE__ */ jsx32("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
|
|
5948
|
+
id ? /* @__PURE__ */ jsx32("a", { href: `${pagesPathBase}/${id}`, children: "Continue to Editor" }) : /* @__PURE__ */ jsx32("a", { href: pagesPathBase, children: "Open Pages" })
|
|
5106
5949
|
]
|
|
5107
5950
|
}
|
|
5108
5951
|
);
|
|
5109
5952
|
}
|
|
5110
5953
|
|
|
5111
5954
|
// src/admin/components/studio/StudioBackBreadcrumb.tsx
|
|
5112
|
-
import { useEffect as
|
|
5955
|
+
import { useEffect as useEffect20, useState as useState20 } from "react";
|
|
5113
5956
|
import { SetStepNav as SetStepNav5 } from "@payloadcms/ui";
|
|
5114
|
-
import { jsx as
|
|
5957
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
5115
5958
|
var toTitle = (slug) => slug.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
5116
5959
|
var buildNav = (pathname, adminBasePath) => {
|
|
5117
5960
|
if (pathname.includes("/globals/")) {
|
|
@@ -5156,8 +5999,8 @@ var buildNav = (pathname, adminBasePath) => {
|
|
|
5156
5999
|
};
|
|
5157
6000
|
function StudioBackBreadcrumb() {
|
|
5158
6001
|
const adminBasePath = useAdminBasePath();
|
|
5159
|
-
const [pathname, setPathname] =
|
|
5160
|
-
|
|
6002
|
+
const [pathname, setPathname] = useState20("");
|
|
6003
|
+
useEffect20(() => {
|
|
5161
6004
|
const update = () => setPathname(window.location.pathname);
|
|
5162
6005
|
update();
|
|
5163
6006
|
window.addEventListener("popstate", update);
|
|
@@ -5165,12 +6008,12 @@ function StudioBackBreadcrumb() {
|
|
|
5165
6008
|
}, []);
|
|
5166
6009
|
const nav = buildNav(pathname, adminBasePath);
|
|
5167
6010
|
if (!nav) return null;
|
|
5168
|
-
return /* @__PURE__ */
|
|
6011
|
+
return /* @__PURE__ */ jsx33(SetStepNav5, { nav });
|
|
5169
6012
|
}
|
|
5170
6013
|
|
|
5171
6014
|
// src/admin/components/studio/StudioContactFormRedirect.tsx
|
|
5172
|
-
import { useEffect as
|
|
5173
|
-
import { jsx as
|
|
6015
|
+
import { useEffect as useEffect21 } from "react";
|
|
6016
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5174
6017
|
var getPropString14 = (props, key, fallback) => {
|
|
5175
6018
|
if (!props || typeof props !== "object") return fallback;
|
|
5176
6019
|
const direct = props[key];
|
|
@@ -5186,11 +6029,11 @@ function StudioContactFormRedirect(props) {
|
|
|
5186
6029
|
const adminBasePath = useAdminBasePath();
|
|
5187
6030
|
const studioContactFormPath = getPropString14(props, "studioContactFormPath", "/contact-form");
|
|
5188
6031
|
const targetPath = resolveAdminPath(adminBasePath, studioContactFormPath);
|
|
5189
|
-
|
|
6032
|
+
useEffect21(() => {
|
|
5190
6033
|
if (window.location.pathname === targetPath) return;
|
|
5191
6034
|
window.location.replace(targetPath);
|
|
5192
6035
|
}, [targetPath]);
|
|
5193
|
-
return /* @__PURE__ */
|
|
6036
|
+
return /* @__PURE__ */ jsxs29(
|
|
5194
6037
|
"div",
|
|
5195
6038
|
{
|
|
5196
6039
|
style: {
|
|
@@ -5203,14 +6046,15 @@ function StudioContactFormRedirect(props) {
|
|
|
5203
6046
|
minHeight: "40vh"
|
|
5204
6047
|
},
|
|
5205
6048
|
children: [
|
|
5206
|
-
/* @__PURE__ */
|
|
5207
|
-
/* @__PURE__ */
|
|
6049
|
+
/* @__PURE__ */ jsx34("h2", { style: { margin: 0 }, children: "Opening Contact Form Editor..." }),
|
|
6050
|
+
/* @__PURE__ */ jsx34("a", { href: targetPath, children: "Continue" })
|
|
5208
6051
|
]
|
|
5209
6052
|
}
|
|
5210
6053
|
);
|
|
5211
6054
|
}
|
|
5212
6055
|
export {
|
|
5213
6056
|
AdminLoginIntro,
|
|
6057
|
+
AdminLoginPasswordToggle,
|
|
5214
6058
|
AdminStudioContactFormView,
|
|
5215
6059
|
AdminStudioDashboard,
|
|
5216
6060
|
AdminStudioFooterGlobalView,
|