@orion-studios/payload-studio 0.6.0-beta.6 → 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 -1413
- 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 -1429
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-NTXOLLDC.mjs +0 -2280
- package/dist/chunk-Z6L5K5MH.mjs +0 -64
package/dist/admin/index.js
CHANGED
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/admin/index.ts
|
|
31
31
|
var admin_exports = {};
|
|
32
32
|
__export(admin_exports, {
|
|
33
|
-
AdminStudioDashboard: () => AdminStudioDashboard,
|
|
34
33
|
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: () => SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
35
34
|
SOCIAL_MEDIA_ICON_OPTIONS: () => SOCIAL_MEDIA_ICON_OPTIONS,
|
|
36
35
|
SOCIAL_MEDIA_PLATFORMS: () => SOCIAL_MEDIA_PLATFORMS,
|
|
@@ -80,26 +79,10 @@ var adminNavIcons = [
|
|
|
80
79
|
"account",
|
|
81
80
|
"analytics"
|
|
82
81
|
];
|
|
83
|
-
var roleCanAccessNav = (role, item) => {
|
|
84
|
-
if (!item.roles || item.roles.length === 0) {
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
if (!role) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
return item.roles.includes(role);
|
|
91
|
-
};
|
|
92
|
-
var navItemIsActive = (pathname, item) => {
|
|
93
|
-
if (item.href === "/admin") {
|
|
94
|
-
return pathname === "/admin";
|
|
95
|
-
}
|
|
96
|
-
return item.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
97
|
-
};
|
|
98
82
|
|
|
99
83
|
// src/shared/studioSections.ts
|
|
100
84
|
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
101
85
|
var studioIcons = new Set(adminNavIcons);
|
|
102
|
-
var dashboardSpans = /* @__PURE__ */ new Set(["full", "half"]);
|
|
103
86
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
104
87
|
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
105
88
|
var normalizePathLikeValue = (value) => {
|
|
@@ -141,22 +124,6 @@ var normalizeCard = (value) => {
|
|
|
141
124
|
};
|
|
142
125
|
};
|
|
143
126
|
var normalizeIcon = (value) => typeof value === "string" && studioIcons.has(value) ? value : void 0;
|
|
144
|
-
var normalizeComponent = (value) => {
|
|
145
|
-
if (!isRecord(value)) {
|
|
146
|
-
return void 0;
|
|
147
|
-
}
|
|
148
|
-
const componentPath = typeof value.path === "string" ? value.path.trim() : "";
|
|
149
|
-
const exportName = typeof value.exportName === "string" ? value.exportName.trim() : "";
|
|
150
|
-
if (!componentPath || !exportName) {
|
|
151
|
-
return void 0;
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
exportName,
|
|
155
|
-
path: componentPath,
|
|
156
|
-
...isRecord(value.clientProps) ? { clientProps: value.clientProps } : {}
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
var normalizeDashboardSpan = (value) => typeof value === "string" && dashboardSpans.has(value) ? value : "half";
|
|
160
127
|
var resolveStudioSections = (value) => {
|
|
161
128
|
if (!Array.isArray(value)) {
|
|
162
129
|
return [];
|
|
@@ -222,38 +189,6 @@ var resolveStudioSectionViews = (value) => {
|
|
|
222
189
|
}
|
|
223
190
|
return views;
|
|
224
191
|
};
|
|
225
|
-
var resolveStudioSectionDashboards = (value) => {
|
|
226
|
-
if (!Array.isArray(value)) {
|
|
227
|
-
return [];
|
|
228
|
-
}
|
|
229
|
-
const panels = [];
|
|
230
|
-
const seen = /* @__PURE__ */ new Set();
|
|
231
|
-
for (const entry of value) {
|
|
232
|
-
if (!isRecord(entry) || typeof entry.id !== "string" || typeof entry.label !== "string") {
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
const id = entry.id.trim();
|
|
236
|
-
const label = entry.label.trim();
|
|
237
|
-
const dashboard = isRecord(entry.dashboard) ? entry.dashboard : null;
|
|
238
|
-
const component = dashboard ? normalizeComponent(dashboard.Component) : void 0;
|
|
239
|
-
const href = typeof entry.href === "string" && entry.href.trim().length > 0 ? normalizePathLikeValue(entry.href) : isRecord(entry.view) && typeof entry.view.path === "string" ? normalizePathLikeValue(entry.view.path) : "";
|
|
240
|
-
if (!id || !label || !dashboard || !component || !href || seen.has(id)) {
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
const priority = typeof dashboard.priority === "number" && Number.isFinite(dashboard.priority) ? dashboard.priority : 100;
|
|
244
|
-
panels.push({
|
|
245
|
-
Component: component,
|
|
246
|
-
href,
|
|
247
|
-
id,
|
|
248
|
-
label,
|
|
249
|
-
priority,
|
|
250
|
-
...normalizeRoles(dashboard.roles ?? entry.roles) ? { roles: normalizeRoles(dashboard.roles ?? entry.roles) } : {},
|
|
251
|
-
span: normalizeDashboardSpan(dashboard.span)
|
|
252
|
-
});
|
|
253
|
-
seen.add(id);
|
|
254
|
-
}
|
|
255
|
-
return panels.sort((a, b) => a.priority === b.priority ? a.label.localeCompare(b.label) : a.priority - b.priority);
|
|
256
|
-
};
|
|
257
192
|
|
|
258
193
|
// src/admin/helpers/configureAdmin.ts
|
|
259
194
|
var import_meta = {};
|
|
@@ -313,7 +248,6 @@ function configureAdmin(config) {
|
|
|
313
248
|
};
|
|
314
249
|
});
|
|
315
250
|
const studioSections = resolveStudioSections(config.studio?.sections || []);
|
|
316
|
-
const studioDashboardPanels = resolveStudioSectionDashboards(config.studio?.sections || []);
|
|
317
251
|
const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
|
|
318
252
|
const sitePreview = config.studio?.sitePreview;
|
|
319
253
|
let cssPath;
|
|
@@ -343,7 +277,6 @@ function configureAdmin(config) {
|
|
|
343
277
|
cssPath = genPath;
|
|
344
278
|
}
|
|
345
279
|
const clientPath = "@orion-studios/payload-studio/admin/client";
|
|
346
|
-
const adminPath = "@orion-studios/payload-studio/admin";
|
|
347
280
|
const studioNavClientProps = {
|
|
348
281
|
brandName,
|
|
349
282
|
formSubmissionsCollectionSlug,
|
|
@@ -355,14 +288,8 @@ function configureAdmin(config) {
|
|
|
355
288
|
logoUrl,
|
|
356
289
|
mediaCollectionSlug,
|
|
357
290
|
pagesCollectionSlug,
|
|
358
|
-
dashboardPanels: studioDashboardPanels,
|
|
359
291
|
sections: studioSections
|
|
360
292
|
};
|
|
361
|
-
const dashboardImportMapGenerator = studioDashboardPanels.length > 0 ? ({ addToImportMap }) => {
|
|
362
|
-
addToImportMap(
|
|
363
|
-
studioDashboardPanels.map((panel) => panel.Component)
|
|
364
|
-
);
|
|
365
|
-
} : void 0;
|
|
366
293
|
const studioBackBreadcrumbComponent = {
|
|
367
294
|
exportName: "StudioBackBreadcrumb",
|
|
368
295
|
path: clientPath
|
|
@@ -397,11 +324,6 @@ function configureAdmin(config) {
|
|
|
397
324
|
return {
|
|
398
325
|
admin: {
|
|
399
326
|
css: cssPath,
|
|
400
|
-
...dashboardImportMapGenerator ? {
|
|
401
|
-
importMap: {
|
|
402
|
-
generators: [dashboardImportMapGenerator]
|
|
403
|
-
}
|
|
404
|
-
} : {},
|
|
405
327
|
components: {
|
|
406
328
|
...studioEnabled ? {
|
|
407
329
|
Nav: {
|
|
@@ -432,7 +354,7 @@ function configureAdmin(config) {
|
|
|
432
354
|
dashboard: {
|
|
433
355
|
Component: {
|
|
434
356
|
exportName: studioEnabled ? "AdminStudioDashboard" : "Dashboard",
|
|
435
|
-
path:
|
|
357
|
+
path: clientPath,
|
|
436
358
|
clientProps: studioNavClientProps
|
|
437
359
|
}
|
|
438
360
|
},
|
|
@@ -828,1339 +750,6 @@ function configureAdmin(config) {
|
|
|
828
750
|
};
|
|
829
751
|
}
|
|
830
752
|
|
|
831
|
-
// src/admin-app/components/AdminBreadcrumbs.tsx
|
|
832
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
833
|
-
function AdminBreadcrumbs({ items }) {
|
|
834
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { "aria-label": "Breadcrumb", className: "orion-admin-breadcrumbs", children: items.map((item, index) => {
|
|
835
|
-
const isLast = index === items.length - 1;
|
|
836
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
837
|
-
item.href && !isLast ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: item.href, children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.label }),
|
|
838
|
-
!isLast ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "orion-admin-breadcrumb-sep", children: "/" }) : null
|
|
839
|
-
] }, `${item.label}-${index}`);
|
|
840
|
-
}) });
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
// src/admin-app/components/AdminPage.tsx
|
|
844
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
845
|
-
function AdminPage({ title, description, breadcrumbs, actions, children }) {
|
|
846
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "orion-admin-page", children: [
|
|
847
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "orion-admin-page-header", children: [
|
|
848
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AdminBreadcrumbs, { items: breadcrumbs }),
|
|
849
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "orion-admin-page-title-row", children: [
|
|
850
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
851
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { children: title }),
|
|
852
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: description }) : null
|
|
853
|
-
] }),
|
|
854
|
-
actions ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "orion-admin-page-actions", children: actions }) : null
|
|
855
|
-
] })
|
|
856
|
-
] }),
|
|
857
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "orion-admin-page-content", children })
|
|
858
|
-
] });
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
// src/admin/components/studio/AdminStudioDashboardClient.tsx
|
|
862
|
-
var import_react = require("react");
|
|
863
|
-
var import_link = __toESM(require("next/link"));
|
|
864
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
865
|
-
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
866
|
-
var isRole = (value) => value === "admin" || value === "editor" || value === "client";
|
|
867
|
-
var canReviewForms = (role) => role === "admin" || role === "editor";
|
|
868
|
-
var canCreatePages = (role) => role === "admin" || role === "editor";
|
|
869
|
-
var canAccess = (role, roles) => {
|
|
870
|
-
if (!roles || roles.length === 0) {
|
|
871
|
-
return true;
|
|
872
|
-
}
|
|
873
|
-
if (!role) {
|
|
874
|
-
return false;
|
|
875
|
-
}
|
|
876
|
-
return roles.includes(role);
|
|
877
|
-
};
|
|
878
|
-
var asText = (value, fallback) => typeof value === "string" && value.trim().length > 0 ? value.trim() : fallback;
|
|
879
|
-
var asID = (value) => {
|
|
880
|
-
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
881
|
-
return "";
|
|
882
|
-
};
|
|
883
|
-
var toTimestamp = (value) => {
|
|
884
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
885
|
-
return Number.NaN;
|
|
886
|
-
}
|
|
887
|
-
const timestamp = Date.parse(value);
|
|
888
|
-
return Number.isFinite(timestamp) ? timestamp : Number.NaN;
|
|
889
|
-
};
|
|
890
|
-
var isRecent = (value) => {
|
|
891
|
-
const timestamp = toTimestamp(value);
|
|
892
|
-
return Number.isFinite(timestamp) && Date.now() - timestamp <= SEVEN_DAYS_MS;
|
|
893
|
-
};
|
|
894
|
-
var formatDateTime = (value) => {
|
|
895
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
896
|
-
return "Unknown time";
|
|
897
|
-
}
|
|
898
|
-
const date = new Date(value);
|
|
899
|
-
if (Number.isNaN(date.getTime())) {
|
|
900
|
-
return value;
|
|
901
|
-
}
|
|
902
|
-
return new Intl.DateTimeFormat(void 0, {
|
|
903
|
-
dateStyle: "medium",
|
|
904
|
-
timeStyle: "short"
|
|
905
|
-
}).format(date);
|
|
906
|
-
};
|
|
907
|
-
var formatRelativeTime = (timestamp) => {
|
|
908
|
-
if (!Number.isFinite(timestamp)) {
|
|
909
|
-
return "Unknown time";
|
|
910
|
-
}
|
|
911
|
-
const diffMs = timestamp - Date.now();
|
|
912
|
-
const diffMinutes = Math.round(diffMs / (60 * 1e3));
|
|
913
|
-
const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
914
|
-
if (Math.abs(diffMinutes) < 60) {
|
|
915
|
-
return rtf.format(diffMinutes, "minute");
|
|
916
|
-
}
|
|
917
|
-
const diffHours = Math.round(diffMinutes / 60);
|
|
918
|
-
if (Math.abs(diffHours) < 24) {
|
|
919
|
-
return rtf.format(diffHours, "hour");
|
|
920
|
-
}
|
|
921
|
-
const diffDays = Math.round(diffHours / 24);
|
|
922
|
-
return rtf.format(diffDays, "day");
|
|
923
|
-
};
|
|
924
|
-
var readSubmissionIdentity = (value) => {
|
|
925
|
-
if (!value || typeof value !== "object") {
|
|
926
|
-
return "New submission";
|
|
927
|
-
}
|
|
928
|
-
const data = value;
|
|
929
|
-
const firstName = typeof data.firstName === "string" ? data.firstName.trim() : "";
|
|
930
|
-
const lastName = typeof data.lastName === "string" ? data.lastName.trim() : "";
|
|
931
|
-
const name = typeof data.name === "string" ? data.name.trim() : "";
|
|
932
|
-
const email = typeof data.email === "string" ? data.email.trim() : typeof data.contactEmail === "string" ? data.contactEmail.trim() : "";
|
|
933
|
-
const fullName = [firstName, lastName].filter(Boolean).join(" ").trim();
|
|
934
|
-
return fullName || name || email || "New submission";
|
|
935
|
-
};
|
|
936
|
-
var getFormID = (value) => {
|
|
937
|
-
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
938
|
-
if (value && typeof value === "object") {
|
|
939
|
-
const nestedID = value.id;
|
|
940
|
-
if (typeof nestedID === "string" || typeof nestedID === "number") return String(nestedID);
|
|
941
|
-
}
|
|
942
|
-
return "";
|
|
943
|
-
};
|
|
944
|
-
var getFormTitle = (value) => {
|
|
945
|
-
if (!value || typeof value !== "object") {
|
|
946
|
-
return "";
|
|
947
|
-
}
|
|
948
|
-
const title = value.title;
|
|
949
|
-
if (typeof title === "string" && title.trim().length > 0) {
|
|
950
|
-
return title.trim();
|
|
951
|
-
}
|
|
952
|
-
const slug = value.slug;
|
|
953
|
-
return typeof slug === "string" && slug.trim().length > 0 ? slug.trim() : "";
|
|
954
|
-
};
|
|
955
|
-
var buildSearchParams = (params) => new URLSearchParams(
|
|
956
|
-
Object.entries(params).filter(([, value]) => typeof value === "string" && value.length > 0)
|
|
957
|
-
).toString();
|
|
958
|
-
async function loadCollection(path2) {
|
|
959
|
-
const response = await fetch(path2, {
|
|
960
|
-
cache: "no-store",
|
|
961
|
-
credentials: "include"
|
|
962
|
-
});
|
|
963
|
-
if (!response.ok) {
|
|
964
|
-
const body = await response.text();
|
|
965
|
-
throw new Error(body || `Request failed: ${response.status}`);
|
|
966
|
-
}
|
|
967
|
-
return await response.json();
|
|
968
|
-
}
|
|
969
|
-
async function loadPages(collectionSlug) {
|
|
970
|
-
const params = buildSearchParams({
|
|
971
|
-
depth: "0",
|
|
972
|
-
draft: "true",
|
|
973
|
-
limit: "200",
|
|
974
|
-
sort: "-updatedAt"
|
|
975
|
-
});
|
|
976
|
-
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
977
|
-
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
978
|
-
return {
|
|
979
|
-
draftCount: docs.filter((doc) => doc._status === "draft").length,
|
|
980
|
-
recent: docs.slice(0, 8),
|
|
981
|
-
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
982
|
-
updatedThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
983
|
-
};
|
|
984
|
-
}
|
|
985
|
-
async function loadForms(formsCollectionSlug, submissionsCollectionSlug) {
|
|
986
|
-
const [formsResult, submissionsResult] = await Promise.all([
|
|
987
|
-
loadCollection(
|
|
988
|
-
`/api/${formsCollectionSlug}?${buildSearchParams({
|
|
989
|
-
depth: "0",
|
|
990
|
-
draft: "true",
|
|
991
|
-
limit: "80",
|
|
992
|
-
sort: "-updatedAt"
|
|
993
|
-
})}`
|
|
994
|
-
),
|
|
995
|
-
loadCollection(
|
|
996
|
-
`/api/${submissionsCollectionSlug}?${buildSearchParams({
|
|
997
|
-
depth: "1",
|
|
998
|
-
limit: "40",
|
|
999
|
-
sort: "-submittedAt"
|
|
1000
|
-
})}`
|
|
1001
|
-
)
|
|
1002
|
-
]);
|
|
1003
|
-
const forms = Array.isArray(formsResult.docs) ? formsResult.docs : [];
|
|
1004
|
-
const recentSubmissions = Array.isArray(submissionsResult.docs) ? submissionsResult.docs : [];
|
|
1005
|
-
const submissionsByForm = /* @__PURE__ */ new Map();
|
|
1006
|
-
for (const submission of recentSubmissions) {
|
|
1007
|
-
const formID = getFormID(submission.form);
|
|
1008
|
-
if (!formID) continue;
|
|
1009
|
-
submissionsByForm.set(formID, (submissionsByForm.get(formID) || 0) + 1);
|
|
1010
|
-
}
|
|
1011
|
-
let busiestFormTitle = null;
|
|
1012
|
-
let busiestFormCount = 0;
|
|
1013
|
-
for (const form of forms) {
|
|
1014
|
-
const formID = asID(form.id);
|
|
1015
|
-
if (!formID) continue;
|
|
1016
|
-
const submissionCount = submissionsByForm.get(formID) || 0;
|
|
1017
|
-
if (submissionCount > busiestFormCount) {
|
|
1018
|
-
busiestFormCount = submissionCount;
|
|
1019
|
-
busiestFormTitle = asText(form.title, "Untitled form");
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
return {
|
|
1023
|
-
busiestFormTitle,
|
|
1024
|
-
forms,
|
|
1025
|
-
recentSubmissions,
|
|
1026
|
-
submissionsThisWeek: recentSubmissions.filter((submission) => isRecent(submission.submittedAt)).length,
|
|
1027
|
-
totalForms: typeof formsResult.totalDocs === "number" ? formsResult.totalDocs : forms.length
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1030
|
-
async function loadMedia(collectionSlug) {
|
|
1031
|
-
const params = buildSearchParams({
|
|
1032
|
-
depth: "0",
|
|
1033
|
-
limit: "24",
|
|
1034
|
-
sort: "-updatedAt"
|
|
1035
|
-
});
|
|
1036
|
-
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
1037
|
-
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
1038
|
-
return {
|
|
1039
|
-
recent: docs.slice(0, 8),
|
|
1040
|
-
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
1041
|
-
uploadsThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
1042
|
-
};
|
|
1043
|
-
}
|
|
1044
|
-
var loadingState = {
|
|
1045
|
-
forms: null,
|
|
1046
|
-
media: { status: "loading" },
|
|
1047
|
-
pages: { status: "loading" }
|
|
1048
|
-
};
|
|
1049
|
-
function ModuleStatus({ message }) {
|
|
1050
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-dashboard-inline-note", children: message });
|
|
1051
|
-
}
|
|
1052
|
-
function EmptyState({
|
|
1053
|
-
body,
|
|
1054
|
-
title
|
|
1055
|
-
}) {
|
|
1056
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-empty-state", children: [
|
|
1057
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: title }),
|
|
1058
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: body })
|
|
1059
|
-
] });
|
|
1060
|
-
}
|
|
1061
|
-
function SnapshotMetric({ card }) {
|
|
1062
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "orion-dashboard-snapshot-card", children: [
|
|
1063
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "orion-dashboard-snapshot-kicker", children: card.kicker }),
|
|
1064
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: card.value }),
|
|
1065
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: card.detail })
|
|
1066
|
-
] });
|
|
1067
|
-
}
|
|
1068
|
-
function AdminStudioDashboardClient({
|
|
1069
|
-
formSubmissionsCollectionSlug,
|
|
1070
|
-
formsCollectionSlug,
|
|
1071
|
-
formsEnabled,
|
|
1072
|
-
formsPath,
|
|
1073
|
-
globalsBasePath,
|
|
1074
|
-
mediaCollectionSlug,
|
|
1075
|
-
mediaPath,
|
|
1076
|
-
pagesCollectionSlug,
|
|
1077
|
-
pagesPath,
|
|
1078
|
-
sectionLinks,
|
|
1079
|
-
toolsPath,
|
|
1080
|
-
userRole,
|
|
1081
|
-
children
|
|
1082
|
-
}) {
|
|
1083
|
-
const role = isRole(userRole) ? userRole : void 0;
|
|
1084
|
-
const [state, setState] = (0, import_react.useState)(
|
|
1085
|
-
() => formsEnabled && canReviewForms(role) ? {
|
|
1086
|
-
forms: { status: "loading" },
|
|
1087
|
-
media: { status: "loading" },
|
|
1088
|
-
pages: { status: "loading" }
|
|
1089
|
-
} : loadingState
|
|
1090
|
-
);
|
|
1091
|
-
(0, import_react.useEffect)(() => {
|
|
1092
|
-
let cancelled = false;
|
|
1093
|
-
const run = async () => {
|
|
1094
|
-
const includeForms = formsEnabled && canReviewForms(role);
|
|
1095
|
-
(0, import_react.startTransition)(() => {
|
|
1096
|
-
setState({
|
|
1097
|
-
forms: includeForms ? { status: "loading" } : null,
|
|
1098
|
-
media: { status: "loading" },
|
|
1099
|
-
pages: { status: "loading" }
|
|
1100
|
-
});
|
|
1101
|
-
});
|
|
1102
|
-
const [pagesResult, formsResult, mediaResult] = await Promise.allSettled([
|
|
1103
|
-
loadPages(pagesCollectionSlug),
|
|
1104
|
-
includeForms ? loadForms(formsCollectionSlug, formSubmissionsCollectionSlug) : Promise.resolve(null),
|
|
1105
|
-
loadMedia(mediaCollectionSlug)
|
|
1106
|
-
]);
|
|
1107
|
-
if (cancelled) return;
|
|
1108
|
-
(0, import_react.startTransition)(() => {
|
|
1109
|
-
setState({
|
|
1110
|
-
forms: includeForms && formsResult.status === "rejected" ? {
|
|
1111
|
-
error: formsResult.reason instanceof Error ? formsResult.reason.message : "Unable to load form activity.",
|
|
1112
|
-
status: "error"
|
|
1113
|
-
} : includeForms && formsResult.status === "fulfilled" && formsResult.value ? {
|
|
1114
|
-
data: formsResult.value,
|
|
1115
|
-
status: "success"
|
|
1116
|
-
} : null,
|
|
1117
|
-
media: mediaResult.status === "rejected" ? {
|
|
1118
|
-
error: mediaResult.reason instanceof Error ? mediaResult.reason.message : "Unable to load media activity.",
|
|
1119
|
-
status: "error"
|
|
1120
|
-
} : {
|
|
1121
|
-
data: mediaResult.value,
|
|
1122
|
-
status: "success"
|
|
1123
|
-
},
|
|
1124
|
-
pages: pagesResult.status === "rejected" ? {
|
|
1125
|
-
error: pagesResult.reason instanceof Error ? pagesResult.reason.message : "Unable to load page activity.",
|
|
1126
|
-
status: "error"
|
|
1127
|
-
} : {
|
|
1128
|
-
data: pagesResult.value,
|
|
1129
|
-
status: "success"
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
|
-
});
|
|
1133
|
-
};
|
|
1134
|
-
void run();
|
|
1135
|
-
return () => {
|
|
1136
|
-
cancelled = true;
|
|
1137
|
-
};
|
|
1138
|
-
}, [
|
|
1139
|
-
formSubmissionsCollectionSlug,
|
|
1140
|
-
formsCollectionSlug,
|
|
1141
|
-
formsEnabled,
|
|
1142
|
-
mediaCollectionSlug,
|
|
1143
|
-
pagesCollectionSlug,
|
|
1144
|
-
role
|
|
1145
|
-
]);
|
|
1146
|
-
const visibleWorkspaceLinks = (0, import_react.useMemo)(
|
|
1147
|
-
() => sectionLinks.filter((section) => canAccess(role, section.roles)),
|
|
1148
|
-
[role, sectionLinks]
|
|
1149
|
-
);
|
|
1150
|
-
const activityItems = (0, import_react.useMemo)(() => {
|
|
1151
|
-
const items = [];
|
|
1152
|
-
if (state.pages.status === "success") {
|
|
1153
|
-
for (const doc of state.pages.data.recent) {
|
|
1154
|
-
const id = asID(doc.id);
|
|
1155
|
-
if (!id) continue;
|
|
1156
|
-
const timestamp = toTimestamp(doc.updatedAt);
|
|
1157
|
-
items.push({
|
|
1158
|
-
href: `${pagesPath}/${id}`,
|
|
1159
|
-
id: `page-${id}`,
|
|
1160
|
-
kind: "page",
|
|
1161
|
-
label: typeof doc._status === "string" ? doc._status : "page",
|
|
1162
|
-
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
1163
|
-
timestamp,
|
|
1164
|
-
title: asText(doc.title, "Untitled page")
|
|
1165
|
-
});
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
if (state.forms?.status === "success") {
|
|
1169
|
-
for (const submission of state.forms.data.recentSubmissions) {
|
|
1170
|
-
const id = asID(submission.id);
|
|
1171
|
-
const formID = getFormID(submission.form);
|
|
1172
|
-
if (!id || !formID) continue;
|
|
1173
|
-
const timestamp = toTimestamp(submission.submittedAt);
|
|
1174
|
-
const formTitle = getFormTitle(submission.form) || "Form response";
|
|
1175
|
-
items.push({
|
|
1176
|
-
href: `${formsPath}?form=${encodeURIComponent(formID)}`,
|
|
1177
|
-
id: `submission-${id}`,
|
|
1178
|
-
kind: "submission",
|
|
1179
|
-
label: formTitle,
|
|
1180
|
-
meta: Number.isFinite(timestamp) ? `${readSubmissionIdentity(submission.data)} \xB7 ${formatDateTime(submission.submittedAt)}` : readSubmissionIdentity(submission.data),
|
|
1181
|
-
timestamp,
|
|
1182
|
-
title: "New submission"
|
|
1183
|
-
});
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
if (state.media.status === "success") {
|
|
1187
|
-
for (const doc of state.media.data.recent) {
|
|
1188
|
-
const id = asID(doc.id);
|
|
1189
|
-
if (!id) continue;
|
|
1190
|
-
const timestamp = toTimestamp(doc.updatedAt);
|
|
1191
|
-
items.push({
|
|
1192
|
-
href: `${mediaPath}/${id}`,
|
|
1193
|
-
id: `media-${id}`,
|
|
1194
|
-
kind: "media",
|
|
1195
|
-
label: asText(doc.mimeType, "Media asset"),
|
|
1196
|
-
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
1197
|
-
timestamp,
|
|
1198
|
-
title: asText(doc.filename, "Untitled asset")
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
return items.filter((item) => Number.isFinite(item.timestamp)).sort((a, b) => b.timestamp - a.timestamp).slice(0, 10);
|
|
1203
|
-
}, [formsPath, mediaPath, pagesPath, state.forms, state.media, state.pages]);
|
|
1204
|
-
const attentionItems = (0, import_react.useMemo)(() => {
|
|
1205
|
-
if (role === "client") {
|
|
1206
|
-
const items2 = [];
|
|
1207
|
-
if (state.pages.status === "success" && state.pages.data.updatedThisWeek > 0) {
|
|
1208
|
-
items2.push({
|
|
1209
|
-
href: pagesPath,
|
|
1210
|
-
id: "pages-updated",
|
|
1211
|
-
label: `${state.pages.data.updatedThisWeek} page${state.pages.data.updatedThisWeek === 1 ? "" : "s"} changed in the last 7 days.`
|
|
1212
|
-
});
|
|
1213
|
-
}
|
|
1214
|
-
if (state.media.status === "success" && state.media.data.uploadsThisWeek > 0) {
|
|
1215
|
-
items2.push({
|
|
1216
|
-
href: mediaPath,
|
|
1217
|
-
id: "media-updated",
|
|
1218
|
-
label: `${state.media.data.uploadsThisWeek} new media asset${state.media.data.uploadsThisWeek === 1 ? "" : "s"} landed this week.`
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
return items2;
|
|
1222
|
-
}
|
|
1223
|
-
const items = [];
|
|
1224
|
-
if (state.pages.status === "success" && state.pages.data.draftCount > 0) {
|
|
1225
|
-
items.push({
|
|
1226
|
-
href: pagesPath,
|
|
1227
|
-
id: "draft-pages",
|
|
1228
|
-
label: `${state.pages.data.draftCount} page${state.pages.data.draftCount === 1 ? "" : "s"} still need publishing review.`,
|
|
1229
|
-
tone: "accent"
|
|
1230
|
-
});
|
|
1231
|
-
}
|
|
1232
|
-
if (state.forms?.status === "success" && state.forms.data.submissionsThisWeek > 0) {
|
|
1233
|
-
items.push({
|
|
1234
|
-
href: formsPath,
|
|
1235
|
-
id: "recent-submissions",
|
|
1236
|
-
label: `${state.forms.data.submissionsThisWeek} form submission${state.forms.data.submissionsThisWeek === 1 ? "" : "s"} arrived in the last 7 days.`,
|
|
1237
|
-
tone: "accent"
|
|
1238
|
-
});
|
|
1239
|
-
}
|
|
1240
|
-
if (state.media.status === "success" && state.media.data.total === 0) {
|
|
1241
|
-
items.push({
|
|
1242
|
-
href: mediaPath,
|
|
1243
|
-
id: "empty-media",
|
|
1244
|
-
label: "The media library is still empty. Add brand assets before content expands."
|
|
1245
|
-
});
|
|
1246
|
-
}
|
|
1247
|
-
if (state.pages.status === "error") {
|
|
1248
|
-
items.push({
|
|
1249
|
-
href: pagesPath,
|
|
1250
|
-
id: "pages-error",
|
|
1251
|
-
label: "Page activity could not be loaded for the dashboard.",
|
|
1252
|
-
tone: "muted"
|
|
1253
|
-
});
|
|
1254
|
-
}
|
|
1255
|
-
if (state.forms?.status === "error") {
|
|
1256
|
-
items.push({
|
|
1257
|
-
href: formsPath,
|
|
1258
|
-
id: "forms-error",
|
|
1259
|
-
label: "Form activity could not be loaded for the dashboard.",
|
|
1260
|
-
tone: "muted"
|
|
1261
|
-
});
|
|
1262
|
-
}
|
|
1263
|
-
if (state.media.status === "error") {
|
|
1264
|
-
items.push({
|
|
1265
|
-
href: mediaPath,
|
|
1266
|
-
id: "media-error",
|
|
1267
|
-
label: "Media activity could not be loaded for the dashboard.",
|
|
1268
|
-
tone: "muted"
|
|
1269
|
-
});
|
|
1270
|
-
}
|
|
1271
|
-
return items;
|
|
1272
|
-
}, [formsPath, mediaPath, pagesPath, role, state.forms, state.media, state.pages]);
|
|
1273
|
-
const snapshotCards = (0, import_react.useMemo)(() => {
|
|
1274
|
-
const cards = [];
|
|
1275
|
-
if (state.pages.status === "success") {
|
|
1276
|
-
cards.push(
|
|
1277
|
-
role === "client" ? {
|
|
1278
|
-
detail: `${state.pages.data.updatedThisWeek} updated this week`,
|
|
1279
|
-
kicker: "Pages",
|
|
1280
|
-
value: `${state.pages.data.total}`
|
|
1281
|
-
} : {
|
|
1282
|
-
detail: `${state.pages.data.draftCount} draft${state.pages.data.draftCount === 1 ? "" : "s"} waiting`,
|
|
1283
|
-
kicker: "Pages",
|
|
1284
|
-
value: `${state.pages.data.total}`
|
|
1285
|
-
}
|
|
1286
|
-
);
|
|
1287
|
-
}
|
|
1288
|
-
if (state.forms?.status === "success") {
|
|
1289
|
-
cards.push({
|
|
1290
|
-
detail: state.forms.data.busiestFormTitle ? `Most active: ${state.forms.data.busiestFormTitle}` : "Waiting on the first submission",
|
|
1291
|
-
kicker: "Forms",
|
|
1292
|
-
value: `${state.forms.data.submissionsThisWeek}`
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
if (state.media.status === "success") {
|
|
1296
|
-
cards.push({
|
|
1297
|
-
detail: `${state.media.data.uploadsThisWeek} uploaded this week`,
|
|
1298
|
-
kicker: "Media",
|
|
1299
|
-
value: `${state.media.data.total}`
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
cards.push({
|
|
1303
|
-
detail: `${visibleWorkspaceLinks.length} section${visibleWorkspaceLinks.length === 1 ? "" : "s"} available`,
|
|
1304
|
-
kicker: "Workspace",
|
|
1305
|
-
value: role ? role.toUpperCase() : "CMS"
|
|
1306
|
-
});
|
|
1307
|
-
return cards.slice(0, 4);
|
|
1308
|
-
}, [role, state.forms, state.media, state.pages, visibleWorkspaceLinks.length]);
|
|
1309
|
-
const primaryActions = (0, import_react.useMemo)(() => {
|
|
1310
|
-
const actions = [];
|
|
1311
|
-
if (canCreatePages(role)) {
|
|
1312
|
-
actions.push({
|
|
1313
|
-
description: "Create or revise content in the visual builder.",
|
|
1314
|
-
href: `${pagesPath}/new`,
|
|
1315
|
-
label: "New Page"
|
|
1316
|
-
});
|
|
1317
|
-
}
|
|
1318
|
-
actions.push({
|
|
1319
|
-
description: "Review live pages and recent edits.",
|
|
1320
|
-
href: pagesPath,
|
|
1321
|
-
label: "Open Pages",
|
|
1322
|
-
tone: "ghost"
|
|
1323
|
-
});
|
|
1324
|
-
if (formsEnabled && canReviewForms(role)) {
|
|
1325
|
-
actions.push({
|
|
1326
|
-
description: "Check submissions and form performance.",
|
|
1327
|
-
href: formsPath,
|
|
1328
|
-
label: "Review Forms",
|
|
1329
|
-
tone: "soft"
|
|
1330
|
-
});
|
|
1331
|
-
}
|
|
1332
|
-
actions.push({
|
|
1333
|
-
description: "Update site settings, navigation, and footer content.",
|
|
1334
|
-
href: globalsBasePath,
|
|
1335
|
-
label: "Open Globals",
|
|
1336
|
-
tone: "ghost"
|
|
1337
|
-
});
|
|
1338
|
-
actions.push({
|
|
1339
|
-
description: "Upload or organize brand and campaign assets.",
|
|
1340
|
-
href: mediaPath,
|
|
1341
|
-
label: "Manage Media",
|
|
1342
|
-
tone: "ghost"
|
|
1343
|
-
});
|
|
1344
|
-
if (role === "admin") {
|
|
1345
|
-
actions.push({
|
|
1346
|
-
description: "Manage users, roles, and fallback tools.",
|
|
1347
|
-
href: toolsPath,
|
|
1348
|
-
label: "Admin Tools",
|
|
1349
|
-
tone: "ghost"
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
return actions;
|
|
1353
|
-
}, [formsEnabled, formsPath, globalsBasePath, mediaPath, pagesPath, role, toolsPath]);
|
|
1354
|
-
const attentionTitle = role === "client" ? "What Changed" : "Needs Attention";
|
|
1355
|
-
const attentionDescription = role === "client" ? "A quick read on recent content and asset changes." : "The highest-signal items that still need review.";
|
|
1356
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-layout", children: [
|
|
1357
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "orion-dashboard-panel orion-dashboard-panel--attention", children: [
|
|
1358
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-panel-header", children: [
|
|
1359
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
1360
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "orion-dashboard-panel-kicker", children: attentionTitle }),
|
|
1361
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: attentionDescription })
|
|
1362
|
-
] }),
|
|
1363
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "orion-dashboard-panel-meta", children: "Last 7 days" })
|
|
1364
|
-
] }),
|
|
1365
|
-
attentionItems.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-dashboard-attention-list", children: attentionItems.map(
|
|
1366
|
-
(item) => item.href ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1367
|
-
import_link.default,
|
|
1368
|
-
{
|
|
1369
|
-
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
1370
|
-
href: item.href,
|
|
1371
|
-
children: [
|
|
1372
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: item.label }),
|
|
1373
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Open" })
|
|
1374
|
-
]
|
|
1375
|
-
},
|
|
1376
|
-
item.id
|
|
1377
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1378
|
-
"div",
|
|
1379
|
-
{
|
|
1380
|
-
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
1381
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: item.label })
|
|
1382
|
-
},
|
|
1383
|
-
item.id
|
|
1384
|
-
)
|
|
1385
|
-
) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModuleStatus, { message: "Loading attention items..." }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1386
|
-
EmptyState,
|
|
1387
|
-
{
|
|
1388
|
-
body: role === "client" ? "No major changes landed during the current review window." : "No urgent follow-up surfaced from content, forms, or media activity.",
|
|
1389
|
-
title: "Everything looks steady"
|
|
1390
|
-
}
|
|
1391
|
-
)
|
|
1392
|
-
] }),
|
|
1393
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "orion-dashboard-panel orion-dashboard-panel--actions", children: [
|
|
1394
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-panel-header", children: [
|
|
1395
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
1396
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Quick Actions" }),
|
|
1397
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: "Jump into the work that matters most." })
|
|
1398
|
-
] }),
|
|
1399
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "orion-dashboard-panel-meta", children: [
|
|
1400
|
-
role || "studio",
|
|
1401
|
-
" mode"
|
|
1402
|
-
] })
|
|
1403
|
-
] }),
|
|
1404
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-dashboard-action-list", children: primaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1405
|
-
import_link.default,
|
|
1406
|
-
{
|
|
1407
|
-
className: [
|
|
1408
|
-
"orion-dashboard-action",
|
|
1409
|
-
action.tone === "ghost" ? "is-ghost" : action.tone === "soft" ? "is-soft" : ""
|
|
1410
|
-
].filter(Boolean).join(" "),
|
|
1411
|
-
href: action.href,
|
|
1412
|
-
children: [
|
|
1413
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: action.label }),
|
|
1414
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: action.description })
|
|
1415
|
-
]
|
|
1416
|
-
},
|
|
1417
|
-
action.label
|
|
1418
|
-
)) }),
|
|
1419
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-workspace-strip", children: [
|
|
1420
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "orion-dashboard-workspace-label", children: "Workspace" }),
|
|
1421
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-dashboard-workspace-pills", children: visibleWorkspaceLinks.map((section) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_link.default, { className: "orion-dashboard-workspace-pill", href: section.href, children: section.label }, section.id)) })
|
|
1422
|
-
] })
|
|
1423
|
-
] }),
|
|
1424
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "orion-dashboard-panel orion-dashboard-panel--activity", children: [
|
|
1425
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-panel-header", children: [
|
|
1426
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
1427
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Recent Activity" }),
|
|
1428
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: "The freshest edits, responses, and uploads across the studio." })
|
|
1429
|
-
] }),
|
|
1430
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "orion-dashboard-panel-meta", children: [
|
|
1431
|
-
activityItems.length,
|
|
1432
|
-
" items"
|
|
1433
|
-
] })
|
|
1434
|
-
] }),
|
|
1435
|
-
activityItems.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-dashboard-activity-list", children: activityItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_link.default, { className: `orion-dashboard-activity-item is-${item.kind}`, href: item.href, children: [
|
|
1436
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-activity-copy", children: [
|
|
1437
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-activity-topline", children: [
|
|
1438
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: item.title }),
|
|
1439
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: formatRelativeTime(item.timestamp) })
|
|
1440
|
-
] }),
|
|
1441
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: item.meta })
|
|
1442
|
-
] }),
|
|
1443
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "orion-dashboard-activity-pill", children: item.label })
|
|
1444
|
-
] }, item.id)) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModuleStatus, { message: "Loading activity feed..." }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1445
|
-
EmptyState,
|
|
1446
|
-
{
|
|
1447
|
-
body: "Recent page edits, submissions, and uploads will start stacking here as soon as the team gets moving.",
|
|
1448
|
-
title: "No recent activity yet"
|
|
1449
|
-
}
|
|
1450
|
-
)
|
|
1451
|
-
] }),
|
|
1452
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "orion-dashboard-panel orion-dashboard-panel--snapshot", children: [
|
|
1453
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-panel-header", children: [
|
|
1454
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
1455
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Business Snapshot" }),
|
|
1456
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: "A compact read on content momentum and performance." })
|
|
1457
|
-
] }),
|
|
1458
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "orion-dashboard-panel-meta", children: "30-day lens" })
|
|
1459
|
-
] }),
|
|
1460
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-snapshot-grid", children: [
|
|
1461
|
-
snapshotCards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SnapshotMetric, { card }, card.kicker)),
|
|
1462
|
-
children
|
|
1463
|
-
] }),
|
|
1464
|
-
state.pages.status === "error" || state.media.status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-dashboard-inline-note", children: "Some dashboard modules could not be loaded. The rest of the workspace remains available." }) : null
|
|
1465
|
-
] })
|
|
1466
|
-
] });
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
1470
|
-
var import_react5 = require("react");
|
|
1471
|
-
var import_navigation = require("next/navigation");
|
|
1472
|
-
var import_ui = require("@payloadcms/ui");
|
|
1473
|
-
|
|
1474
|
-
// src/admin-app/components/AdminShellClient.tsx
|
|
1475
|
-
var import_react2 = require("react");
|
|
1476
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1477
|
-
var iconSize = 20;
|
|
1478
|
-
var iconStyle = { display: "block", flexShrink: 0 };
|
|
1479
|
-
function NavIcon({ name }) {
|
|
1480
|
-
const props = { width: iconSize, height: iconSize, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", style: iconStyle };
|
|
1481
|
-
switch (name) {
|
|
1482
|
-
case "dashboard":
|
|
1483
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...props, children: [
|
|
1484
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "3", y: "3", width: "7", height: "9", rx: "1" }),
|
|
1485
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "14", y: "3", width: "7", height: "5", rx: "1" }),
|
|
1486
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "14", y: "12", width: "7", height: "9", rx: "1" }),
|
|
1487
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "3", y: "16", width: "7", height: "5", rx: "1" })
|
|
1488
|
-
] });
|
|
1489
|
-
case "pages":
|
|
1490
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...props, children: [
|
|
1491
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
|
|
1492
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "14 2 14 8 20 8" }),
|
|
1493
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
|
|
1494
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "8", y1: "17", x2: "12", y2: "17" })
|
|
1495
|
-
] });
|
|
1496
|
-
case "forms":
|
|
1497
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...props, children: [
|
|
1498
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 3h6" }),
|
|
1499
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 3v18" }),
|
|
1500
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5 7h14a2 2 0 0 1 2 2v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a2 2 0 0 1 2-2Z" }),
|
|
1501
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7 11h10" }),
|
|
1502
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7 15h6" })
|
|
1503
|
-
] });
|
|
1504
|
-
case "globals":
|
|
1505
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...props, children: [
|
|
1506
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "12", cy: "12", r: "3" }),
|
|
1507
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z" })
|
|
1508
|
-
] });
|
|
1509
|
-
case "media":
|
|
1510
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...props, children: [
|
|
1511
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
1512
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
1513
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "21 15 16 10 5 21" })
|
|
1514
|
-
] });
|
|
1515
|
-
case "tools":
|
|
1516
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76Z" }) });
|
|
1517
|
-
case "analytics":
|
|
1518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...props, children: [
|
|
1519
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 19V5" }),
|
|
1520
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M10 19V10" }),
|
|
1521
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M16 19v-6" }),
|
|
1522
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M22 19V3" })
|
|
1523
|
-
] });
|
|
1524
|
-
case "account":
|
|
1525
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...props, children: [
|
|
1526
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
|
|
1527
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "12", cy: "7", r: "4" })
|
|
1528
|
-
] });
|
|
1529
|
-
default:
|
|
1530
|
-
return null;
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
function AdminShellClient({
|
|
1534
|
-
children,
|
|
1535
|
-
brandName,
|
|
1536
|
-
logoUrl,
|
|
1537
|
-
userEmail,
|
|
1538
|
-
userRole,
|
|
1539
|
-
pathname,
|
|
1540
|
-
navItems,
|
|
1541
|
-
onLogout,
|
|
1542
|
-
storageKey = "orion-admin-shell-collapsed"
|
|
1543
|
-
}) {
|
|
1544
|
-
const [collapsed, setCollapsed] = (0, import_react2.useState)(false);
|
|
1545
|
-
const [loggingOut, setLoggingOut] = (0, import_react2.useState)(false);
|
|
1546
|
-
(0, import_react2.useEffect)(() => {
|
|
1547
|
-
try {
|
|
1548
|
-
const stored = window.localStorage.getItem(storageKey);
|
|
1549
|
-
if (stored === "1") {
|
|
1550
|
-
setCollapsed(true);
|
|
1551
|
-
}
|
|
1552
|
-
} catch {
|
|
1553
|
-
}
|
|
1554
|
-
}, [storageKey]);
|
|
1555
|
-
const toggleSidebar = () => {
|
|
1556
|
-
setCollapsed((current) => {
|
|
1557
|
-
const next = !current;
|
|
1558
|
-
try {
|
|
1559
|
-
window.localStorage.setItem(storageKey, next ? "1" : "0");
|
|
1560
|
-
} catch {
|
|
1561
|
-
}
|
|
1562
|
-
return next;
|
|
1563
|
-
});
|
|
1564
|
-
};
|
|
1565
|
-
const handleLogout = async () => {
|
|
1566
|
-
setLoggingOut(true);
|
|
1567
|
-
try {
|
|
1568
|
-
await onLogout();
|
|
1569
|
-
} finally {
|
|
1570
|
-
setLoggingOut(false);
|
|
1571
|
-
}
|
|
1572
|
-
};
|
|
1573
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `orion-admin-shell ${collapsed ? "is-collapsed" : ""}`, children: [
|
|
1574
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("aside", { className: "orion-admin-sidebar", children: [
|
|
1575
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1576
|
-
"button",
|
|
1577
|
-
{
|
|
1578
|
-
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
1579
|
-
className: "orion-admin-sidebar-toggle",
|
|
1580
|
-
onClick: toggleSidebar,
|
|
1581
|
-
type: "button",
|
|
1582
|
-
children: collapsed ? ">" : "<"
|
|
1583
|
-
}
|
|
1584
|
-
),
|
|
1585
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "orion-admin-brand-wrap", children: [
|
|
1586
|
-
logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "orion-admin-brand-logo", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { alt: `${brandName} logo`, src: logoUrl }) }) : null,
|
|
1587
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "orion-admin-brand-text", children: [
|
|
1588
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "orion-admin-brand-name", title: brandName, children: collapsed ? brandName.slice(0, 1).toUpperCase() : brandName }),
|
|
1589
|
-
!collapsed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "orion-admin-brand-subtitle", children: "Studio" }) : null
|
|
1590
|
-
] })
|
|
1591
|
-
] }),
|
|
1592
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("nav", { className: "orion-admin-nav", children: navItems.filter((item) => roleCanAccessNav(userRole, item)).map((item) => {
|
|
1593
|
-
const active = navItemIsActive(pathname, item);
|
|
1594
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1595
|
-
"a",
|
|
1596
|
-
{
|
|
1597
|
-
className: `orion-admin-nav-link ${active ? "is-active" : ""}`,
|
|
1598
|
-
href: item.href,
|
|
1599
|
-
title: item.label,
|
|
1600
|
-
children: item.icon ? collapsed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NavIcon, { name: item.icon }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { alignItems: "center", display: "flex", gap: "0.6rem" }, children: [
|
|
1601
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NavIcon, { name: item.icon }),
|
|
1602
|
-
item.label
|
|
1603
|
-
] }) : collapsed ? item.label.slice(0, 1) : item.label
|
|
1604
|
-
},
|
|
1605
|
-
item.href
|
|
1606
|
-
);
|
|
1607
|
-
}) }),
|
|
1608
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "orion-admin-sidebar-footer", children: [
|
|
1609
|
-
!collapsed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1610
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "orion-admin-user-label", children: "Signed in as" }),
|
|
1611
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "orion-admin-user-email", children: userEmail })
|
|
1612
|
-
] }) : null,
|
|
1613
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "orion-admin-logout", disabled: loggingOut, onClick: handleLogout, type: "button", children: loggingOut ? "..." : "Log out" })
|
|
1614
|
-
] })
|
|
1615
|
-
] }),
|
|
1616
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("main", { className: "orion-admin-main", children })
|
|
1617
|
-
] });
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
// src/admin/hooks/useSiteBranding.ts
|
|
1621
|
-
var import_react3 = require("react");
|
|
1622
|
-
var asRecord = (value) => {
|
|
1623
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1624
|
-
return value;
|
|
1625
|
-
};
|
|
1626
|
-
var pickString = (value) => {
|
|
1627
|
-
if (typeof value !== "string") return null;
|
|
1628
|
-
const next = value.trim();
|
|
1629
|
-
return next.length > 0 ? next : null;
|
|
1630
|
-
};
|
|
1631
|
-
var resolveUploadUrl = (value) => {
|
|
1632
|
-
const direct = pickString(value);
|
|
1633
|
-
if (direct) return direct;
|
|
1634
|
-
const record = asRecord(value);
|
|
1635
|
-
if (!record) return null;
|
|
1636
|
-
const fromUrl = pickString(record.url);
|
|
1637
|
-
if (fromUrl) return fromUrl;
|
|
1638
|
-
const fromFilename = pickString(record.filename);
|
|
1639
|
-
if (fromFilename) return `/api/media/file/${fromFilename}`;
|
|
1640
|
-
return null;
|
|
1641
|
-
};
|
|
1642
|
-
var resolveLogoUrl = (settings) => {
|
|
1643
|
-
return resolveUploadUrl(settings.logo) || resolveUploadUrl(settings.adminLogo) || resolveUploadUrl(settings.brandLogo) || null;
|
|
1644
|
-
};
|
|
1645
|
-
var cachedBranding = null;
|
|
1646
|
-
function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
1647
|
-
const [branding, setBranding] = (0, import_react3.useState)(() => {
|
|
1648
|
-
if (cachedBranding) {
|
|
1649
|
-
return {
|
|
1650
|
-
logoUrl: cachedBranding.logoUrl || defaultLogoUrl || null,
|
|
1651
|
-
siteName: cachedBranding.siteName || defaultName || null
|
|
1652
|
-
};
|
|
1653
|
-
}
|
|
1654
|
-
return {
|
|
1655
|
-
logoUrl: defaultLogoUrl || null,
|
|
1656
|
-
siteName: defaultName || null
|
|
1657
|
-
};
|
|
1658
|
-
});
|
|
1659
|
-
(0, import_react3.useEffect)(() => {
|
|
1660
|
-
let cancelled = false;
|
|
1661
|
-
const run = async () => {
|
|
1662
|
-
try {
|
|
1663
|
-
const res = await fetch("/api/globals/site-settings?depth=1", {
|
|
1664
|
-
credentials: "include"
|
|
1665
|
-
});
|
|
1666
|
-
if (!res.ok) return;
|
|
1667
|
-
const data = await res.json();
|
|
1668
|
-
const record = asRecord(data);
|
|
1669
|
-
if (!record) return;
|
|
1670
|
-
const siteName = pickString(record.siteName);
|
|
1671
|
-
const logoUrl = resolveLogoUrl(record);
|
|
1672
|
-
cachedBranding = { logoUrl, siteName };
|
|
1673
|
-
if (!cancelled) {
|
|
1674
|
-
setBranding({
|
|
1675
|
-
logoUrl: logoUrl || defaultLogoUrl || null,
|
|
1676
|
-
siteName: siteName || defaultName || null
|
|
1677
|
-
});
|
|
1678
|
-
}
|
|
1679
|
-
} catch {
|
|
1680
|
-
}
|
|
1681
|
-
};
|
|
1682
|
-
void run();
|
|
1683
|
-
return () => {
|
|
1684
|
-
cancelled = true;
|
|
1685
|
-
};
|
|
1686
|
-
}, [defaultLogoUrl, defaultName]);
|
|
1687
|
-
return branding;
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
// src/admin/components/studio/adminPathUtils.ts
|
|
1691
|
-
var import_react4 = require("react");
|
|
1692
|
-
var DEFAULT_ADMIN_BASE_PATH = "/admin";
|
|
1693
|
-
var normalizePath = (value) => {
|
|
1694
|
-
if (!value || value === "/") return "/";
|
|
1695
|
-
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
1696
|
-
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
1697
|
-
return trimmed.length > 0 ? trimmed : "/";
|
|
1698
|
-
};
|
|
1699
|
-
var normalizeAdminBasePath = (value) => {
|
|
1700
|
-
const normalized = normalizePath(value);
|
|
1701
|
-
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH : normalized;
|
|
1702
|
-
};
|
|
1703
|
-
var detectAdminBasePath = (pathname, fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1704
|
-
const normalizedPathname = normalizePath(pathname);
|
|
1705
|
-
const normalizedFallback = normalizeAdminBasePath(fallback);
|
|
1706
|
-
const markers = [
|
|
1707
|
-
"/contact-form",
|
|
1708
|
-
"/collections/",
|
|
1709
|
-
"/globals/",
|
|
1710
|
-
"/forms",
|
|
1711
|
-
"/pages/",
|
|
1712
|
-
"/tools",
|
|
1713
|
-
"/media",
|
|
1714
|
-
"/logout",
|
|
1715
|
-
"/login"
|
|
1716
|
-
];
|
|
1717
|
-
for (const marker of markers) {
|
|
1718
|
-
const index = normalizedPathname.indexOf(marker);
|
|
1719
|
-
if (index > 0) {
|
|
1720
|
-
return normalizeAdminBasePath(normalizedPathname.slice(0, index));
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
if (normalizedPathname === normalizedFallback || normalizedPathname.startsWith(`${normalizedFallback}/`)) {
|
|
1724
|
-
return normalizedFallback;
|
|
1725
|
-
}
|
|
1726
|
-
const segments = normalizedPathname.split("/").filter(Boolean);
|
|
1727
|
-
if (segments.length > 0) {
|
|
1728
|
-
return normalizeAdminBasePath(`/${segments[0]}`);
|
|
1729
|
-
}
|
|
1730
|
-
return normalizedFallback;
|
|
1731
|
-
};
|
|
1732
|
-
var isAbsoluteExternalURL2 = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
1733
|
-
var resolveAdminPath = (adminBasePath, targetPath) => {
|
|
1734
|
-
if (!targetPath) return adminBasePath;
|
|
1735
|
-
if (isAbsoluteExternalURL2(targetPath)) return targetPath;
|
|
1736
|
-
const normalizedBasePath = normalizeAdminBasePath(adminBasePath);
|
|
1737
|
-
const normalizedTargetPath = normalizePath(targetPath);
|
|
1738
|
-
if (normalizedTargetPath === "/admin") {
|
|
1739
|
-
return normalizedBasePath;
|
|
1740
|
-
}
|
|
1741
|
-
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
1742
|
-
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
1743
|
-
}
|
|
1744
|
-
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
1745
|
-
return normalizedTargetPath;
|
|
1746
|
-
}
|
|
1747
|
-
if (normalizedTargetPath === "/") {
|
|
1748
|
-
return normalizedBasePath;
|
|
1749
|
-
}
|
|
1750
|
-
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
1751
|
-
};
|
|
1752
|
-
var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1753
|
-
const [adminBasePath, setAdminBasePath] = (0, import_react4.useState)(normalizeAdminBasePath(fallback));
|
|
1754
|
-
(0, import_react4.useEffect)(() => {
|
|
1755
|
-
const update = () => {
|
|
1756
|
-
setAdminBasePath(detectAdminBasePath(window.location.pathname, fallback));
|
|
1757
|
-
};
|
|
1758
|
-
update();
|
|
1759
|
-
window.addEventListener("popstate", update);
|
|
1760
|
-
return () => window.removeEventListener("popstate", update);
|
|
1761
|
-
}, [fallback]);
|
|
1762
|
-
return adminBasePath;
|
|
1763
|
-
};
|
|
1764
|
-
|
|
1765
|
-
// src/admin/components/studio/studioNavModel.ts
|
|
1766
|
-
var getPropString = (props, key, fallback) => {
|
|
1767
|
-
if (!props || typeof props !== "object") return fallback;
|
|
1768
|
-
const direct = props[key];
|
|
1769
|
-
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
1770
|
-
const clientProps = props.clientProps;
|
|
1771
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1772
|
-
const nested = clientProps[key];
|
|
1773
|
-
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
1774
|
-
}
|
|
1775
|
-
return fallback;
|
|
1776
|
-
};
|
|
1777
|
-
var getPropBoolean = (props, key, fallback) => {
|
|
1778
|
-
if (!props || typeof props !== "object") return fallback;
|
|
1779
|
-
const direct = props[key];
|
|
1780
|
-
if (typeof direct === "boolean") return direct;
|
|
1781
|
-
const clientProps = props.clientProps;
|
|
1782
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1783
|
-
const nested = clientProps[key];
|
|
1784
|
-
if (typeof nested === "boolean") return nested;
|
|
1785
|
-
}
|
|
1786
|
-
return fallback;
|
|
1787
|
-
};
|
|
1788
|
-
var getPropStringArray = (props, key, fallback) => {
|
|
1789
|
-
if (!props || typeof props !== "object") return fallback;
|
|
1790
|
-
const read = (candidate) => Array.isArray(candidate) ? candidate.filter((value) => typeof value === "string" && value.length > 0) : null;
|
|
1791
|
-
const direct = read(props[key]);
|
|
1792
|
-
if (direct) return direct;
|
|
1793
|
-
const clientProps = props.clientProps;
|
|
1794
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1795
|
-
const nested = read(clientProps[key]);
|
|
1796
|
-
if (nested) return nested;
|
|
1797
|
-
}
|
|
1798
|
-
return fallback;
|
|
1799
|
-
};
|
|
1800
|
-
var getPropSections = (props) => {
|
|
1801
|
-
if (!props || typeof props !== "object") return [];
|
|
1802
|
-
const direct = resolveStudioSections(props.sections);
|
|
1803
|
-
if (direct.length > 0) return direct;
|
|
1804
|
-
const clientProps = props.clientProps;
|
|
1805
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1806
|
-
return resolveStudioSections(clientProps.sections);
|
|
1807
|
-
}
|
|
1808
|
-
return [];
|
|
1809
|
-
};
|
|
1810
|
-
var readUserRole = (user) => {
|
|
1811
|
-
if (!user || typeof user !== "object") {
|
|
1812
|
-
return void 0;
|
|
1813
|
-
}
|
|
1814
|
-
const role = user.role;
|
|
1815
|
-
return typeof role === "string" ? role : void 0;
|
|
1816
|
-
};
|
|
1817
|
-
var buildStudioNavItems = (props, adminBasePath) => {
|
|
1818
|
-
const formsEnabled = getPropBoolean(props, "formsEnabled", false);
|
|
1819
|
-
const formsCollectionSlug = getPropString(props, "formsCollectionSlug", "forms");
|
|
1820
|
-
const formSubmissionsCollectionSlug = getPropString(
|
|
1821
|
-
props,
|
|
1822
|
-
"formSubmissionsCollectionSlug",
|
|
1823
|
-
"form-submissions"
|
|
1824
|
-
);
|
|
1825
|
-
const formUploadsCollectionSlug = getPropString(props, "formUploadsCollectionSlug", "form-uploads");
|
|
1826
|
-
const mediaCollectionSlug = getPropString(props, "mediaCollectionSlug", "media");
|
|
1827
|
-
const globalsBasePath = getPropString(props, "globalsBasePath", "/globals");
|
|
1828
|
-
const globalsExtraMatchPrefixes = getPropStringArray(props, "globalsExtraMatchPrefixes", []);
|
|
1829
|
-
const sections = getPropSections(props);
|
|
1830
|
-
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1831
|
-
const formsPath = resolveAdminPath(adminBasePath, "/forms");
|
|
1832
|
-
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
1833
|
-
const toolsPath = resolveAdminPath(adminBasePath, "/tools");
|
|
1834
|
-
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
1835
|
-
const resolvedGlobalsExtraMatchPrefixes = globalsExtraMatchPrefixes.map(
|
|
1836
|
-
(prefix) => resolveAdminPath(adminBasePath, prefix)
|
|
1837
|
-
);
|
|
1838
|
-
const baseItemsBeforeTools = [
|
|
1839
|
-
{
|
|
1840
|
-
href: adminBasePath,
|
|
1841
|
-
icon: "dashboard",
|
|
1842
|
-
label: "Dashboard",
|
|
1843
|
-
matchPrefixes: [adminBasePath]
|
|
1844
|
-
},
|
|
1845
|
-
{
|
|
1846
|
-
href: pagesPath,
|
|
1847
|
-
icon: "pages",
|
|
1848
|
-
label: "Pages",
|
|
1849
|
-
matchPrefixes: [pagesPath]
|
|
1850
|
-
},
|
|
1851
|
-
...formsEnabled ? [
|
|
1852
|
-
{
|
|
1853
|
-
href: formsPath,
|
|
1854
|
-
icon: "forms",
|
|
1855
|
-
label: "Forms",
|
|
1856
|
-
matchPrefixes: [
|
|
1857
|
-
formsPath,
|
|
1858
|
-
resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`),
|
|
1859
|
-
resolveAdminPath(adminBasePath, `/collections/${formSubmissionsCollectionSlug}`),
|
|
1860
|
-
resolveAdminPath(adminBasePath, `/collections/${formUploadsCollectionSlug}`)
|
|
1861
|
-
]
|
|
1862
|
-
}
|
|
1863
|
-
] : [],
|
|
1864
|
-
{
|
|
1865
|
-
href: resolvedGlobalsBasePath,
|
|
1866
|
-
icon: "globals",
|
|
1867
|
-
label: "Globals",
|
|
1868
|
-
matchPrefixes: [
|
|
1869
|
-
resolvedGlobalsBasePath,
|
|
1870
|
-
resolveAdminPath(adminBasePath, "/globals"),
|
|
1871
|
-
...resolvedGlobalsExtraMatchPrefixes
|
|
1872
|
-
]
|
|
1873
|
-
},
|
|
1874
|
-
{
|
|
1875
|
-
href: mediaPath,
|
|
1876
|
-
icon: "media",
|
|
1877
|
-
label: "Media",
|
|
1878
|
-
matchPrefixes: [mediaPath, resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`)]
|
|
1879
|
-
}
|
|
1880
|
-
];
|
|
1881
|
-
const adminToolsItem = {
|
|
1882
|
-
href: toolsPath,
|
|
1883
|
-
icon: "tools",
|
|
1884
|
-
label: "Admin Tools",
|
|
1885
|
-
matchPrefixes: [toolsPath, resolveAdminPath(adminBasePath, "/collections/users")],
|
|
1886
|
-
roles: ["admin"]
|
|
1887
|
-
};
|
|
1888
|
-
const extensionItems = sections.map((section) => ({
|
|
1889
|
-
href: resolveAdminPath(adminBasePath, section.href),
|
|
1890
|
-
...section.icon ? { icon: section.icon } : {},
|
|
1891
|
-
label: section.label,
|
|
1892
|
-
matchPrefixes: section.matchPrefixes.map((prefix) => resolveAdminPath(adminBasePath, prefix)),
|
|
1893
|
-
roles: section.roles
|
|
1894
|
-
}));
|
|
1895
|
-
return [...baseItemsBeforeTools, ...extensionItems, adminToolsItem];
|
|
1896
|
-
};
|
|
1897
|
-
|
|
1898
|
-
// src/admin/components/studio/StudioSectionLayout.tsx
|
|
1899
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1900
|
-
function StudioSectionLayout({ children, navProps }) {
|
|
1901
|
-
const { user } = (0, import_ui.useAuth)();
|
|
1902
|
-
const pathname = (0, import_navigation.usePathname)() || "";
|
|
1903
|
-
const router = (0, import_navigation.useRouter)();
|
|
1904
|
-
const adminBasePath = useAdminBasePath();
|
|
1905
|
-
const defaultBrandName = getPropString(navProps, "brandName", "Orion Studio");
|
|
1906
|
-
const defaultLogoUrl = getPropString(navProps, "logoUrl", "");
|
|
1907
|
-
const navItems = (0, import_react5.useMemo)(
|
|
1908
|
-
() => buildStudioNavItems(navProps, adminBasePath),
|
|
1909
|
-
[adminBasePath, navProps]
|
|
1910
|
-
);
|
|
1911
|
-
const branding = useSiteBranding(defaultBrandName, defaultLogoUrl || void 0);
|
|
1912
|
-
(0, import_react5.useLayoutEffect)(() => {
|
|
1913
|
-
document.body.classList.add("orion-studio-shell-active");
|
|
1914
|
-
return () => {
|
|
1915
|
-
document.body.classList.remove("orion-studio-shell-active");
|
|
1916
|
-
};
|
|
1917
|
-
}, []);
|
|
1918
|
-
const logout = (0, import_react5.useMemo)(
|
|
1919
|
-
() => async () => {
|
|
1920
|
-
await fetch("/api/users/logout", {
|
|
1921
|
-
credentials: "include",
|
|
1922
|
-
method: "POST"
|
|
1923
|
-
});
|
|
1924
|
-
router.push(resolveAdminPath(adminBasePath, "/login"));
|
|
1925
|
-
router.refresh();
|
|
1926
|
-
},
|
|
1927
|
-
[adminBasePath, router]
|
|
1928
|
-
);
|
|
1929
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1930
|
-
AdminShellClient,
|
|
1931
|
-
{
|
|
1932
|
-
brandName: branding.siteName || defaultBrandName,
|
|
1933
|
-
logoUrl: branding.logoUrl || defaultLogoUrl || void 0,
|
|
1934
|
-
navItems,
|
|
1935
|
-
onLogout: logout,
|
|
1936
|
-
pathname,
|
|
1937
|
-
storageKey: "orion-admin-sidebar-collapsed-v1",
|
|
1938
|
-
userEmail: typeof user?.email === "string" ? user.email : "user",
|
|
1939
|
-
userRole: readUserRole(user),
|
|
1940
|
-
children
|
|
1941
|
-
}
|
|
1942
|
-
);
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
|
-
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
1946
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1947
|
-
var DEFAULT_ADMIN_BASE_PATH2 = "/admin";
|
|
1948
|
-
var normalizePath2 = (value) => {
|
|
1949
|
-
if (!value || value === "/") return "/";
|
|
1950
|
-
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
1951
|
-
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
1952
|
-
return trimmed.length > 0 ? trimmed : "/";
|
|
1953
|
-
};
|
|
1954
|
-
var normalizeAdminBasePath2 = (value) => {
|
|
1955
|
-
const normalized = normalizePath2(value);
|
|
1956
|
-
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH2 : normalized;
|
|
1957
|
-
};
|
|
1958
|
-
var isAbsoluteExternalURL3 = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
1959
|
-
var resolveAdminPath2 = (adminBasePath, targetPath) => {
|
|
1960
|
-
if (!targetPath) return adminBasePath;
|
|
1961
|
-
if (isAbsoluteExternalURL3(targetPath)) return targetPath;
|
|
1962
|
-
const normalizedBasePath = normalizeAdminBasePath2(adminBasePath);
|
|
1963
|
-
const normalizedTargetPath = normalizePath2(targetPath);
|
|
1964
|
-
if (normalizedTargetPath === "/admin") {
|
|
1965
|
-
return normalizedBasePath;
|
|
1966
|
-
}
|
|
1967
|
-
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
1968
|
-
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
1969
|
-
}
|
|
1970
|
-
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
1971
|
-
return normalizedTargetPath;
|
|
1972
|
-
}
|
|
1973
|
-
if (normalizedTargetPath === "/") {
|
|
1974
|
-
return normalizedBasePath;
|
|
1975
|
-
}
|
|
1976
|
-
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
1977
|
-
};
|
|
1978
|
-
var getPropString2 = (props, key, fallback) => {
|
|
1979
|
-
if (!props || typeof props !== "object") return fallback;
|
|
1980
|
-
const direct = props[key];
|
|
1981
|
-
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
1982
|
-
const clientProps = props.clientProps;
|
|
1983
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1984
|
-
const nested = clientProps[key];
|
|
1985
|
-
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
1986
|
-
}
|
|
1987
|
-
return fallback;
|
|
1988
|
-
};
|
|
1989
|
-
var getPropBoolean2 = (props, key, fallback) => {
|
|
1990
|
-
if (!props || typeof props !== "object") return fallback;
|
|
1991
|
-
const direct = props[key];
|
|
1992
|
-
if (typeof direct === "boolean") return direct;
|
|
1993
|
-
const clientProps = props.clientProps;
|
|
1994
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1995
|
-
const nested = clientProps[key];
|
|
1996
|
-
if (typeof nested === "boolean") return nested;
|
|
1997
|
-
}
|
|
1998
|
-
return fallback;
|
|
1999
|
-
};
|
|
2000
|
-
var getPropSections2 = (props) => {
|
|
2001
|
-
if (!props || typeof props !== "object") return [];
|
|
2002
|
-
const direct = resolveStudioSections(props.sections);
|
|
2003
|
-
if (direct.length > 0) return direct;
|
|
2004
|
-
const clientProps = props.clientProps;
|
|
2005
|
-
if (clientProps && typeof clientProps === "object") {
|
|
2006
|
-
return resolveStudioSections(clientProps.sections);
|
|
2007
|
-
}
|
|
2008
|
-
return [];
|
|
2009
|
-
};
|
|
2010
|
-
var readUserRole2 = (props) => {
|
|
2011
|
-
if (!props || typeof props !== "object") return void 0;
|
|
2012
|
-
const user = props.user;
|
|
2013
|
-
if (user && typeof user === "object") {
|
|
2014
|
-
const role = user.role;
|
|
2015
|
-
if (typeof role === "string") {
|
|
2016
|
-
return role;
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
const initPageResult = props.initPageResult;
|
|
2020
|
-
if (initPageResult && typeof initPageResult === "object") {
|
|
2021
|
-
const req = initPageResult.req;
|
|
2022
|
-
if (req && typeof req === "object") {
|
|
2023
|
-
const nestedUser = req.user;
|
|
2024
|
-
if (nestedUser && typeof nestedUser === "object") {
|
|
2025
|
-
const role = nestedUser.role;
|
|
2026
|
-
if (typeof role === "string") {
|
|
2027
|
-
return role;
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
return void 0;
|
|
2033
|
-
};
|
|
2034
|
-
var readAdminBasePath = (props) => {
|
|
2035
|
-
if (!props || typeof props !== "object") {
|
|
2036
|
-
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2037
|
-
}
|
|
2038
|
-
const payloadLike = props.payload;
|
|
2039
|
-
if (payloadLike && typeof payloadLike === "object") {
|
|
2040
|
-
const config = payloadLike.config;
|
|
2041
|
-
const routes = config && typeof config === "object" ? config.routes : null;
|
|
2042
|
-
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
2043
|
-
if (typeof admin === "string" && admin.length > 0) {
|
|
2044
|
-
return normalizeAdminBasePath2(admin);
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
const initPageResult = props.initPageResult;
|
|
2048
|
-
if (initPageResult && typeof initPageResult === "object") {
|
|
2049
|
-
const req = initPageResult.req;
|
|
2050
|
-
if (req && typeof req === "object") {
|
|
2051
|
-
const nestedPayload = req.payload;
|
|
2052
|
-
if (nestedPayload && typeof nestedPayload === "object") {
|
|
2053
|
-
const config = nestedPayload.config;
|
|
2054
|
-
const routes = config && typeof config === "object" ? config.routes : null;
|
|
2055
|
-
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
2056
|
-
if (typeof admin === "string" && admin.length > 0) {
|
|
2057
|
-
return normalizeAdminBasePath2(admin);
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
|
-
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2063
|
-
};
|
|
2064
|
-
var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
|
|
2065
|
-
const links = [
|
|
2066
|
-
{
|
|
2067
|
-
href: resolveAdminPath2(adminBasePath, "/pages"),
|
|
2068
|
-
id: "pages",
|
|
2069
|
-
label: "Pages"
|
|
2070
|
-
},
|
|
2071
|
-
...formsEnabled ? [
|
|
2072
|
-
{
|
|
2073
|
-
href: resolveAdminPath2(adminBasePath, "/forms"),
|
|
2074
|
-
id: "forms",
|
|
2075
|
-
label: "Forms",
|
|
2076
|
-
roles: ["admin", "editor"]
|
|
2077
|
-
}
|
|
2078
|
-
] : [],
|
|
2079
|
-
{
|
|
2080
|
-
href: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
2081
|
-
id: "globals",
|
|
2082
|
-
label: "Globals"
|
|
2083
|
-
},
|
|
2084
|
-
{
|
|
2085
|
-
href: resolveAdminPath2(adminBasePath, "/media"),
|
|
2086
|
-
id: "media",
|
|
2087
|
-
label: "Media"
|
|
2088
|
-
},
|
|
2089
|
-
...sections.map((section) => ({
|
|
2090
|
-
href: resolveAdminPath2(adminBasePath, section.href),
|
|
2091
|
-
id: section.id,
|
|
2092
|
-
label: section.label,
|
|
2093
|
-
...section.roles ? { roles: section.roles } : {}
|
|
2094
|
-
})),
|
|
2095
|
-
{
|
|
2096
|
-
href: resolveAdminPath2(adminBasePath, "/tools"),
|
|
2097
|
-
id: "admin-tools",
|
|
2098
|
-
label: "Admin Tools",
|
|
2099
|
-
roles: ["admin"]
|
|
2100
|
-
}
|
|
2101
|
-
];
|
|
2102
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2103
|
-
return links.filter((link) => {
|
|
2104
|
-
if (seen.has(link.id)) {
|
|
2105
|
-
return false;
|
|
2106
|
-
}
|
|
2107
|
-
seen.add(link.id);
|
|
2108
|
-
return true;
|
|
2109
|
-
});
|
|
2110
|
-
};
|
|
2111
|
-
function AdminStudioDashboard(rawProps) {
|
|
2112
|
-
const props = rawProps || {};
|
|
2113
|
-
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
2114
|
-
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
2115
|
-
const sections = getPropSections2(props);
|
|
2116
|
-
const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
|
|
2117
|
-
const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
|
|
2118
|
-
const formSubmissionsCollectionSlug = getPropString2(
|
|
2119
|
-
props,
|
|
2120
|
-
"formSubmissionsCollectionSlug",
|
|
2121
|
-
"form-submissions"
|
|
2122
|
-
);
|
|
2123
|
-
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
2124
|
-
const adminBasePath = readAdminBasePath(props);
|
|
2125
|
-
const userRole = readUserRole2(props);
|
|
2126
|
-
const navProps = {
|
|
2127
|
-
brandName: getPropString2(props, "brandName", "Orion Studio"),
|
|
2128
|
-
formSubmissionsCollectionSlug,
|
|
2129
|
-
formsCollectionSlug,
|
|
2130
|
-
formsEnabled,
|
|
2131
|
-
globalsBasePath,
|
|
2132
|
-
logoUrl: getPropString2(props, "logoUrl", ""),
|
|
2133
|
-
mediaCollectionSlug,
|
|
2134
|
-
pagesCollectionSlug,
|
|
2135
|
-
sections
|
|
2136
|
-
};
|
|
2137
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StudioSectionLayout, { navProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2138
|
-
AdminPage,
|
|
2139
|
-
{
|
|
2140
|
-
breadcrumbs: [{ label: "Dashboard" }],
|
|
2141
|
-
description: "What needs attention, what changed recently, and how the site is performing.",
|
|
2142
|
-
title: "Studio",
|
|
2143
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2144
|
-
AdminStudioDashboardClient,
|
|
2145
|
-
{
|
|
2146
|
-
formSubmissionsCollectionSlug,
|
|
2147
|
-
formsCollectionSlug,
|
|
2148
|
-
formsEnabled,
|
|
2149
|
-
formsPath: resolveAdminPath2(adminBasePath, "/forms"),
|
|
2150
|
-
globalsBasePath: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
2151
|
-
mediaCollectionSlug,
|
|
2152
|
-
mediaPath: resolveAdminPath2(adminBasePath, "/media"),
|
|
2153
|
-
pagesCollectionSlug,
|
|
2154
|
-
pagesPath: resolveAdminPath2(adminBasePath, "/pages"),
|
|
2155
|
-
sectionLinks: buildSectionLinks(adminBasePath, sections, formsEnabled, globalsBasePath),
|
|
2156
|
-
toolsPath: resolveAdminPath2(adminBasePath, "/tools"),
|
|
2157
|
-
userRole
|
|
2158
|
-
}
|
|
2159
|
-
)
|
|
2160
|
-
}
|
|
2161
|
-
) });
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
753
|
// src/admin/helpers/withTooltips.ts
|
|
2165
754
|
var defaultTooltips = {
|
|
2166
755
|
title: "The main title displayed on this page.",
|
|
@@ -2417,7 +1006,6 @@ var createSocialMediaGlobal = (options = {}) => ({
|
|
|
2417
1006
|
});
|
|
2418
1007
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2419
1008
|
0 && (module.exports = {
|
|
2420
|
-
AdminStudioDashboard,
|
|
2421
1009
|
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
2422
1010
|
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
2423
1011
|
SOCIAL_MEDIA_PLATFORMS,
|