@orion-studios/payload-studio 0.6.0-beta.5 → 0.6.0-beta.7
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 +1 -0
- package/dist/admin/client.d.ts +1 -0
- package/dist/admin/client.js +1489 -662
- package/dist/admin/client.mjs +1337 -511
- package/dist/admin/index.d.mts +1 -2
- package/dist/admin/index.d.ts +1 -2
- package/dist/admin/index.js +1 -1505
- package/dist/admin/index.mjs +2 -4
- package/dist/admin-app/index.mjs +4 -4
- package/dist/chunk-5FNTVRCR.mjs +910 -0
- package/dist/{chunk-EHUE4LCT.mjs → chunk-RKTIFEUY.mjs} +33 -3
- package/dist/chunk-W2UOCJDX.mjs +32 -0
- package/dist/{index-DEkV-sMs.d.mts → index-DyMmaRfI.d.mts} +2 -7
- package/dist/{index-bbA3HSxa.d.ts → index-QPDAedIX.d.ts} +2 -7
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +63 -1521
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-PKVTM6DY.mjs +0 -2372
- package/dist/chunk-Z6L5K5MH.mjs +0 -64
package/dist/admin/client.js
CHANGED
|
@@ -1169,6 +1169,7 @@ __export(client_exports, {
|
|
|
1169
1169
|
AdminLoginIntro: () => AdminLoginIntro,
|
|
1170
1170
|
AdminLoginPasswordToggle: () => AdminLoginPasswordToggle,
|
|
1171
1171
|
AdminStudioContactFormView: () => AdminStudioContactFormView,
|
|
1172
|
+
AdminStudioDashboard: () => AdminStudioDashboard,
|
|
1172
1173
|
AdminStudioFooterGlobalView: () => AdminStudioFooterGlobalView,
|
|
1173
1174
|
AdminStudioFormsView: () => AdminStudioFormsView,
|
|
1174
1175
|
AdminStudioGlobalsView: () => AdminStudioGlobalsView,
|
|
@@ -3171,11 +3172,6 @@ function StudioSectionLayout({ children, navProps }) {
|
|
|
3171
3172
|
);
|
|
3172
3173
|
}
|
|
3173
3174
|
|
|
3174
|
-
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
3175
|
-
var import_react16 = require("react");
|
|
3176
|
-
var import_link = __toESM(require("next/link"));
|
|
3177
|
-
var import_ui5 = require("@payloadcms/ui");
|
|
3178
|
-
|
|
3179
3175
|
// src/admin-app/components/AdminBreadcrumbs.tsx
|
|
3180
3176
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3181
3177
|
function AdminBreadcrumbs({ items }) {
|
|
@@ -3206,14 +3202,844 @@ function AdminPage({ title, description, breadcrumbs, actions, children }) {
|
|
|
3206
3202
|
] });
|
|
3207
3203
|
}
|
|
3208
3204
|
|
|
3209
|
-
// src/admin/components/studio/
|
|
3205
|
+
// src/admin/components/studio/AdminStudioDashboardClient.tsx
|
|
3206
|
+
var import_react16 = require("react");
|
|
3207
|
+
var import_link = __toESM(require("next/link"));
|
|
3210
3208
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3209
|
+
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3210
|
+
var isRole = (value) => value === "admin" || value === "editor" || value === "client";
|
|
3211
|
+
var canReviewForms = (role) => role === "admin" || role === "editor";
|
|
3212
|
+
var canCreatePages = (role) => role === "admin" || role === "editor";
|
|
3213
|
+
var canAccess = (role, roles) => {
|
|
3214
|
+
if (!roles || roles.length === 0) {
|
|
3215
|
+
return true;
|
|
3216
|
+
}
|
|
3217
|
+
if (!role) {
|
|
3218
|
+
return false;
|
|
3219
|
+
}
|
|
3220
|
+
return roles.includes(role);
|
|
3221
|
+
};
|
|
3222
|
+
var asText = (value, fallback) => typeof value === "string" && value.trim().length > 0 ? value.trim() : fallback;
|
|
3223
|
+
var asID = (value) => {
|
|
3224
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
3225
|
+
return "";
|
|
3226
|
+
};
|
|
3227
|
+
var toTimestamp = (value) => {
|
|
3228
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
3229
|
+
return Number.NaN;
|
|
3230
|
+
}
|
|
3231
|
+
const timestamp = Date.parse(value);
|
|
3232
|
+
return Number.isFinite(timestamp) ? timestamp : Number.NaN;
|
|
3233
|
+
};
|
|
3234
|
+
var isRecent = (value) => {
|
|
3235
|
+
const timestamp = toTimestamp(value);
|
|
3236
|
+
return Number.isFinite(timestamp) && Date.now() - timestamp <= SEVEN_DAYS_MS;
|
|
3237
|
+
};
|
|
3238
|
+
var formatDateTime = (value) => {
|
|
3239
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
3240
|
+
return "Unknown time";
|
|
3241
|
+
}
|
|
3242
|
+
const date = new Date(value);
|
|
3243
|
+
if (Number.isNaN(date.getTime())) {
|
|
3244
|
+
return value;
|
|
3245
|
+
}
|
|
3246
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
3247
|
+
dateStyle: "medium",
|
|
3248
|
+
timeStyle: "short"
|
|
3249
|
+
}).format(date);
|
|
3250
|
+
};
|
|
3251
|
+
var formatRelativeTime2 = (timestamp) => {
|
|
3252
|
+
if (!Number.isFinite(timestamp)) {
|
|
3253
|
+
return "Unknown time";
|
|
3254
|
+
}
|
|
3255
|
+
const diffMs = timestamp - Date.now();
|
|
3256
|
+
const diffMinutes = Math.round(diffMs / (60 * 1e3));
|
|
3257
|
+
const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
3258
|
+
if (Math.abs(diffMinutes) < 60) {
|
|
3259
|
+
return rtf.format(diffMinutes, "minute");
|
|
3260
|
+
}
|
|
3261
|
+
const diffHours = Math.round(diffMinutes / 60);
|
|
3262
|
+
if (Math.abs(diffHours) < 24) {
|
|
3263
|
+
return rtf.format(diffHours, "hour");
|
|
3264
|
+
}
|
|
3265
|
+
const diffDays = Math.round(diffHours / 24);
|
|
3266
|
+
return rtf.format(diffDays, "day");
|
|
3267
|
+
};
|
|
3268
|
+
var readSubmissionIdentity = (value) => {
|
|
3269
|
+
if (!value || typeof value !== "object") {
|
|
3270
|
+
return "New submission";
|
|
3271
|
+
}
|
|
3272
|
+
const data = value;
|
|
3273
|
+
const firstName = typeof data.firstName === "string" ? data.firstName.trim() : "";
|
|
3274
|
+
const lastName = typeof data.lastName === "string" ? data.lastName.trim() : "";
|
|
3275
|
+
const name = typeof data.name === "string" ? data.name.trim() : "";
|
|
3276
|
+
const email = typeof data.email === "string" ? data.email.trim() : typeof data.contactEmail === "string" ? data.contactEmail.trim() : "";
|
|
3277
|
+
const fullName = [firstName, lastName].filter(Boolean).join(" ").trim();
|
|
3278
|
+
return fullName || name || email || "New submission";
|
|
3279
|
+
};
|
|
3280
|
+
var getFormID = (value) => {
|
|
3281
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
3282
|
+
if (value && typeof value === "object") {
|
|
3283
|
+
const nestedID = value.id;
|
|
3284
|
+
if (typeof nestedID === "string" || typeof nestedID === "number") return String(nestedID);
|
|
3285
|
+
}
|
|
3286
|
+
return "";
|
|
3287
|
+
};
|
|
3288
|
+
var getFormTitle = (value) => {
|
|
3289
|
+
if (!value || typeof value !== "object") {
|
|
3290
|
+
return "";
|
|
3291
|
+
}
|
|
3292
|
+
const title = value.title;
|
|
3293
|
+
if (typeof title === "string" && title.trim().length > 0) {
|
|
3294
|
+
return title.trim();
|
|
3295
|
+
}
|
|
3296
|
+
const slug = value.slug;
|
|
3297
|
+
return typeof slug === "string" && slug.trim().length > 0 ? slug.trim() : "";
|
|
3298
|
+
};
|
|
3299
|
+
var buildSearchParams = (params) => new URLSearchParams(
|
|
3300
|
+
Object.entries(params).filter(([, value]) => typeof value === "string" && value.length > 0)
|
|
3301
|
+
).toString();
|
|
3302
|
+
async function loadCollection(path) {
|
|
3303
|
+
const response = await fetch(path, {
|
|
3304
|
+
cache: "no-store",
|
|
3305
|
+
credentials: "include"
|
|
3306
|
+
});
|
|
3307
|
+
if (!response.ok) {
|
|
3308
|
+
const body = await response.text();
|
|
3309
|
+
throw new Error(body || `Request failed: ${response.status}`);
|
|
3310
|
+
}
|
|
3311
|
+
return await response.json();
|
|
3312
|
+
}
|
|
3313
|
+
async function loadPages(collectionSlug) {
|
|
3314
|
+
const params = buildSearchParams({
|
|
3315
|
+
depth: "0",
|
|
3316
|
+
draft: "true",
|
|
3317
|
+
limit: "200",
|
|
3318
|
+
sort: "-updatedAt"
|
|
3319
|
+
});
|
|
3320
|
+
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
3321
|
+
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
3322
|
+
return {
|
|
3323
|
+
draftCount: docs.filter((doc) => doc._status === "draft").length,
|
|
3324
|
+
recent: docs.slice(0, 8),
|
|
3325
|
+
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
3326
|
+
updatedThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
3327
|
+
};
|
|
3328
|
+
}
|
|
3329
|
+
async function loadForms(formsCollectionSlug, submissionsCollectionSlug) {
|
|
3330
|
+
const [formsResult, submissionsResult] = await Promise.all([
|
|
3331
|
+
loadCollection(
|
|
3332
|
+
`/api/${formsCollectionSlug}?${buildSearchParams({
|
|
3333
|
+
depth: "0",
|
|
3334
|
+
draft: "true",
|
|
3335
|
+
limit: "80",
|
|
3336
|
+
sort: "-updatedAt"
|
|
3337
|
+
})}`
|
|
3338
|
+
),
|
|
3339
|
+
loadCollection(
|
|
3340
|
+
`/api/${submissionsCollectionSlug}?${buildSearchParams({
|
|
3341
|
+
depth: "1",
|
|
3342
|
+
limit: "40",
|
|
3343
|
+
sort: "-submittedAt"
|
|
3344
|
+
})}`
|
|
3345
|
+
)
|
|
3346
|
+
]);
|
|
3347
|
+
const forms = Array.isArray(formsResult.docs) ? formsResult.docs : [];
|
|
3348
|
+
const recentSubmissions = Array.isArray(submissionsResult.docs) ? submissionsResult.docs : [];
|
|
3349
|
+
const submissionsByForm = /* @__PURE__ */ new Map();
|
|
3350
|
+
for (const submission of recentSubmissions) {
|
|
3351
|
+
const formID = getFormID(submission.form);
|
|
3352
|
+
if (!formID) continue;
|
|
3353
|
+
submissionsByForm.set(formID, (submissionsByForm.get(formID) || 0) + 1);
|
|
3354
|
+
}
|
|
3355
|
+
let busiestFormTitle = null;
|
|
3356
|
+
let busiestFormCount = 0;
|
|
3357
|
+
for (const form of forms) {
|
|
3358
|
+
const formID = asID(form.id);
|
|
3359
|
+
if (!formID) continue;
|
|
3360
|
+
const submissionCount = submissionsByForm.get(formID) || 0;
|
|
3361
|
+
if (submissionCount > busiestFormCount) {
|
|
3362
|
+
busiestFormCount = submissionCount;
|
|
3363
|
+
busiestFormTitle = asText(form.title, "Untitled form");
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
return {
|
|
3367
|
+
busiestFormTitle,
|
|
3368
|
+
forms,
|
|
3369
|
+
recentSubmissions,
|
|
3370
|
+
submissionsThisWeek: recentSubmissions.filter((submission) => isRecent(submission.submittedAt)).length,
|
|
3371
|
+
totalForms: typeof formsResult.totalDocs === "number" ? formsResult.totalDocs : forms.length
|
|
3372
|
+
};
|
|
3373
|
+
}
|
|
3374
|
+
async function loadMedia(collectionSlug) {
|
|
3375
|
+
const params = buildSearchParams({
|
|
3376
|
+
depth: "0",
|
|
3377
|
+
limit: "24",
|
|
3378
|
+
sort: "-updatedAt"
|
|
3379
|
+
});
|
|
3380
|
+
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
3381
|
+
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
3382
|
+
return {
|
|
3383
|
+
recent: docs.slice(0, 8),
|
|
3384
|
+
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
3385
|
+
uploadsThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
3386
|
+
};
|
|
3387
|
+
}
|
|
3388
|
+
var loadingState = {
|
|
3389
|
+
forms: null,
|
|
3390
|
+
media: { status: "loading" },
|
|
3391
|
+
pages: { status: "loading" }
|
|
3392
|
+
};
|
|
3393
|
+
function ModuleStatus({ message }) {
|
|
3394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-dashboard-inline-note", children: message });
|
|
3395
|
+
}
|
|
3396
|
+
function EmptyState2({
|
|
3397
|
+
body,
|
|
3398
|
+
title
|
|
3399
|
+
}) {
|
|
3400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-empty-state", children: [
|
|
3401
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { children: title }),
|
|
3402
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: body })
|
|
3403
|
+
] });
|
|
3404
|
+
}
|
|
3405
|
+
function SnapshotMetric({ card }) {
|
|
3406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("article", { className: "orion-dashboard-snapshot-card", children: [
|
|
3407
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "orion-dashboard-snapshot-kicker", children: card.kicker }),
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { children: card.value }),
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: card.detail })
|
|
3410
|
+
] });
|
|
3411
|
+
}
|
|
3412
|
+
function AdminStudioDashboardClient({
|
|
3413
|
+
formSubmissionsCollectionSlug,
|
|
3414
|
+
formsCollectionSlug,
|
|
3415
|
+
formsEnabled,
|
|
3416
|
+
formsPath,
|
|
3417
|
+
globalsBasePath,
|
|
3418
|
+
mediaCollectionSlug,
|
|
3419
|
+
mediaPath,
|
|
3420
|
+
pagesCollectionSlug,
|
|
3421
|
+
pagesPath,
|
|
3422
|
+
sectionLinks,
|
|
3423
|
+
toolsPath,
|
|
3424
|
+
userRole,
|
|
3425
|
+
children
|
|
3426
|
+
}) {
|
|
3427
|
+
const role = isRole(userRole) ? userRole : void 0;
|
|
3428
|
+
const [state, setState] = (0, import_react16.useState)(
|
|
3429
|
+
() => formsEnabled && canReviewForms(role) ? {
|
|
3430
|
+
forms: { status: "loading" },
|
|
3431
|
+
media: { status: "loading" },
|
|
3432
|
+
pages: { status: "loading" }
|
|
3433
|
+
} : loadingState
|
|
3434
|
+
);
|
|
3435
|
+
(0, import_react16.useEffect)(() => {
|
|
3436
|
+
let cancelled = false;
|
|
3437
|
+
const run = async () => {
|
|
3438
|
+
const includeForms = formsEnabled && canReviewForms(role);
|
|
3439
|
+
(0, import_react16.startTransition)(() => {
|
|
3440
|
+
setState({
|
|
3441
|
+
forms: includeForms ? { status: "loading" } : null,
|
|
3442
|
+
media: { status: "loading" },
|
|
3443
|
+
pages: { status: "loading" }
|
|
3444
|
+
});
|
|
3445
|
+
});
|
|
3446
|
+
const [pagesResult, formsResult, mediaResult] = await Promise.allSettled([
|
|
3447
|
+
loadPages(pagesCollectionSlug),
|
|
3448
|
+
includeForms ? loadForms(formsCollectionSlug, formSubmissionsCollectionSlug) : Promise.resolve(null),
|
|
3449
|
+
loadMedia(mediaCollectionSlug)
|
|
3450
|
+
]);
|
|
3451
|
+
if (cancelled) return;
|
|
3452
|
+
(0, import_react16.startTransition)(() => {
|
|
3453
|
+
setState({
|
|
3454
|
+
forms: includeForms && formsResult.status === "rejected" ? {
|
|
3455
|
+
error: formsResult.reason instanceof Error ? formsResult.reason.message : "Unable to load form activity.",
|
|
3456
|
+
status: "error"
|
|
3457
|
+
} : includeForms && formsResult.status === "fulfilled" && formsResult.value ? {
|
|
3458
|
+
data: formsResult.value,
|
|
3459
|
+
status: "success"
|
|
3460
|
+
} : null,
|
|
3461
|
+
media: mediaResult.status === "rejected" ? {
|
|
3462
|
+
error: mediaResult.reason instanceof Error ? mediaResult.reason.message : "Unable to load media activity.",
|
|
3463
|
+
status: "error"
|
|
3464
|
+
} : {
|
|
3465
|
+
data: mediaResult.value,
|
|
3466
|
+
status: "success"
|
|
3467
|
+
},
|
|
3468
|
+
pages: pagesResult.status === "rejected" ? {
|
|
3469
|
+
error: pagesResult.reason instanceof Error ? pagesResult.reason.message : "Unable to load page activity.",
|
|
3470
|
+
status: "error"
|
|
3471
|
+
} : {
|
|
3472
|
+
data: pagesResult.value,
|
|
3473
|
+
status: "success"
|
|
3474
|
+
}
|
|
3475
|
+
});
|
|
3476
|
+
});
|
|
3477
|
+
};
|
|
3478
|
+
void run();
|
|
3479
|
+
return () => {
|
|
3480
|
+
cancelled = true;
|
|
3481
|
+
};
|
|
3482
|
+
}, [
|
|
3483
|
+
formSubmissionsCollectionSlug,
|
|
3484
|
+
formsCollectionSlug,
|
|
3485
|
+
formsEnabled,
|
|
3486
|
+
mediaCollectionSlug,
|
|
3487
|
+
pagesCollectionSlug,
|
|
3488
|
+
role
|
|
3489
|
+
]);
|
|
3490
|
+
const visibleWorkspaceLinks = (0, import_react16.useMemo)(
|
|
3491
|
+
() => sectionLinks.filter((section) => canAccess(role, section.roles)),
|
|
3492
|
+
[role, sectionLinks]
|
|
3493
|
+
);
|
|
3494
|
+
const activityItems = (0, import_react16.useMemo)(() => {
|
|
3495
|
+
const items = [];
|
|
3496
|
+
if (state.pages.status === "success") {
|
|
3497
|
+
for (const doc of state.pages.data.recent) {
|
|
3498
|
+
const id = asID(doc.id);
|
|
3499
|
+
if (!id) continue;
|
|
3500
|
+
const timestamp = toTimestamp(doc.updatedAt);
|
|
3501
|
+
items.push({
|
|
3502
|
+
href: `${pagesPath}/${id}`,
|
|
3503
|
+
id: `page-${id}`,
|
|
3504
|
+
kind: "page",
|
|
3505
|
+
label: typeof doc._status === "string" ? doc._status : "page",
|
|
3506
|
+
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
3507
|
+
timestamp,
|
|
3508
|
+
title: asText(doc.title, "Untitled page")
|
|
3509
|
+
});
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
if (state.forms?.status === "success") {
|
|
3513
|
+
for (const submission of state.forms.data.recentSubmissions) {
|
|
3514
|
+
const id = asID(submission.id);
|
|
3515
|
+
const formID = getFormID(submission.form);
|
|
3516
|
+
if (!id || !formID) continue;
|
|
3517
|
+
const timestamp = toTimestamp(submission.submittedAt);
|
|
3518
|
+
const formTitle = getFormTitle(submission.form) || "Form response";
|
|
3519
|
+
items.push({
|
|
3520
|
+
href: `${formsPath}?form=${encodeURIComponent(formID)}`,
|
|
3521
|
+
id: `submission-${id}`,
|
|
3522
|
+
kind: "submission",
|
|
3523
|
+
label: formTitle,
|
|
3524
|
+
meta: Number.isFinite(timestamp) ? `${readSubmissionIdentity(submission.data)} \xB7 ${formatDateTime(submission.submittedAt)}` : readSubmissionIdentity(submission.data),
|
|
3525
|
+
timestamp,
|
|
3526
|
+
title: "New submission"
|
|
3527
|
+
});
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
if (state.media.status === "success") {
|
|
3531
|
+
for (const doc of state.media.data.recent) {
|
|
3532
|
+
const id = asID(doc.id);
|
|
3533
|
+
if (!id) continue;
|
|
3534
|
+
const timestamp = toTimestamp(doc.updatedAt);
|
|
3535
|
+
items.push({
|
|
3536
|
+
href: `${mediaPath}/${id}`,
|
|
3537
|
+
id: `media-${id}`,
|
|
3538
|
+
kind: "media",
|
|
3539
|
+
label: asText(doc.mimeType, "Media asset"),
|
|
3540
|
+
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
3541
|
+
timestamp,
|
|
3542
|
+
title: asText(doc.filename, "Untitled asset")
|
|
3543
|
+
});
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
return items.filter((item) => Number.isFinite(item.timestamp)).sort((a, b) => b.timestamp - a.timestamp).slice(0, 10);
|
|
3547
|
+
}, [formsPath, mediaPath, pagesPath, state.forms, state.media, state.pages]);
|
|
3548
|
+
const attentionItems = (0, import_react16.useMemo)(() => {
|
|
3549
|
+
if (role === "client") {
|
|
3550
|
+
const items2 = [];
|
|
3551
|
+
if (state.pages.status === "success" && state.pages.data.updatedThisWeek > 0) {
|
|
3552
|
+
items2.push({
|
|
3553
|
+
href: pagesPath,
|
|
3554
|
+
id: "pages-updated",
|
|
3555
|
+
label: `${state.pages.data.updatedThisWeek} page${state.pages.data.updatedThisWeek === 1 ? "" : "s"} changed in the last 7 days.`
|
|
3556
|
+
});
|
|
3557
|
+
}
|
|
3558
|
+
if (state.media.status === "success" && state.media.data.uploadsThisWeek > 0) {
|
|
3559
|
+
items2.push({
|
|
3560
|
+
href: mediaPath,
|
|
3561
|
+
id: "media-updated",
|
|
3562
|
+
label: `${state.media.data.uploadsThisWeek} new media asset${state.media.data.uploadsThisWeek === 1 ? "" : "s"} landed this week.`
|
|
3563
|
+
});
|
|
3564
|
+
}
|
|
3565
|
+
return items2;
|
|
3566
|
+
}
|
|
3567
|
+
const items = [];
|
|
3568
|
+
if (state.pages.status === "success" && state.pages.data.draftCount > 0) {
|
|
3569
|
+
items.push({
|
|
3570
|
+
href: pagesPath,
|
|
3571
|
+
id: "draft-pages",
|
|
3572
|
+
label: `${state.pages.data.draftCount} page${state.pages.data.draftCount === 1 ? "" : "s"} still need publishing review.`,
|
|
3573
|
+
tone: "accent"
|
|
3574
|
+
});
|
|
3575
|
+
}
|
|
3576
|
+
if (state.forms?.status === "success" && state.forms.data.submissionsThisWeek > 0) {
|
|
3577
|
+
items.push({
|
|
3578
|
+
href: formsPath,
|
|
3579
|
+
id: "recent-submissions",
|
|
3580
|
+
label: `${state.forms.data.submissionsThisWeek} form submission${state.forms.data.submissionsThisWeek === 1 ? "" : "s"} arrived in the last 7 days.`,
|
|
3581
|
+
tone: "accent"
|
|
3582
|
+
});
|
|
3583
|
+
}
|
|
3584
|
+
if (state.media.status === "success" && state.media.data.total === 0) {
|
|
3585
|
+
items.push({
|
|
3586
|
+
href: mediaPath,
|
|
3587
|
+
id: "empty-media",
|
|
3588
|
+
label: "The media library is still empty. Add brand assets before content expands."
|
|
3589
|
+
});
|
|
3590
|
+
}
|
|
3591
|
+
if (state.pages.status === "error") {
|
|
3592
|
+
items.push({
|
|
3593
|
+
href: pagesPath,
|
|
3594
|
+
id: "pages-error",
|
|
3595
|
+
label: "Page activity could not be loaded for the dashboard.",
|
|
3596
|
+
tone: "muted"
|
|
3597
|
+
});
|
|
3598
|
+
}
|
|
3599
|
+
if (state.forms?.status === "error") {
|
|
3600
|
+
items.push({
|
|
3601
|
+
href: formsPath,
|
|
3602
|
+
id: "forms-error",
|
|
3603
|
+
label: "Form activity could not be loaded for the dashboard.",
|
|
3604
|
+
tone: "muted"
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
3607
|
+
if (state.media.status === "error") {
|
|
3608
|
+
items.push({
|
|
3609
|
+
href: mediaPath,
|
|
3610
|
+
id: "media-error",
|
|
3611
|
+
label: "Media activity could not be loaded for the dashboard.",
|
|
3612
|
+
tone: "muted"
|
|
3613
|
+
});
|
|
3614
|
+
}
|
|
3615
|
+
return items;
|
|
3616
|
+
}, [formsPath, mediaPath, pagesPath, role, state.forms, state.media, state.pages]);
|
|
3617
|
+
const snapshotCards = (0, import_react16.useMemo)(() => {
|
|
3618
|
+
const cards = [];
|
|
3619
|
+
if (state.pages.status === "success") {
|
|
3620
|
+
cards.push(
|
|
3621
|
+
role === "client" ? {
|
|
3622
|
+
detail: `${state.pages.data.updatedThisWeek} updated this week`,
|
|
3623
|
+
kicker: "Pages",
|
|
3624
|
+
value: `${state.pages.data.total}`
|
|
3625
|
+
} : {
|
|
3626
|
+
detail: `${state.pages.data.draftCount} draft${state.pages.data.draftCount === 1 ? "" : "s"} waiting`,
|
|
3627
|
+
kicker: "Pages",
|
|
3628
|
+
value: `${state.pages.data.total}`
|
|
3629
|
+
}
|
|
3630
|
+
);
|
|
3631
|
+
}
|
|
3632
|
+
if (state.forms?.status === "success") {
|
|
3633
|
+
cards.push({
|
|
3634
|
+
detail: state.forms.data.busiestFormTitle ? `Most active: ${state.forms.data.busiestFormTitle}` : "Waiting on the first submission",
|
|
3635
|
+
kicker: "Forms",
|
|
3636
|
+
value: `${state.forms.data.submissionsThisWeek}`
|
|
3637
|
+
});
|
|
3638
|
+
}
|
|
3639
|
+
if (state.media.status === "success") {
|
|
3640
|
+
cards.push({
|
|
3641
|
+
detail: `${state.media.data.uploadsThisWeek} uploaded this week`,
|
|
3642
|
+
kicker: "Media",
|
|
3643
|
+
value: `${state.media.data.total}`
|
|
3644
|
+
});
|
|
3645
|
+
}
|
|
3646
|
+
cards.push({
|
|
3647
|
+
detail: `${visibleWorkspaceLinks.length} section${visibleWorkspaceLinks.length === 1 ? "" : "s"} available`,
|
|
3648
|
+
kicker: "Workspace",
|
|
3649
|
+
value: role ? role.toUpperCase() : "CMS"
|
|
3650
|
+
});
|
|
3651
|
+
return cards.slice(0, 4);
|
|
3652
|
+
}, [role, state.forms, state.media, state.pages, visibleWorkspaceLinks.length]);
|
|
3653
|
+
const primaryActions = (0, import_react16.useMemo)(() => {
|
|
3654
|
+
const actions = [];
|
|
3655
|
+
if (canCreatePages(role)) {
|
|
3656
|
+
actions.push({
|
|
3657
|
+
description: "Create or revise content in the visual builder.",
|
|
3658
|
+
href: `${pagesPath}/new`,
|
|
3659
|
+
label: "New Page"
|
|
3660
|
+
});
|
|
3661
|
+
}
|
|
3662
|
+
actions.push({
|
|
3663
|
+
description: "Review live pages and recent edits.",
|
|
3664
|
+
href: pagesPath,
|
|
3665
|
+
label: "Open Pages",
|
|
3666
|
+
tone: "ghost"
|
|
3667
|
+
});
|
|
3668
|
+
if (formsEnabled && canReviewForms(role)) {
|
|
3669
|
+
actions.push({
|
|
3670
|
+
description: "Check submissions and form performance.",
|
|
3671
|
+
href: formsPath,
|
|
3672
|
+
label: "Review Forms",
|
|
3673
|
+
tone: "soft"
|
|
3674
|
+
});
|
|
3675
|
+
}
|
|
3676
|
+
actions.push({
|
|
3677
|
+
description: "Update site settings, navigation, and footer content.",
|
|
3678
|
+
href: globalsBasePath,
|
|
3679
|
+
label: "Open Globals",
|
|
3680
|
+
tone: "ghost"
|
|
3681
|
+
});
|
|
3682
|
+
actions.push({
|
|
3683
|
+
description: "Upload or organize brand and campaign assets.",
|
|
3684
|
+
href: mediaPath,
|
|
3685
|
+
label: "Manage Media",
|
|
3686
|
+
tone: "ghost"
|
|
3687
|
+
});
|
|
3688
|
+
if (role === "admin") {
|
|
3689
|
+
actions.push({
|
|
3690
|
+
description: "Manage users, roles, and fallback tools.",
|
|
3691
|
+
href: toolsPath,
|
|
3692
|
+
label: "Admin Tools",
|
|
3693
|
+
tone: "ghost"
|
|
3694
|
+
});
|
|
3695
|
+
}
|
|
3696
|
+
return actions;
|
|
3697
|
+
}, [formsEnabled, formsPath, globalsBasePath, mediaPath, pagesPath, role, toolsPath]);
|
|
3698
|
+
const attentionTitle = role === "client" ? "What Changed" : "Needs Attention";
|
|
3699
|
+
const attentionDescription = role === "client" ? "A quick read on recent content and asset changes." : "The highest-signal items that still need review.";
|
|
3700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-layout", children: [
|
|
3701
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: "orion-dashboard-panel orion-dashboard-panel--attention", children: [
|
|
3702
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-panel-header", children: [
|
|
3703
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3704
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "orion-dashboard-panel-kicker", children: attentionTitle }),
|
|
3705
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { children: attentionDescription })
|
|
3706
|
+
] }),
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "orion-dashboard-panel-meta", children: "Last 7 days" })
|
|
3708
|
+
] }),
|
|
3709
|
+
attentionItems.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-dashboard-attention-list", children: attentionItems.map(
|
|
3710
|
+
(item) => item.href ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3711
|
+
import_link.default,
|
|
3712
|
+
{
|
|
3713
|
+
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
3714
|
+
href: item.href,
|
|
3715
|
+
children: [
|
|
3716
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { children: item.label }),
|
|
3717
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Open" })
|
|
3718
|
+
]
|
|
3719
|
+
},
|
|
3720
|
+
item.id
|
|
3721
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3722
|
+
"div",
|
|
3723
|
+
{
|
|
3724
|
+
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
3725
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { children: item.label })
|
|
3726
|
+
},
|
|
3727
|
+
item.id
|
|
3728
|
+
)
|
|
3729
|
+
) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ModuleStatus, { message: "Loading attention items..." }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3730
|
+
EmptyState2,
|
|
3731
|
+
{
|
|
3732
|
+
body: role === "client" ? "No major changes landed during the current review window." : "No urgent follow-up surfaced from content, forms, or media activity.",
|
|
3733
|
+
title: "Everything looks steady"
|
|
3734
|
+
}
|
|
3735
|
+
)
|
|
3736
|
+
] }),
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: "orion-dashboard-panel orion-dashboard-panel--actions", children: [
|
|
3738
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-panel-header", children: [
|
|
3739
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3740
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Quick Actions" }),
|
|
3741
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { children: "Jump into the work that matters most." })
|
|
3742
|
+
] }),
|
|
3743
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "orion-dashboard-panel-meta", children: [
|
|
3744
|
+
role || "studio",
|
|
3745
|
+
" mode"
|
|
3746
|
+
] })
|
|
3747
|
+
] }),
|
|
3748
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-dashboard-action-list", children: primaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3749
|
+
import_link.default,
|
|
3750
|
+
{
|
|
3751
|
+
className: [
|
|
3752
|
+
"orion-dashboard-action",
|
|
3753
|
+
action.tone === "ghost" ? "is-ghost" : action.tone === "soft" ? "is-soft" : ""
|
|
3754
|
+
].filter(Boolean).join(" "),
|
|
3755
|
+
href: action.href,
|
|
3756
|
+
children: [
|
|
3757
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { children: action.label }),
|
|
3758
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: action.description })
|
|
3759
|
+
]
|
|
3760
|
+
},
|
|
3761
|
+
action.label
|
|
3762
|
+
)) }),
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-workspace-strip", children: [
|
|
3764
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "orion-dashboard-workspace-label", children: "Workspace" }),
|
|
3765
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-dashboard-workspace-pills", children: visibleWorkspaceLinks.map((section) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_link.default, { className: "orion-dashboard-workspace-pill", href: section.href, children: section.label }, section.id)) })
|
|
3766
|
+
] })
|
|
3767
|
+
] }),
|
|
3768
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: "orion-dashboard-panel orion-dashboard-panel--activity", children: [
|
|
3769
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-panel-header", children: [
|
|
3770
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3771
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Recent Activity" }),
|
|
3772
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { children: "The freshest edits, responses, and uploads across the studio." })
|
|
3773
|
+
] }),
|
|
3774
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "orion-dashboard-panel-meta", children: [
|
|
3775
|
+
activityItems.length,
|
|
3776
|
+
" items"
|
|
3777
|
+
] })
|
|
3778
|
+
] }),
|
|
3779
|
+
activityItems.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-dashboard-activity-list", children: activityItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_link.default, { className: `orion-dashboard-activity-item is-${item.kind}`, href: item.href, children: [
|
|
3780
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-activity-copy", children: [
|
|
3781
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-activity-topline", children: [
|
|
3782
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { children: item.title }),
|
|
3783
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: formatRelativeTime2(item.timestamp) })
|
|
3784
|
+
] }),
|
|
3785
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: item.meta })
|
|
3786
|
+
] }),
|
|
3787
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "orion-dashboard-activity-pill", children: item.label })
|
|
3788
|
+
] }, item.id)) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ModuleStatus, { message: "Loading activity feed..." }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3789
|
+
EmptyState2,
|
|
3790
|
+
{
|
|
3791
|
+
body: "Recent page edits, submissions, and uploads will start stacking here as soon as the team gets moving.",
|
|
3792
|
+
title: "No recent activity yet"
|
|
3793
|
+
}
|
|
3794
|
+
)
|
|
3795
|
+
] }),
|
|
3796
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: "orion-dashboard-panel orion-dashboard-panel--snapshot", children: [
|
|
3797
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-panel-header", children: [
|
|
3798
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3799
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Business Snapshot" }),
|
|
3800
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { children: "A compact read on content momentum and performance." })
|
|
3801
|
+
] }),
|
|
3802
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "orion-dashboard-panel-meta", children: "30-day lens" })
|
|
3803
|
+
] }),
|
|
3804
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "orion-dashboard-snapshot-grid", children: [
|
|
3805
|
+
snapshotCards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SnapshotMetric, { card }, card.kicker)),
|
|
3806
|
+
children
|
|
3807
|
+
] }),
|
|
3808
|
+
state.pages.status === "error" || state.media.status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "orion-dashboard-inline-note", children: "Some dashboard modules could not be loaded. The rest of the workspace remains available." }) : null
|
|
3809
|
+
] })
|
|
3810
|
+
] });
|
|
3811
|
+
}
|
|
3812
|
+
|
|
3813
|
+
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
3814
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3815
|
+
var DEFAULT_ADMIN_BASE_PATH2 = "/admin";
|
|
3816
|
+
var normalizePath2 = (value) => {
|
|
3817
|
+
if (!value || value === "/") return "/";
|
|
3818
|
+
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
3819
|
+
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
3820
|
+
return trimmed.length > 0 ? trimmed : "/";
|
|
3821
|
+
};
|
|
3822
|
+
var normalizeAdminBasePath2 = (value) => {
|
|
3823
|
+
const normalized = normalizePath2(value);
|
|
3824
|
+
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH2 : normalized;
|
|
3825
|
+
};
|
|
3826
|
+
var isAbsoluteExternalURL3 = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
3827
|
+
var resolveAdminPath2 = (adminBasePath, targetPath) => {
|
|
3828
|
+
if (!targetPath) return adminBasePath;
|
|
3829
|
+
if (isAbsoluteExternalURL3(targetPath)) return targetPath;
|
|
3830
|
+
const normalizedBasePath = normalizeAdminBasePath2(adminBasePath);
|
|
3831
|
+
const normalizedTargetPath = normalizePath2(targetPath);
|
|
3832
|
+
if (normalizedTargetPath === "/admin") {
|
|
3833
|
+
return normalizedBasePath;
|
|
3834
|
+
}
|
|
3835
|
+
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
3836
|
+
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
3837
|
+
}
|
|
3838
|
+
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
3839
|
+
return normalizedTargetPath;
|
|
3840
|
+
}
|
|
3841
|
+
if (normalizedTargetPath === "/") {
|
|
3842
|
+
return normalizedBasePath;
|
|
3843
|
+
}
|
|
3844
|
+
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
3845
|
+
};
|
|
3846
|
+
var getPropString2 = (props, key, fallback) => {
|
|
3847
|
+
if (!props || typeof props !== "object") return fallback;
|
|
3848
|
+
const direct = props[key];
|
|
3849
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
3850
|
+
const clientProps = props.clientProps;
|
|
3851
|
+
if (clientProps && typeof clientProps === "object") {
|
|
3852
|
+
const nested = clientProps[key];
|
|
3853
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
3854
|
+
}
|
|
3855
|
+
return fallback;
|
|
3856
|
+
};
|
|
3857
|
+
var getPropBoolean2 = (props, key, fallback) => {
|
|
3858
|
+
if (!props || typeof props !== "object") return fallback;
|
|
3859
|
+
const direct = props[key];
|
|
3860
|
+
if (typeof direct === "boolean") return direct;
|
|
3861
|
+
const clientProps = props.clientProps;
|
|
3862
|
+
if (clientProps && typeof clientProps === "object") {
|
|
3863
|
+
const nested = clientProps[key];
|
|
3864
|
+
if (typeof nested === "boolean") return nested;
|
|
3865
|
+
}
|
|
3866
|
+
return fallback;
|
|
3867
|
+
};
|
|
3868
|
+
var getPropSections2 = (props) => {
|
|
3869
|
+
if (!props || typeof props !== "object") return [];
|
|
3870
|
+
const direct = resolveStudioSections(props.sections);
|
|
3871
|
+
if (direct.length > 0) return direct;
|
|
3872
|
+
const clientProps = props.clientProps;
|
|
3873
|
+
if (clientProps && typeof clientProps === "object") {
|
|
3874
|
+
return resolveStudioSections(clientProps.sections);
|
|
3875
|
+
}
|
|
3876
|
+
return [];
|
|
3877
|
+
};
|
|
3878
|
+
var readUserRole2 = (props) => {
|
|
3879
|
+
if (!props || typeof props !== "object") return void 0;
|
|
3880
|
+
const user = props.user;
|
|
3881
|
+
if (user && typeof user === "object") {
|
|
3882
|
+
const role = user.role;
|
|
3883
|
+
if (typeof role === "string") {
|
|
3884
|
+
return role;
|
|
3885
|
+
}
|
|
3886
|
+
}
|
|
3887
|
+
const initPageResult = props.initPageResult;
|
|
3888
|
+
if (initPageResult && typeof initPageResult === "object") {
|
|
3889
|
+
const req = initPageResult.req;
|
|
3890
|
+
if (req && typeof req === "object") {
|
|
3891
|
+
const nestedUser = req.user;
|
|
3892
|
+
if (nestedUser && typeof nestedUser === "object") {
|
|
3893
|
+
const role = nestedUser.role;
|
|
3894
|
+
if (typeof role === "string") {
|
|
3895
|
+
return role;
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
return void 0;
|
|
3901
|
+
};
|
|
3902
|
+
var readAdminBasePath = (props) => {
|
|
3903
|
+
if (!props || typeof props !== "object") {
|
|
3904
|
+
return DEFAULT_ADMIN_BASE_PATH2;
|
|
3905
|
+
}
|
|
3906
|
+
const payloadLike = props.payload;
|
|
3907
|
+
if (payloadLike && typeof payloadLike === "object") {
|
|
3908
|
+
const config = payloadLike.config;
|
|
3909
|
+
const routes = config && typeof config === "object" ? config.routes : null;
|
|
3910
|
+
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
3911
|
+
if (typeof admin === "string" && admin.length > 0) {
|
|
3912
|
+
return normalizeAdminBasePath2(admin);
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
const initPageResult = props.initPageResult;
|
|
3916
|
+
if (initPageResult && typeof initPageResult === "object") {
|
|
3917
|
+
const req = initPageResult.req;
|
|
3918
|
+
if (req && typeof req === "object") {
|
|
3919
|
+
const nestedPayload = req.payload;
|
|
3920
|
+
if (nestedPayload && typeof nestedPayload === "object") {
|
|
3921
|
+
const config = nestedPayload.config;
|
|
3922
|
+
const routes = config && typeof config === "object" ? config.routes : null;
|
|
3923
|
+
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
3924
|
+
if (typeof admin === "string" && admin.length > 0) {
|
|
3925
|
+
return normalizeAdminBasePath2(admin);
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
return DEFAULT_ADMIN_BASE_PATH2;
|
|
3931
|
+
};
|
|
3932
|
+
var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
|
|
3933
|
+
const links = [
|
|
3934
|
+
{
|
|
3935
|
+
href: resolveAdminPath2(adminBasePath, "/pages"),
|
|
3936
|
+
id: "pages",
|
|
3937
|
+
label: "Pages"
|
|
3938
|
+
},
|
|
3939
|
+
...formsEnabled ? [
|
|
3940
|
+
{
|
|
3941
|
+
href: resolveAdminPath2(adminBasePath, "/forms"),
|
|
3942
|
+
id: "forms",
|
|
3943
|
+
label: "Forms",
|
|
3944
|
+
roles: ["admin", "editor"]
|
|
3945
|
+
}
|
|
3946
|
+
] : [],
|
|
3947
|
+
{
|
|
3948
|
+
href: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
3949
|
+
id: "globals",
|
|
3950
|
+
label: "Globals"
|
|
3951
|
+
},
|
|
3952
|
+
{
|
|
3953
|
+
href: resolveAdminPath2(adminBasePath, "/media"),
|
|
3954
|
+
id: "media",
|
|
3955
|
+
label: "Media"
|
|
3956
|
+
},
|
|
3957
|
+
...sections.map((section) => ({
|
|
3958
|
+
href: resolveAdminPath2(adminBasePath, section.href),
|
|
3959
|
+
id: section.id,
|
|
3960
|
+
label: section.label,
|
|
3961
|
+
...section.roles ? { roles: section.roles } : {}
|
|
3962
|
+
})),
|
|
3963
|
+
{
|
|
3964
|
+
href: resolveAdminPath2(adminBasePath, "/tools"),
|
|
3965
|
+
id: "admin-tools",
|
|
3966
|
+
label: "Admin Tools",
|
|
3967
|
+
roles: ["admin"]
|
|
3968
|
+
}
|
|
3969
|
+
];
|
|
3970
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3971
|
+
return links.filter((link) => {
|
|
3972
|
+
if (seen.has(link.id)) {
|
|
3973
|
+
return false;
|
|
3974
|
+
}
|
|
3975
|
+
seen.add(link.id);
|
|
3976
|
+
return true;
|
|
3977
|
+
});
|
|
3978
|
+
};
|
|
3979
|
+
function AdminStudioDashboard(rawProps) {
|
|
3980
|
+
const props = rawProps || {};
|
|
3981
|
+
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
3982
|
+
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
3983
|
+
const sections = getPropSections2(props);
|
|
3984
|
+
const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
|
|
3985
|
+
const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
|
|
3986
|
+
const formSubmissionsCollectionSlug = getPropString2(
|
|
3987
|
+
props,
|
|
3988
|
+
"formSubmissionsCollectionSlug",
|
|
3989
|
+
"form-submissions"
|
|
3990
|
+
);
|
|
3991
|
+
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
3992
|
+
const adminBasePath = readAdminBasePath(props);
|
|
3993
|
+
const userRole = readUserRole2(props);
|
|
3994
|
+
const navProps = {
|
|
3995
|
+
brandName: getPropString2(props, "brandName", "Orion Studio"),
|
|
3996
|
+
formSubmissionsCollectionSlug,
|
|
3997
|
+
formsCollectionSlug,
|
|
3998
|
+
formsEnabled,
|
|
3999
|
+
globalsBasePath,
|
|
4000
|
+
logoUrl: getPropString2(props, "logoUrl", ""),
|
|
4001
|
+
mediaCollectionSlug,
|
|
4002
|
+
pagesCollectionSlug,
|
|
4003
|
+
sections
|
|
4004
|
+
};
|
|
4005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StudioSectionLayout, { navProps, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4006
|
+
AdminPage,
|
|
4007
|
+
{
|
|
4008
|
+
breadcrumbs: [{ label: "Dashboard" }],
|
|
4009
|
+
description: "What needs attention, what changed recently, and how the site is performing.",
|
|
4010
|
+
title: "Studio",
|
|
4011
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4012
|
+
AdminStudioDashboardClient,
|
|
4013
|
+
{
|
|
4014
|
+
formSubmissionsCollectionSlug,
|
|
4015
|
+
formsCollectionSlug,
|
|
4016
|
+
formsEnabled,
|
|
4017
|
+
formsPath: resolveAdminPath2(adminBasePath, "/forms"),
|
|
4018
|
+
globalsBasePath: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
4019
|
+
mediaCollectionSlug,
|
|
4020
|
+
mediaPath: resolveAdminPath2(adminBasePath, "/media"),
|
|
4021
|
+
pagesCollectionSlug,
|
|
4022
|
+
pagesPath: resolveAdminPath2(adminBasePath, "/pages"),
|
|
4023
|
+
sectionLinks: buildSectionLinks(adminBasePath, sections, formsEnabled, globalsBasePath),
|
|
4024
|
+
toolsPath: resolveAdminPath2(adminBasePath, "/tools"),
|
|
4025
|
+
userRole
|
|
4026
|
+
}
|
|
4027
|
+
)
|
|
4028
|
+
}
|
|
4029
|
+
) });
|
|
4030
|
+
}
|
|
4031
|
+
|
|
4032
|
+
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
4033
|
+
var import_react17 = require("react");
|
|
4034
|
+
var import_link2 = __toESM(require("next/link"));
|
|
4035
|
+
var import_ui5 = require("@payloadcms/ui");
|
|
4036
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3211
4037
|
var isAdmin = (user) => {
|
|
3212
4038
|
if (!user || typeof user !== "object") return false;
|
|
3213
4039
|
const role = user.role;
|
|
3214
4040
|
return typeof role === "string" && role === "admin";
|
|
3215
4041
|
};
|
|
3216
|
-
var
|
|
4042
|
+
var getPropString3 = (props, key, fallback) => {
|
|
3217
4043
|
if (!props || typeof props !== "object") return fallback;
|
|
3218
4044
|
const direct = props[key];
|
|
3219
4045
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3226,13 +4052,13 @@ var getPropString2 = (props, key, fallback) => {
|
|
|
3226
4052
|
};
|
|
3227
4053
|
function AdminStudioPagesListView(props) {
|
|
3228
4054
|
const { user } = (0, import_ui5.useAuth)();
|
|
3229
|
-
const pagesCollectionSlug =
|
|
4055
|
+
const pagesCollectionSlug = getPropString3(props, "pagesCollectionSlug", "pages");
|
|
3230
4056
|
const adminBasePath = useAdminBasePath();
|
|
3231
4057
|
const newPagePath = resolveAdminPath(adminBasePath, "/pages/new");
|
|
3232
|
-
const [loading, setLoading] = (0,
|
|
3233
|
-
const [error, setError] = (0,
|
|
3234
|
-
const [docs, setDocs] = (0,
|
|
3235
|
-
const apiURL = (0,
|
|
4058
|
+
const [loading, setLoading] = (0, import_react17.useState)(true);
|
|
4059
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
4060
|
+
const [docs, setDocs] = (0, import_react17.useState)([]);
|
|
4061
|
+
const apiURL = (0, import_react17.useMemo)(() => {
|
|
3236
4062
|
const params = new URLSearchParams({
|
|
3237
4063
|
depth: "0",
|
|
3238
4064
|
limit: "100",
|
|
@@ -3241,7 +4067,7 @@ function AdminStudioPagesListView(props) {
|
|
|
3241
4067
|
});
|
|
3242
4068
|
return `/api/${pagesCollectionSlug}?${params.toString()}`;
|
|
3243
4069
|
}, [pagesCollectionSlug]);
|
|
3244
|
-
(0,
|
|
4070
|
+
(0, import_react17.useEffect)(() => {
|
|
3245
4071
|
let cancelled = false;
|
|
3246
4072
|
const run = async () => {
|
|
3247
4073
|
setLoading(true);
|
|
@@ -3271,10 +4097,10 @@ function AdminStudioPagesListView(props) {
|
|
|
3271
4097
|
cancelled = true;
|
|
3272
4098
|
};
|
|
3273
4099
|
}, [apiURL]);
|
|
3274
|
-
return /* @__PURE__ */ (0,
|
|
4100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3275
4101
|
AdminPage,
|
|
3276
4102
|
{
|
|
3277
|
-
actions: isAdmin(user) ? /* @__PURE__ */ (0,
|
|
4103
|
+
actions: isAdmin(user) ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_link2.default, { className: "orion-admin-action-button", href: newPagePath, children: "New Page" }) : null,
|
|
3278
4104
|
breadcrumbs: [
|
|
3279
4105
|
{ label: "Dashboard", href: adminBasePath },
|
|
3280
4106
|
{ label: "Pages" }
|
|
@@ -3282,21 +4108,21 @@ function AdminStudioPagesListView(props) {
|
|
|
3282
4108
|
description: "Open a page to edit it in the inline custom builder.",
|
|
3283
4109
|
title: "Pages",
|
|
3284
4110
|
children: [
|
|
3285
|
-
loading ? /* @__PURE__ */ (0,
|
|
3286
|
-
error ? /* @__PURE__ */ (0,
|
|
3287
|
-
/* @__PURE__ */ (0,
|
|
3288
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */ (0,
|
|
3289
|
-
/* @__PURE__ */ (0,
|
|
3290
|
-
/* @__PURE__ */ (0,
|
|
4111
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
4112
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "orion-admin-error", children: error }) : null,
|
|
4113
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "orion-admin-list", children: [
|
|
4114
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "orion-admin-card", children: [
|
|
4115
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("strong", { children: "No pages yet" }),
|
|
4116
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Create the first page to start building content." })
|
|
3291
4117
|
] }) : null,
|
|
3292
4118
|
docs.map((doc) => {
|
|
3293
4119
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
3294
4120
|
if (!id) return null;
|
|
3295
4121
|
const title = typeof doc.title === "string" ? doc.title : "Untitled Page";
|
|
3296
4122
|
const status = typeof doc._status === "string" ? doc._status : "draft";
|
|
3297
|
-
return /* @__PURE__ */ (0,
|
|
3298
|
-
/* @__PURE__ */ (0,
|
|
3299
|
-
/* @__PURE__ */ (0,
|
|
4123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_link2.default, { className: "orion-admin-list-item", href: resolveAdminPath(adminBasePath, `/pages/${id}`), children: [
|
|
4124
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("strong", { children: title }) }),
|
|
4125
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "orion-admin-pill", children: status })
|
|
3300
4126
|
] }, id);
|
|
3301
4127
|
})
|
|
3302
4128
|
] })
|
|
@@ -3306,9 +4132,9 @@ function AdminStudioPagesListView(props) {
|
|
|
3306
4132
|
}
|
|
3307
4133
|
|
|
3308
4134
|
// src/admin/components/studio/AdminStudioPageEditView.tsx
|
|
3309
|
-
var
|
|
4135
|
+
var import_react18 = require("react");
|
|
3310
4136
|
var import_ui6 = require("@payloadcms/ui");
|
|
3311
|
-
var
|
|
4137
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3312
4138
|
var isAdmin2 = (user) => {
|
|
3313
4139
|
if (!user || typeof user !== "object") return false;
|
|
3314
4140
|
const role = user.role;
|
|
@@ -3319,7 +4145,7 @@ var isEditor = (user) => {
|
|
|
3319
4145
|
const role = user.role;
|
|
3320
4146
|
return typeof role === "string" && role === "editor";
|
|
3321
4147
|
};
|
|
3322
|
-
var
|
|
4148
|
+
var getPropString4 = (props, key, fallback) => {
|
|
3323
4149
|
if (!props || typeof props !== "object") return fallback;
|
|
3324
4150
|
const direct = props[key];
|
|
3325
4151
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3348,18 +4174,18 @@ var getPageIDFromPathname = (pathname) => {
|
|
|
3348
4174
|
function AdminStudioPageEditView(props) {
|
|
3349
4175
|
const { user } = (0, import_ui6.useAuth)();
|
|
3350
4176
|
const adminBasePath = useAdminBasePath();
|
|
3351
|
-
const iframeRef = (0,
|
|
3352
|
-
const [saving, setSaving] = (0,
|
|
3353
|
-
const [dirty, setDirty] = (0,
|
|
3354
|
-
const [hasUnpublishedChanges, setHasUnpublishedChanges] = (0,
|
|
3355
|
-
const [canUndo, setCanUndo] = (0,
|
|
3356
|
-
const [canRedo, setCanRedo] = (0,
|
|
3357
|
-
const builderBasePath =
|
|
4177
|
+
const iframeRef = (0, import_react18.useRef)(null);
|
|
4178
|
+
const [saving, setSaving] = (0, import_react18.useState)(null);
|
|
4179
|
+
const [dirty, setDirty] = (0, import_react18.useState)(false);
|
|
4180
|
+
const [hasUnpublishedChanges, setHasUnpublishedChanges] = (0, import_react18.useState)(false);
|
|
4181
|
+
const [canUndo, setCanUndo] = (0, import_react18.useState)(false);
|
|
4182
|
+
const [canRedo, setCanRedo] = (0, import_react18.useState)(false);
|
|
4183
|
+
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
3358
4184
|
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
3359
|
-
const pageIDFromParams = (0,
|
|
3360
|
-
const [pageID, setPageID] = (0,
|
|
3361
|
-
const [didResolvePathFallback, setDidResolvePathFallback] = (0,
|
|
3362
|
-
(0,
|
|
4185
|
+
const pageIDFromParams = (0, import_react18.useMemo)(() => getParam(props.params, "id"), [props.params]);
|
|
4186
|
+
const [pageID, setPageID] = (0, import_react18.useState)(pageIDFromParams);
|
|
4187
|
+
const [didResolvePathFallback, setDidResolvePathFallback] = (0, import_react18.useState)(false);
|
|
4188
|
+
(0, import_react18.useEffect)(() => {
|
|
3363
4189
|
if (pageIDFromParams) {
|
|
3364
4190
|
setPageID(pageIDFromParams);
|
|
3365
4191
|
setDidResolvePathFallback(true);
|
|
@@ -3403,7 +4229,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3403
4229
|
} catch {
|
|
3404
4230
|
}
|
|
3405
4231
|
};
|
|
3406
|
-
(0,
|
|
4232
|
+
(0, import_react18.useEffect)(() => {
|
|
3407
4233
|
if (!pageID) {
|
|
3408
4234
|
return;
|
|
3409
4235
|
}
|
|
@@ -3426,7 +4252,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3426
4252
|
}
|
|
3427
4253
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
3428
4254
|
};
|
|
3429
|
-
(0,
|
|
4255
|
+
(0, import_react18.useEffect)(() => {
|
|
3430
4256
|
const onMessage = (event) => {
|
|
3431
4257
|
const data = event.data;
|
|
3432
4258
|
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
@@ -3461,8 +4287,8 @@ function AdminStudioPageEditView(props) {
|
|
|
3461
4287
|
return () => window.removeEventListener("message", onMessage);
|
|
3462
4288
|
}, []);
|
|
3463
4289
|
if (!pageID && !didResolvePathFallback) {
|
|
3464
|
-
return /* @__PURE__ */ (0,
|
|
3465
|
-
/* @__PURE__ */ (0,
|
|
4290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4291
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3466
4292
|
import_ui6.SetStepNav,
|
|
3467
4293
|
{
|
|
3468
4294
|
nav: [
|
|
@@ -3471,13 +4297,13 @@ function AdminStudioPageEditView(props) {
|
|
|
3471
4297
|
]
|
|
3472
4298
|
}
|
|
3473
4299
|
),
|
|
3474
|
-
/* @__PURE__ */ (0,
|
|
3475
|
-
/* @__PURE__ */ (0,
|
|
4300
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
4301
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading page editor..." })
|
|
3476
4302
|
] }) });
|
|
3477
4303
|
}
|
|
3478
4304
|
if (!pageID) {
|
|
3479
|
-
return /* @__PURE__ */ (0,
|
|
3480
|
-
/* @__PURE__ */ (0,
|
|
4305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4306
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3481
4307
|
import_ui6.SetStepNav,
|
|
3482
4308
|
{
|
|
3483
4309
|
nav: [
|
|
@@ -3486,12 +4312,12 @@ function AdminStudioPageEditView(props) {
|
|
|
3486
4312
|
]
|
|
3487
4313
|
}
|
|
3488
4314
|
),
|
|
3489
|
-
/* @__PURE__ */ (0,
|
|
3490
|
-
/* @__PURE__ */ (0,
|
|
4315
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
4316
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Missing page ID." })
|
|
3491
4317
|
] }) });
|
|
3492
4318
|
}
|
|
3493
|
-
return /* @__PURE__ */ (0,
|
|
3494
|
-
/* @__PURE__ */ (0,
|
|
4319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4320
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3495
4321
|
import_ui6.SetStepNav,
|
|
3496
4322
|
{
|
|
3497
4323
|
nav: [
|
|
@@ -3500,8 +4326,8 @@ function AdminStudioPageEditView(props) {
|
|
|
3500
4326
|
]
|
|
3501
4327
|
}
|
|
3502
4328
|
),
|
|
3503
|
-
/* @__PURE__ */ (0,
|
|
3504
|
-
/* @__PURE__ */ (0,
|
|
4329
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "grid", gridTemplateRows: "auto 1fr", height: "calc(100vh - 120px)" }, children: [
|
|
4330
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3505
4331
|
"div",
|
|
3506
4332
|
{
|
|
3507
4333
|
style: {
|
|
@@ -3517,9 +4343,9 @@ function AdminStudioPageEditView(props) {
|
|
|
3517
4343
|
zIndex: 20
|
|
3518
4344
|
},
|
|
3519
4345
|
children: [
|
|
3520
|
-
/* @__PURE__ */ (0,
|
|
3521
|
-
/* @__PURE__ */ (0,
|
|
3522
|
-
/* @__PURE__ */ (0,
|
|
4346
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
4347
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { fontWeight: 900 }, children: "Page Editor" }),
|
|
4348
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3523
4349
|
"div",
|
|
3524
4350
|
{
|
|
3525
4351
|
style: {
|
|
@@ -3535,9 +4361,9 @@ function AdminStudioPageEditView(props) {
|
|
|
3535
4361
|
}
|
|
3536
4362
|
)
|
|
3537
4363
|
] }),
|
|
3538
|
-
/* @__PURE__ */ (0,
|
|
3539
|
-
/* @__PURE__ */ (0,
|
|
3540
|
-
/* @__PURE__ */ (0,
|
|
4364
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
4365
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: dirty ? "var(--theme-elevation-900)" : "var(--theme-elevation-600)", fontSize: "0.85rem", fontWeight: 700 }, children: dirty ? "Unsaved changes" : "All changes saved" }),
|
|
4366
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3541
4367
|
"div",
|
|
3542
4368
|
{
|
|
3543
4369
|
style: {
|
|
@@ -3554,7 +4380,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3554
4380
|
children: hasUnpublishedChanges ? "Unpublished draft changes" : "Live is up to date"
|
|
3555
4381
|
}
|
|
3556
4382
|
),
|
|
3557
|
-
/* @__PURE__ */ (0,
|
|
4383
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3558
4384
|
"button",
|
|
3559
4385
|
{
|
|
3560
4386
|
disabled: !canUndo,
|
|
@@ -3570,7 +4396,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3570
4396
|
children: "Undo"
|
|
3571
4397
|
}
|
|
3572
4398
|
),
|
|
3573
|
-
/* @__PURE__ */ (0,
|
|
4399
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3574
4400
|
"button",
|
|
3575
4401
|
{
|
|
3576
4402
|
disabled: !canRedo,
|
|
@@ -3586,7 +4412,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3586
4412
|
children: "Redo"
|
|
3587
4413
|
}
|
|
3588
4414
|
),
|
|
3589
|
-
/* @__PURE__ */ (0,
|
|
4415
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3590
4416
|
"button",
|
|
3591
4417
|
{
|
|
3592
4418
|
disabled: saving !== null,
|
|
@@ -3602,7 +4428,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3602
4428
|
children: saving === "draft" ? "Saving\u2026" : "Save Draft"
|
|
3603
4429
|
}
|
|
3604
4430
|
),
|
|
3605
|
-
/* @__PURE__ */ (0,
|
|
4431
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3606
4432
|
"button",
|
|
3607
4433
|
{
|
|
3608
4434
|
disabled: !canPublish || saving !== null,
|
|
@@ -3625,7 +4451,7 @@ function AdminStudioPageEditView(props) {
|
|
|
3625
4451
|
]
|
|
3626
4452
|
}
|
|
3627
4453
|
),
|
|
3628
|
-
/* @__PURE__ */ (0,
|
|
4454
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3629
4455
|
"iframe",
|
|
3630
4456
|
{
|
|
3631
4457
|
ref: iframeRef,
|
|
@@ -3645,11 +4471,11 @@ function AdminStudioPageEditView(props) {
|
|
|
3645
4471
|
}
|
|
3646
4472
|
|
|
3647
4473
|
// src/admin/components/studio/AdminStudioNewPageView.tsx
|
|
3648
|
-
var
|
|
4474
|
+
var import_react19 = require("react");
|
|
3649
4475
|
var import_ui7 = require("@payloadcms/ui");
|
|
3650
|
-
var
|
|
4476
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3651
4477
|
var pageTemplates = ["standard", "landing", "services", "contact"];
|
|
3652
|
-
var
|
|
4478
|
+
var getPropString5 = (props, key, fallback) => {
|
|
3653
4479
|
if (!props || typeof props !== "object") return fallback;
|
|
3654
4480
|
const direct = props[key];
|
|
3655
4481
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3669,11 +4495,11 @@ var slugify = (value) => value.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "")
|
|
|
3669
4495
|
function AdminStudioNewPageView(props) {
|
|
3670
4496
|
const { user } = (0, import_ui7.useAuth)();
|
|
3671
4497
|
const adminBasePath = useAdminBasePath();
|
|
3672
|
-
const pagesCollectionSlug =
|
|
3673
|
-
const [submitting, setSubmitting] = (0,
|
|
3674
|
-
const [error, setError] = (0,
|
|
4498
|
+
const pagesCollectionSlug = getPropString5(props, "pagesCollectionSlug", "pages");
|
|
4499
|
+
const [submitting, setSubmitting] = (0, import_react19.useState)(false);
|
|
4500
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
3675
4501
|
if (!canManagePages(user)) {
|
|
3676
|
-
return /* @__PURE__ */ (0,
|
|
4502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3677
4503
|
AdminPage,
|
|
3678
4504
|
{
|
|
3679
4505
|
breadcrumbs: [
|
|
@@ -3683,9 +4509,9 @@ function AdminStudioNewPageView(props) {
|
|
|
3683
4509
|
],
|
|
3684
4510
|
description: "You do not have access to create pages.",
|
|
3685
4511
|
title: "New Page",
|
|
3686
|
-
children: /* @__PURE__ */ (0,
|
|
3687
|
-
/* @__PURE__ */ (0,
|
|
3688
|
-
/* @__PURE__ */ (0,
|
|
4512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "orion-admin-card", children: [
|
|
4513
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("strong", { children: "Access denied" }),
|
|
4514
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "This section is restricted to administrator and editor accounts." })
|
|
3689
4515
|
] })
|
|
3690
4516
|
}
|
|
3691
4517
|
) });
|
|
@@ -3730,7 +4556,7 @@ function AdminStudioNewPageView(props) {
|
|
|
3730
4556
|
setSubmitting(false);
|
|
3731
4557
|
}
|
|
3732
4558
|
};
|
|
3733
|
-
return /* @__PURE__ */ (0,
|
|
4559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3734
4560
|
AdminPage,
|
|
3735
4561
|
{
|
|
3736
4562
|
breadcrumbs: [
|
|
@@ -3740,33 +4566,33 @@ function AdminStudioNewPageView(props) {
|
|
|
3740
4566
|
],
|
|
3741
4567
|
description: "Create a new page and open it in the custom editor.",
|
|
3742
4568
|
title: "New Page",
|
|
3743
|
-
children: /* @__PURE__ */ (0,
|
|
3744
|
-
error ? /* @__PURE__ */ (0,
|
|
3745
|
-
/* @__PURE__ */ (0,
|
|
4569
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("form", { className: "orion-admin-form", onSubmit: createPage, children: [
|
|
4570
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "orion-admin-error", children: error }) : null,
|
|
4571
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { children: [
|
|
3746
4572
|
"Title",
|
|
3747
|
-
/* @__PURE__ */ (0,
|
|
4573
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { name: "title", placeholder: "Services", required: true, type: "text" })
|
|
3748
4574
|
] }),
|
|
3749
|
-
/* @__PURE__ */ (0,
|
|
4575
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { children: [
|
|
3750
4576
|
"Slug",
|
|
3751
|
-
/* @__PURE__ */ (0,
|
|
4577
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { name: "slug", placeholder: "services", type: "text" })
|
|
3752
4578
|
] }),
|
|
3753
|
-
/* @__PURE__ */ (0,
|
|
4579
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { children: [
|
|
3754
4580
|
"Template",
|
|
3755
|
-
/* @__PURE__ */ (0,
|
|
3756
|
-
/* @__PURE__ */ (0,
|
|
3757
|
-
/* @__PURE__ */ (0,
|
|
3758
|
-
/* @__PURE__ */ (0,
|
|
3759
|
-
/* @__PURE__ */ (0,
|
|
4581
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("select", { defaultValue: "standard", name: "template", children: [
|
|
4582
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "standard", children: "Standard" }),
|
|
4583
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "landing", children: "Landing" }),
|
|
4584
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "contact", children: "Contact" }),
|
|
4585
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "services", children: "Services" })
|
|
3760
4586
|
] })
|
|
3761
4587
|
] }),
|
|
3762
|
-
/* @__PURE__ */ (0,
|
|
4588
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { disabled: submitting, type: "submit", children: submitting ? "Creating..." : "Create Page" })
|
|
3763
4589
|
] })
|
|
3764
4590
|
}
|
|
3765
4591
|
) });
|
|
3766
4592
|
}
|
|
3767
4593
|
|
|
3768
4594
|
// src/admin/components/studio/AdminStudioGlobalsView.tsx
|
|
3769
|
-
var
|
|
4595
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3770
4596
|
var getPropGlobals = (props) => {
|
|
3771
4597
|
if (!props || typeof props !== "object") return null;
|
|
3772
4598
|
const direct = props.globals;
|
|
@@ -3786,7 +4612,7 @@ function AdminStudioGlobalsView(props) {
|
|
|
3786
4612
|
{ slug: "footer", label: "Footer" },
|
|
3787
4613
|
{ slug: "social-media", label: "Social Media" }
|
|
3788
4614
|
];
|
|
3789
|
-
return /* @__PURE__ */ (0,
|
|
4615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3790
4616
|
AdminPage,
|
|
3791
4617
|
{
|
|
3792
4618
|
breadcrumbs: [
|
|
@@ -3795,17 +4621,17 @@ function AdminStudioGlobalsView(props) {
|
|
|
3795
4621
|
],
|
|
3796
4622
|
description: "Site-wide content and branding settings.",
|
|
3797
4623
|
title: "Globals",
|
|
3798
|
-
children: /* @__PURE__ */ (0,
|
|
4624
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "orion-admin-list", children: globals.map((global) => {
|
|
3799
4625
|
const href = resolveAdminPath(
|
|
3800
4626
|
adminBasePath,
|
|
3801
4627
|
typeof global.href === "string" ? global.href : `/globals/${global.slug}`
|
|
3802
4628
|
);
|
|
3803
|
-
return /* @__PURE__ */ (0,
|
|
3804
|
-
/* @__PURE__ */ (0,
|
|
3805
|
-
/* @__PURE__ */ (0,
|
|
3806
|
-
/* @__PURE__ */ (0,
|
|
4629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("a", { className: "orion-admin-list-item", href, children: [
|
|
4630
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
|
|
4631
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("strong", { children: global.label }),
|
|
4632
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "orion-admin-list-meta", children: typeof global.description === "string" && global.description.length > 0 ? global.description : href })
|
|
3807
4633
|
] }),
|
|
3808
|
-
/* @__PURE__ */ (0,
|
|
4634
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "orion-admin-list-meta", children: "Open" })
|
|
3809
4635
|
] }, global.slug);
|
|
3810
4636
|
}) })
|
|
3811
4637
|
}
|
|
@@ -3813,9 +4639,9 @@ function AdminStudioGlobalsView(props) {
|
|
|
3813
4639
|
}
|
|
3814
4640
|
|
|
3815
4641
|
// src/admin/components/studio/AdminStudioSiteSettingsGlobalView.tsx
|
|
3816
|
-
var
|
|
3817
|
-
var
|
|
3818
|
-
var
|
|
4642
|
+
var import_react20 = require("react");
|
|
4643
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4644
|
+
var getPropString6 = (props, key, fallback) => {
|
|
3819
4645
|
if (!props || typeof props !== "object") return fallback;
|
|
3820
4646
|
const direct = props[key];
|
|
3821
4647
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3894,18 +4720,18 @@ var serializeRows = (value, formatter) => {
|
|
|
3894
4720
|
return value.filter((item) => Boolean(item) && typeof item === "object").map((item) => formatter(item)).filter((item) => Boolean(item)).join("\n");
|
|
3895
4721
|
};
|
|
3896
4722
|
function AdminStudioSiteSettingsGlobalView(props) {
|
|
3897
|
-
const globalSlug =
|
|
3898
|
-
const globalsBasePath =
|
|
3899
|
-
const mediaCollectionSlug =
|
|
4723
|
+
const globalSlug = getPropString6(props, "globalSlug", "site-settings");
|
|
4724
|
+
const globalsBasePath = getPropString6(props, "globalsBasePath", "/globals");
|
|
4725
|
+
const mediaCollectionSlug = getPropString6(props, "mediaCollectionSlug", "media");
|
|
3900
4726
|
const adminBasePath = useAdminBasePath();
|
|
3901
4727
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3902
|
-
const [loading, setLoading] = (0,
|
|
3903
|
-
const [saving, setSaving] = (0,
|
|
3904
|
-
const [error, setError] = (0,
|
|
3905
|
-
const [savedMessage, setSavedMessage] = (0,
|
|
3906
|
-
const [globalData, setGlobalData] = (0,
|
|
3907
|
-
const [mediaOptions, setMediaOptions] = (0,
|
|
3908
|
-
(0,
|
|
4728
|
+
const [loading, setLoading] = (0, import_react20.useState)(true);
|
|
4729
|
+
const [saving, setSaving] = (0, import_react20.useState)(false);
|
|
4730
|
+
const [error, setError] = (0, import_react20.useState)(null);
|
|
4731
|
+
const [savedMessage, setSavedMessage] = (0, import_react20.useState)(null);
|
|
4732
|
+
const [globalData, setGlobalData] = (0, import_react20.useState)({});
|
|
4733
|
+
const [mediaOptions, setMediaOptions] = (0, import_react20.useState)([]);
|
|
4734
|
+
(0, import_react20.useEffect)(() => {
|
|
3909
4735
|
let cancelled = false;
|
|
3910
4736
|
const run = async () => {
|
|
3911
4737
|
setLoading(true);
|
|
@@ -3953,15 +4779,15 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
3953
4779
|
cancelled = true;
|
|
3954
4780
|
};
|
|
3955
4781
|
}, [globalSlug, mediaCollectionSlug]);
|
|
3956
|
-
const defaultSeo = (0,
|
|
4782
|
+
const defaultSeo = (0, import_react20.useMemo)(() => {
|
|
3957
4783
|
const value = globalData.defaultSeo;
|
|
3958
4784
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
3959
4785
|
}, [globalData.defaultSeo]);
|
|
3960
|
-
const businessProfile = (0,
|
|
4786
|
+
const businessProfile = (0, import_react20.useMemo)(() => {
|
|
3961
4787
|
const value = globalData.businessProfile;
|
|
3962
4788
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
3963
4789
|
}, [globalData.businessProfile]);
|
|
3964
|
-
const openingHoursRows = (0,
|
|
4790
|
+
const openingHoursRows = (0, import_react20.useMemo)(
|
|
3965
4791
|
() => serializeRows(businessProfile.openingHours, (item) => {
|
|
3966
4792
|
const dayOfWeek = String(item.dayOfWeek || "").trim();
|
|
3967
4793
|
const opens = String(item.opens || "").trim();
|
|
@@ -3973,14 +4799,14 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
3973
4799
|
}),
|
|
3974
4800
|
[businessProfile.openingHours]
|
|
3975
4801
|
);
|
|
3976
|
-
const sameAsRows = (0,
|
|
4802
|
+
const sameAsRows = (0, import_react20.useMemo)(
|
|
3977
4803
|
() => serializeRows(businessProfile.sameAs, (item) => {
|
|
3978
4804
|
const url = String(item.url || "").trim();
|
|
3979
4805
|
return url || null;
|
|
3980
4806
|
}),
|
|
3981
4807
|
[businessProfile.sameAs]
|
|
3982
4808
|
);
|
|
3983
|
-
const serviceCatalogRows = (0,
|
|
4809
|
+
const serviceCatalogRows = (0, import_react20.useMemo)(
|
|
3984
4810
|
() => serializeRows(businessProfile.serviceCatalog, (item) => {
|
|
3985
4811
|
const name = String(item.name || "").trim();
|
|
3986
4812
|
const description = String(item.description || "").trim();
|
|
@@ -4051,7 +4877,7 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
4051
4877
|
};
|
|
4052
4878
|
const logoID = getRelationID(globalData.logo);
|
|
4053
4879
|
const ogImageID = getRelationID(defaultSeo.ogImage);
|
|
4054
|
-
return /* @__PURE__ */ (0,
|
|
4880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4055
4881
|
AdminPage,
|
|
4056
4882
|
{
|
|
4057
4883
|
breadcrumbs: [
|
|
@@ -4062,126 +4888,126 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
4062
4888
|
description: "Manage site-wide brand, SEO, and business metadata.",
|
|
4063
4889
|
title: "Website Settings",
|
|
4064
4890
|
children: [
|
|
4065
|
-
loading ? /* @__PURE__ */ (0,
|
|
4066
|
-
!loading ? /* @__PURE__ */ (0,
|
|
4067
|
-
error ? /* @__PURE__ */ (0,
|
|
4068
|
-
savedMessage ? /* @__PURE__ */ (0,
|
|
4069
|
-
/* @__PURE__ */ (0,
|
|
4891
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
4892
|
+
!loading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("form", { className: "orion-admin-form", onSubmit: save, children: [
|
|
4893
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "orion-admin-error", children: error }) : null,
|
|
4894
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
4895
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4070
4896
|
"Site Name",
|
|
4071
|
-
/* @__PURE__ */ (0,
|
|
4897
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(globalData.siteName || ""), name: "siteName", required: true, type: "text" })
|
|
4072
4898
|
] }),
|
|
4073
|
-
/* @__PURE__ */ (0,
|
|
4899
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4074
4900
|
"Tagline",
|
|
4075
|
-
/* @__PURE__ */ (0,
|
|
4901
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(globalData.tagline || ""), name: "tagline", type: "text" })
|
|
4076
4902
|
] }),
|
|
4077
|
-
/* @__PURE__ */ (0,
|
|
4903
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4078
4904
|
"Logo (media ID)",
|
|
4079
|
-
/* @__PURE__ */ (0,
|
|
4080
|
-
/* @__PURE__ */ (0,
|
|
4905
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("select", { defaultValue: logoID ? String(logoID) : "", name: "logo", children: [
|
|
4906
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "No logo" }),
|
|
4081
4907
|
mediaOptions.map((asset) => {
|
|
4082
4908
|
const id = typeof asset.id === "string" || typeof asset.id === "number" ? String(asset.id) : "";
|
|
4083
4909
|
if (!id) return null;
|
|
4084
|
-
return /* @__PURE__ */ (0,
|
|
4910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: id, children: asset.filename || `Media ${id}` }, id);
|
|
4085
4911
|
})
|
|
4086
4912
|
] })
|
|
4087
4913
|
] }),
|
|
4088
|
-
/* @__PURE__ */ (0,
|
|
4914
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4089
4915
|
"SEO Meta Title",
|
|
4090
|
-
/* @__PURE__ */ (0,
|
|
4916
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(defaultSeo.metaTitle || ""), name: "metaTitle", type: "text" })
|
|
4091
4917
|
] }),
|
|
4092
|
-
/* @__PURE__ */ (0,
|
|
4918
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4093
4919
|
"SEO Meta Description",
|
|
4094
|
-
/* @__PURE__ */ (0,
|
|
4920
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { defaultValue: String(defaultSeo.metaDescription || ""), name: "metaDescription", rows: 3 })
|
|
4095
4921
|
] }),
|
|
4096
|
-
/* @__PURE__ */ (0,
|
|
4922
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4097
4923
|
"Canonical Base URL",
|
|
4098
|
-
/* @__PURE__ */ (0,
|
|
4924
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(defaultSeo.canonicalBaseUrl || ""), name: "canonicalBaseUrl", type: "text" })
|
|
4099
4925
|
] }),
|
|
4100
|
-
/* @__PURE__ */ (0,
|
|
4926
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4101
4927
|
"SEO OG Image (media ID)",
|
|
4102
|
-
/* @__PURE__ */ (0,
|
|
4103
|
-
/* @__PURE__ */ (0,
|
|
4928
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("select", { defaultValue: ogImageID ? String(ogImageID) : "", name: "ogImage", children: [
|
|
4929
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "No image" }),
|
|
4104
4930
|
mediaOptions.map((asset) => {
|
|
4105
4931
|
const id = typeof asset.id === "string" || typeof asset.id === "number" ? String(asset.id) : "";
|
|
4106
4932
|
if (!id) return null;
|
|
4107
|
-
return /* @__PURE__ */ (0,
|
|
4933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: id, children: asset.filename || `Media ${id}` }, id);
|
|
4108
4934
|
})
|
|
4109
4935
|
] })
|
|
4110
4936
|
] }),
|
|
4111
|
-
/* @__PURE__ */ (0,
|
|
4937
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4112
4938
|
"Business Schema Type",
|
|
4113
|
-
/* @__PURE__ */ (0,
|
|
4939
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.schemaType || "Store"), name: "schemaType", type: "text" })
|
|
4114
4940
|
] }),
|
|
4115
|
-
/* @__PURE__ */ (0,
|
|
4941
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4116
4942
|
"Business Description",
|
|
4117
|
-
/* @__PURE__ */ (0,
|
|
4943
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { defaultValue: String(businessProfile.description || ""), name: "businessDescription", rows: 4 })
|
|
4118
4944
|
] }),
|
|
4119
|
-
/* @__PURE__ */ (0,
|
|
4945
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4120
4946
|
"Street Address",
|
|
4121
|
-
/* @__PURE__ */ (0,
|
|
4947
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.streetAddress || ""), name: "streetAddress", type: "text" })
|
|
4122
4948
|
] }),
|
|
4123
|
-
/* @__PURE__ */ (0,
|
|
4949
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4124
4950
|
"City",
|
|
4125
|
-
/* @__PURE__ */ (0,
|
|
4951
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.addressLocality || ""), name: "addressLocality", type: "text" })
|
|
4126
4952
|
] }),
|
|
4127
|
-
/* @__PURE__ */ (0,
|
|
4953
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4128
4954
|
"State / Region",
|
|
4129
|
-
/* @__PURE__ */ (0,
|
|
4955
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.addressRegion || ""), name: "addressRegion", type: "text" })
|
|
4130
4956
|
] }),
|
|
4131
|
-
/* @__PURE__ */ (0,
|
|
4957
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4132
4958
|
"Postal Code",
|
|
4133
|
-
/* @__PURE__ */ (0,
|
|
4959
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.postalCode || ""), name: "postalCode", type: "text" })
|
|
4134
4960
|
] }),
|
|
4135
|
-
/* @__PURE__ */ (0,
|
|
4961
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4136
4962
|
"Country Code",
|
|
4137
|
-
/* @__PURE__ */ (0,
|
|
4963
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.addressCountry || "US"), name: "addressCountry", type: "text" })
|
|
4138
4964
|
] }),
|
|
4139
|
-
/* @__PURE__ */ (0,
|
|
4965
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4140
4966
|
"Neighborhood",
|
|
4141
|
-
/* @__PURE__ */ (0,
|
|
4967
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.neighborhood || ""), name: "neighborhood", type: "text" })
|
|
4142
4968
|
] }),
|
|
4143
|
-
/* @__PURE__ */ (0,
|
|
4969
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4144
4970
|
"Latitude",
|
|
4145
|
-
/* @__PURE__ */ (0,
|
|
4971
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.latitude || ""), name: "latitude", type: "text" })
|
|
4146
4972
|
] }),
|
|
4147
|
-
/* @__PURE__ */ (0,
|
|
4973
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4148
4974
|
"Longitude",
|
|
4149
|
-
/* @__PURE__ */ (0,
|
|
4975
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.longitude || ""), name: "longitude", type: "text" })
|
|
4150
4976
|
] }),
|
|
4151
|
-
/* @__PURE__ */ (0,
|
|
4977
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4152
4978
|
"Price Range",
|
|
4153
|
-
/* @__PURE__ */ (0,
|
|
4979
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.priceRange || ""), name: "priceRange", type: "text" })
|
|
4154
4980
|
] }),
|
|
4155
|
-
/* @__PURE__ */ (0,
|
|
4981
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4156
4982
|
"Map URL",
|
|
4157
|
-
/* @__PURE__ */ (0,
|
|
4983
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { defaultValue: String(businessProfile.mapUrl || ""), name: "mapUrl", type: "text" })
|
|
4158
4984
|
] }),
|
|
4159
|
-
/* @__PURE__ */ (0,
|
|
4985
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4160
4986
|
"LLM Summary",
|
|
4161
|
-
/* @__PURE__ */ (0,
|
|
4987
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { defaultValue: String(businessProfile.llmsSummary || ""), name: "llmsSummary", rows: 4 })
|
|
4162
4988
|
] }),
|
|
4163
|
-
/* @__PURE__ */ (0,
|
|
4989
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4164
4990
|
"Opening Hours Rows",
|
|
4165
|
-
/* @__PURE__ */ (0,
|
|
4166
|
-
/* @__PURE__ */ (0,
|
|
4991
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { defaultValue: openingHoursRows, name: "openingHoursRows", rows: 4 }),
|
|
4992
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: [
|
|
4167
4993
|
"One row per line: ",
|
|
4168
|
-
/* @__PURE__ */ (0,
|
|
4994
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("code", { children: "Monday,Tuesday,Wednesday|10:00|19:00" })
|
|
4169
4995
|
] })
|
|
4170
4996
|
] }),
|
|
4171
|
-
/* @__PURE__ */ (0,
|
|
4997
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4172
4998
|
"Citation / SameAs URLs",
|
|
4173
|
-
/* @__PURE__ */ (0,
|
|
4174
|
-
/* @__PURE__ */ (0,
|
|
4999
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { defaultValue: sameAsRows, name: "sameAsRows", rows: 4 }),
|
|
5000
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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." })
|
|
4175
5001
|
] }),
|
|
4176
|
-
/* @__PURE__ */ (0,
|
|
5002
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { children: [
|
|
4177
5003
|
"Service Schema Rows",
|
|
4178
|
-
/* @__PURE__ */ (0,
|
|
4179
|
-
/* @__PURE__ */ (0,
|
|
5004
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { defaultValue: serviceCatalogRows, name: "serviceCatalogRows", rows: 6 }),
|
|
5005
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: [
|
|
4180
5006
|
"One row per line: ",
|
|
4181
|
-
/* @__PURE__ */ (0,
|
|
5007
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("code", { children: "Name|Description|Optional price range|/page-path" })
|
|
4182
5008
|
] })
|
|
4183
5009
|
] }),
|
|
4184
|
-
/* @__PURE__ */ (0,
|
|
5010
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { disabled: saving, type: "submit", children: saving ? "Saving..." : "Save Global" })
|
|
4185
5011
|
] }) : null
|
|
4186
5012
|
]
|
|
4187
5013
|
}
|
|
@@ -4189,7 +5015,7 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
4189
5015
|
}
|
|
4190
5016
|
|
|
4191
5017
|
// src/admin/components/studio/AdminStudioSocialMediaGlobalView.tsx
|
|
4192
|
-
var
|
|
5018
|
+
var import_react21 = require("react");
|
|
4193
5019
|
|
|
4194
5020
|
// src/shared/socialMedia.ts
|
|
4195
5021
|
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
@@ -4271,10 +5097,10 @@ var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
|
4271
5097
|
);
|
|
4272
5098
|
|
|
4273
5099
|
// src/admin/components/studio/AdminStudioSocialMediaGlobalView.tsx
|
|
4274
|
-
var
|
|
5100
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4275
5101
|
var getSocialUrlFieldName = (platform) => `social-${platform}-url`;
|
|
4276
5102
|
var getSocialIconFieldName = (platform) => `social-${platform}-icon`;
|
|
4277
|
-
var
|
|
5103
|
+
var getPropString7 = (props, key, fallback) => {
|
|
4278
5104
|
if (!props || typeof props !== "object") return fallback;
|
|
4279
5105
|
const direct = props[key];
|
|
4280
5106
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -4322,16 +5148,16 @@ var normalizeOptionalProfileUrl = (value, platformLabel) => {
|
|
|
4322
5148
|
return parsed.toString();
|
|
4323
5149
|
};
|
|
4324
5150
|
function AdminStudioSocialMediaGlobalView(props) {
|
|
4325
|
-
const globalSlug =
|
|
4326
|
-
const globalsBasePath =
|
|
5151
|
+
const globalSlug = getPropString7(props, "globalSlug", "social-media");
|
|
5152
|
+
const globalsBasePath = getPropString7(props, "globalsBasePath", "/globals");
|
|
4327
5153
|
const adminBasePath = useAdminBasePath();
|
|
4328
5154
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
4329
|
-
const [loading, setLoading] = (0,
|
|
4330
|
-
const [saving, setSaving] = (0,
|
|
4331
|
-
const [error, setError] = (0,
|
|
4332
|
-
const [savedMessage, setSavedMessage] = (0,
|
|
4333
|
-
const [globalData, setGlobalData] = (0,
|
|
4334
|
-
(0,
|
|
5155
|
+
const [loading, setLoading] = (0, import_react21.useState)(true);
|
|
5156
|
+
const [saving, setSaving] = (0, import_react21.useState)(false);
|
|
5157
|
+
const [error, setError] = (0, import_react21.useState)(null);
|
|
5158
|
+
const [savedMessage, setSavedMessage] = (0, import_react21.useState)(null);
|
|
5159
|
+
const [globalData, setGlobalData] = (0, import_react21.useState)({});
|
|
5160
|
+
(0, import_react21.useEffect)(() => {
|
|
4335
5161
|
let cancelled = false;
|
|
4336
5162
|
const run = async () => {
|
|
4337
5163
|
setLoading(true);
|
|
@@ -4362,7 +5188,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
4362
5188
|
cancelled = true;
|
|
4363
5189
|
};
|
|
4364
5190
|
}, [globalSlug]);
|
|
4365
|
-
const socialProfiles = (0,
|
|
5191
|
+
const socialProfiles = (0, import_react21.useMemo)(
|
|
4366
5192
|
() => normalizeSocialMediaProfiles(globalData.profiles),
|
|
4367
5193
|
[globalData.profiles]
|
|
4368
5194
|
);
|
|
@@ -4408,7 +5234,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
4408
5234
|
setSaving(false);
|
|
4409
5235
|
}
|
|
4410
5236
|
};
|
|
4411
|
-
return /* @__PURE__ */ (0,
|
|
5237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4412
5238
|
AdminPage,
|
|
4413
5239
|
{
|
|
4414
5240
|
breadcrumbs: [
|
|
@@ -4419,16 +5245,16 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
4419
5245
|
description: "Control which social profiles appear across the site.",
|
|
4420
5246
|
title: "Social Media",
|
|
4421
5247
|
children: [
|
|
4422
|
-
loading ? /* @__PURE__ */ (0,
|
|
4423
|
-
!loading ? /* @__PURE__ */ (0,
|
|
4424
|
-
error ? /* @__PURE__ */ (0,
|
|
4425
|
-
savedMessage ? /* @__PURE__ */ (0,
|
|
4426
|
-
/* @__PURE__ */ (0,
|
|
5248
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5249
|
+
!loading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("form", { className: "orion-admin-form", onSubmit: save, children: [
|
|
5250
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "orion-admin-error", children: error }) : null,
|
|
5251
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
5252
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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." }),
|
|
4427
5253
|
SOCIAL_MEDIA_PLATFORMS.map((platform) => {
|
|
4428
5254
|
const profile = socialProfiles[platform];
|
|
4429
5255
|
const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
|
|
4430
5256
|
const placeholderDomain = platform === "x" ? "x.com" : `${platform}.com`;
|
|
4431
|
-
return /* @__PURE__ */ (0,
|
|
5257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4432
5258
|
"fieldset",
|
|
4433
5259
|
{
|
|
4434
5260
|
style: {
|
|
@@ -4439,10 +5265,10 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
4439
5265
|
padding: "0.85rem"
|
|
4440
5266
|
},
|
|
4441
5267
|
children: [
|
|
4442
|
-
/* @__PURE__ */ (0,
|
|
4443
|
-
/* @__PURE__ */ (0,
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("legend", { style: { fontWeight: 700, padding: "0 0.3rem" }, children: platformLabel }),
|
|
5269
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { children: [
|
|
4444
5270
|
"Profile URL",
|
|
4445
|
-
/* @__PURE__ */ (0,
|
|
5271
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4446
5272
|
"input",
|
|
4447
5273
|
{
|
|
4448
5274
|
defaultValue: profile.url,
|
|
@@ -4453,16 +5279,16 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
4453
5279
|
}
|
|
4454
5280
|
)
|
|
4455
5281
|
] }),
|
|
4456
|
-
/* @__PURE__ */ (0,
|
|
5282
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { children: [
|
|
4457
5283
|
"Icon Style",
|
|
4458
|
-
/* @__PURE__ */ (0,
|
|
5284
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("select", { defaultValue: profile.icon, name: getSocialIconFieldName(platform), children: SOCIAL_MEDIA_ICON_OPTIONS[platform].map((option) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: option.value, children: option.label }, option.value)) })
|
|
4459
5285
|
] })
|
|
4460
5286
|
]
|
|
4461
5287
|
},
|
|
4462
5288
|
platform
|
|
4463
5289
|
);
|
|
4464
5290
|
}),
|
|
4465
|
-
/* @__PURE__ */ (0,
|
|
5291
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { disabled: saving, type: "submit", children: saving ? "Saving..." : "Save Global" })
|
|
4466
5292
|
] }) : null
|
|
4467
5293
|
]
|
|
4468
5294
|
}
|
|
@@ -4470,11 +5296,11 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
4470
5296
|
}
|
|
4471
5297
|
|
|
4472
5298
|
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
4473
|
-
var
|
|
5299
|
+
var import_react24 = require("react");
|
|
4474
5300
|
var import_ui8 = require("@payloadcms/ui");
|
|
4475
5301
|
|
|
4476
5302
|
// src/admin-app/components/HeaderNavEditorWithPreview.tsx
|
|
4477
|
-
var
|
|
5303
|
+
var import_react23 = require("react");
|
|
4478
5304
|
|
|
4479
5305
|
// src/admin-app/nestedNavigation.ts
|
|
4480
5306
|
var normalizeNestedNavItems = (items) => {
|
|
@@ -4523,7 +5349,7 @@ var buildNestedNavTree = (items) => {
|
|
|
4523
5349
|
};
|
|
4524
5350
|
|
|
4525
5351
|
// src/admin-app/components/HeaderNavItemsEditor.tsx
|
|
4526
|
-
var
|
|
5352
|
+
var import_react22 = require("react");
|
|
4527
5353
|
|
|
4528
5354
|
// src/admin-app/navigationLinks.ts
|
|
4529
5355
|
var fallbackHomeOption = {
|
|
@@ -4602,7 +5428,7 @@ var normalizeAdminNavInputs = (rows, pageOptions) => {
|
|
|
4602
5428
|
};
|
|
4603
5429
|
|
|
4604
5430
|
// src/admin-app/components/HeaderNavItemsEditor.tsx
|
|
4605
|
-
var
|
|
5431
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4606
5432
|
var toRow = (item, index) => ({
|
|
4607
5433
|
id: `row-${index}-${item.href || "empty"}`,
|
|
4608
5434
|
href: item.href || "",
|
|
@@ -4622,12 +5448,12 @@ var moveRow = (rows, fromIndex, toIndex) => {
|
|
|
4622
5448
|
return next;
|
|
4623
5449
|
};
|
|
4624
5450
|
function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
4625
|
-
const [rows, setRows] = (0,
|
|
4626
|
-
const [nextRowID, setNextRowID] = (0,
|
|
4627
|
-
const [draggingRowID, setDraggingRowID] = (0,
|
|
4628
|
-
const [dragOverRowID, setDragOverRowID] = (0,
|
|
4629
|
-
const pageOptionByHref = (0,
|
|
4630
|
-
const serializedState = (0,
|
|
5451
|
+
const [rows, setRows] = (0, import_react22.useState)(() => initialItems.map(toRow));
|
|
5452
|
+
const [nextRowID, setNextRowID] = (0, import_react22.useState)(initialItems.length);
|
|
5453
|
+
const [draggingRowID, setDraggingRowID] = (0, import_react22.useState)(null);
|
|
5454
|
+
const [dragOverRowID, setDragOverRowID] = (0, import_react22.useState)(null);
|
|
5455
|
+
const pageOptionByHref = (0, import_react22.useMemo)(() => new Map(pageOptions.map((option) => [option.href, option])), [pageOptions]);
|
|
5456
|
+
const serializedState = (0, import_react22.useMemo)(
|
|
4631
5457
|
() => JSON.stringify(
|
|
4632
5458
|
rows.map((row) => ({
|
|
4633
5459
|
href: row.href.trim(),
|
|
@@ -4637,7 +5463,7 @@ function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
|
4637
5463
|
),
|
|
4638
5464
|
[rows]
|
|
4639
5465
|
);
|
|
4640
|
-
const normalizedItems = (0,
|
|
5466
|
+
const normalizedItems = (0, import_react22.useMemo)(() => {
|
|
4641
5467
|
const inputs = rows.map((row) => ({
|
|
4642
5468
|
href: row.href,
|
|
4643
5469
|
label: row.label,
|
|
@@ -4645,7 +5471,7 @@ function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
|
4645
5471
|
}));
|
|
4646
5472
|
return normalizeAdminNavInputs(inputs, pageOptions);
|
|
4647
5473
|
}, [rows, pageOptions]);
|
|
4648
|
-
(0,
|
|
5474
|
+
(0, import_react22.useEffect)(() => {
|
|
4649
5475
|
onItemsChange?.(normalizedItems);
|
|
4650
5476
|
}, [normalizedItems, onItemsChange]);
|
|
4651
5477
|
const setRowValue = (rowID, changes) => {
|
|
@@ -4681,15 +5507,15 @@ function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
|
4681
5507
|
]);
|
|
4682
5508
|
setNextRowID((current) => current + 1);
|
|
4683
5509
|
};
|
|
4684
|
-
return /* @__PURE__ */ (0,
|
|
4685
|
-
/* @__PURE__ */ (0,
|
|
4686
|
-
/* @__PURE__ */ (0,
|
|
4687
|
-
/* @__PURE__ */ (0,
|
|
4688
|
-
/* @__PURE__ */ (0,
|
|
5510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "orion-admin-nav-editor", children: [
|
|
5511
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { name: "navItemsState", readOnly: true, type: "hidden", value: serializedState }),
|
|
5512
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "orion-admin-nav-editor-head", children: [
|
|
5513
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "orion-admin-nav-editor-title", children: "Navigation Items" }),
|
|
5514
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { className: "orion-admin-nav-editor-add", onClick: addRow, type: "button", children: "Add Item" })
|
|
4689
5515
|
] }),
|
|
4690
|
-
/* @__PURE__ */ (0,
|
|
4691
|
-
rows.length === 0 ? /* @__PURE__ */ (0,
|
|
4692
|
-
/* @__PURE__ */ (0,
|
|
5516
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "orion-admin-nav-editor-help", children: "Add only links you want in the menu. Drag rows to reorder. Set a parent to create dropdown items." }),
|
|
5517
|
+
rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "orion-admin-nav-editor-empty", children: 'No navigation items yet. Click "Add Item" to start.' }) : null,
|
|
5518
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "orion-admin-nav-editor-list", children: rows.map((row, rowIndex) => {
|
|
4693
5519
|
const parentCandidates = rows.filter((candidate) => candidate.id !== row.id && candidate.href.trim().length > 0).map((candidate) => {
|
|
4694
5520
|
const resolved = pageOptionByHref.get(candidate.href);
|
|
4695
5521
|
return {
|
|
@@ -4699,7 +5525,7 @@ function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
|
4699
5525
|
});
|
|
4700
5526
|
const selectedPage = pageOptionByHref.get(row.href);
|
|
4701
5527
|
const labelPlaceholder = selectedPage?.title || "Navigation Label";
|
|
4702
|
-
return /* @__PURE__ */ (0,
|
|
5528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4703
5529
|
"div",
|
|
4704
5530
|
{
|
|
4705
5531
|
className: `orion-admin-nav-editor-row${draggingRowID === row.id ? " is-dragging" : ""}${dragOverRowID === row.id && draggingRowID !== row.id ? " is-drop-target" : ""}`,
|
|
@@ -4742,18 +5568,18 @@ function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
|
4742
5568
|
setDragOverRowID(null);
|
|
4743
5569
|
},
|
|
4744
5570
|
children: [
|
|
4745
|
-
/* @__PURE__ */ (0,
|
|
4746
|
-
/* @__PURE__ */ (0,
|
|
4747
|
-
/* @__PURE__ */ (0,
|
|
5571
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "orion-admin-nav-editor-row-head", children: [
|
|
5572
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "orion-admin-nav-editor-drag", children: "Drag" }),
|
|
5573
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "orion-admin-nav-editor-row-index", children: [
|
|
4748
5574
|
"#",
|
|
4749
5575
|
rowIndex + 1
|
|
4750
5576
|
] }),
|
|
4751
|
-
/* @__PURE__ */ (0,
|
|
5577
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { className: "orion-admin-nav-editor-remove", onClick: () => removeRow(row.id), type: "button", children: "Remove" })
|
|
4752
5578
|
] }),
|
|
4753
|
-
/* @__PURE__ */ (0,
|
|
4754
|
-
/* @__PURE__ */ (0,
|
|
5579
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "orion-admin-nav-editor-row-grid", children: [
|
|
5580
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { children: [
|
|
4755
5581
|
"Label",
|
|
4756
|
-
/* @__PURE__ */ (0,
|
|
5582
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4757
5583
|
"input",
|
|
4758
5584
|
{
|
|
4759
5585
|
name: `navLabel_${rowIndex}`,
|
|
@@ -4764,9 +5590,9 @@ function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
|
4764
5590
|
}
|
|
4765
5591
|
)
|
|
4766
5592
|
] }),
|
|
4767
|
-
/* @__PURE__ */ (0,
|
|
5593
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { children: [
|
|
4768
5594
|
"Page",
|
|
4769
|
-
/* @__PURE__ */ (0,
|
|
5595
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4770
5596
|
"select",
|
|
4771
5597
|
{
|
|
4772
5598
|
name: `navPage_${rowIndex}`,
|
|
@@ -4777,23 +5603,23 @@ function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
|
4777
5603
|
},
|
|
4778
5604
|
value: row.href,
|
|
4779
5605
|
children: [
|
|
4780
|
-
/* @__PURE__ */ (0,
|
|
4781
|
-
pageOptions.map((pageOption) => /* @__PURE__ */ (0,
|
|
5606
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "", children: "Select page..." }),
|
|
5607
|
+
pageOptions.map((pageOption) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: pageOption.href, children: pageOption.label }, `${pageOption.href}-${pageOption.title}`))
|
|
4782
5608
|
]
|
|
4783
5609
|
}
|
|
4784
5610
|
)
|
|
4785
5611
|
] }),
|
|
4786
|
-
/* @__PURE__ */ (0,
|
|
5612
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { children: [
|
|
4787
5613
|
"Parent (dropdown under)",
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
5614
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4789
5615
|
"select",
|
|
4790
5616
|
{
|
|
4791
5617
|
name: `navParentHref_${rowIndex}`,
|
|
4792
5618
|
onChange: (event) => setRowValue(row.id, { parentHref: event.target.value }),
|
|
4793
5619
|
value: row.parentHref,
|
|
4794
5620
|
children: [
|
|
4795
|
-
/* @__PURE__ */ (0,
|
|
4796
|
-
parentCandidates.map((candidate) => /* @__PURE__ */ (0,
|
|
5621
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "", children: "Top-level item" }),
|
|
5622
|
+
parentCandidates.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: candidate.href, children: candidate.label }, `${row.id}-parent-${candidate.href}`))
|
|
4797
5623
|
]
|
|
4798
5624
|
}
|
|
4799
5625
|
)
|
|
@@ -4808,7 +5634,7 @@ function HeaderNavItemsEditor({ initialItems, pageOptions, onItemsChange }) {
|
|
|
4808
5634
|
}
|
|
4809
5635
|
|
|
4810
5636
|
// src/admin-app/components/SitePreview.tsx
|
|
4811
|
-
var
|
|
5637
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4812
5638
|
var fallbackHeaderNav = [{ href: "/", label: "Home" }];
|
|
4813
5639
|
var socialGlyphByPlatform = {
|
|
4814
5640
|
facebook: "f",
|
|
@@ -4841,11 +5667,11 @@ function PreviewSocialLinks({
|
|
|
4841
5667
|
if (links.length === 0) {
|
|
4842
5668
|
return null;
|
|
4843
5669
|
}
|
|
4844
|
-
return /* @__PURE__ */ (0,
|
|
5670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4845
5671
|
"div",
|
|
4846
5672
|
{
|
|
4847
5673
|
className: variant === "header" ? "orion-admin-site-preview-social-list" : "orion-admin-site-preview-social-list orion-admin-site-preview-social-list--footer",
|
|
4848
|
-
children: links.map((item) => /* @__PURE__ */ (0,
|
|
5674
|
+
children: links.map((item) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4849
5675
|
"a",
|
|
4850
5676
|
{
|
|
4851
5677
|
className: variant === "header" ? "orion-admin-site-preview-social-badge" : "orion-admin-site-preview-social-badge orion-admin-site-preview-social-badge--footer",
|
|
@@ -4864,27 +5690,27 @@ function PreviewLogo({
|
|
|
4864
5690
|
siteName
|
|
4865
5691
|
}) {
|
|
4866
5692
|
if (logoUrl && logoUrl.trim().length > 0) {
|
|
4867
|
-
return /* @__PURE__ */ (0,
|
|
5693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { alt: `${siteName} logo`, className, src: logoUrl });
|
|
4868
5694
|
}
|
|
4869
|
-
return /* @__PURE__ */ (0,
|
|
5695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: `${className} orion-admin-site-preview-logo-fallback`, children: getInitials(siteName) });
|
|
4870
5696
|
}
|
|
4871
5697
|
function SiteHeaderPreview({ site }) {
|
|
4872
5698
|
const navItems = site.navItems.length > 0 ? site.navItems : fallbackHeaderNav;
|
|
4873
5699
|
const [taglineLineOne, taglineLineTwo] = getTaglineLines(site.tagline);
|
|
4874
5700
|
const socialLinks = site.socialLinks?.slice(0, 4) || [];
|
|
4875
5701
|
const activePath = site.activePath || navItems[0]?.href || "/";
|
|
4876
|
-
return /* @__PURE__ */ (0,
|
|
4877
|
-
/* @__PURE__ */ (0,
|
|
4878
|
-
/* @__PURE__ */ (0,
|
|
4879
|
-
/* @__PURE__ */ (0,
|
|
4880
|
-
site.locationSummary?.hours?.trim() ? /* @__PURE__ */ (0,
|
|
4881
|
-
/* @__PURE__ */ (0,
|
|
4882
|
-
/* @__PURE__ */ (0,
|
|
5702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "aria-hidden": "true", className: "orion-admin-site-preview orion-admin-site-preview--header", children: [
|
|
5703
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "orion-admin-site-preview-header-bar", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-shell orion-admin-site-preview-shell--utility", children: [
|
|
5704
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "orion-admin-site-preview-utility-copy", children: site.locationSummary?.address?.trim() || "Neighborhood gift shop" }),
|
|
5705
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-utility-meta", children: [
|
|
5706
|
+
site.locationSummary?.hours?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "orion-admin-site-preview-utility-copy", children: site.locationSummary.hours.trim() }) : null,
|
|
5707
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PreviewSocialLinks, { links: socialLinks, variant: "header" }),
|
|
5708
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { className: "orion-admin-site-preview-header-action", href: site.actionHref || "/contact", tabIndex: -1, children: site.actionLabel || "Visit Today" })
|
|
4883
5709
|
] })
|
|
4884
5710
|
] }) }),
|
|
4885
|
-
/* @__PURE__ */ (0,
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
4887
|
-
/* @__PURE__ */ (0,
|
|
5711
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "orion-admin-site-preview-header-main", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-shell orion-admin-site-preview-shell--main", children: [
|
|
5712
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("a", { className: "orion-admin-site-preview-brand", href: "/", tabIndex: -1, children: [
|
|
5713
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4888
5714
|
PreviewLogo,
|
|
4889
5715
|
{
|
|
4890
5716
|
className: "orion-admin-site-preview-header-logo",
|
|
@@ -4892,12 +5718,12 @@ function SiteHeaderPreview({ site }) {
|
|
|
4892
5718
|
siteName: site.siteName
|
|
4893
5719
|
}
|
|
4894
5720
|
),
|
|
4895
|
-
/* @__PURE__ */ (0,
|
|
4896
|
-
/* @__PURE__ */ (0,
|
|
4897
|
-
/* @__PURE__ */ (0,
|
|
5721
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-tagline", children: [
|
|
5722
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "orion-admin-site-preview-tagline-line", children: taglineLineOne }),
|
|
5723
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "orion-admin-site-preview-tagline-line", children: taglineLineTwo })
|
|
4898
5724
|
] })
|
|
4899
5725
|
] }),
|
|
4900
|
-
/* @__PURE__ */ (0,
|
|
5726
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("nav", { className: "orion-admin-site-preview-nav", children: navItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4901
5727
|
"a",
|
|
4902
5728
|
{
|
|
4903
5729
|
className: item.href === activePath ? "is-active" : void 0,
|
|
@@ -4907,10 +5733,10 @@ function SiteHeaderPreview({ site }) {
|
|
|
4907
5733
|
},
|
|
4908
5734
|
`${item.href}-${item.label}`
|
|
4909
5735
|
)) }),
|
|
4910
|
-
/* @__PURE__ */ (0,
|
|
4911
|
-
/* @__PURE__ */ (0,
|
|
4912
|
-
/* @__PURE__ */ (0,
|
|
4913
|
-
/* @__PURE__ */ (0,
|
|
5736
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-mobile-toggle", children: [
|
|
5737
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", {}),
|
|
5738
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", {}),
|
|
5739
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", {})
|
|
4914
5740
|
] })
|
|
4915
5741
|
] }) })
|
|
4916
5742
|
] });
|
|
@@ -4920,11 +5746,11 @@ function SiteFooterPreview({ site }) {
|
|
|
4920
5746
|
const socialLinks = site.socialLinks?.slice(0, 4) || [];
|
|
4921
5747
|
const builtByLabel = site.builtByLabel || "Built by Orion Studios";
|
|
4922
5748
|
const builtByHref = site.builtByHref || "https://orionstudios.dev";
|
|
4923
|
-
return /* @__PURE__ */ (0,
|
|
4924
|
-
/* @__PURE__ */ (0,
|
|
4925
|
-
/* @__PURE__ */ (0,
|
|
4926
|
-
/* @__PURE__ */ (0,
|
|
4927
|
-
/* @__PURE__ */ (0,
|
|
5749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { "aria-hidden": "true", className: "orion-admin-site-preview orion-admin-site-preview--footer", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-footer-shell", children: [
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-footer-grid", children: [
|
|
5751
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
5752
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-footer-brand", children: [
|
|
5753
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4928
5754
|
PreviewLogo,
|
|
4929
5755
|
{
|
|
4930
5756
|
className: "orion-admin-site-preview-footer-logo",
|
|
@@ -4932,38 +5758,38 @@ function SiteFooterPreview({ site }) {
|
|
|
4932
5758
|
siteName: site.siteName
|
|
4933
5759
|
}
|
|
4934
5760
|
),
|
|
4935
|
-
/* @__PURE__ */ (0,
|
|
5761
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "orion-admin-site-preview-footer-name", children: site.siteName })
|
|
4936
5762
|
] }),
|
|
4937
|
-
/* @__PURE__ */ (0,
|
|
5763
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "orion-admin-site-preview-footer-description", children: description })
|
|
4938
5764
|
] }),
|
|
4939
|
-
/* @__PURE__ */ (0,
|
|
4940
|
-
/* @__PURE__ */ (0,
|
|
4941
|
-
/* @__PURE__ */ (0,
|
|
5765
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
5766
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "orion-admin-site-preview-footer-eyebrow", children: "Shop focus" }),
|
|
5767
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "orion-admin-site-preview-footer-list", children: site.footerCategories.map((item) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { children: item }, item)) })
|
|
4942
5768
|
] }),
|
|
4943
|
-
/* @__PURE__ */ (0,
|
|
4944
|
-
/* @__PURE__ */ (0,
|
|
4945
|
-
/* @__PURE__ */ (0,
|
|
5769
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
5770
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "orion-admin-site-preview-footer-eyebrow", children: "Explore" }),
|
|
5771
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "orion-admin-site-preview-footer-list", children: site.footerLinks.map((item) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: item.href, tabIndex: -1, children: item.label }, `${item.href}-${item.label}`)) })
|
|
4946
5772
|
] }),
|
|
4947
|
-
/* @__PURE__ */ (0,
|
|
4948
|
-
/* @__PURE__ */ (0,
|
|
4949
|
-
/* @__PURE__ */ (0,
|
|
4950
|
-
site.locationSummary.address?.trim() ? /* @__PURE__ */ (0,
|
|
4951
|
-
site.locationSummary.hours?.trim() ? /* @__PURE__ */ (0,
|
|
4952
|
-
site.locationSummary.phone?.trim() ? /* @__PURE__ */ (0,
|
|
4953
|
-
/* @__PURE__ */ (0,
|
|
5773
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
5774
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "orion-admin-site-preview-footer-eyebrow", children: "Visit" }),
|
|
5775
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-footer-contact", children: [
|
|
5776
|
+
site.locationSummary.address?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { children: site.locationSummary.address.trim() }) : null,
|
|
5777
|
+
site.locationSummary.hours?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { children: site.locationSummary.hours.trim() }) : null,
|
|
5778
|
+
site.locationSummary.phone?.trim() ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: `tel:${site.locationSummary.phone.trim()}`, tabIndex: -1, children: site.locationSummary.phone.trim() }) : null,
|
|
5779
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: `mailto:${site.contactEmail}`, tabIndex: -1, children: site.contactEmail })
|
|
4954
5780
|
] }),
|
|
4955
|
-
/* @__PURE__ */ (0,
|
|
5781
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PreviewSocialLinks, { links: socialLinks, variant: "footer" })
|
|
4956
5782
|
] })
|
|
4957
5783
|
] }),
|
|
4958
|
-
/* @__PURE__ */ (0,
|
|
4959
|
-
/* @__PURE__ */ (0,
|
|
4960
|
-
/* @__PURE__ */ (0,
|
|
5784
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "orion-admin-site-preview-footer-meta", children: [
|
|
5785
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: site.copyright }),
|
|
5786
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: builtByHref, tabIndex: -1, children: builtByLabel })
|
|
4961
5787
|
] })
|
|
4962
5788
|
] }) });
|
|
4963
5789
|
}
|
|
4964
5790
|
|
|
4965
5791
|
// src/admin-app/components/HeaderNavEditorWithPreview.tsx
|
|
4966
|
-
var
|
|
5792
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4967
5793
|
var fallbackNav = [{ href: "/", label: "Home" }];
|
|
4968
5794
|
function HeaderNavEditorWithPreview({
|
|
4969
5795
|
activePath,
|
|
@@ -4978,14 +5804,14 @@ function HeaderNavEditorWithPreview({
|
|
|
4978
5804
|
socialLinks,
|
|
4979
5805
|
tagline = ""
|
|
4980
5806
|
}) {
|
|
4981
|
-
const [liveItems, setLiveItems] = (0,
|
|
4982
|
-
const previewItems = (0,
|
|
5807
|
+
const [liveItems, setLiveItems] = (0, import_react23.useState)(initialItems);
|
|
5808
|
+
const previewItems = (0, import_react23.useMemo)(() => {
|
|
4983
5809
|
const normalized = normalizeNestedNavItems(liveItems);
|
|
4984
5810
|
const tree = buildNestedNavTree(normalized);
|
|
4985
5811
|
return tree.topLevel.length > 0 ? tree : buildNestedNavTree(fallbackNav);
|
|
4986
5812
|
}, [liveItems]);
|
|
4987
|
-
return /* @__PURE__ */ (0,
|
|
4988
|
-
/* @__PURE__ */ (0,
|
|
5813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
5814
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4989
5815
|
HeaderNavItemsEditor,
|
|
4990
5816
|
{
|
|
4991
5817
|
initialItems,
|
|
@@ -4996,8 +5822,8 @@ function HeaderNavEditorWithPreview({
|
|
|
4996
5822
|
pageOptions
|
|
4997
5823
|
}
|
|
4998
5824
|
),
|
|
4999
|
-
/* @__PURE__ */ (0,
|
|
5000
|
-
/* @__PURE__ */ (0,
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "orion-admin-preview-label", children: "Header Preview" }),
|
|
5826
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "orion-admin-preview-frame", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "orion-admin-preview-surface", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5001
5827
|
SiteHeaderPreview,
|
|
5002
5828
|
{
|
|
5003
5829
|
site: {
|
|
@@ -5046,8 +5872,8 @@ function resolveSocialMediaLinks(data) {
|
|
|
5046
5872
|
}
|
|
5047
5873
|
|
|
5048
5874
|
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
5049
|
-
var
|
|
5050
|
-
var
|
|
5875
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5876
|
+
var getPropString8 = (props, key, fallback) => {
|
|
5051
5877
|
if (!props || typeof props !== "object") return fallback;
|
|
5052
5878
|
const direct = props[key];
|
|
5053
5879
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -5103,25 +5929,25 @@ var resolveMediaURL = (value) => {
|
|
|
5103
5929
|
return "";
|
|
5104
5930
|
};
|
|
5105
5931
|
function AdminStudioHeaderGlobalView(props) {
|
|
5106
|
-
const globalSlug =
|
|
5107
|
-
const globalsBasePath =
|
|
5108
|
-
const pagesCollectionSlug =
|
|
5109
|
-
const actionHref =
|
|
5110
|
-
const actionLabel =
|
|
5932
|
+
const globalSlug = getPropString8(props, "globalSlug", "header");
|
|
5933
|
+
const globalsBasePath = getPropString8(props, "globalsBasePath", "/globals");
|
|
5934
|
+
const pagesCollectionSlug = getPropString8(props, "pagesCollectionSlug", "pages");
|
|
5935
|
+
const actionHref = getPropString8(props, "actionHref", "/contact");
|
|
5936
|
+
const actionLabel = getPropString8(props, "actionLabel", "Visit Today");
|
|
5111
5937
|
const locationSummary = getPropLocationSummary(props, "locationSummary");
|
|
5112
5938
|
const adminBasePath = useAdminBasePath();
|
|
5113
5939
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
5114
5940
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
5115
|
-
const [loading, setLoading] = (0,
|
|
5116
|
-
const [saving, setSaving] = (0,
|
|
5117
|
-
const [error, setError] = (0,
|
|
5118
|
-
const [savedMessage, setSavedMessage] = (0,
|
|
5119
|
-
const [initialItems, setInitialItems] = (0,
|
|
5120
|
-
const [liveItems, setLiveItems] = (0,
|
|
5121
|
-
const [pages, setPages] = (0,
|
|
5122
|
-
const [siteSettings, setSiteSettings] = (0,
|
|
5123
|
-
const [socialMedia, setSocialMedia] = (0,
|
|
5124
|
-
(0,
|
|
5941
|
+
const [loading, setLoading] = (0, import_react24.useState)(true);
|
|
5942
|
+
const [saving, setSaving] = (0, import_react24.useState)(false);
|
|
5943
|
+
const [error, setError] = (0, import_react24.useState)(null);
|
|
5944
|
+
const [savedMessage, setSavedMessage] = (0, import_react24.useState)(null);
|
|
5945
|
+
const [initialItems, setInitialItems] = (0, import_react24.useState)([]);
|
|
5946
|
+
const [liveItems, setLiveItems] = (0, import_react24.useState)([]);
|
|
5947
|
+
const [pages, setPages] = (0, import_react24.useState)([]);
|
|
5948
|
+
const [siteSettings, setSiteSettings] = (0, import_react24.useState)({});
|
|
5949
|
+
const [socialMedia, setSocialMedia] = (0, import_react24.useState)({});
|
|
5950
|
+
(0, import_react24.useEffect)(() => {
|
|
5125
5951
|
let cancelled = false;
|
|
5126
5952
|
const run = async () => {
|
|
5127
5953
|
setLoading(true);
|
|
@@ -5184,8 +6010,8 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
5184
6010
|
cancelled = true;
|
|
5185
6011
|
};
|
|
5186
6012
|
}, [globalSlug, pagesCollectionSlug]);
|
|
5187
|
-
const pageOptions = (0,
|
|
5188
|
-
const previewSocialLinks = (0,
|
|
6013
|
+
const pageOptions = (0, import_react24.useMemo)(() => buildAdminPageLinkOptions(pages), [pages]);
|
|
6014
|
+
const previewSocialLinks = (0, import_react24.useMemo)(
|
|
5189
6015
|
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
5190
6016
|
label: item.label,
|
|
5191
6017
|
platform: item.platform,
|
|
@@ -5196,7 +6022,7 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
5196
6022
|
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
5197
6023
|
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
5198
6024
|
const previewLogoUrl = resolveMediaURL(siteSettings.logo);
|
|
5199
|
-
const editorKey = (0,
|
|
6025
|
+
const editorKey = (0, import_react24.useMemo)(() => JSON.stringify(initialItems), [initialItems]);
|
|
5200
6026
|
const save = async () => {
|
|
5201
6027
|
setSaving(true);
|
|
5202
6028
|
setError(null);
|
|
@@ -5230,8 +6056,8 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
5230
6056
|
setSaving(false);
|
|
5231
6057
|
}
|
|
5232
6058
|
};
|
|
5233
|
-
return /* @__PURE__ */ (0,
|
|
5234
|
-
/* @__PURE__ */ (0,
|
|
6059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { style: { paddingBottom: "2rem" }, children: [
|
|
6060
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5235
6061
|
import_ui8.SetStepNav,
|
|
5236
6062
|
{
|
|
5237
6063
|
nav: [
|
|
@@ -5240,13 +6066,13 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
5240
6066
|
]
|
|
5241
6067
|
}
|
|
5242
6068
|
),
|
|
5243
|
-
/* @__PURE__ */ (0,
|
|
5244
|
-
/* @__PURE__ */ (0,
|
|
5245
|
-
loading ? /* @__PURE__ */ (0,
|
|
5246
|
-
error ? /* @__PURE__ */ (0,
|
|
5247
|
-
savedMessage ? /* @__PURE__ */ (0,
|
|
5248
|
-
!loading ? /* @__PURE__ */ (0,
|
|
5249
|
-
/* @__PURE__ */ (0,
|
|
6069
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h1", { style: { margin: 0 }, children: "Header & Navigation" }),
|
|
6070
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage the main website navigation and preview it in place." }),
|
|
6071
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading header settings\u2026" }) : null,
|
|
6072
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
6073
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
6074
|
+
!loading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
6075
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5250
6076
|
HeaderNavEditorWithPreview,
|
|
5251
6077
|
{
|
|
5252
6078
|
actionHref,
|
|
@@ -5263,7 +6089,7 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
5263
6089
|
},
|
|
5264
6090
|
editorKey
|
|
5265
6091
|
),
|
|
5266
|
-
/* @__PURE__ */ (0,
|
|
6092
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5267
6093
|
"button",
|
|
5268
6094
|
{
|
|
5269
6095
|
disabled: saving,
|
|
@@ -5287,10 +6113,10 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
5287
6113
|
}
|
|
5288
6114
|
|
|
5289
6115
|
// src/admin/components/studio/AdminStudioFooterGlobalView.tsx
|
|
5290
|
-
var
|
|
6116
|
+
var import_react25 = require("react");
|
|
5291
6117
|
var import_ui9 = require("@payloadcms/ui");
|
|
5292
|
-
var
|
|
5293
|
-
var
|
|
6118
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6119
|
+
var getPropString9 = (props, key, fallback) => {
|
|
5294
6120
|
if (!props || typeof props !== "object") return fallback;
|
|
5295
6121
|
const direct = props[key];
|
|
5296
6122
|
if (typeof direct === "string") return direct;
|
|
@@ -5384,29 +6210,29 @@ var deriveHours = (siteSettings) => {
|
|
|
5384
6210
|
return `${dayOfWeek} \u2022 ${opens} - ${closes}`;
|
|
5385
6211
|
};
|
|
5386
6212
|
function AdminStudioFooterGlobalView(props) {
|
|
5387
|
-
const globalSlug =
|
|
5388
|
-
const globalsBasePath =
|
|
5389
|
-
const builtByHref =
|
|
5390
|
-
const builtByLabel =
|
|
5391
|
-
const description =
|
|
6213
|
+
const globalSlug = getPropString9(props, "globalSlug", "footer");
|
|
6214
|
+
const globalsBasePath = getPropString9(props, "globalsBasePath", "/globals");
|
|
6215
|
+
const builtByHref = getPropString9(props, "builtByHref", "");
|
|
6216
|
+
const builtByLabel = getPropString9(props, "builtByLabel", "");
|
|
6217
|
+
const description = getPropString9(props, "description", "");
|
|
5392
6218
|
const footerCategories = getPropStringArray2(props, "footerCategories");
|
|
5393
6219
|
const footerLinks = getPropLinks(props, "footerLinks");
|
|
5394
6220
|
const configuredLocationSummary = getPropLocationSummary2(props, "locationSummary");
|
|
5395
6221
|
const adminBasePath = useAdminBasePath();
|
|
5396
6222
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
5397
6223
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
5398
|
-
const [loading, setLoading] = (0,
|
|
5399
|
-
const [saving, setSaving] = (0,
|
|
5400
|
-
const [error, setError] = (0,
|
|
5401
|
-
const [savedMessage, setSavedMessage] = (0,
|
|
5402
|
-
const [doc, setDoc] = (0,
|
|
6224
|
+
const [loading, setLoading] = (0, import_react25.useState)(true);
|
|
6225
|
+
const [saving, setSaving] = (0, import_react25.useState)(false);
|
|
6226
|
+
const [error, setError] = (0, import_react25.useState)(null);
|
|
6227
|
+
const [savedMessage, setSavedMessage] = (0, import_react25.useState)(null);
|
|
6228
|
+
const [doc, setDoc] = (0, import_react25.useState)({
|
|
5403
6229
|
contactEmail: "",
|
|
5404
6230
|
contactPhone: "",
|
|
5405
6231
|
copyright: ""
|
|
5406
6232
|
});
|
|
5407
|
-
const [siteSettings, setSiteSettings] = (0,
|
|
5408
|
-
const [socialMedia, setSocialMedia] = (0,
|
|
5409
|
-
(0,
|
|
6233
|
+
const [siteSettings, setSiteSettings] = (0, import_react25.useState)({});
|
|
6234
|
+
const [socialMedia, setSocialMedia] = (0, import_react25.useState)({});
|
|
6235
|
+
(0, import_react25.useEffect)(() => {
|
|
5410
6236
|
let cancelled = false;
|
|
5411
6237
|
const run = async () => {
|
|
5412
6238
|
setLoading(true);
|
|
@@ -5458,7 +6284,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5458
6284
|
cancelled = true;
|
|
5459
6285
|
};
|
|
5460
6286
|
}, [globalSlug]);
|
|
5461
|
-
const previewSocialLinks = (0,
|
|
6287
|
+
const previewSocialLinks = (0, import_react25.useMemo)(
|
|
5462
6288
|
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
5463
6289
|
label: item.label,
|
|
5464
6290
|
platform: item.platform,
|
|
@@ -5503,8 +6329,8 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5503
6329
|
setSaving(false);
|
|
5504
6330
|
}
|
|
5505
6331
|
};
|
|
5506
|
-
return /* @__PURE__ */ (0,
|
|
5507
|
-
/* @__PURE__ */ (0,
|
|
6332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { style: { paddingBottom: "2rem" }, children: [
|
|
6333
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5508
6334
|
import_ui9.SetStepNav,
|
|
5509
6335
|
{
|
|
5510
6336
|
nav: [
|
|
@@ -5513,13 +6339,13 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5513
6339
|
]
|
|
5514
6340
|
}
|
|
5515
6341
|
),
|
|
5516
|
-
/* @__PURE__ */ (0,
|
|
5517
|
-
/* @__PURE__ */ (0,
|
|
5518
|
-
loading ? /* @__PURE__ */ (0,
|
|
5519
|
-
error ? /* @__PURE__ */ (0,
|
|
5520
|
-
savedMessage ? /* @__PURE__ */ (0,
|
|
5521
|
-
!loading ? /* @__PURE__ */ (0,
|
|
5522
|
-
/* @__PURE__ */ (0,
|
|
6342
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h1", { style: { margin: 0 }, children: "Footer" }),
|
|
6343
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage footer contact details and preview the package footer in place." }),
|
|
6344
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading footer settings\u2026" }) : null,
|
|
6345
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
6346
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
6347
|
+
!loading ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
6348
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5523
6349
|
"label",
|
|
5524
6350
|
{
|
|
5525
6351
|
style: {
|
|
@@ -5531,7 +6357,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5531
6357
|
},
|
|
5532
6358
|
children: [
|
|
5533
6359
|
"Copyright",
|
|
5534
|
-
/* @__PURE__ */ (0,
|
|
6360
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5535
6361
|
"input",
|
|
5536
6362
|
{
|
|
5537
6363
|
onChange: (event) => setDoc((current) => ({ ...current, copyright: event.target.value })),
|
|
@@ -5552,7 +6378,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5552
6378
|
]
|
|
5553
6379
|
}
|
|
5554
6380
|
),
|
|
5555
|
-
/* @__PURE__ */ (0,
|
|
6381
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5556
6382
|
"label",
|
|
5557
6383
|
{
|
|
5558
6384
|
style: {
|
|
@@ -5564,7 +6390,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5564
6390
|
},
|
|
5565
6391
|
children: [
|
|
5566
6392
|
"Contact Email",
|
|
5567
|
-
/* @__PURE__ */ (0,
|
|
6393
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5568
6394
|
"input",
|
|
5569
6395
|
{
|
|
5570
6396
|
onChange: (event) => setDoc((current) => ({ ...current, contactEmail: event.target.value })),
|
|
@@ -5585,7 +6411,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5585
6411
|
]
|
|
5586
6412
|
}
|
|
5587
6413
|
),
|
|
5588
|
-
/* @__PURE__ */ (0,
|
|
6414
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5589
6415
|
"label",
|
|
5590
6416
|
{
|
|
5591
6417
|
style: {
|
|
@@ -5597,7 +6423,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5597
6423
|
},
|
|
5598
6424
|
children: [
|
|
5599
6425
|
"Contact Phone",
|
|
5600
|
-
/* @__PURE__ */ (0,
|
|
6426
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5601
6427
|
"input",
|
|
5602
6428
|
{
|
|
5603
6429
|
onChange: (event) => setDoc((current) => ({ ...current, contactPhone: event.target.value })),
|
|
@@ -5618,8 +6444,8 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5618
6444
|
]
|
|
5619
6445
|
}
|
|
5620
6446
|
),
|
|
5621
|
-
/* @__PURE__ */ (0,
|
|
5622
|
-
/* @__PURE__ */ (0,
|
|
6447
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "orion-admin-preview-label", children: "Footer Preview" }),
|
|
6448
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "orion-admin-preview-frame", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "orion-admin-preview-surface", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5623
6449
|
SiteFooterPreview,
|
|
5624
6450
|
{
|
|
5625
6451
|
site: {
|
|
@@ -5638,7 +6464,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5638
6464
|
}
|
|
5639
6465
|
}
|
|
5640
6466
|
) }) }),
|
|
5641
|
-
/* @__PURE__ */ (0,
|
|
6467
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5642
6468
|
"button",
|
|
5643
6469
|
{
|
|
5644
6470
|
disabled: saving,
|
|
@@ -5662,9 +6488,9 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
5662
6488
|
}
|
|
5663
6489
|
|
|
5664
6490
|
// src/admin/components/studio/AdminStudioContactFormView.tsx
|
|
5665
|
-
var
|
|
6491
|
+
var import_react26 = require("react");
|
|
5666
6492
|
var import_ui10 = require("@payloadcms/ui");
|
|
5667
|
-
var
|
|
6493
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5668
6494
|
var defaultDoc = {
|
|
5669
6495
|
disabledMessage: "This form is temporarily unavailable. Please call us for immediate service.",
|
|
5670
6496
|
enabled: true,
|
|
@@ -5679,7 +6505,7 @@ var defaultDoc = {
|
|
|
5679
6505
|
submitButtonLabel: "Send Request",
|
|
5680
6506
|
successMessage: "Thanks, your request has been received. We will follow up shortly."
|
|
5681
6507
|
};
|
|
5682
|
-
var
|
|
6508
|
+
var getPropString10 = (props, key, fallback) => {
|
|
5683
6509
|
if (!props || typeof props !== "object") return fallback;
|
|
5684
6510
|
const direct = props[key];
|
|
5685
6511
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -5748,17 +6574,17 @@ var ghostButtonStyle = {
|
|
|
5748
6574
|
color: "var(--theme-elevation-900)"
|
|
5749
6575
|
};
|
|
5750
6576
|
function AdminStudioContactFormView(props) {
|
|
5751
|
-
const globalSlug =
|
|
5752
|
-
const globalsBasePath =
|
|
6577
|
+
const globalSlug = getPropString10(props, "globalSlug", "contact-form");
|
|
6578
|
+
const globalsBasePath = getPropString10(props, "globalsBasePath", "/globals");
|
|
5753
6579
|
const adminBasePath = useAdminBasePath();
|
|
5754
6580
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
5755
6581
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
5756
|
-
const [doc, setDoc] = (0,
|
|
5757
|
-
const [error, setError] = (0,
|
|
5758
|
-
const [isLoading, setIsLoading] = (0,
|
|
5759
|
-
const [isSaving, setIsSaving] = (0,
|
|
5760
|
-
const [savedMessage, setSavedMessage] = (0,
|
|
5761
|
-
(0,
|
|
6582
|
+
const [doc, setDoc] = (0, import_react26.useState)(defaultDoc);
|
|
6583
|
+
const [error, setError] = (0, import_react26.useState)(null);
|
|
6584
|
+
const [isLoading, setIsLoading] = (0, import_react26.useState)(true);
|
|
6585
|
+
const [isSaving, setIsSaving] = (0, import_react26.useState)(false);
|
|
6586
|
+
const [savedMessage, setSavedMessage] = (0, import_react26.useState)(null);
|
|
6587
|
+
(0, import_react26.useEffect)(() => {
|
|
5762
6588
|
let mounted = true;
|
|
5763
6589
|
const load = async () => {
|
|
5764
6590
|
setIsLoading(true);
|
|
@@ -5788,7 +6614,7 @@ function AdminStudioContactFormView(props) {
|
|
|
5788
6614
|
mounted = false;
|
|
5789
6615
|
};
|
|
5790
6616
|
}, [globalSlug]);
|
|
5791
|
-
const payload = (0,
|
|
6617
|
+
const payload = (0, import_react26.useMemo)(
|
|
5792
6618
|
() => ({
|
|
5793
6619
|
disabledMessage: doc.disabledMessage,
|
|
5794
6620
|
enabled: doc.enabled,
|
|
@@ -5825,8 +6651,8 @@ function AdminStudioContactFormView(props) {
|
|
|
5825
6651
|
setIsSaving(false);
|
|
5826
6652
|
}
|
|
5827
6653
|
};
|
|
5828
|
-
return /* @__PURE__ */ (0,
|
|
5829
|
-
/* @__PURE__ */ (0,
|
|
6654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { style: { paddingBottom: "2rem" }, children: [
|
|
6655
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5830
6656
|
import_ui10.SetStepNav,
|
|
5831
6657
|
{
|
|
5832
6658
|
nav: [
|
|
@@ -5835,14 +6661,14 @@ function AdminStudioContactFormView(props) {
|
|
|
5835
6661
|
]
|
|
5836
6662
|
}
|
|
5837
6663
|
),
|
|
5838
|
-
/* @__PURE__ */ (0,
|
|
5839
|
-
/* @__PURE__ */ (0,
|
|
5840
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
5841
|
-
error ? /* @__PURE__ */ (0,
|
|
5842
|
-
savedMessage ? /* @__PURE__ */ (0,
|
|
5843
|
-
!isLoading ? /* @__PURE__ */ (0,
|
|
5844
|
-
/* @__PURE__ */ (0,
|
|
5845
|
-
/* @__PURE__ */ (0,
|
|
6664
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h1", { style: { margin: 0 }, children: "Contact Form" }),
|
|
6665
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Edit form behavior and submission messaging without leaving Studio." }),
|
|
6666
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading form settings\u2026" }) : null,
|
|
6667
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
6668
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
6669
|
+
!isLoading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem", maxWidth: 900 }, children: [
|
|
6670
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { style: { ...fieldLabelStyle, alignItems: "center", display: "flex", gap: "0.6rem" }, children: [
|
|
6671
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5846
6672
|
"input",
|
|
5847
6673
|
{
|
|
5848
6674
|
checked: doc.enabled,
|
|
@@ -5852,9 +6678,9 @@ function AdminStudioContactFormView(props) {
|
|
|
5852
6678
|
),
|
|
5853
6679
|
"Form enabled"
|
|
5854
6680
|
] }),
|
|
5855
|
-
/* @__PURE__ */ (0,
|
|
6681
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
5856
6682
|
"Notification Email",
|
|
5857
|
-
/* @__PURE__ */ (0,
|
|
6683
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5858
6684
|
"input",
|
|
5859
6685
|
{
|
|
5860
6686
|
onChange: (event) => setDoc((prev) => ({ ...prev, notificationEmail: event.target.value })),
|
|
@@ -5864,9 +6690,9 @@ function AdminStudioContactFormView(props) {
|
|
|
5864
6690
|
}
|
|
5865
6691
|
)
|
|
5866
6692
|
] }),
|
|
5867
|
-
/* @__PURE__ */ (0,
|
|
6693
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
5868
6694
|
"Submit Button Label",
|
|
5869
|
-
/* @__PURE__ */ (0,
|
|
6695
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5870
6696
|
"input",
|
|
5871
6697
|
{
|
|
5872
6698
|
onChange: (event) => setDoc((prev) => ({ ...prev, submitButtonLabel: event.target.value })),
|
|
@@ -5876,9 +6702,9 @@ function AdminStudioContactFormView(props) {
|
|
|
5876
6702
|
}
|
|
5877
6703
|
)
|
|
5878
6704
|
] }),
|
|
5879
|
-
/* @__PURE__ */ (0,
|
|
6705
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
5880
6706
|
"Success Message",
|
|
5881
|
-
/* @__PURE__ */ (0,
|
|
6707
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5882
6708
|
"input",
|
|
5883
6709
|
{
|
|
5884
6710
|
onChange: (event) => setDoc((prev) => ({ ...prev, successMessage: event.target.value })),
|
|
@@ -5888,9 +6714,9 @@ function AdminStudioContactFormView(props) {
|
|
|
5888
6714
|
}
|
|
5889
6715
|
)
|
|
5890
6716
|
] }),
|
|
5891
|
-
/* @__PURE__ */ (0,
|
|
6717
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
5892
6718
|
"Error Message",
|
|
5893
|
-
/* @__PURE__ */ (0,
|
|
6719
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5894
6720
|
"input",
|
|
5895
6721
|
{
|
|
5896
6722
|
onChange: (event) => setDoc((prev) => ({ ...prev, errorMessage: event.target.value })),
|
|
@@ -5900,9 +6726,9 @@ function AdminStudioContactFormView(props) {
|
|
|
5900
6726
|
}
|
|
5901
6727
|
)
|
|
5902
6728
|
] }),
|
|
5903
|
-
/* @__PURE__ */ (0,
|
|
6729
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { style: fieldLabelStyle, children: [
|
|
5904
6730
|
"Disabled Message",
|
|
5905
|
-
/* @__PURE__ */ (0,
|
|
6731
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5906
6732
|
"input",
|
|
5907
6733
|
{
|
|
5908
6734
|
onChange: (event) => setDoc((prev) => ({ ...prev, disabledMessage: event.target.value })),
|
|
@@ -5912,7 +6738,7 @@ function AdminStudioContactFormView(props) {
|
|
|
5912
6738
|
}
|
|
5913
6739
|
)
|
|
5914
6740
|
] }),
|
|
5915
|
-
/* @__PURE__ */ (0,
|
|
6741
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5916
6742
|
"div",
|
|
5917
6743
|
{
|
|
5918
6744
|
style: {
|
|
@@ -5922,9 +6748,9 @@ function AdminStudioContactFormView(props) {
|
|
|
5922
6748
|
padding: "0.85rem"
|
|
5923
6749
|
},
|
|
5924
6750
|
children: [
|
|
5925
|
-
/* @__PURE__ */ (0,
|
|
5926
|
-
/* @__PURE__ */ (0,
|
|
5927
|
-
/* @__PURE__ */ (0,
|
|
6751
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { style: { fontWeight: 900, marginBottom: "0.65rem" }, children: "Service Options" }),
|
|
6752
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { style: { display: "grid", gap: "0.55rem" }, children: doc.serviceOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
6753
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5928
6754
|
"input",
|
|
5929
6755
|
{
|
|
5930
6756
|
onChange: (event) => setDoc((prev) => ({
|
|
@@ -5938,7 +6764,7 @@ function AdminStudioContactFormView(props) {
|
|
|
5938
6764
|
value: option.label
|
|
5939
6765
|
}
|
|
5940
6766
|
),
|
|
5941
|
-
/* @__PURE__ */ (0,
|
|
6767
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5942
6768
|
"button",
|
|
5943
6769
|
{
|
|
5944
6770
|
onClick: () => setDoc((prev) => ({
|
|
@@ -5951,7 +6777,7 @@ function AdminStudioContactFormView(props) {
|
|
|
5951
6777
|
}
|
|
5952
6778
|
)
|
|
5953
6779
|
] }, `${index}-${option.label}`)) }),
|
|
5954
|
-
/* @__PURE__ */ (0,
|
|
6780
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5955
6781
|
"button",
|
|
5956
6782
|
{
|
|
5957
6783
|
onClick: () => setDoc((prev) => ({
|
|
@@ -5966,9 +6792,9 @@ function AdminStudioContactFormView(props) {
|
|
|
5966
6792
|
]
|
|
5967
6793
|
}
|
|
5968
6794
|
),
|
|
5969
|
-
/* @__PURE__ */ (0,
|
|
5970
|
-
/* @__PURE__ */ (0,
|
|
5971
|
-
/* @__PURE__ */ (0,
|
|
6795
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { style: { display: "flex", gap: "0.6rem" }, children: [
|
|
6796
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { disabled: isSaving, onClick: () => void save(), style: buttonStyle, type: "button", children: isSaving ? "Saving\u2026" : "Save Form Settings" }),
|
|
6797
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5972
6798
|
"a",
|
|
5973
6799
|
{
|
|
5974
6800
|
href: rawGlobalPath,
|
|
@@ -5988,10 +6814,10 @@ function AdminStudioContactFormView(props) {
|
|
|
5988
6814
|
}
|
|
5989
6815
|
|
|
5990
6816
|
// src/admin/components/studio/AdminStudioMediaView.tsx
|
|
5991
|
-
var
|
|
6817
|
+
var import_react28 = require("react");
|
|
5992
6818
|
|
|
5993
6819
|
// src/admin-app/components/MediaListItem.tsx
|
|
5994
|
-
var
|
|
6820
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5995
6821
|
function formatFileSize(bytes) {
|
|
5996
6822
|
if (bytes < 1024) return `${bytes} B`;
|
|
5997
6823
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
@@ -6014,21 +6840,21 @@ function MediaListItem({
|
|
|
6014
6840
|
if (typeof filesize === "number") metaParts.push(formatFileSize(filesize));
|
|
6015
6841
|
if (typeof width === "number" && typeof height === "number") metaParts.push(`${width}\xD7${height}`);
|
|
6016
6842
|
if (typeof mimeType === "string") metaParts.push(mimeType);
|
|
6017
|
-
return /* @__PURE__ */ (0,
|
|
6018
|
-
/* @__PURE__ */ (0,
|
|
6019
|
-
url ? /* @__PURE__ */ (0,
|
|
6020
|
-
/* @__PURE__ */ (0,
|
|
6021
|
-
/* @__PURE__ */ (0,
|
|
6022
|
-
/* @__PURE__ */ (0,
|
|
6023
|
-
metaParts.length > 0 ? /* @__PURE__ */ (0,
|
|
6843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("a", { className: "orion-admin-list-item", href, children: [
|
|
6844
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { style: { alignItems: "center", display: "flex", gap: "0.8rem" }, children: [
|
|
6845
|
+
url ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("img", { alt: altText || label, className: "orion-admin-media-preview", src: url }) : null,
|
|
6846
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
6847
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("strong", { children: label }),
|
|
6848
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "orion-admin-list-meta", children: altText || "No alt text" }),
|
|
6849
|
+
metaParts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "orion-admin-list-meta", style: { marginTop: "0.15rem" }, children: metaParts.join(" \xB7 ") }) : null
|
|
6024
6850
|
] })
|
|
6025
6851
|
] }),
|
|
6026
|
-
/* @__PURE__ */ (0,
|
|
6852
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "orion-admin-list-meta", children: "Edit" })
|
|
6027
6853
|
] });
|
|
6028
6854
|
}
|
|
6029
6855
|
|
|
6030
6856
|
// src/admin-app/components/MediaUploadForm.tsx
|
|
6031
|
-
var
|
|
6857
|
+
var import_react27 = require("react");
|
|
6032
6858
|
var import_navigation3 = require("next/navigation");
|
|
6033
6859
|
|
|
6034
6860
|
// src/shared/clientImageUploadOptimization.ts
|
|
@@ -6125,7 +6951,7 @@ async function optimizeImageForUpload(file) {
|
|
|
6125
6951
|
}
|
|
6126
6952
|
|
|
6127
6953
|
// src/admin-app/components/MediaUploadForm.tsx
|
|
6128
|
-
var
|
|
6954
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6129
6955
|
var MEDIA_LIBRARY_SYNC_EVENT = "orion-media-library-updated";
|
|
6130
6956
|
var notifyMediaLibraryUpdated = () => {
|
|
6131
6957
|
if (typeof window === "undefined") {
|
|
@@ -6165,14 +6991,14 @@ var parseUploadError = async (response) => {
|
|
|
6165
6991
|
};
|
|
6166
6992
|
function MediaUploadForm() {
|
|
6167
6993
|
const router = (0, import_navigation3.useRouter)();
|
|
6168
|
-
const fileInputRef = (0,
|
|
6169
|
-
const [alt, setAlt] = (0,
|
|
6170
|
-
const [file, setFile] = (0,
|
|
6171
|
-
const [preview, setPreview] = (0,
|
|
6172
|
-
const [dragging, setDragging] = (0,
|
|
6173
|
-
const [submitting, setSubmitting] = (0,
|
|
6174
|
-
const [error, setError] = (0,
|
|
6175
|
-
const handleFile = (0,
|
|
6994
|
+
const fileInputRef = (0, import_react27.useRef)(null);
|
|
6995
|
+
const [alt, setAlt] = (0, import_react27.useState)("");
|
|
6996
|
+
const [file, setFile] = (0, import_react27.useState)(null);
|
|
6997
|
+
const [preview, setPreview] = (0, import_react27.useState)(null);
|
|
6998
|
+
const [dragging, setDragging] = (0, import_react27.useState)(false);
|
|
6999
|
+
const [submitting, setSubmitting] = (0, import_react27.useState)(false);
|
|
7000
|
+
const [error, setError] = (0, import_react27.useState)(null);
|
|
7001
|
+
const handleFile = (0, import_react27.useCallback)((selectedFile) => {
|
|
6176
7002
|
setFile(selectedFile);
|
|
6177
7003
|
if (preview) {
|
|
6178
7004
|
URL.revokeObjectURL(preview);
|
|
@@ -6182,15 +7008,15 @@ function MediaUploadForm() {
|
|
|
6182
7008
|
setPreview(URL.createObjectURL(selectedFile));
|
|
6183
7009
|
}
|
|
6184
7010
|
}, [preview]);
|
|
6185
|
-
const onDragOver = (0,
|
|
7011
|
+
const onDragOver = (0, import_react27.useCallback)((e) => {
|
|
6186
7012
|
e.preventDefault();
|
|
6187
7013
|
setDragging(true);
|
|
6188
7014
|
}, []);
|
|
6189
|
-
const onDragLeave = (0,
|
|
7015
|
+
const onDragLeave = (0, import_react27.useCallback)((e) => {
|
|
6190
7016
|
e.preventDefault();
|
|
6191
7017
|
setDragging(false);
|
|
6192
7018
|
}, []);
|
|
6193
|
-
const onDrop = (0,
|
|
7019
|
+
const onDrop = (0, import_react27.useCallback)((e) => {
|
|
6194
7020
|
e.preventDefault();
|
|
6195
7021
|
setDragging(false);
|
|
6196
7022
|
const droppedFile = e.dataTransfer.files?.[0] || null;
|
|
@@ -6239,10 +7065,10 @@ function MediaUploadForm() {
|
|
|
6239
7065
|
setSubmitting(false);
|
|
6240
7066
|
}
|
|
6241
7067
|
};
|
|
6242
|
-
return /* @__PURE__ */ (0,
|
|
6243
|
-
/* @__PURE__ */ (0,
|
|
7068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("form", { className: "orion-admin-upload-form", onSubmit: upload, children: [
|
|
7069
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { children: [
|
|
6244
7070
|
"Alt text",
|
|
6245
|
-
/* @__PURE__ */ (0,
|
|
7071
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6246
7072
|
"input",
|
|
6247
7073
|
{
|
|
6248
7074
|
onChange: (event) => setAlt(event.target.value),
|
|
@@ -6252,7 +7078,7 @@ function MediaUploadForm() {
|
|
|
6252
7078
|
}
|
|
6253
7079
|
)
|
|
6254
7080
|
] }),
|
|
6255
|
-
/* @__PURE__ */ (0,
|
|
7081
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6256
7082
|
"div",
|
|
6257
7083
|
{
|
|
6258
7084
|
className: `orion-admin-dropzone${dragging ? " is-dragging" : ""}${file ? " has-file" : ""}`,
|
|
@@ -6261,14 +7087,14 @@ function MediaUploadForm() {
|
|
|
6261
7087
|
onDragOver,
|
|
6262
7088
|
onDrop,
|
|
6263
7089
|
children: [
|
|
6264
|
-
preview ? /* @__PURE__ */ (0,
|
|
6265
|
-
/* @__PURE__ */ (0,
|
|
6266
|
-
/* @__PURE__ */ (0,
|
|
6267
|
-
] }) : /* @__PURE__ */ (0,
|
|
6268
|
-
/* @__PURE__ */ (0,
|
|
6269
|
-
/* @__PURE__ */ (0,
|
|
7090
|
+
preview ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "orion-admin-dropzone-preview", children: [
|
|
7091
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("img", { alt: "Upload preview", src: preview }),
|
|
7092
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: file?.name })
|
|
7093
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "orion-admin-dropzone-label", children: [
|
|
7094
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "Drop an image here" }),
|
|
7095
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "or click to browse" })
|
|
6270
7096
|
] }),
|
|
6271
|
-
/* @__PURE__ */ (0,
|
|
7097
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6272
7098
|
"input",
|
|
6273
7099
|
{
|
|
6274
7100
|
accept: "image/*",
|
|
@@ -6281,15 +7107,15 @@ function MediaUploadForm() {
|
|
|
6281
7107
|
]
|
|
6282
7108
|
}
|
|
6283
7109
|
),
|
|
6284
|
-
error ? /* @__PURE__ */ (0,
|
|
6285
|
-
/* @__PURE__ */ (0,
|
|
7110
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "orion-admin-upload-error", children: error }) : null,
|
|
7111
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { disabled: submitting, type: "submit", children: submitting ? "Uploading..." : "Upload" })
|
|
6286
7112
|
] });
|
|
6287
7113
|
}
|
|
6288
7114
|
|
|
6289
7115
|
// src/admin/components/studio/AdminStudioMediaView.tsx
|
|
6290
|
-
var
|
|
7116
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6291
7117
|
var MEDIA_LIBRARY_SYNC_EVENT2 = "orion-media-library-updated";
|
|
6292
|
-
var
|
|
7118
|
+
var getPropString11 = (props, key, fallback) => {
|
|
6293
7119
|
if (!props || typeof props !== "object") return fallback;
|
|
6294
7120
|
const direct = props[key];
|
|
6295
7121
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -6301,12 +7127,12 @@ var getPropString10 = (props, key, fallback) => {
|
|
|
6301
7127
|
return fallback;
|
|
6302
7128
|
};
|
|
6303
7129
|
function AdminStudioMediaView(props) {
|
|
6304
|
-
const mediaCollectionSlug =
|
|
7130
|
+
const mediaCollectionSlug = getPropString11(props, "mediaCollectionSlug", "media");
|
|
6305
7131
|
const adminBasePath = useAdminBasePath();
|
|
6306
|
-
const [docs, setDocs] = (0,
|
|
6307
|
-
const [loading, setLoading] = (0,
|
|
6308
|
-
const [error, setError] = (0,
|
|
6309
|
-
const apiURL = (0,
|
|
7132
|
+
const [docs, setDocs] = (0, import_react28.useState)([]);
|
|
7133
|
+
const [loading, setLoading] = (0, import_react28.useState)(true);
|
|
7134
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
7135
|
+
const apiURL = (0, import_react28.useMemo)(() => {
|
|
6310
7136
|
const params = new URLSearchParams({
|
|
6311
7137
|
depth: "0",
|
|
6312
7138
|
draft: "true",
|
|
@@ -6315,7 +7141,7 @@ function AdminStudioMediaView(props) {
|
|
|
6315
7141
|
});
|
|
6316
7142
|
return `/api/${mediaCollectionSlug}?${params.toString()}`;
|
|
6317
7143
|
}, [mediaCollectionSlug]);
|
|
6318
|
-
(0,
|
|
7144
|
+
(0, import_react28.useEffect)(() => {
|
|
6319
7145
|
let cancelled = false;
|
|
6320
7146
|
const run = async () => {
|
|
6321
7147
|
setLoading(true);
|
|
@@ -6351,7 +7177,7 @@ function AdminStudioMediaView(props) {
|
|
|
6351
7177
|
window.removeEventListener("storage", rerun);
|
|
6352
7178
|
};
|
|
6353
7179
|
}, [apiURL]);
|
|
6354
|
-
return /* @__PURE__ */ (0,
|
|
7180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
6355
7181
|
AdminPage,
|
|
6356
7182
|
{
|
|
6357
7183
|
breadcrumbs: [
|
|
@@ -6361,18 +7187,18 @@ function AdminStudioMediaView(props) {
|
|
|
6361
7187
|
description: `${docs.length} asset${docs.length === 1 ? "" : "s"} \u2014 Upload assets here, including logos used in Site Settings branding.`,
|
|
6362
7188
|
title: "Media",
|
|
6363
7189
|
children: [
|
|
6364
|
-
/* @__PURE__ */ (0,
|
|
6365
|
-
loading ? /* @__PURE__ */ (0,
|
|
6366
|
-
error ? /* @__PURE__ */ (0,
|
|
6367
|
-
/* @__PURE__ */ (0,
|
|
6368
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */ (0,
|
|
6369
|
-
/* @__PURE__ */ (0,
|
|
6370
|
-
/* @__PURE__ */ (0,
|
|
7190
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MediaUploadForm, {}),
|
|
7191
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "orion-admin-list-meta", style: { marginTop: "1rem" }, children: "Loading..." }) : null,
|
|
7192
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "orion-admin-error", style: { marginTop: "1rem" }, children: error }) : null,
|
|
7193
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "orion-admin-list", style: { marginTop: "1rem" }, children: [
|
|
7194
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "orion-admin-card", children: [
|
|
7195
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "No media found" }),
|
|
7196
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Upload an image to get started." })
|
|
6371
7197
|
] }) : null,
|
|
6372
7198
|
docs.map((doc) => {
|
|
6373
7199
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
6374
7200
|
if (!id) return null;
|
|
6375
|
-
return /* @__PURE__ */ (0,
|
|
7201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6376
7202
|
MediaListItem,
|
|
6377
7203
|
{
|
|
6378
7204
|
alt: doc.alt,
|
|
@@ -6395,11 +7221,11 @@ function AdminStudioMediaView(props) {
|
|
|
6395
7221
|
}
|
|
6396
7222
|
|
|
6397
7223
|
// src/admin/components/studio/AdminStudioMediaItemView.tsx
|
|
6398
|
-
var
|
|
7224
|
+
var import_react30 = require("react");
|
|
6399
7225
|
|
|
6400
7226
|
// src/admin-app/components/MediaDetailPanel.tsx
|
|
6401
|
-
var
|
|
6402
|
-
var
|
|
7227
|
+
var import_react29 = require("react");
|
|
7228
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6403
7229
|
function formatFileSize2(bytes) {
|
|
6404
7230
|
if (bytes < 1024) return `${bytes} B`;
|
|
6405
7231
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
@@ -6418,8 +7244,8 @@ function MediaDetailPanel({
|
|
|
6418
7244
|
updateAction,
|
|
6419
7245
|
deleteAction
|
|
6420
7246
|
}) {
|
|
6421
|
-
const [copied, setCopied] = (0,
|
|
6422
|
-
const [confirmDelete, setConfirmDelete] = (0,
|
|
7247
|
+
const [copied, setCopied] = (0, import_react29.useState)(false);
|
|
7248
|
+
const [confirmDelete, setConfirmDelete] = (0, import_react29.useState)(false);
|
|
6423
7249
|
const copyUrl = async () => {
|
|
6424
7250
|
if (!url) return;
|
|
6425
7251
|
try {
|
|
@@ -6449,10 +7275,10 @@ function MediaDetailPanel({
|
|
|
6449
7275
|
metaRows.push({ label: "Uploaded", value: createdAt });
|
|
6450
7276
|
}
|
|
6451
7277
|
}
|
|
6452
|
-
return /* @__PURE__ */ (0,
|
|
6453
|
-
/* @__PURE__ */ (0,
|
|
6454
|
-
/* @__PURE__ */ (0,
|
|
6455
|
-
url ? /* @__PURE__ */ (0,
|
|
7278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "orion-admin-grid", style: { alignItems: "start" }, children: [
|
|
7279
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
7280
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "orion-admin-card", children: url ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("img", { alt: alt || filename || "Media", src: url, style: { borderRadius: 12, width: "100%" } }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "No preview available." }) }),
|
|
7281
|
+
url ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6456
7282
|
"button",
|
|
6457
7283
|
{
|
|
6458
7284
|
className: "orion-admin-action-button",
|
|
@@ -6463,28 +7289,28 @@ function MediaDetailPanel({
|
|
|
6463
7289
|
}
|
|
6464
7290
|
) : null
|
|
6465
7291
|
] }),
|
|
6466
|
-
/* @__PURE__ */ (0,
|
|
6467
|
-
metaRows.length > 0 ? /* @__PURE__ */ (0,
|
|
6468
|
-
/* @__PURE__ */ (0,
|
|
6469
|
-
/* @__PURE__ */ (0,
|
|
7292
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { style: { display: "grid", gap: "0.8rem" }, children: [
|
|
7293
|
+
metaRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "orion-admin-card orion-admin-meta-table", children: metaRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "orion-admin-meta-row", children: [
|
|
7294
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "orion-admin-meta-label", children: row.label }),
|
|
7295
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "orion-admin-meta-value", children: row.value })
|
|
6470
7296
|
] }, row.label)) }) : null,
|
|
6471
|
-
/* @__PURE__ */ (0,
|
|
6472
|
-
/* @__PURE__ */ (0,
|
|
6473
|
-
/* @__PURE__ */ (0,
|
|
7297
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("form", { action: updateAction, className: "orion-admin-form", children: [
|
|
7298
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("input", { name: "id", type: "hidden", value: id }),
|
|
7299
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { children: [
|
|
6474
7300
|
"Alt text",
|
|
6475
|
-
/* @__PURE__ */ (0,
|
|
7301
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("input", { defaultValue: alt || "", name: "alt", required: true, type: "text" })
|
|
6476
7302
|
] }),
|
|
6477
|
-
/* @__PURE__ */ (0,
|
|
7303
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "submit", children: "Save" })
|
|
6478
7304
|
] }),
|
|
6479
|
-
confirmDelete ? /* @__PURE__ */ (0,
|
|
6480
|
-
/* @__PURE__ */ (0,
|
|
6481
|
-
/* @__PURE__ */ (0,
|
|
6482
|
-
/* @__PURE__ */ (0,
|
|
6483
|
-
/* @__PURE__ */ (0,
|
|
6484
|
-
/* @__PURE__ */ (0,
|
|
6485
|
-
/* @__PURE__ */ (0,
|
|
7305
|
+
confirmDelete ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "orion-admin-form", style: { borderColor: "#b42318" }, children: [
|
|
7306
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { style: { fontWeight: 700, margin: 0 }, children: "Are you sure you want to delete this asset?" }),
|
|
7307
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { style: { color: "var(--orion-admin-muted)", fontSize: "0.9rem", margin: 0 }, children: "This action cannot be undone." }),
|
|
7308
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
7309
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("form", { action: deleteAction, style: { flex: 1 }, children: [
|
|
7310
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("input", { name: "id", type: "hidden", value: id }),
|
|
7311
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { style: { background: "#b42318", border: 0, borderRadius: 10, color: "#fff", cursor: "pointer", fontWeight: 800, padding: "0.55rem 0.8rem", width: "100%" }, type: "submit", children: "Yes, Delete" })
|
|
6486
7312
|
] }),
|
|
6487
|
-
/* @__PURE__ */ (0,
|
|
7313
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6488
7314
|
"button",
|
|
6489
7315
|
{
|
|
6490
7316
|
onClick: () => setConfirmDelete(false),
|
|
@@ -6494,7 +7320,7 @@ function MediaDetailPanel({
|
|
|
6494
7320
|
}
|
|
6495
7321
|
)
|
|
6496
7322
|
] })
|
|
6497
|
-
] }) : /* @__PURE__ */ (0,
|
|
7323
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6498
7324
|
"button",
|
|
6499
7325
|
{
|
|
6500
7326
|
className: "orion-admin-action-button",
|
|
@@ -6509,8 +7335,8 @@ function MediaDetailPanel({
|
|
|
6509
7335
|
}
|
|
6510
7336
|
|
|
6511
7337
|
// src/admin/components/studio/AdminStudioMediaItemView.tsx
|
|
6512
|
-
var
|
|
6513
|
-
var
|
|
7338
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
7339
|
+
var getPropString12 = (props, key, fallback) => {
|
|
6514
7340
|
if (!props || typeof props !== "object") return fallback;
|
|
6515
7341
|
const direct = props[key];
|
|
6516
7342
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -6536,16 +7362,16 @@ var getMediaIDFromPathname = (pathname) => {
|
|
|
6536
7362
|
return id ? decodeURIComponent(id) : null;
|
|
6537
7363
|
};
|
|
6538
7364
|
function AdminStudioMediaItemView(props) {
|
|
6539
|
-
const mediaCollectionSlug =
|
|
7365
|
+
const mediaCollectionSlug = getPropString12(props, "mediaCollectionSlug", "media");
|
|
6540
7366
|
const adminBasePath = useAdminBasePath();
|
|
6541
7367
|
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
6542
|
-
const mediaIDFromParams = (0,
|
|
6543
|
-
const [mediaID, setMediaID] = (0,
|
|
6544
|
-
const [doc, setDoc] = (0,
|
|
6545
|
-
const [loading, setLoading] = (0,
|
|
6546
|
-
const [error, setError] = (0,
|
|
6547
|
-
const [savedMessage, setSavedMessage] = (0,
|
|
6548
|
-
(0,
|
|
7368
|
+
const mediaIDFromParams = (0, import_react30.useMemo)(() => getParam2(props.params, "id"), [props.params]);
|
|
7369
|
+
const [mediaID, setMediaID] = (0, import_react30.useState)(mediaIDFromParams);
|
|
7370
|
+
const [doc, setDoc] = (0, import_react30.useState)(null);
|
|
7371
|
+
const [loading, setLoading] = (0, import_react30.useState)(true);
|
|
7372
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
7373
|
+
const [savedMessage, setSavedMessage] = (0, import_react30.useState)(null);
|
|
7374
|
+
(0, import_react30.useEffect)(() => {
|
|
6549
7375
|
if (mediaIDFromParams) {
|
|
6550
7376
|
setMediaID(mediaIDFromParams);
|
|
6551
7377
|
return;
|
|
@@ -6573,7 +7399,7 @@ function AdminStudioMediaItemView(props) {
|
|
|
6573
7399
|
setLoading(false);
|
|
6574
7400
|
}
|
|
6575
7401
|
};
|
|
6576
|
-
(0,
|
|
7402
|
+
(0, import_react30.useEffect)(() => {
|
|
6577
7403
|
if (!mediaID) return;
|
|
6578
7404
|
void loadDoc(mediaID);
|
|
6579
7405
|
}, [mediaCollectionSlug, mediaID]);
|
|
@@ -6619,7 +7445,7 @@ function AdminStudioMediaItemView(props) {
|
|
|
6619
7445
|
setError(deleteError instanceof Error ? deleteError.message : "Failed to delete media item.");
|
|
6620
7446
|
}
|
|
6621
7447
|
};
|
|
6622
|
-
return /* @__PURE__ */ (0,
|
|
7448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
6623
7449
|
AdminPage,
|
|
6624
7450
|
{
|
|
6625
7451
|
breadcrumbs: [
|
|
@@ -6630,10 +7456,10 @@ function AdminStudioMediaItemView(props) {
|
|
|
6630
7456
|
description: "Update metadata or remove the selected asset.",
|
|
6631
7457
|
title: "Media Asset",
|
|
6632
7458
|
children: [
|
|
6633
|
-
loading ? /* @__PURE__ */ (0,
|
|
6634
|
-
error ? /* @__PURE__ */ (0,
|
|
6635
|
-
savedMessage ? /* @__PURE__ */ (0,
|
|
6636
|
-
!loading && !error && doc && mediaID ? /* @__PURE__ */ (0,
|
|
7459
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
7460
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "orion-admin-error", children: error }) : null,
|
|
7461
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
7462
|
+
!loading && !error && doc && mediaID ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6637
7463
|
MediaDetailPanel,
|
|
6638
7464
|
{
|
|
6639
7465
|
alt: doc.alt,
|
|
@@ -6655,10 +7481,10 @@ function AdminStudioMediaItemView(props) {
|
|
|
6655
7481
|
}
|
|
6656
7482
|
|
|
6657
7483
|
// src/admin/components/studio/AdminStudioFormsView.tsx
|
|
6658
|
-
var
|
|
6659
|
-
var
|
|
7484
|
+
var import_link3 = __toESM(require("next/link"));
|
|
7485
|
+
var import_react31 = require("react");
|
|
6660
7486
|
var import_ui11 = require("@payloadcms/ui");
|
|
6661
|
-
var
|
|
7487
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6662
7488
|
var FORM_TONES = [
|
|
6663
7489
|
{
|
|
6664
7490
|
accent: "var(--orion-cms-tone-1, var(--orion-cms-accent, var(--orion-admin-accent)))",
|
|
@@ -6709,8 +7535,8 @@ var isEditor2 = (user) => {
|
|
|
6709
7535
|
const role = user.role;
|
|
6710
7536
|
return typeof role === "string" && role === "editor";
|
|
6711
7537
|
};
|
|
6712
|
-
var
|
|
6713
|
-
var
|
|
7538
|
+
var canReviewForms2 = (user) => isAdmin3(user) || isEditor2(user);
|
|
7539
|
+
var getPropString13 = (props, key, fallback) => {
|
|
6714
7540
|
if (!props || typeof props !== "object") return fallback;
|
|
6715
7541
|
const direct = props[key];
|
|
6716
7542
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -6738,7 +7564,7 @@ var getFieldCount = (form) => Array.isArray(form.steps) ? form.steps.reduce((cou
|
|
|
6738
7564
|
const fields = step.fields;
|
|
6739
7565
|
return count + (Array.isArray(fields) ? fields.length : 0);
|
|
6740
7566
|
}, 0) : 0;
|
|
6741
|
-
var
|
|
7567
|
+
var getFormID2 = (value) => {
|
|
6742
7568
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
6743
7569
|
if (value && typeof value === "object") {
|
|
6744
7570
|
const id = value.id;
|
|
@@ -6859,7 +7685,7 @@ var getSecondaryIdentity = (identity, previewFields, uploads) => {
|
|
|
6859
7685
|
if (identity.email) return "Email response";
|
|
6860
7686
|
return "Response preview unavailable";
|
|
6861
7687
|
};
|
|
6862
|
-
var
|
|
7688
|
+
var loadCollection2 = async (slug, params) => {
|
|
6863
7689
|
const response = await fetch(`/api/${slug}?${params.toString()}`, {
|
|
6864
7690
|
credentials: "include"
|
|
6865
7691
|
});
|
|
@@ -6870,19 +7696,19 @@ var loadCollection = async (slug, params) => {
|
|
|
6870
7696
|
const payload = await response.json();
|
|
6871
7697
|
return Array.isArray(payload.docs) ? payload.docs : [];
|
|
6872
7698
|
};
|
|
6873
|
-
var renderEmptyMessage = (message) => /* @__PURE__ */ (0,
|
|
6874
|
-
/* @__PURE__ */ (0,
|
|
6875
|
-
/* @__PURE__ */ (0,
|
|
7699
|
+
var renderEmptyMessage = (message) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-empty-state", children: [
|
|
7700
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { children: "No responses yet" }),
|
|
7701
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: message })
|
|
6876
7702
|
] });
|
|
6877
7703
|
function AdminStudioFormsView(props) {
|
|
6878
7704
|
const { user } = (0, import_ui11.useAuth)();
|
|
6879
|
-
const formsCollectionSlug =
|
|
6880
|
-
const formSubmissionsCollectionSlug =
|
|
7705
|
+
const formsCollectionSlug = getPropString13(props, "formsCollectionSlug", "forms");
|
|
7706
|
+
const formSubmissionsCollectionSlug = getPropString13(
|
|
6881
7707
|
props,
|
|
6882
7708
|
"formSubmissionsCollectionSlug",
|
|
6883
7709
|
"form-submissions"
|
|
6884
7710
|
);
|
|
6885
|
-
const formUploadsCollectionSlug =
|
|
7711
|
+
const formUploadsCollectionSlug = getPropString13(props, "formUploadsCollectionSlug", "form-uploads");
|
|
6886
7712
|
const adminBasePath = useAdminBasePath();
|
|
6887
7713
|
const rawFormsPath = resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`);
|
|
6888
7714
|
const rawSubmissionsPath = resolveAdminPath(
|
|
@@ -6890,12 +7716,12 @@ function AdminStudioFormsView(props) {
|
|
|
6890
7716
|
`/collections/${formSubmissionsCollectionSlug}`
|
|
6891
7717
|
);
|
|
6892
7718
|
const rawUploadsPath = resolveAdminPath(adminBasePath, `/collections/${formUploadsCollectionSlug}`);
|
|
6893
|
-
const [forms, setForms] = (0,
|
|
6894
|
-
const [submissions, setSubmissions] = (0,
|
|
6895
|
-
const [loading, setLoading] = (0,
|
|
6896
|
-
const [error, setError] = (0,
|
|
6897
|
-
(0,
|
|
6898
|
-
if (!
|
|
7719
|
+
const [forms, setForms] = (0, import_react31.useState)([]);
|
|
7720
|
+
const [submissions, setSubmissions] = (0, import_react31.useState)([]);
|
|
7721
|
+
const [loading, setLoading] = (0, import_react31.useState)(true);
|
|
7722
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
7723
|
+
(0, import_react31.useEffect)(() => {
|
|
7724
|
+
if (!canReviewForms2(user)) {
|
|
6899
7725
|
return;
|
|
6900
7726
|
}
|
|
6901
7727
|
let cancelled = false;
|
|
@@ -6914,8 +7740,8 @@ function AdminStudioFormsView(props) {
|
|
|
6914
7740
|
sort: "-submittedAt"
|
|
6915
7741
|
});
|
|
6916
7742
|
const [nextForms, nextSubmissions] = await Promise.all([
|
|
6917
|
-
|
|
6918
|
-
|
|
7743
|
+
loadCollection2(formsCollectionSlug, formsParams),
|
|
7744
|
+
loadCollection2(formSubmissionsCollectionSlug, submissionsParams)
|
|
6919
7745
|
]);
|
|
6920
7746
|
if (cancelled) return;
|
|
6921
7747
|
setForms(nextForms);
|
|
@@ -6935,10 +7761,10 @@ function AdminStudioFormsView(props) {
|
|
|
6935
7761
|
cancelled = true;
|
|
6936
7762
|
};
|
|
6937
7763
|
}, [formSubmissionsCollectionSlug, formsCollectionSlug, user]);
|
|
6938
|
-
const submissionsByForm = (0,
|
|
7764
|
+
const submissionsByForm = (0, import_react31.useMemo)(() => {
|
|
6939
7765
|
const map = /* @__PURE__ */ new Map();
|
|
6940
7766
|
for (const submission of submissions) {
|
|
6941
|
-
const formID =
|
|
7767
|
+
const formID = getFormID2(submission.form);
|
|
6942
7768
|
if (!formID) continue;
|
|
6943
7769
|
const current = map.get(formID) || [];
|
|
6944
7770
|
current.push(submission);
|
|
@@ -6946,7 +7772,7 @@ function AdminStudioFormsView(props) {
|
|
|
6946
7772
|
}
|
|
6947
7773
|
return map;
|
|
6948
7774
|
}, [submissions]);
|
|
6949
|
-
const busiestForm = (0,
|
|
7775
|
+
const busiestForm = (0, import_react31.useMemo)(
|
|
6950
7776
|
() => forms.reduce((current, form) => {
|
|
6951
7777
|
const title = typeof form.title === "string" && form.title.trim().length > 0 ? form.title : "Untitled Form";
|
|
6952
7778
|
const count = (typeof form.id === "string" || typeof form.id === "number" ? submissionsByForm.get(String(form.id)) : null)?.length || 0;
|
|
@@ -6957,8 +7783,8 @@ function AdminStudioFormsView(props) {
|
|
|
6957
7783
|
}, null),
|
|
6958
7784
|
[forms, submissionsByForm]
|
|
6959
7785
|
);
|
|
6960
|
-
if (!
|
|
6961
|
-
return /* @__PURE__ */ (0,
|
|
7786
|
+
if (!canReviewForms2(user)) {
|
|
7787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6962
7788
|
AdminPage,
|
|
6963
7789
|
{
|
|
6964
7790
|
breadcrumbs: [
|
|
@@ -6967,14 +7793,14 @@ function AdminStudioFormsView(props) {
|
|
|
6967
7793
|
],
|
|
6968
7794
|
description: "You do not have access to this section.",
|
|
6969
7795
|
title: "Forms",
|
|
6970
|
-
children: /* @__PURE__ */ (0,
|
|
6971
|
-
/* @__PURE__ */ (0,
|
|
6972
|
-
/* @__PURE__ */ (0,
|
|
7796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-card", children: [
|
|
7797
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { children: "Access denied" }),
|
|
7798
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "This section is restricted to editor and administrator accounts." })
|
|
6973
7799
|
] })
|
|
6974
7800
|
}
|
|
6975
7801
|
) });
|
|
6976
7802
|
}
|
|
6977
|
-
return /* @__PURE__ */ (0,
|
|
7803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
6978
7804
|
AdminPage,
|
|
6979
7805
|
{
|
|
6980
7806
|
breadcrumbs: [
|
|
@@ -6984,30 +7810,30 @@ function AdminStudioFormsView(props) {
|
|
|
6984
7810
|
description: "Review live forms, recent responses, and uploaded files.",
|
|
6985
7811
|
title: "Forms",
|
|
6986
7812
|
children: [
|
|
6987
|
-
loading ? /* @__PURE__ */ (0,
|
|
6988
|
-
error ? /* @__PURE__ */ (0,
|
|
6989
|
-
!loading && !error ? /* @__PURE__ */ (0,
|
|
6990
|
-
/* @__PURE__ */ (0,
|
|
6991
|
-
/* @__PURE__ */ (0,
|
|
6992
|
-
/* @__PURE__ */ (0,
|
|
6993
|
-
/* @__PURE__ */ (0,
|
|
6994
|
-
/* @__PURE__ */ (0,
|
|
7813
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
7814
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "orion-admin-error", children: error }) : null,
|
|
7815
|
+
!loading && !error ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-forms-dashboard", children: [
|
|
7816
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-forms-summary-grid", children: [
|
|
7817
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("article", { className: "orion-admin-overview-stat", children: [
|
|
7818
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-overview-stat-label", children: "Configured forms" }),
|
|
7819
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { children: forms.length }),
|
|
7820
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { children: "Published or draft forms currently available inside the CMS." })
|
|
6995
7821
|
] }),
|
|
6996
|
-
/* @__PURE__ */ (0,
|
|
6997
|
-
/* @__PURE__ */ (0,
|
|
6998
|
-
/* @__PURE__ */ (0,
|
|
6999
|
-
/* @__PURE__ */ (0,
|
|
7822
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("article", { className: "orion-admin-overview-stat", children: [
|
|
7823
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-overview-stat-label", children: "Recent submissions" }),
|
|
7824
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { children: submissions.length }),
|
|
7825
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { children: "Latest 200 responses collected across every form." })
|
|
7000
7826
|
] }),
|
|
7001
|
-
/* @__PURE__ */ (0,
|
|
7002
|
-
/* @__PURE__ */ (0,
|
|
7003
|
-
/* @__PURE__ */ (0,
|
|
7004
|
-
/* @__PURE__ */ (0,
|
|
7827
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("article", { className: "orion-admin-overview-stat", children: [
|
|
7828
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-overview-stat-label", children: "Most active form" }),
|
|
7829
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { children: busiestForm && busiestForm.count > 0 ? busiestForm.title : "No activity yet" }),
|
|
7830
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("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." })
|
|
7005
7831
|
] })
|
|
7006
7832
|
] }),
|
|
7007
|
-
forms.length === 0 ? /* @__PURE__ */ (0,
|
|
7008
|
-
/* @__PURE__ */ (0,
|
|
7009
|
-
/* @__PURE__ */ (0,
|
|
7010
|
-
] }) : /* @__PURE__ */ (0,
|
|
7833
|
+
forms.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-card", children: [
|
|
7834
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { children: "No forms found" }),
|
|
7835
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Create a form in Payload to start collecting responses." })
|
|
7836
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "orion-admin-forms-board-list", children: forms.map((form) => {
|
|
7011
7837
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
7012
7838
|
if (!id) return null;
|
|
7013
7839
|
const title = typeof form.title === "string" && form.title.trim().length > 0 ? form.title : "Untitled Form";
|
|
@@ -7022,31 +7848,31 @@ function AdminStudioFormsView(props) {
|
|
|
7022
7848
|
const updatedMeta = form.updatedAt ? `Updated ${formatDate(form.updatedAt)}` : "Update time unavailable";
|
|
7023
7849
|
const toneStyle = getFormToneStyle(slug, title || id);
|
|
7024
7850
|
const isResponsePanelScrollable = formSubmissions.length > RESPONSE_SCROLL_THRESHOLD;
|
|
7025
|
-
return /* @__PURE__ */ (0,
|
|
7026
|
-
/* @__PURE__ */ (0,
|
|
7027
|
-
/* @__PURE__ */ (0,
|
|
7028
|
-
/* @__PURE__ */ (0,
|
|
7029
|
-
/* @__PURE__ */ (0,
|
|
7030
|
-
/* @__PURE__ */ (0,
|
|
7851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("section", { className: "orion-admin-form-board", style: toneStyle, children: [
|
|
7852
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-board-header", children: [
|
|
7853
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-board-heading", children: [
|
|
7854
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-board-kicker-row", children: [
|
|
7855
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-board-kicker", children: slug || "No slug set" }),
|
|
7856
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-board-meta", children: updatedMeta })
|
|
7031
7857
|
] }),
|
|
7032
|
-
/* @__PURE__ */ (0,
|
|
7033
|
-
/* @__PURE__ */ (0,
|
|
7034
|
-
/* @__PURE__ */ (0,
|
|
7035
|
-
/* @__PURE__ */ (0,
|
|
7036
|
-
/* @__PURE__ */ (0,
|
|
7858
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-board-title-row", children: [
|
|
7859
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "orion-admin-form-board-mark", children: getInitials2(title, slug) }),
|
|
7860
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-board-copy", children: [
|
|
7861
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h2", { className: "orion-admin-form-board-title", children: title }),
|
|
7862
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "orion-admin-form-board-subtitle", children: latestResponse ? `Latest response ${latestResponseLabel}` : "Awaiting the first submission" })
|
|
7037
7863
|
] })
|
|
7038
7864
|
] })
|
|
7039
7865
|
] }),
|
|
7040
|
-
/* @__PURE__ */ (0,
|
|
7041
|
-
/* @__PURE__ */ (0,
|
|
7042
|
-
/* @__PURE__ */ (0,
|
|
7043
|
-
/* @__PURE__ */ (0,
|
|
7866
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-board-actions", children: [
|
|
7867
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-board-count", children: [
|
|
7868
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-board-count-value", children: formSubmissions.length }),
|
|
7869
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "orion-admin-form-board-count-label", children: [
|
|
7044
7870
|
"response",
|
|
7045
7871
|
formSubmissions.length === 1 ? "" : "s"
|
|
7046
7872
|
] })
|
|
7047
7873
|
] }),
|
|
7048
|
-
/* @__PURE__ */ (0,
|
|
7049
|
-
|
|
7874
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7875
|
+
import_link3.default,
|
|
7050
7876
|
{
|
|
7051
7877
|
className: "orion-admin-action-button orion-admin-action-button--soft",
|
|
7052
7878
|
href: `${rawFormsPath}/${id}`,
|
|
@@ -7055,35 +7881,35 @@ function AdminStudioFormsView(props) {
|
|
|
7055
7881
|
)
|
|
7056
7882
|
] })
|
|
7057
7883
|
] }),
|
|
7058
|
-
/* @__PURE__ */ (0,
|
|
7059
|
-
/* @__PURE__ */ (0,
|
|
7060
|
-
/* @__PURE__ */ (0,
|
|
7061
|
-
/* @__PURE__ */ (0,
|
|
7884
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-board-metrics", children: [
|
|
7885
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("article", { className: "orion-admin-form-metric", children: [
|
|
7886
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-metric-label", children: "Workflow steps" }),
|
|
7887
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { className: "orion-admin-form-metric-value", children: stepCount })
|
|
7062
7888
|
] }),
|
|
7063
|
-
/* @__PURE__ */ (0,
|
|
7064
|
-
/* @__PURE__ */ (0,
|
|
7065
|
-
/* @__PURE__ */ (0,
|
|
7889
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("article", { className: "orion-admin-form-metric", children: [
|
|
7890
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-metric-label", children: "Fields" }),
|
|
7891
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { className: "orion-admin-form-metric-value", children: fieldCount })
|
|
7066
7892
|
] }),
|
|
7067
|
-
/* @__PURE__ */ (0,
|
|
7068
|
-
/* @__PURE__ */ (0,
|
|
7069
|
-
/* @__PURE__ */ (0,
|
|
7893
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("article", { className: "orion-admin-form-metric", children: [
|
|
7894
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-metric-label", children: "Submit button" }),
|
|
7895
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { className: "orion-admin-form-metric-value is-copy", children: submitLabel })
|
|
7070
7896
|
] }),
|
|
7071
|
-
/* @__PURE__ */ (0,
|
|
7072
|
-
/* @__PURE__ */ (0,
|
|
7073
|
-
/* @__PURE__ */ (0,
|
|
7897
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("article", { className: "orion-admin-form-metric", children: [
|
|
7898
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-metric-label", children: "Latest response" }),
|
|
7899
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { className: "orion-admin-form-metric-value is-copy", children: latestResponseLabel })
|
|
7074
7900
|
] })
|
|
7075
7901
|
] }),
|
|
7076
|
-
/* @__PURE__ */ (0,
|
|
7077
|
-
/* @__PURE__ */ (0,
|
|
7078
|
-
/* @__PURE__ */ (0,
|
|
7079
|
-
/* @__PURE__ */ (0,
|
|
7080
|
-
/* @__PURE__ */ (0,
|
|
7902
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-response-panel", children: [
|
|
7903
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-form-response-panel-header", children: [
|
|
7904
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
7905
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-section-label", children: "Response stream" }),
|
|
7906
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { children: formSubmissions.length > 0 ? `${formSubmissions.length} recent submission${formSubmissions.length === 1 ? "" : "s"}` : "No responses yet" })
|
|
7081
7907
|
] }),
|
|
7082
|
-
isResponsePanelScrollable ? /* @__PURE__ */ (0,
|
|
7908
|
+
isResponsePanelScrollable ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-panel-note", children: "Latest 3 visible. Scroll for older responses." }) : formSubmissions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-form-panel-note", children: "Showing all recent activity" }) : null
|
|
7083
7909
|
] }),
|
|
7084
7910
|
formSubmissions.length === 0 ? renderEmptyMessage(
|
|
7085
7911
|
"This form will start filling this lane as soon as the first submission arrives."
|
|
7086
|
-
) : /* @__PURE__ */ (0,
|
|
7912
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7087
7913
|
"div",
|
|
7088
7914
|
{
|
|
7089
7915
|
className: [
|
|
@@ -7107,33 +7933,33 @@ function AdminStudioFormsView(props) {
|
|
|
7107
7933
|
);
|
|
7108
7934
|
const visibleUploads = uploads.slice(0, 2);
|
|
7109
7935
|
const hiddenUploadCount = uploads.length - visibleUploads.length;
|
|
7110
|
-
return /* @__PURE__ */ (0,
|
|
7936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
7111
7937
|
"article",
|
|
7112
7938
|
{
|
|
7113
7939
|
className: "orion-admin-response-card",
|
|
7114
7940
|
children: [
|
|
7115
|
-
/* @__PURE__ */ (0,
|
|
7116
|
-
/* @__PURE__ */ (0,
|
|
7117
|
-
/* @__PURE__ */ (0,
|
|
7118
|
-
/* @__PURE__ */ (0,
|
|
7119
|
-
/* @__PURE__ */ (0,
|
|
7120
|
-
/* @__PURE__ */ (0,
|
|
7941
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-response-card-main", children: [
|
|
7942
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-response-card-top", children: [
|
|
7943
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "orion-admin-response-badge", children: getInitials2(identity.name, identity.email, title) }),
|
|
7944
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-response-heading", children: [
|
|
7945
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { children: primaryIdentity }),
|
|
7946
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "orion-admin-response-secondary", children: secondaryIdentity })
|
|
7121
7947
|
] }),
|
|
7122
|
-
/* @__PURE__ */ (0,
|
|
7948
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "orion-admin-response-date", children: formatDate(submission.submittedAt) })
|
|
7123
7949
|
] }),
|
|
7124
|
-
previewFields.length > 0 ? /* @__PURE__ */ (0,
|
|
7950
|
+
previewFields.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "orion-admin-response-chip-row", children: previewFields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
7125
7951
|
"div",
|
|
7126
7952
|
{
|
|
7127
7953
|
className: "orion-admin-response-chip",
|
|
7128
7954
|
children: [
|
|
7129
|
-
/* @__PURE__ */ (0,
|
|
7130
|
-
/* @__PURE__ */ (0,
|
|
7955
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-response-chip-label", children: field.label }),
|
|
7956
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-response-chip-value", children: field.value })
|
|
7131
7957
|
]
|
|
7132
7958
|
},
|
|
7133
7959
|
`${submissionID}-${field.label}-${index}`
|
|
7134
|
-
)) }) : /* @__PURE__ */ (0,
|
|
7135
|
-
uploads.length > 0 ? /* @__PURE__ */ (0,
|
|
7136
|
-
/* @__PURE__ */ (0,
|
|
7960
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "orion-admin-response-empty", children: "No preview fields are available for this submission." }),
|
|
7961
|
+
uploads.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "orion-admin-response-upload-row", children: [
|
|
7962
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "orion-admin-upload-label", children: "Uploads" }),
|
|
7137
7963
|
visibleUploads.map((upload) => {
|
|
7138
7964
|
const uploadID = typeof upload.id === "string" || typeof upload.id === "number" ? String(upload.id) : "";
|
|
7139
7965
|
if (!uploadID) return null;
|
|
@@ -7147,8 +7973,8 @@ function AdminStudioFormsView(props) {
|
|
|
7147
7973
|
),
|
|
7148
7974
|
38
|
|
7149
7975
|
);
|
|
7150
|
-
return /* @__PURE__ */ (0,
|
|
7151
|
-
|
|
7976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7977
|
+
import_link3.default,
|
|
7152
7978
|
{
|
|
7153
7979
|
className: "orion-admin-upload-chip",
|
|
7154
7980
|
href: `${rawUploadsPath}/${uploadID}`,
|
|
@@ -7157,15 +7983,15 @@ function AdminStudioFormsView(props) {
|
|
|
7157
7983
|
uploadID
|
|
7158
7984
|
);
|
|
7159
7985
|
}),
|
|
7160
|
-
hiddenUploadCount > 0 ? /* @__PURE__ */ (0,
|
|
7986
|
+
hiddenUploadCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "orion-admin-upload-chip is-passive", children: [
|
|
7161
7987
|
"+",
|
|
7162
7988
|
hiddenUploadCount,
|
|
7163
7989
|
" more"
|
|
7164
7990
|
] }) : null
|
|
7165
7991
|
] }) : null
|
|
7166
7992
|
] }),
|
|
7167
|
-
/* @__PURE__ */ (0,
|
|
7168
|
-
|
|
7993
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7994
|
+
import_link3.default,
|
|
7169
7995
|
{
|
|
7170
7996
|
className: "orion-admin-action-button orion-admin-action-button--ghost",
|
|
7171
7997
|
href: `${rawSubmissionsPath}/${submissionID}`,
|
|
@@ -7189,9 +8015,9 @@ function AdminStudioFormsView(props) {
|
|
|
7189
8015
|
}
|
|
7190
8016
|
|
|
7191
8017
|
// src/admin/components/studio/AdminStudioToolsView.tsx
|
|
7192
|
-
var
|
|
8018
|
+
var import_react32 = require("react");
|
|
7193
8019
|
var import_ui12 = require("@payloadcms/ui");
|
|
7194
|
-
var
|
|
8020
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7195
8021
|
var userRoles = ["admin", "client", "editor"];
|
|
7196
8022
|
var isAdmin4 = (user) => {
|
|
7197
8023
|
if (!user || typeof user !== "object") return false;
|
|
@@ -7202,14 +8028,14 @@ var normalizeRole = (value) => userRoles.includes(value) ? value : "editor";
|
|
|
7202
8028
|
function AdminStudioToolsView(props) {
|
|
7203
8029
|
const { user } = (0, import_ui12.useAuth)();
|
|
7204
8030
|
const adminBasePath = useAdminBasePath();
|
|
7205
|
-
const [docs, setDocs] = (0,
|
|
7206
|
-
const [loading, setLoading] = (0,
|
|
7207
|
-
const [error, setError] = (0,
|
|
7208
|
-
const [savedMessage, setSavedMessage] = (0,
|
|
7209
|
-
const [createSubmitting, setCreateSubmitting] = (0,
|
|
7210
|
-
const [updatingUserID, setUpdatingUserID] = (0,
|
|
8031
|
+
const [docs, setDocs] = (0, import_react32.useState)([]);
|
|
8032
|
+
const [loading, setLoading] = (0, import_react32.useState)(true);
|
|
8033
|
+
const [error, setError] = (0, import_react32.useState)(null);
|
|
8034
|
+
const [savedMessage, setSavedMessage] = (0, import_react32.useState)(null);
|
|
8035
|
+
const [createSubmitting, setCreateSubmitting] = (0, import_react32.useState)(false);
|
|
8036
|
+
const [updatingUserID, setUpdatingUserID] = (0, import_react32.useState)(null);
|
|
7211
8037
|
if (!isAdmin4(user)) {
|
|
7212
|
-
return /* @__PURE__ */ (0,
|
|
8038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7213
8039
|
AdminPage,
|
|
7214
8040
|
{
|
|
7215
8041
|
breadcrumbs: [
|
|
@@ -7218,9 +8044,9 @@ function AdminStudioToolsView(props) {
|
|
|
7218
8044
|
],
|
|
7219
8045
|
description: "You do not have access to this section.",
|
|
7220
8046
|
title: "Admin Tools",
|
|
7221
|
-
children: /* @__PURE__ */ (0,
|
|
7222
|
-
/* @__PURE__ */ (0,
|
|
7223
|
-
/* @__PURE__ */ (0,
|
|
8047
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "orion-admin-card", children: [
|
|
8048
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("strong", { children: "Access denied" }),
|
|
8049
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "This section is restricted to administrator accounts." })
|
|
7224
8050
|
] })
|
|
7225
8051
|
}
|
|
7226
8052
|
) });
|
|
@@ -7249,7 +8075,7 @@ function AdminStudioToolsView(props) {
|
|
|
7249
8075
|
setLoading(false);
|
|
7250
8076
|
}
|
|
7251
8077
|
};
|
|
7252
|
-
(0,
|
|
8078
|
+
(0, import_react32.useEffect)(() => {
|
|
7253
8079
|
void loadUsers();
|
|
7254
8080
|
}, []);
|
|
7255
8081
|
const createUser = async (event) => {
|
|
@@ -7320,7 +8146,7 @@ function AdminStudioToolsView(props) {
|
|
|
7320
8146
|
setUpdatingUserID(null);
|
|
7321
8147
|
}
|
|
7322
8148
|
};
|
|
7323
|
-
return /* @__PURE__ */ (0,
|
|
8149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
7324
8150
|
AdminPage,
|
|
7325
8151
|
{
|
|
7326
8152
|
breadcrumbs: [
|
|
@@ -7330,53 +8156,53 @@ function AdminStudioToolsView(props) {
|
|
|
7330
8156
|
description: "Manage users and fallback links to Payload native admin.",
|
|
7331
8157
|
title: "Admin Tools",
|
|
7332
8158
|
children: [
|
|
7333
|
-
/* @__PURE__ */ (0,
|
|
7334
|
-
error ? /* @__PURE__ */ (0,
|
|
7335
|
-
savedMessage ? /* @__PURE__ */ (0,
|
|
7336
|
-
/* @__PURE__ */ (0,
|
|
7337
|
-
/* @__PURE__ */ (0,
|
|
7338
|
-
/* @__PURE__ */ (0,
|
|
8159
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "orion-admin-inline-actions", style: { marginBottom: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("a", { className: "orion-admin-action-button", href: "/admin-core", target: "_blank", children: "Open Payload Core Admin" }) }),
|
|
8160
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "orion-admin-error", style: { marginBottom: "1rem" }, children: error }) : null,
|
|
8161
|
+
savedMessage ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "orion-admin-success", style: { marginBottom: "1rem" }, children: savedMessage }) : null,
|
|
8162
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("form", { className: "orion-admin-form", onSubmit: createUser, style: { marginBottom: "1rem" }, children: [
|
|
8163
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("strong", { children: "Create User" }),
|
|
8164
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { children: [
|
|
7339
8165
|
"Email",
|
|
7340
|
-
/* @__PURE__ */ (0,
|
|
8166
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { name: "email", required: true, type: "email" })
|
|
7341
8167
|
] }),
|
|
7342
|
-
/* @__PURE__ */ (0,
|
|
8168
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { children: [
|
|
7343
8169
|
"Full Name",
|
|
7344
|
-
/* @__PURE__ */ (0,
|
|
8170
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { name: "fullName", type: "text" })
|
|
7345
8171
|
] }),
|
|
7346
|
-
/* @__PURE__ */ (0,
|
|
8172
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { children: [
|
|
7347
8173
|
"Password",
|
|
7348
|
-
/* @__PURE__ */ (0,
|
|
8174
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { name: "password", required: true, type: "password" })
|
|
7349
8175
|
] }),
|
|
7350
|
-
/* @__PURE__ */ (0,
|
|
8176
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { children: [
|
|
7351
8177
|
"Role",
|
|
7352
|
-
/* @__PURE__ */ (0,
|
|
7353
|
-
/* @__PURE__ */ (0,
|
|
7354
|
-
/* @__PURE__ */ (0,
|
|
7355
|
-
/* @__PURE__ */ (0,
|
|
8178
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("select", { defaultValue: "editor", name: "role", children: [
|
|
8179
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("option", { value: "admin", children: "admin" }),
|
|
8180
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("option", { value: "editor", children: "editor" }),
|
|
8181
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("option", { value: "client", children: "client" })
|
|
7356
8182
|
] })
|
|
7357
8183
|
] }),
|
|
7358
|
-
/* @__PURE__ */ (0,
|
|
8184
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { disabled: createSubmitting, type: "submit", children: createSubmitting ? "Creating..." : "Create User" })
|
|
7359
8185
|
] }),
|
|
7360
|
-
loading ? /* @__PURE__ */ (0,
|
|
7361
|
-
/* @__PURE__ */ (0,
|
|
8186
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
8187
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "orion-admin-list", children: docs.map((doc) => {
|
|
7362
8188
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
7363
8189
|
if (!id) return null;
|
|
7364
8190
|
const email = typeof doc.email === "string" ? doc.email : `user-${id}`;
|
|
7365
8191
|
const fullName = typeof doc.fullName === "string" ? doc.fullName : "";
|
|
7366
8192
|
const currentRole = typeof doc.role === "string" ? normalizeRole(doc.role) : "editor";
|
|
7367
|
-
return /* @__PURE__ */ (0,
|
|
7368
|
-
/* @__PURE__ */ (0,
|
|
7369
|
-
/* @__PURE__ */ (0,
|
|
7370
|
-
/* @__PURE__ */ (0,
|
|
8193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "orion-admin-list-item", children: [
|
|
8194
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
8195
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("strong", { children: email }),
|
|
8196
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "orion-admin-list-meta", children: fullName || "No full name set" })
|
|
7371
8197
|
] }),
|
|
7372
|
-
/* @__PURE__ */ (0,
|
|
7373
|
-
/* @__PURE__ */ (0,
|
|
7374
|
-
/* @__PURE__ */ (0,
|
|
7375
|
-
/* @__PURE__ */ (0,
|
|
7376
|
-
/* @__PURE__ */ (0,
|
|
7377
|
-
/* @__PURE__ */ (0,
|
|
8198
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("form", { className: "orion-admin-inline-actions", onSubmit: updateUserRole, children: [
|
|
8199
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { name: "id", type: "hidden", value: id }),
|
|
8200
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("select", { defaultValue: currentRole, name: "role", children: [
|
|
8201
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("option", { value: "admin", children: "admin" }),
|
|
8202
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("option", { value: "editor", children: "editor" }),
|
|
8203
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("option", { value: "client", children: "client" })
|
|
7378
8204
|
] }),
|
|
7379
|
-
/* @__PURE__ */ (0,
|
|
8205
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { disabled: updatingUserID === id, type: "submit", children: updatingUserID === id ? "Updating..." : "Update" })
|
|
7380
8206
|
] })
|
|
7381
8207
|
] }, id);
|
|
7382
8208
|
}) })
|
|
@@ -7387,14 +8213,14 @@ function AdminStudioToolsView(props) {
|
|
|
7387
8213
|
|
|
7388
8214
|
// src/admin/components/studio/OpenInStudioMenuItem.tsx
|
|
7389
8215
|
var import_ui13 = require("@payloadcms/ui");
|
|
7390
|
-
var
|
|
8216
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7391
8217
|
function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
7392
8218
|
const documentInfo = (0, import_ui13.useDocumentInfo)();
|
|
7393
8219
|
const id = documentInfo?.id;
|
|
7394
8220
|
if (!id) {
|
|
7395
8221
|
return null;
|
|
7396
8222
|
}
|
|
7397
|
-
return /* @__PURE__ */ (0,
|
|
8223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7398
8224
|
"a",
|
|
7399
8225
|
{
|
|
7400
8226
|
href: `${pagesPathBase}/${id}`,
|
|
@@ -7413,19 +8239,19 @@ function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
|
7413
8239
|
}
|
|
7414
8240
|
|
|
7415
8241
|
// src/admin/components/studio/PageEditRedirectToStudio.tsx
|
|
7416
|
-
var
|
|
8242
|
+
var import_react33 = require("react");
|
|
7417
8243
|
var import_ui14 = require("@payloadcms/ui");
|
|
7418
|
-
var
|
|
8244
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7419
8245
|
function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
7420
8246
|
const documentInfo = (0, import_ui14.useDocumentInfo)();
|
|
7421
8247
|
const id = documentInfo?.id;
|
|
7422
|
-
(0,
|
|
8248
|
+
(0, import_react33.useEffect)(() => {
|
|
7423
8249
|
if (!id) {
|
|
7424
8250
|
return;
|
|
7425
8251
|
}
|
|
7426
8252
|
window.location.replace(`${pagesPathBase}/${id}`);
|
|
7427
8253
|
}, [id, pagesPathBase]);
|
|
7428
|
-
return /* @__PURE__ */ (0,
|
|
8254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
7429
8255
|
"div",
|
|
7430
8256
|
{
|
|
7431
8257
|
style: {
|
|
@@ -7437,18 +8263,18 @@ function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
|
7437
8263
|
minHeight: "50vh"
|
|
7438
8264
|
},
|
|
7439
8265
|
children: [
|
|
7440
|
-
/* @__PURE__ */ (0,
|
|
7441
|
-
/* @__PURE__ */ (0,
|
|
7442
|
-
id ? /* @__PURE__ */ (0,
|
|
8266
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
|
|
8267
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
|
|
8268
|
+
id ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("a", { href: `${pagesPathBase}/${id}`, children: "Continue to Editor" }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("a", { href: pagesPathBase, children: "Open Pages" })
|
|
7443
8269
|
]
|
|
7444
8270
|
}
|
|
7445
8271
|
);
|
|
7446
8272
|
}
|
|
7447
8273
|
|
|
7448
8274
|
// src/admin/components/studio/StudioBackBreadcrumb.tsx
|
|
7449
|
-
var
|
|
8275
|
+
var import_react34 = require("react");
|
|
7450
8276
|
var import_ui15 = require("@payloadcms/ui");
|
|
7451
|
-
var
|
|
8277
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7452
8278
|
var toTitle = (slug) => slug.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
7453
8279
|
var buildNav = (pathname, adminBasePath) => {
|
|
7454
8280
|
if (pathname.includes("/globals/")) {
|
|
@@ -7493,8 +8319,8 @@ var buildNav = (pathname, adminBasePath) => {
|
|
|
7493
8319
|
};
|
|
7494
8320
|
function StudioBackBreadcrumb() {
|
|
7495
8321
|
const adminBasePath = useAdminBasePath();
|
|
7496
|
-
const [pathname, setPathname] = (0,
|
|
7497
|
-
(0,
|
|
8322
|
+
const [pathname, setPathname] = (0, import_react34.useState)("");
|
|
8323
|
+
(0, import_react34.useEffect)(() => {
|
|
7498
8324
|
const update = () => setPathname(window.location.pathname);
|
|
7499
8325
|
update();
|
|
7500
8326
|
window.addEventListener("popstate", update);
|
|
@@ -7502,13 +8328,13 @@ function StudioBackBreadcrumb() {
|
|
|
7502
8328
|
}, []);
|
|
7503
8329
|
const nav = buildNav(pathname, adminBasePath);
|
|
7504
8330
|
if (!nav) return null;
|
|
7505
|
-
return /* @__PURE__ */ (0,
|
|
8331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_ui15.SetStepNav, { nav });
|
|
7506
8332
|
}
|
|
7507
8333
|
|
|
7508
8334
|
// src/admin/components/studio/StudioContactFormRedirect.tsx
|
|
7509
|
-
var
|
|
7510
|
-
var
|
|
7511
|
-
var
|
|
8335
|
+
var import_react35 = require("react");
|
|
8336
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
8337
|
+
var getPropString14 = (props, key, fallback) => {
|
|
7512
8338
|
if (!props || typeof props !== "object") return fallback;
|
|
7513
8339
|
const direct = props[key];
|
|
7514
8340
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -7521,13 +8347,13 @@ var getPropString13 = (props, key, fallback) => {
|
|
|
7521
8347
|
};
|
|
7522
8348
|
function StudioContactFormRedirect(props) {
|
|
7523
8349
|
const adminBasePath = useAdminBasePath();
|
|
7524
|
-
const studioContactFormPath =
|
|
8350
|
+
const studioContactFormPath = getPropString14(props, "studioContactFormPath", "/contact-form");
|
|
7525
8351
|
const targetPath = resolveAdminPath(adminBasePath, studioContactFormPath);
|
|
7526
|
-
(0,
|
|
8352
|
+
(0, import_react35.useEffect)(() => {
|
|
7527
8353
|
if (window.location.pathname === targetPath) return;
|
|
7528
8354
|
window.location.replace(targetPath);
|
|
7529
8355
|
}, [targetPath]);
|
|
7530
|
-
return /* @__PURE__ */ (0,
|
|
8356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
7531
8357
|
"div",
|
|
7532
8358
|
{
|
|
7533
8359
|
style: {
|
|
@@ -7540,8 +8366,8 @@ function StudioContactFormRedirect(props) {
|
|
|
7540
8366
|
minHeight: "40vh"
|
|
7541
8367
|
},
|
|
7542
8368
|
children: [
|
|
7543
|
-
/* @__PURE__ */ (0,
|
|
7544
|
-
/* @__PURE__ */ (0,
|
|
8369
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { style: { margin: 0 }, children: "Opening Contact Form Editor..." }),
|
|
8370
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("a", { href: targetPath, children: "Continue" })
|
|
7545
8371
|
]
|
|
7546
8372
|
}
|
|
7547
8373
|
);
|
|
@@ -7551,6 +8377,7 @@ function StudioContactFormRedirect(props) {
|
|
|
7551
8377
|
AdminLoginIntro,
|
|
7552
8378
|
AdminLoginPasswordToggle,
|
|
7553
8379
|
AdminStudioContactFormView,
|
|
8380
|
+
AdminStudioDashboard,
|
|
7554
8381
|
AdminStudioFooterGlobalView,
|
|
7555
8382
|
AdminStudioFormsView,
|
|
7556
8383
|
AdminStudioGlobalsView,
|