@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.mjs
CHANGED
|
@@ -1803,11 +1803,6 @@ function StudioSectionLayout({ children, navProps }) {
|
|
|
1803
1803
|
);
|
|
1804
1804
|
}
|
|
1805
1805
|
|
|
1806
|
-
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
1807
|
-
import { useEffect as useEffect7, useMemo as useMemo3, useState as useState7 } from "react";
|
|
1808
|
-
import Link from "next/link";
|
|
1809
|
-
import { useAuth as useAuth3 } from "@payloadcms/ui";
|
|
1810
|
-
|
|
1811
1806
|
// src/admin-app/components/AdminBreadcrumbs.tsx
|
|
1812
1807
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1813
1808
|
function AdminBreadcrumbs({ items }) {
|
|
@@ -1838,14 +1833,844 @@ function AdminPage({ title, description, breadcrumbs, actions, children }) {
|
|
|
1838
1833
|
] });
|
|
1839
1834
|
}
|
|
1840
1835
|
|
|
1841
|
-
// src/admin/components/studio/
|
|
1836
|
+
// src/admin/components/studio/AdminStudioDashboardClient.tsx
|
|
1837
|
+
import { startTransition, useEffect as useEffect7, useMemo as useMemo3, useState as useState7 } from "react";
|
|
1838
|
+
import Link from "next/link";
|
|
1842
1839
|
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1840
|
+
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
1841
|
+
var isRole = (value) => value === "admin" || value === "editor" || value === "client";
|
|
1842
|
+
var canReviewForms = (role) => role === "admin" || role === "editor";
|
|
1843
|
+
var canCreatePages = (role) => role === "admin" || role === "editor";
|
|
1844
|
+
var canAccess = (role, roles) => {
|
|
1845
|
+
if (!roles || roles.length === 0) {
|
|
1846
|
+
return true;
|
|
1847
|
+
}
|
|
1848
|
+
if (!role) {
|
|
1849
|
+
return false;
|
|
1850
|
+
}
|
|
1851
|
+
return roles.includes(role);
|
|
1852
|
+
};
|
|
1853
|
+
var asText = (value, fallback) => typeof value === "string" && value.trim().length > 0 ? value.trim() : fallback;
|
|
1854
|
+
var asID = (value) => {
|
|
1855
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
1856
|
+
return "";
|
|
1857
|
+
};
|
|
1858
|
+
var toTimestamp = (value) => {
|
|
1859
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
1860
|
+
return Number.NaN;
|
|
1861
|
+
}
|
|
1862
|
+
const timestamp = Date.parse(value);
|
|
1863
|
+
return Number.isFinite(timestamp) ? timestamp : Number.NaN;
|
|
1864
|
+
};
|
|
1865
|
+
var isRecent = (value) => {
|
|
1866
|
+
const timestamp = toTimestamp(value);
|
|
1867
|
+
return Number.isFinite(timestamp) && Date.now() - timestamp <= SEVEN_DAYS_MS;
|
|
1868
|
+
};
|
|
1869
|
+
var formatDateTime = (value) => {
|
|
1870
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
1871
|
+
return "Unknown time";
|
|
1872
|
+
}
|
|
1873
|
+
const date = new Date(value);
|
|
1874
|
+
if (Number.isNaN(date.getTime())) {
|
|
1875
|
+
return value;
|
|
1876
|
+
}
|
|
1877
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1878
|
+
dateStyle: "medium",
|
|
1879
|
+
timeStyle: "short"
|
|
1880
|
+
}).format(date);
|
|
1881
|
+
};
|
|
1882
|
+
var formatRelativeTime2 = (timestamp) => {
|
|
1883
|
+
if (!Number.isFinite(timestamp)) {
|
|
1884
|
+
return "Unknown time";
|
|
1885
|
+
}
|
|
1886
|
+
const diffMs = timestamp - Date.now();
|
|
1887
|
+
const diffMinutes = Math.round(diffMs / (60 * 1e3));
|
|
1888
|
+
const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
1889
|
+
if (Math.abs(diffMinutes) < 60) {
|
|
1890
|
+
return rtf.format(diffMinutes, "minute");
|
|
1891
|
+
}
|
|
1892
|
+
const diffHours = Math.round(diffMinutes / 60);
|
|
1893
|
+
if (Math.abs(diffHours) < 24) {
|
|
1894
|
+
return rtf.format(diffHours, "hour");
|
|
1895
|
+
}
|
|
1896
|
+
const diffDays = Math.round(diffHours / 24);
|
|
1897
|
+
return rtf.format(diffDays, "day");
|
|
1898
|
+
};
|
|
1899
|
+
var readSubmissionIdentity = (value) => {
|
|
1900
|
+
if (!value || typeof value !== "object") {
|
|
1901
|
+
return "New submission";
|
|
1902
|
+
}
|
|
1903
|
+
const data = value;
|
|
1904
|
+
const firstName = typeof data.firstName === "string" ? data.firstName.trim() : "";
|
|
1905
|
+
const lastName = typeof data.lastName === "string" ? data.lastName.trim() : "";
|
|
1906
|
+
const name = typeof data.name === "string" ? data.name.trim() : "";
|
|
1907
|
+
const email = typeof data.email === "string" ? data.email.trim() : typeof data.contactEmail === "string" ? data.contactEmail.trim() : "";
|
|
1908
|
+
const fullName = [firstName, lastName].filter(Boolean).join(" ").trim();
|
|
1909
|
+
return fullName || name || email || "New submission";
|
|
1910
|
+
};
|
|
1911
|
+
var getFormID = (value) => {
|
|
1912
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
1913
|
+
if (value && typeof value === "object") {
|
|
1914
|
+
const nestedID = value.id;
|
|
1915
|
+
if (typeof nestedID === "string" || typeof nestedID === "number") return String(nestedID);
|
|
1916
|
+
}
|
|
1917
|
+
return "";
|
|
1918
|
+
};
|
|
1919
|
+
var getFormTitle = (value) => {
|
|
1920
|
+
if (!value || typeof value !== "object") {
|
|
1921
|
+
return "";
|
|
1922
|
+
}
|
|
1923
|
+
const title = value.title;
|
|
1924
|
+
if (typeof title === "string" && title.trim().length > 0) {
|
|
1925
|
+
return title.trim();
|
|
1926
|
+
}
|
|
1927
|
+
const slug = value.slug;
|
|
1928
|
+
return typeof slug === "string" && slug.trim().length > 0 ? slug.trim() : "";
|
|
1929
|
+
};
|
|
1930
|
+
var buildSearchParams = (params) => new URLSearchParams(
|
|
1931
|
+
Object.entries(params).filter(([, value]) => typeof value === "string" && value.length > 0)
|
|
1932
|
+
).toString();
|
|
1933
|
+
async function loadCollection(path) {
|
|
1934
|
+
const response = await fetch(path, {
|
|
1935
|
+
cache: "no-store",
|
|
1936
|
+
credentials: "include"
|
|
1937
|
+
});
|
|
1938
|
+
if (!response.ok) {
|
|
1939
|
+
const body = await response.text();
|
|
1940
|
+
throw new Error(body || `Request failed: ${response.status}`);
|
|
1941
|
+
}
|
|
1942
|
+
return await response.json();
|
|
1943
|
+
}
|
|
1944
|
+
async function loadPages(collectionSlug) {
|
|
1945
|
+
const params = buildSearchParams({
|
|
1946
|
+
depth: "0",
|
|
1947
|
+
draft: "true",
|
|
1948
|
+
limit: "200",
|
|
1949
|
+
sort: "-updatedAt"
|
|
1950
|
+
});
|
|
1951
|
+
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
1952
|
+
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
1953
|
+
return {
|
|
1954
|
+
draftCount: docs.filter((doc) => doc._status === "draft").length,
|
|
1955
|
+
recent: docs.slice(0, 8),
|
|
1956
|
+
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
1957
|
+
updatedThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
1958
|
+
};
|
|
1959
|
+
}
|
|
1960
|
+
async function loadForms(formsCollectionSlug, submissionsCollectionSlug) {
|
|
1961
|
+
const [formsResult, submissionsResult] = await Promise.all([
|
|
1962
|
+
loadCollection(
|
|
1963
|
+
`/api/${formsCollectionSlug}?${buildSearchParams({
|
|
1964
|
+
depth: "0",
|
|
1965
|
+
draft: "true",
|
|
1966
|
+
limit: "80",
|
|
1967
|
+
sort: "-updatedAt"
|
|
1968
|
+
})}`
|
|
1969
|
+
),
|
|
1970
|
+
loadCollection(
|
|
1971
|
+
`/api/${submissionsCollectionSlug}?${buildSearchParams({
|
|
1972
|
+
depth: "1",
|
|
1973
|
+
limit: "40",
|
|
1974
|
+
sort: "-submittedAt"
|
|
1975
|
+
})}`
|
|
1976
|
+
)
|
|
1977
|
+
]);
|
|
1978
|
+
const forms = Array.isArray(formsResult.docs) ? formsResult.docs : [];
|
|
1979
|
+
const recentSubmissions = Array.isArray(submissionsResult.docs) ? submissionsResult.docs : [];
|
|
1980
|
+
const submissionsByForm = /* @__PURE__ */ new Map();
|
|
1981
|
+
for (const submission of recentSubmissions) {
|
|
1982
|
+
const formID = getFormID(submission.form);
|
|
1983
|
+
if (!formID) continue;
|
|
1984
|
+
submissionsByForm.set(formID, (submissionsByForm.get(formID) || 0) + 1);
|
|
1985
|
+
}
|
|
1986
|
+
let busiestFormTitle = null;
|
|
1987
|
+
let busiestFormCount = 0;
|
|
1988
|
+
for (const form of forms) {
|
|
1989
|
+
const formID = asID(form.id);
|
|
1990
|
+
if (!formID) continue;
|
|
1991
|
+
const submissionCount = submissionsByForm.get(formID) || 0;
|
|
1992
|
+
if (submissionCount > busiestFormCount) {
|
|
1993
|
+
busiestFormCount = submissionCount;
|
|
1994
|
+
busiestFormTitle = asText(form.title, "Untitled form");
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
return {
|
|
1998
|
+
busiestFormTitle,
|
|
1999
|
+
forms,
|
|
2000
|
+
recentSubmissions,
|
|
2001
|
+
submissionsThisWeek: recentSubmissions.filter((submission) => isRecent(submission.submittedAt)).length,
|
|
2002
|
+
totalForms: typeof formsResult.totalDocs === "number" ? formsResult.totalDocs : forms.length
|
|
2003
|
+
};
|
|
2004
|
+
}
|
|
2005
|
+
async function loadMedia(collectionSlug) {
|
|
2006
|
+
const params = buildSearchParams({
|
|
2007
|
+
depth: "0",
|
|
2008
|
+
limit: "24",
|
|
2009
|
+
sort: "-updatedAt"
|
|
2010
|
+
});
|
|
2011
|
+
const result = await loadCollection(`/api/${collectionSlug}?${params}`);
|
|
2012
|
+
const docs = Array.isArray(result.docs) ? result.docs : [];
|
|
2013
|
+
return {
|
|
2014
|
+
recent: docs.slice(0, 8),
|
|
2015
|
+
total: typeof result.totalDocs === "number" ? result.totalDocs : docs.length,
|
|
2016
|
+
uploadsThisWeek: docs.filter((doc) => isRecent(doc.updatedAt)).length
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
var loadingState = {
|
|
2020
|
+
forms: null,
|
|
2021
|
+
media: { status: "loading" },
|
|
2022
|
+
pages: { status: "loading" }
|
|
2023
|
+
};
|
|
2024
|
+
function ModuleStatus({ message }) {
|
|
2025
|
+
return /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-inline-note", children: message });
|
|
2026
|
+
}
|
|
2027
|
+
function EmptyState2({
|
|
2028
|
+
body,
|
|
2029
|
+
title
|
|
2030
|
+
}) {
|
|
2031
|
+
return /* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-empty-state", children: [
|
|
2032
|
+
/* @__PURE__ */ jsx16("strong", { children: title }),
|
|
2033
|
+
/* @__PURE__ */ jsx16("span", { children: body })
|
|
2034
|
+
] });
|
|
2035
|
+
}
|
|
2036
|
+
function SnapshotMetric({ card }) {
|
|
2037
|
+
return /* @__PURE__ */ jsxs14("article", { className: "orion-dashboard-snapshot-card", children: [
|
|
2038
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-snapshot-kicker", children: card.kicker }),
|
|
2039
|
+
/* @__PURE__ */ jsx16("strong", { children: card.value }),
|
|
2040
|
+
/* @__PURE__ */ jsx16("p", { children: card.detail })
|
|
2041
|
+
] });
|
|
2042
|
+
}
|
|
2043
|
+
function AdminStudioDashboardClient({
|
|
2044
|
+
formSubmissionsCollectionSlug,
|
|
2045
|
+
formsCollectionSlug,
|
|
2046
|
+
formsEnabled,
|
|
2047
|
+
formsPath,
|
|
2048
|
+
globalsBasePath,
|
|
2049
|
+
mediaCollectionSlug,
|
|
2050
|
+
mediaPath,
|
|
2051
|
+
pagesCollectionSlug,
|
|
2052
|
+
pagesPath,
|
|
2053
|
+
sectionLinks,
|
|
2054
|
+
toolsPath,
|
|
2055
|
+
userRole,
|
|
2056
|
+
children
|
|
2057
|
+
}) {
|
|
2058
|
+
const role = isRole(userRole) ? userRole : void 0;
|
|
2059
|
+
const [state, setState] = useState7(
|
|
2060
|
+
() => formsEnabled && canReviewForms(role) ? {
|
|
2061
|
+
forms: { status: "loading" },
|
|
2062
|
+
media: { status: "loading" },
|
|
2063
|
+
pages: { status: "loading" }
|
|
2064
|
+
} : loadingState
|
|
2065
|
+
);
|
|
2066
|
+
useEffect7(() => {
|
|
2067
|
+
let cancelled = false;
|
|
2068
|
+
const run = async () => {
|
|
2069
|
+
const includeForms = formsEnabled && canReviewForms(role);
|
|
2070
|
+
startTransition(() => {
|
|
2071
|
+
setState({
|
|
2072
|
+
forms: includeForms ? { status: "loading" } : null,
|
|
2073
|
+
media: { status: "loading" },
|
|
2074
|
+
pages: { status: "loading" }
|
|
2075
|
+
});
|
|
2076
|
+
});
|
|
2077
|
+
const [pagesResult, formsResult, mediaResult] = await Promise.allSettled([
|
|
2078
|
+
loadPages(pagesCollectionSlug),
|
|
2079
|
+
includeForms ? loadForms(formsCollectionSlug, formSubmissionsCollectionSlug) : Promise.resolve(null),
|
|
2080
|
+
loadMedia(mediaCollectionSlug)
|
|
2081
|
+
]);
|
|
2082
|
+
if (cancelled) return;
|
|
2083
|
+
startTransition(() => {
|
|
2084
|
+
setState({
|
|
2085
|
+
forms: includeForms && formsResult.status === "rejected" ? {
|
|
2086
|
+
error: formsResult.reason instanceof Error ? formsResult.reason.message : "Unable to load form activity.",
|
|
2087
|
+
status: "error"
|
|
2088
|
+
} : includeForms && formsResult.status === "fulfilled" && formsResult.value ? {
|
|
2089
|
+
data: formsResult.value,
|
|
2090
|
+
status: "success"
|
|
2091
|
+
} : null,
|
|
2092
|
+
media: mediaResult.status === "rejected" ? {
|
|
2093
|
+
error: mediaResult.reason instanceof Error ? mediaResult.reason.message : "Unable to load media activity.",
|
|
2094
|
+
status: "error"
|
|
2095
|
+
} : {
|
|
2096
|
+
data: mediaResult.value,
|
|
2097
|
+
status: "success"
|
|
2098
|
+
},
|
|
2099
|
+
pages: pagesResult.status === "rejected" ? {
|
|
2100
|
+
error: pagesResult.reason instanceof Error ? pagesResult.reason.message : "Unable to load page activity.",
|
|
2101
|
+
status: "error"
|
|
2102
|
+
} : {
|
|
2103
|
+
data: pagesResult.value,
|
|
2104
|
+
status: "success"
|
|
2105
|
+
}
|
|
2106
|
+
});
|
|
2107
|
+
});
|
|
2108
|
+
};
|
|
2109
|
+
void run();
|
|
2110
|
+
return () => {
|
|
2111
|
+
cancelled = true;
|
|
2112
|
+
};
|
|
2113
|
+
}, [
|
|
2114
|
+
formSubmissionsCollectionSlug,
|
|
2115
|
+
formsCollectionSlug,
|
|
2116
|
+
formsEnabled,
|
|
2117
|
+
mediaCollectionSlug,
|
|
2118
|
+
pagesCollectionSlug,
|
|
2119
|
+
role
|
|
2120
|
+
]);
|
|
2121
|
+
const visibleWorkspaceLinks = useMemo3(
|
|
2122
|
+
() => sectionLinks.filter((section) => canAccess(role, section.roles)),
|
|
2123
|
+
[role, sectionLinks]
|
|
2124
|
+
);
|
|
2125
|
+
const activityItems = useMemo3(() => {
|
|
2126
|
+
const items = [];
|
|
2127
|
+
if (state.pages.status === "success") {
|
|
2128
|
+
for (const doc of state.pages.data.recent) {
|
|
2129
|
+
const id = asID(doc.id);
|
|
2130
|
+
if (!id) continue;
|
|
2131
|
+
const timestamp = toTimestamp(doc.updatedAt);
|
|
2132
|
+
items.push({
|
|
2133
|
+
href: `${pagesPath}/${id}`,
|
|
2134
|
+
id: `page-${id}`,
|
|
2135
|
+
kind: "page",
|
|
2136
|
+
label: typeof doc._status === "string" ? doc._status : "page",
|
|
2137
|
+
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
2138
|
+
timestamp,
|
|
2139
|
+
title: asText(doc.title, "Untitled page")
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
if (state.forms?.status === "success") {
|
|
2144
|
+
for (const submission of state.forms.data.recentSubmissions) {
|
|
2145
|
+
const id = asID(submission.id);
|
|
2146
|
+
const formID = getFormID(submission.form);
|
|
2147
|
+
if (!id || !formID) continue;
|
|
2148
|
+
const timestamp = toTimestamp(submission.submittedAt);
|
|
2149
|
+
const formTitle = getFormTitle(submission.form) || "Form response";
|
|
2150
|
+
items.push({
|
|
2151
|
+
href: `${formsPath}?form=${encodeURIComponent(formID)}`,
|
|
2152
|
+
id: `submission-${id}`,
|
|
2153
|
+
kind: "submission",
|
|
2154
|
+
label: formTitle,
|
|
2155
|
+
meta: Number.isFinite(timestamp) ? `${readSubmissionIdentity(submission.data)} \xB7 ${formatDateTime(submission.submittedAt)}` : readSubmissionIdentity(submission.data),
|
|
2156
|
+
timestamp,
|
|
2157
|
+
title: "New submission"
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
if (state.media.status === "success") {
|
|
2162
|
+
for (const doc of state.media.data.recent) {
|
|
2163
|
+
const id = asID(doc.id);
|
|
2164
|
+
if (!id) continue;
|
|
2165
|
+
const timestamp = toTimestamp(doc.updatedAt);
|
|
2166
|
+
items.push({
|
|
2167
|
+
href: `${mediaPath}/${id}`,
|
|
2168
|
+
id: `media-${id}`,
|
|
2169
|
+
kind: "media",
|
|
2170
|
+
label: asText(doc.mimeType, "Media asset"),
|
|
2171
|
+
meta: Number.isFinite(timestamp) ? formatDateTime(doc.updatedAt) : "Update time unavailable",
|
|
2172
|
+
timestamp,
|
|
2173
|
+
title: asText(doc.filename, "Untitled asset")
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
return items.filter((item) => Number.isFinite(item.timestamp)).sort((a, b) => b.timestamp - a.timestamp).slice(0, 10);
|
|
2178
|
+
}, [formsPath, mediaPath, pagesPath, state.forms, state.media, state.pages]);
|
|
2179
|
+
const attentionItems = useMemo3(() => {
|
|
2180
|
+
if (role === "client") {
|
|
2181
|
+
const items2 = [];
|
|
2182
|
+
if (state.pages.status === "success" && state.pages.data.updatedThisWeek > 0) {
|
|
2183
|
+
items2.push({
|
|
2184
|
+
href: pagesPath,
|
|
2185
|
+
id: "pages-updated",
|
|
2186
|
+
label: `${state.pages.data.updatedThisWeek} page${state.pages.data.updatedThisWeek === 1 ? "" : "s"} changed in the last 7 days.`
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2189
|
+
if (state.media.status === "success" && state.media.data.uploadsThisWeek > 0) {
|
|
2190
|
+
items2.push({
|
|
2191
|
+
href: mediaPath,
|
|
2192
|
+
id: "media-updated",
|
|
2193
|
+
label: `${state.media.data.uploadsThisWeek} new media asset${state.media.data.uploadsThisWeek === 1 ? "" : "s"} landed this week.`
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
return items2;
|
|
2197
|
+
}
|
|
2198
|
+
const items = [];
|
|
2199
|
+
if (state.pages.status === "success" && state.pages.data.draftCount > 0) {
|
|
2200
|
+
items.push({
|
|
2201
|
+
href: pagesPath,
|
|
2202
|
+
id: "draft-pages",
|
|
2203
|
+
label: `${state.pages.data.draftCount} page${state.pages.data.draftCount === 1 ? "" : "s"} still need publishing review.`,
|
|
2204
|
+
tone: "accent"
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
if (state.forms?.status === "success" && state.forms.data.submissionsThisWeek > 0) {
|
|
2208
|
+
items.push({
|
|
2209
|
+
href: formsPath,
|
|
2210
|
+
id: "recent-submissions",
|
|
2211
|
+
label: `${state.forms.data.submissionsThisWeek} form submission${state.forms.data.submissionsThisWeek === 1 ? "" : "s"} arrived in the last 7 days.`,
|
|
2212
|
+
tone: "accent"
|
|
2213
|
+
});
|
|
2214
|
+
}
|
|
2215
|
+
if (state.media.status === "success" && state.media.data.total === 0) {
|
|
2216
|
+
items.push({
|
|
2217
|
+
href: mediaPath,
|
|
2218
|
+
id: "empty-media",
|
|
2219
|
+
label: "The media library is still empty. Add brand assets before content expands."
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
if (state.pages.status === "error") {
|
|
2223
|
+
items.push({
|
|
2224
|
+
href: pagesPath,
|
|
2225
|
+
id: "pages-error",
|
|
2226
|
+
label: "Page activity could not be loaded for the dashboard.",
|
|
2227
|
+
tone: "muted"
|
|
2228
|
+
});
|
|
2229
|
+
}
|
|
2230
|
+
if (state.forms?.status === "error") {
|
|
2231
|
+
items.push({
|
|
2232
|
+
href: formsPath,
|
|
2233
|
+
id: "forms-error",
|
|
2234
|
+
label: "Form activity could not be loaded for the dashboard.",
|
|
2235
|
+
tone: "muted"
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
if (state.media.status === "error") {
|
|
2239
|
+
items.push({
|
|
2240
|
+
href: mediaPath,
|
|
2241
|
+
id: "media-error",
|
|
2242
|
+
label: "Media activity could not be loaded for the dashboard.",
|
|
2243
|
+
tone: "muted"
|
|
2244
|
+
});
|
|
2245
|
+
}
|
|
2246
|
+
return items;
|
|
2247
|
+
}, [formsPath, mediaPath, pagesPath, role, state.forms, state.media, state.pages]);
|
|
2248
|
+
const snapshotCards = useMemo3(() => {
|
|
2249
|
+
const cards = [];
|
|
2250
|
+
if (state.pages.status === "success") {
|
|
2251
|
+
cards.push(
|
|
2252
|
+
role === "client" ? {
|
|
2253
|
+
detail: `${state.pages.data.updatedThisWeek} updated this week`,
|
|
2254
|
+
kicker: "Pages",
|
|
2255
|
+
value: `${state.pages.data.total}`
|
|
2256
|
+
} : {
|
|
2257
|
+
detail: `${state.pages.data.draftCount} draft${state.pages.data.draftCount === 1 ? "" : "s"} waiting`,
|
|
2258
|
+
kicker: "Pages",
|
|
2259
|
+
value: `${state.pages.data.total}`
|
|
2260
|
+
}
|
|
2261
|
+
);
|
|
2262
|
+
}
|
|
2263
|
+
if (state.forms?.status === "success") {
|
|
2264
|
+
cards.push({
|
|
2265
|
+
detail: state.forms.data.busiestFormTitle ? `Most active: ${state.forms.data.busiestFormTitle}` : "Waiting on the first submission",
|
|
2266
|
+
kicker: "Forms",
|
|
2267
|
+
value: `${state.forms.data.submissionsThisWeek}`
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
if (state.media.status === "success") {
|
|
2271
|
+
cards.push({
|
|
2272
|
+
detail: `${state.media.data.uploadsThisWeek} uploaded this week`,
|
|
2273
|
+
kicker: "Media",
|
|
2274
|
+
value: `${state.media.data.total}`
|
|
2275
|
+
});
|
|
2276
|
+
}
|
|
2277
|
+
cards.push({
|
|
2278
|
+
detail: `${visibleWorkspaceLinks.length} section${visibleWorkspaceLinks.length === 1 ? "" : "s"} available`,
|
|
2279
|
+
kicker: "Workspace",
|
|
2280
|
+
value: role ? role.toUpperCase() : "CMS"
|
|
2281
|
+
});
|
|
2282
|
+
return cards.slice(0, 4);
|
|
2283
|
+
}, [role, state.forms, state.media, state.pages, visibleWorkspaceLinks.length]);
|
|
2284
|
+
const primaryActions = useMemo3(() => {
|
|
2285
|
+
const actions = [];
|
|
2286
|
+
if (canCreatePages(role)) {
|
|
2287
|
+
actions.push({
|
|
2288
|
+
description: "Create or revise content in the visual builder.",
|
|
2289
|
+
href: `${pagesPath}/new`,
|
|
2290
|
+
label: "New Page"
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
actions.push({
|
|
2294
|
+
description: "Review live pages and recent edits.",
|
|
2295
|
+
href: pagesPath,
|
|
2296
|
+
label: "Open Pages",
|
|
2297
|
+
tone: "ghost"
|
|
2298
|
+
});
|
|
2299
|
+
if (formsEnabled && canReviewForms(role)) {
|
|
2300
|
+
actions.push({
|
|
2301
|
+
description: "Check submissions and form performance.",
|
|
2302
|
+
href: formsPath,
|
|
2303
|
+
label: "Review Forms",
|
|
2304
|
+
tone: "soft"
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2307
|
+
actions.push({
|
|
2308
|
+
description: "Update site settings, navigation, and footer content.",
|
|
2309
|
+
href: globalsBasePath,
|
|
2310
|
+
label: "Open Globals",
|
|
2311
|
+
tone: "ghost"
|
|
2312
|
+
});
|
|
2313
|
+
actions.push({
|
|
2314
|
+
description: "Upload or organize brand and campaign assets.",
|
|
2315
|
+
href: mediaPath,
|
|
2316
|
+
label: "Manage Media",
|
|
2317
|
+
tone: "ghost"
|
|
2318
|
+
});
|
|
2319
|
+
if (role === "admin") {
|
|
2320
|
+
actions.push({
|
|
2321
|
+
description: "Manage users, roles, and fallback tools.",
|
|
2322
|
+
href: toolsPath,
|
|
2323
|
+
label: "Admin Tools",
|
|
2324
|
+
tone: "ghost"
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
return actions;
|
|
2328
|
+
}, [formsEnabled, formsPath, globalsBasePath, mediaPath, pagesPath, role, toolsPath]);
|
|
2329
|
+
const attentionTitle = role === "client" ? "What Changed" : "Needs Attention";
|
|
2330
|
+
const attentionDescription = role === "client" ? "A quick read on recent content and asset changes." : "The highest-signal items that still need review.";
|
|
2331
|
+
return /* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-layout", children: [
|
|
2332
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--attention", children: [
|
|
2333
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2334
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2335
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: attentionTitle }),
|
|
2336
|
+
/* @__PURE__ */ jsx16("h2", { children: attentionDescription })
|
|
2337
|
+
] }),
|
|
2338
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-meta", children: "Last 7 days" })
|
|
2339
|
+
] }),
|
|
2340
|
+
attentionItems.length > 0 ? /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-attention-list", children: attentionItems.map(
|
|
2341
|
+
(item) => item.href ? /* @__PURE__ */ jsxs14(
|
|
2342
|
+
Link,
|
|
2343
|
+
{
|
|
2344
|
+
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
2345
|
+
href: item.href,
|
|
2346
|
+
children: [
|
|
2347
|
+
/* @__PURE__ */ jsx16("strong", { children: item.label }),
|
|
2348
|
+
/* @__PURE__ */ jsx16("span", { children: "Open" })
|
|
2349
|
+
]
|
|
2350
|
+
},
|
|
2351
|
+
item.id
|
|
2352
|
+
) : /* @__PURE__ */ jsx16(
|
|
2353
|
+
"div",
|
|
2354
|
+
{
|
|
2355
|
+
className: ["orion-dashboard-attention-item", item.tone ? `is-${item.tone}` : ""].filter(Boolean).join(" "),
|
|
2356
|
+
children: /* @__PURE__ */ jsx16("strong", { children: item.label })
|
|
2357
|
+
},
|
|
2358
|
+
item.id
|
|
2359
|
+
)
|
|
2360
|
+
) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ jsx16(ModuleStatus, { message: "Loading attention items..." }) : /* @__PURE__ */ jsx16(
|
|
2361
|
+
EmptyState2,
|
|
2362
|
+
{
|
|
2363
|
+
body: role === "client" ? "No major changes landed during the current review window." : "No urgent follow-up surfaced from content, forms, or media activity.",
|
|
2364
|
+
title: "Everything looks steady"
|
|
2365
|
+
}
|
|
2366
|
+
)
|
|
2367
|
+
] }),
|
|
2368
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--actions", children: [
|
|
2369
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2370
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2371
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: "Quick Actions" }),
|
|
2372
|
+
/* @__PURE__ */ jsx16("h2", { children: "Jump into the work that matters most." })
|
|
2373
|
+
] }),
|
|
2374
|
+
/* @__PURE__ */ jsxs14("span", { className: "orion-dashboard-panel-meta", children: [
|
|
2375
|
+
role || "studio",
|
|
2376
|
+
" mode"
|
|
2377
|
+
] })
|
|
2378
|
+
] }),
|
|
2379
|
+
/* @__PURE__ */ jsx16("div", { className: "orion-dashboard-action-list", children: primaryActions.map((action) => /* @__PURE__ */ jsxs14(
|
|
2380
|
+
Link,
|
|
2381
|
+
{
|
|
2382
|
+
className: [
|
|
2383
|
+
"orion-dashboard-action",
|
|
2384
|
+
action.tone === "ghost" ? "is-ghost" : action.tone === "soft" ? "is-soft" : ""
|
|
2385
|
+
].filter(Boolean).join(" "),
|
|
2386
|
+
href: action.href,
|
|
2387
|
+
children: [
|
|
2388
|
+
/* @__PURE__ */ jsx16("strong", { children: action.label }),
|
|
2389
|
+
/* @__PURE__ */ jsx16("span", { children: action.description })
|
|
2390
|
+
]
|
|
2391
|
+
},
|
|
2392
|
+
action.label
|
|
2393
|
+
)) }),
|
|
2394
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-workspace-strip", children: [
|
|
2395
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-workspace-label", children: "Workspace" }),
|
|
2396
|
+
/* @__PURE__ */ jsx16("div", { className: "orion-dashboard-workspace-pills", children: visibleWorkspaceLinks.map((section) => /* @__PURE__ */ jsx16(Link, { className: "orion-dashboard-workspace-pill", href: section.href, children: section.label }, section.id)) })
|
|
2397
|
+
] })
|
|
2398
|
+
] }),
|
|
2399
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--activity", children: [
|
|
2400
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2401
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2402
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: "Recent Activity" }),
|
|
2403
|
+
/* @__PURE__ */ jsx16("h2", { children: "The freshest edits, responses, and uploads across the studio." })
|
|
2404
|
+
] }),
|
|
2405
|
+
/* @__PURE__ */ jsxs14("span", { className: "orion-dashboard-panel-meta", children: [
|
|
2406
|
+
activityItems.length,
|
|
2407
|
+
" items"
|
|
2408
|
+
] })
|
|
2409
|
+
] }),
|
|
2410
|
+
activityItems.length > 0 ? /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-activity-list", children: activityItems.map((item) => /* @__PURE__ */ jsxs14(Link, { className: `orion-dashboard-activity-item is-${item.kind}`, href: item.href, children: [
|
|
2411
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-activity-copy", children: [
|
|
2412
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-activity-topline", children: [
|
|
2413
|
+
/* @__PURE__ */ jsx16("strong", { children: item.title }),
|
|
2414
|
+
/* @__PURE__ */ jsx16("span", { children: formatRelativeTime2(item.timestamp) })
|
|
2415
|
+
] }),
|
|
2416
|
+
/* @__PURE__ */ jsx16("p", { children: item.meta })
|
|
2417
|
+
] }),
|
|
2418
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-activity-pill", children: item.label })
|
|
2419
|
+
] }, item.id)) }) : state.pages.status === "loading" || state.media.status === "loading" ? /* @__PURE__ */ jsx16(ModuleStatus, { message: "Loading activity feed..." }) : /* @__PURE__ */ jsx16(
|
|
2420
|
+
EmptyState2,
|
|
2421
|
+
{
|
|
2422
|
+
body: "Recent page edits, submissions, and uploads will start stacking here as soon as the team gets moving.",
|
|
2423
|
+
title: "No recent activity yet"
|
|
2424
|
+
}
|
|
2425
|
+
)
|
|
2426
|
+
] }),
|
|
2427
|
+
/* @__PURE__ */ jsxs14("section", { className: "orion-dashboard-panel orion-dashboard-panel--snapshot", children: [
|
|
2428
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-panel-header", children: [
|
|
2429
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2430
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-kicker", children: "Business Snapshot" }),
|
|
2431
|
+
/* @__PURE__ */ jsx16("h2", { children: "A compact read on content momentum and performance." })
|
|
2432
|
+
] }),
|
|
2433
|
+
/* @__PURE__ */ jsx16("span", { className: "orion-dashboard-panel-meta", children: "30-day lens" })
|
|
2434
|
+
] }),
|
|
2435
|
+
/* @__PURE__ */ jsxs14("div", { className: "orion-dashboard-snapshot-grid", children: [
|
|
2436
|
+
snapshotCards.map((card) => /* @__PURE__ */ jsx16(SnapshotMetric, { card }, card.kicker)),
|
|
2437
|
+
children
|
|
2438
|
+
] }),
|
|
2439
|
+
state.pages.status === "error" || state.media.status === "error" ? /* @__PURE__ */ jsx16("div", { className: "orion-dashboard-inline-note", children: "Some dashboard modules could not be loaded. The rest of the workspace remains available." }) : null
|
|
2440
|
+
] })
|
|
2441
|
+
] });
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
2445
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2446
|
+
var DEFAULT_ADMIN_BASE_PATH2 = "/admin";
|
|
2447
|
+
var normalizePath2 = (value) => {
|
|
2448
|
+
if (!value || value === "/") return "/";
|
|
2449
|
+
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
2450
|
+
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
2451
|
+
return trimmed.length > 0 ? trimmed : "/";
|
|
2452
|
+
};
|
|
2453
|
+
var normalizeAdminBasePath2 = (value) => {
|
|
2454
|
+
const normalized = normalizePath2(value);
|
|
2455
|
+
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH2 : normalized;
|
|
2456
|
+
};
|
|
2457
|
+
var isAbsoluteExternalURL3 = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
2458
|
+
var resolveAdminPath2 = (adminBasePath, targetPath) => {
|
|
2459
|
+
if (!targetPath) return adminBasePath;
|
|
2460
|
+
if (isAbsoluteExternalURL3(targetPath)) return targetPath;
|
|
2461
|
+
const normalizedBasePath = normalizeAdminBasePath2(adminBasePath);
|
|
2462
|
+
const normalizedTargetPath = normalizePath2(targetPath);
|
|
2463
|
+
if (normalizedTargetPath === "/admin") {
|
|
2464
|
+
return normalizedBasePath;
|
|
2465
|
+
}
|
|
2466
|
+
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
2467
|
+
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
2468
|
+
}
|
|
2469
|
+
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
2470
|
+
return normalizedTargetPath;
|
|
2471
|
+
}
|
|
2472
|
+
if (normalizedTargetPath === "/") {
|
|
2473
|
+
return normalizedBasePath;
|
|
2474
|
+
}
|
|
2475
|
+
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
2476
|
+
};
|
|
2477
|
+
var getPropString2 = (props, key, fallback) => {
|
|
2478
|
+
if (!props || typeof props !== "object") return fallback;
|
|
2479
|
+
const direct = props[key];
|
|
2480
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
2481
|
+
const clientProps = props.clientProps;
|
|
2482
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2483
|
+
const nested = clientProps[key];
|
|
2484
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
2485
|
+
}
|
|
2486
|
+
return fallback;
|
|
2487
|
+
};
|
|
2488
|
+
var getPropBoolean2 = (props, key, fallback) => {
|
|
2489
|
+
if (!props || typeof props !== "object") return fallback;
|
|
2490
|
+
const direct = props[key];
|
|
2491
|
+
if (typeof direct === "boolean") return direct;
|
|
2492
|
+
const clientProps = props.clientProps;
|
|
2493
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2494
|
+
const nested = clientProps[key];
|
|
2495
|
+
if (typeof nested === "boolean") return nested;
|
|
2496
|
+
}
|
|
2497
|
+
return fallback;
|
|
2498
|
+
};
|
|
2499
|
+
var getPropSections2 = (props) => {
|
|
2500
|
+
if (!props || typeof props !== "object") return [];
|
|
2501
|
+
const direct = resolveStudioSections(props.sections);
|
|
2502
|
+
if (direct.length > 0) return direct;
|
|
2503
|
+
const clientProps = props.clientProps;
|
|
2504
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2505
|
+
return resolveStudioSections(clientProps.sections);
|
|
2506
|
+
}
|
|
2507
|
+
return [];
|
|
2508
|
+
};
|
|
2509
|
+
var readUserRole2 = (props) => {
|
|
2510
|
+
if (!props || typeof props !== "object") return void 0;
|
|
2511
|
+
const user = props.user;
|
|
2512
|
+
if (user && typeof user === "object") {
|
|
2513
|
+
const role = user.role;
|
|
2514
|
+
if (typeof role === "string") {
|
|
2515
|
+
return role;
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
const initPageResult = props.initPageResult;
|
|
2519
|
+
if (initPageResult && typeof initPageResult === "object") {
|
|
2520
|
+
const req = initPageResult.req;
|
|
2521
|
+
if (req && typeof req === "object") {
|
|
2522
|
+
const nestedUser = req.user;
|
|
2523
|
+
if (nestedUser && typeof nestedUser === "object") {
|
|
2524
|
+
const role = nestedUser.role;
|
|
2525
|
+
if (typeof role === "string") {
|
|
2526
|
+
return role;
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
return void 0;
|
|
2532
|
+
};
|
|
2533
|
+
var readAdminBasePath = (props) => {
|
|
2534
|
+
if (!props || typeof props !== "object") {
|
|
2535
|
+
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2536
|
+
}
|
|
2537
|
+
const payloadLike = props.payload;
|
|
2538
|
+
if (payloadLike && typeof payloadLike === "object") {
|
|
2539
|
+
const config = payloadLike.config;
|
|
2540
|
+
const routes = config && typeof config === "object" ? config.routes : null;
|
|
2541
|
+
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
2542
|
+
if (typeof admin === "string" && admin.length > 0) {
|
|
2543
|
+
return normalizeAdminBasePath2(admin);
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
const initPageResult = props.initPageResult;
|
|
2547
|
+
if (initPageResult && typeof initPageResult === "object") {
|
|
2548
|
+
const req = initPageResult.req;
|
|
2549
|
+
if (req && typeof req === "object") {
|
|
2550
|
+
const nestedPayload = req.payload;
|
|
2551
|
+
if (nestedPayload && typeof nestedPayload === "object") {
|
|
2552
|
+
const config = nestedPayload.config;
|
|
2553
|
+
const routes = config && typeof config === "object" ? config.routes : null;
|
|
2554
|
+
const admin = routes && typeof routes === "object" ? routes.admin : null;
|
|
2555
|
+
if (typeof admin === "string" && admin.length > 0) {
|
|
2556
|
+
return normalizeAdminBasePath2(admin);
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2562
|
+
};
|
|
2563
|
+
var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
|
|
2564
|
+
const links = [
|
|
2565
|
+
{
|
|
2566
|
+
href: resolveAdminPath2(adminBasePath, "/pages"),
|
|
2567
|
+
id: "pages",
|
|
2568
|
+
label: "Pages"
|
|
2569
|
+
},
|
|
2570
|
+
...formsEnabled ? [
|
|
2571
|
+
{
|
|
2572
|
+
href: resolveAdminPath2(adminBasePath, "/forms"),
|
|
2573
|
+
id: "forms",
|
|
2574
|
+
label: "Forms",
|
|
2575
|
+
roles: ["admin", "editor"]
|
|
2576
|
+
}
|
|
2577
|
+
] : [],
|
|
2578
|
+
{
|
|
2579
|
+
href: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
2580
|
+
id: "globals",
|
|
2581
|
+
label: "Globals"
|
|
2582
|
+
},
|
|
2583
|
+
{
|
|
2584
|
+
href: resolveAdminPath2(adminBasePath, "/media"),
|
|
2585
|
+
id: "media",
|
|
2586
|
+
label: "Media"
|
|
2587
|
+
},
|
|
2588
|
+
...sections.map((section) => ({
|
|
2589
|
+
href: resolveAdminPath2(adminBasePath, section.href),
|
|
2590
|
+
id: section.id,
|
|
2591
|
+
label: section.label,
|
|
2592
|
+
...section.roles ? { roles: section.roles } : {}
|
|
2593
|
+
})),
|
|
2594
|
+
{
|
|
2595
|
+
href: resolveAdminPath2(adminBasePath, "/tools"),
|
|
2596
|
+
id: "admin-tools",
|
|
2597
|
+
label: "Admin Tools",
|
|
2598
|
+
roles: ["admin"]
|
|
2599
|
+
}
|
|
2600
|
+
];
|
|
2601
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2602
|
+
return links.filter((link) => {
|
|
2603
|
+
if (seen.has(link.id)) {
|
|
2604
|
+
return false;
|
|
2605
|
+
}
|
|
2606
|
+
seen.add(link.id);
|
|
2607
|
+
return true;
|
|
2608
|
+
});
|
|
2609
|
+
};
|
|
2610
|
+
function AdminStudioDashboard(rawProps) {
|
|
2611
|
+
const props = rawProps || {};
|
|
2612
|
+
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
2613
|
+
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
2614
|
+
const sections = getPropSections2(props);
|
|
2615
|
+
const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
|
|
2616
|
+
const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
|
|
2617
|
+
const formSubmissionsCollectionSlug = getPropString2(
|
|
2618
|
+
props,
|
|
2619
|
+
"formSubmissionsCollectionSlug",
|
|
2620
|
+
"form-submissions"
|
|
2621
|
+
);
|
|
2622
|
+
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
2623
|
+
const adminBasePath = readAdminBasePath(props);
|
|
2624
|
+
const userRole = readUserRole2(props);
|
|
2625
|
+
const navProps = {
|
|
2626
|
+
brandName: getPropString2(props, "brandName", "Orion Studio"),
|
|
2627
|
+
formSubmissionsCollectionSlug,
|
|
2628
|
+
formsCollectionSlug,
|
|
2629
|
+
formsEnabled,
|
|
2630
|
+
globalsBasePath,
|
|
2631
|
+
logoUrl: getPropString2(props, "logoUrl", ""),
|
|
2632
|
+
mediaCollectionSlug,
|
|
2633
|
+
pagesCollectionSlug,
|
|
2634
|
+
sections
|
|
2635
|
+
};
|
|
2636
|
+
return /* @__PURE__ */ jsx17(StudioSectionLayout, { navProps, children: /* @__PURE__ */ jsx17(
|
|
2637
|
+
AdminPage,
|
|
2638
|
+
{
|
|
2639
|
+
breadcrumbs: [{ label: "Dashboard" }],
|
|
2640
|
+
description: "What needs attention, what changed recently, and how the site is performing.",
|
|
2641
|
+
title: "Studio",
|
|
2642
|
+
children: /* @__PURE__ */ jsx17(
|
|
2643
|
+
AdminStudioDashboardClient,
|
|
2644
|
+
{
|
|
2645
|
+
formSubmissionsCollectionSlug,
|
|
2646
|
+
formsCollectionSlug,
|
|
2647
|
+
formsEnabled,
|
|
2648
|
+
formsPath: resolveAdminPath2(adminBasePath, "/forms"),
|
|
2649
|
+
globalsBasePath: resolveAdminPath2(adminBasePath, globalsBasePath),
|
|
2650
|
+
mediaCollectionSlug,
|
|
2651
|
+
mediaPath: resolveAdminPath2(adminBasePath, "/media"),
|
|
2652
|
+
pagesCollectionSlug,
|
|
2653
|
+
pagesPath: resolveAdminPath2(adminBasePath, "/pages"),
|
|
2654
|
+
sectionLinks: buildSectionLinks(adminBasePath, sections, formsEnabled, globalsBasePath),
|
|
2655
|
+
toolsPath: resolveAdminPath2(adminBasePath, "/tools"),
|
|
2656
|
+
userRole
|
|
2657
|
+
}
|
|
2658
|
+
)
|
|
2659
|
+
}
|
|
2660
|
+
) });
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
2664
|
+
import { useEffect as useEffect8, useMemo as useMemo4, useState as useState8 } from "react";
|
|
2665
|
+
import Link2 from "next/link";
|
|
2666
|
+
import { useAuth as useAuth3 } from "@payloadcms/ui";
|
|
2667
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1843
2668
|
var isAdmin = (user) => {
|
|
1844
2669
|
if (!user || typeof user !== "object") return false;
|
|
1845
2670
|
const role = user.role;
|
|
1846
2671
|
return typeof role === "string" && role === "admin";
|
|
1847
2672
|
};
|
|
1848
|
-
var
|
|
2673
|
+
var getPropString3 = (props, key, fallback) => {
|
|
1849
2674
|
if (!props || typeof props !== "object") return fallback;
|
|
1850
2675
|
const direct = props[key];
|
|
1851
2676
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -1858,13 +2683,13 @@ var getPropString2 = (props, key, fallback) => {
|
|
|
1858
2683
|
};
|
|
1859
2684
|
function AdminStudioPagesListView(props) {
|
|
1860
2685
|
const { user } = useAuth3();
|
|
1861
|
-
const pagesCollectionSlug =
|
|
2686
|
+
const pagesCollectionSlug = getPropString3(props, "pagesCollectionSlug", "pages");
|
|
1862
2687
|
const adminBasePath = useAdminBasePath();
|
|
1863
2688
|
const newPagePath = resolveAdminPath(adminBasePath, "/pages/new");
|
|
1864
|
-
const [loading, setLoading] =
|
|
1865
|
-
const [error, setError] =
|
|
1866
|
-
const [docs, setDocs] =
|
|
1867
|
-
const apiURL =
|
|
2689
|
+
const [loading, setLoading] = useState8(true);
|
|
2690
|
+
const [error, setError] = useState8(null);
|
|
2691
|
+
const [docs, setDocs] = useState8([]);
|
|
2692
|
+
const apiURL = useMemo4(() => {
|
|
1868
2693
|
const params = new URLSearchParams({
|
|
1869
2694
|
depth: "0",
|
|
1870
2695
|
limit: "100",
|
|
@@ -1873,7 +2698,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1873
2698
|
});
|
|
1874
2699
|
return `/api/${pagesCollectionSlug}?${params.toString()}`;
|
|
1875
2700
|
}, [pagesCollectionSlug]);
|
|
1876
|
-
|
|
2701
|
+
useEffect8(() => {
|
|
1877
2702
|
let cancelled = false;
|
|
1878
2703
|
const run = async () => {
|
|
1879
2704
|
setLoading(true);
|
|
@@ -1903,10 +2728,10 @@ function AdminStudioPagesListView(props) {
|
|
|
1903
2728
|
cancelled = true;
|
|
1904
2729
|
};
|
|
1905
2730
|
}, [apiURL]);
|
|
1906
|
-
return /* @__PURE__ */
|
|
2731
|
+
return /* @__PURE__ */ jsx18(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs15(
|
|
1907
2732
|
AdminPage,
|
|
1908
2733
|
{
|
|
1909
|
-
actions: isAdmin(user) ? /* @__PURE__ */
|
|
2734
|
+
actions: isAdmin(user) ? /* @__PURE__ */ jsx18(Link2, { className: "orion-admin-action-button", href: newPagePath, children: "New Page" }) : null,
|
|
1910
2735
|
breadcrumbs: [
|
|
1911
2736
|
{ label: "Dashboard", href: adminBasePath },
|
|
1912
2737
|
{ label: "Pages" }
|
|
@@ -1914,21 +2739,21 @@ function AdminStudioPagesListView(props) {
|
|
|
1914
2739
|
description: "Open a page to edit it in the inline custom builder.",
|
|
1915
2740
|
title: "Pages",
|
|
1916
2741
|
children: [
|
|
1917
|
-
loading ? /* @__PURE__ */
|
|
1918
|
-
error ? /* @__PURE__ */
|
|
1919
|
-
/* @__PURE__ */
|
|
1920
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */
|
|
1921
|
-
/* @__PURE__ */
|
|
1922
|
-
/* @__PURE__ */
|
|
2742
|
+
loading ? /* @__PURE__ */ jsx18("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
2743
|
+
error ? /* @__PURE__ */ jsx18("div", { className: "orion-admin-error", children: error }) : null,
|
|
2744
|
+
/* @__PURE__ */ jsxs15("div", { className: "orion-admin-list", children: [
|
|
2745
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ jsxs15("div", { className: "orion-admin-card", children: [
|
|
2746
|
+
/* @__PURE__ */ jsx18("strong", { children: "No pages yet" }),
|
|
2747
|
+
/* @__PURE__ */ jsx18("span", { children: "Create the first page to start building content." })
|
|
1923
2748
|
] }) : null,
|
|
1924
2749
|
docs.map((doc) => {
|
|
1925
2750
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
1926
2751
|
if (!id) return null;
|
|
1927
2752
|
const title = typeof doc.title === "string" ? doc.title : "Untitled Page";
|
|
1928
2753
|
const status = typeof doc._status === "string" ? doc._status : "draft";
|
|
1929
|
-
return /* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
1931
|
-
/* @__PURE__ */
|
|
2754
|
+
return /* @__PURE__ */ jsxs15(Link2, { className: "orion-admin-list-item", href: resolveAdminPath(adminBasePath, `/pages/${id}`), children: [
|
|
2755
|
+
/* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsx18("strong", { children: title }) }),
|
|
2756
|
+
/* @__PURE__ */ jsx18("span", { className: "orion-admin-pill", children: status })
|
|
1932
2757
|
] }, id);
|
|
1933
2758
|
})
|
|
1934
2759
|
] })
|
|
@@ -1938,9 +2763,9 @@ function AdminStudioPagesListView(props) {
|
|
|
1938
2763
|
}
|
|
1939
2764
|
|
|
1940
2765
|
// src/admin/components/studio/AdminStudioPageEditView.tsx
|
|
1941
|
-
import { useEffect as
|
|
2766
|
+
import { useEffect as useEffect9, useMemo as useMemo5, useRef as useRef3, useState as useState9 } from "react";
|
|
1942
2767
|
import { SetStepNav, toast, useAuth as useAuth4 } from "@payloadcms/ui";
|
|
1943
|
-
import { Fragment as Fragment3, jsx as
|
|
2768
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1944
2769
|
var isAdmin2 = (user) => {
|
|
1945
2770
|
if (!user || typeof user !== "object") return false;
|
|
1946
2771
|
const role = user.role;
|
|
@@ -1951,7 +2776,7 @@ var isEditor = (user) => {
|
|
|
1951
2776
|
const role = user.role;
|
|
1952
2777
|
return typeof role === "string" && role === "editor";
|
|
1953
2778
|
};
|
|
1954
|
-
var
|
|
2779
|
+
var getPropString4 = (props, key, fallback) => {
|
|
1955
2780
|
if (!props || typeof props !== "object") return fallback;
|
|
1956
2781
|
const direct = props[key];
|
|
1957
2782
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -1981,17 +2806,17 @@ function AdminStudioPageEditView(props) {
|
|
|
1981
2806
|
const { user } = useAuth4();
|
|
1982
2807
|
const adminBasePath = useAdminBasePath();
|
|
1983
2808
|
const iframeRef = useRef3(null);
|
|
1984
|
-
const [saving, setSaving] =
|
|
1985
|
-
const [dirty, setDirty] =
|
|
1986
|
-
const [hasUnpublishedChanges, setHasUnpublishedChanges] =
|
|
1987
|
-
const [canUndo, setCanUndo] =
|
|
1988
|
-
const [canRedo, setCanRedo] =
|
|
1989
|
-
const builderBasePath =
|
|
2809
|
+
const [saving, setSaving] = useState9(null);
|
|
2810
|
+
const [dirty, setDirty] = useState9(false);
|
|
2811
|
+
const [hasUnpublishedChanges, setHasUnpublishedChanges] = useState9(false);
|
|
2812
|
+
const [canUndo, setCanUndo] = useState9(false);
|
|
2813
|
+
const [canRedo, setCanRedo] = useState9(false);
|
|
2814
|
+
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
1990
2815
|
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1991
|
-
const pageIDFromParams =
|
|
1992
|
-
const [pageID, setPageID] =
|
|
1993
|
-
const [didResolvePathFallback, setDidResolvePathFallback] =
|
|
1994
|
-
|
|
2816
|
+
const pageIDFromParams = useMemo5(() => getParam(props.params, "id"), [props.params]);
|
|
2817
|
+
const [pageID, setPageID] = useState9(pageIDFromParams);
|
|
2818
|
+
const [didResolvePathFallback, setDidResolvePathFallback] = useState9(false);
|
|
2819
|
+
useEffect9(() => {
|
|
1995
2820
|
if (pageIDFromParams) {
|
|
1996
2821
|
setPageID(pageIDFromParams);
|
|
1997
2822
|
setDidResolvePathFallback(true);
|
|
@@ -2035,7 +2860,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2035
2860
|
} catch {
|
|
2036
2861
|
}
|
|
2037
2862
|
};
|
|
2038
|
-
|
|
2863
|
+
useEffect9(() => {
|
|
2039
2864
|
if (!pageID) {
|
|
2040
2865
|
return;
|
|
2041
2866
|
}
|
|
@@ -2058,7 +2883,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2058
2883
|
}
|
|
2059
2884
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
2060
2885
|
};
|
|
2061
|
-
|
|
2886
|
+
useEffect9(() => {
|
|
2062
2887
|
const onMessage = (event) => {
|
|
2063
2888
|
const data = event.data;
|
|
2064
2889
|
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
@@ -2093,8 +2918,8 @@ function AdminStudioPageEditView(props) {
|
|
|
2093
2918
|
return () => window.removeEventListener("message", onMessage);
|
|
2094
2919
|
}, []);
|
|
2095
2920
|
if (!pageID && !didResolvePathFallback) {
|
|
2096
|
-
return /* @__PURE__ */
|
|
2097
|
-
/* @__PURE__ */
|
|
2921
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
2922
|
+
/* @__PURE__ */ jsx19(
|
|
2098
2923
|
SetStepNav,
|
|
2099
2924
|
{
|
|
2100
2925
|
nav: [
|
|
@@ -2103,13 +2928,13 @@ function AdminStudioPageEditView(props) {
|
|
|
2103
2928
|
]
|
|
2104
2929
|
}
|
|
2105
2930
|
),
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2931
|
+
/* @__PURE__ */ jsx19("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
2932
|
+
/* @__PURE__ */ jsx19("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading page editor..." })
|
|
2108
2933
|
] }) });
|
|
2109
2934
|
}
|
|
2110
2935
|
if (!pageID) {
|
|
2111
|
-
return /* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2936
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
2937
|
+
/* @__PURE__ */ jsx19(
|
|
2113
2938
|
SetStepNav,
|
|
2114
2939
|
{
|
|
2115
2940
|
nav: [
|
|
@@ -2118,12 +2943,12 @@ function AdminStudioPageEditView(props) {
|
|
|
2118
2943
|
]
|
|
2119
2944
|
}
|
|
2120
2945
|
),
|
|
2121
|
-
/* @__PURE__ */
|
|
2122
|
-
/* @__PURE__ */
|
|
2946
|
+
/* @__PURE__ */ jsx19("h1", { style: { margin: 0 }, children: "Page Editor" }),
|
|
2947
|
+
/* @__PURE__ */ jsx19("p", { style: { color: "var(--theme-elevation-600)" }, children: "Missing page ID." })
|
|
2123
2948
|
] }) });
|
|
2124
2949
|
}
|
|
2125
|
-
return /* @__PURE__ */
|
|
2126
|
-
/* @__PURE__ */
|
|
2950
|
+
return /* @__PURE__ */ jsx19(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
2951
|
+
/* @__PURE__ */ jsx19(
|
|
2127
2952
|
SetStepNav,
|
|
2128
2953
|
{
|
|
2129
2954
|
nav: [
|
|
@@ -2132,8 +2957,8 @@ function AdminStudioPageEditView(props) {
|
|
|
2132
2957
|
]
|
|
2133
2958
|
}
|
|
2134
2959
|
),
|
|
2135
|
-
/* @__PURE__ */
|
|
2136
|
-
/* @__PURE__ */
|
|
2960
|
+
/* @__PURE__ */ jsxs16("div", { style: { display: "grid", gridTemplateRows: "auto 1fr", height: "calc(100vh - 120px)" }, children: [
|
|
2961
|
+
/* @__PURE__ */ jsxs16(
|
|
2137
2962
|
"div",
|
|
2138
2963
|
{
|
|
2139
2964
|
style: {
|
|
@@ -2149,9 +2974,9 @@ function AdminStudioPageEditView(props) {
|
|
|
2149
2974
|
zIndex: 20
|
|
2150
2975
|
},
|
|
2151
2976
|
children: [
|
|
2152
|
-
/* @__PURE__ */
|
|
2153
|
-
/* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2977
|
+
/* @__PURE__ */ jsxs16("div", { style: { minWidth: 0 }, children: [
|
|
2978
|
+
/* @__PURE__ */ jsx19("div", { style: { fontWeight: 900 }, children: "Page Editor" }),
|
|
2979
|
+
/* @__PURE__ */ jsxs16(
|
|
2155
2980
|
"div",
|
|
2156
2981
|
{
|
|
2157
2982
|
style: {
|
|
@@ -2167,9 +2992,9 @@ function AdminStudioPageEditView(props) {
|
|
|
2167
2992
|
}
|
|
2168
2993
|
)
|
|
2169
2994
|
] }),
|
|
2170
|
-
/* @__PURE__ */
|
|
2171
|
-
/* @__PURE__ */
|
|
2172
|
-
/* @__PURE__ */
|
|
2995
|
+
/* @__PURE__ */ jsxs16("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
2996
|
+
/* @__PURE__ */ jsx19("div", { style: { color: dirty ? "var(--theme-elevation-900)" : "var(--theme-elevation-600)", fontSize: "0.85rem", fontWeight: 700 }, children: dirty ? "Unsaved changes" : "All changes saved" }),
|
|
2997
|
+
/* @__PURE__ */ jsx19(
|
|
2173
2998
|
"div",
|
|
2174
2999
|
{
|
|
2175
3000
|
style: {
|
|
@@ -2186,7 +3011,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2186
3011
|
children: hasUnpublishedChanges ? "Unpublished draft changes" : "Live is up to date"
|
|
2187
3012
|
}
|
|
2188
3013
|
),
|
|
2189
|
-
/* @__PURE__ */
|
|
3014
|
+
/* @__PURE__ */ jsx19(
|
|
2190
3015
|
"button",
|
|
2191
3016
|
{
|
|
2192
3017
|
disabled: !canUndo,
|
|
@@ -2202,7 +3027,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2202
3027
|
children: "Undo"
|
|
2203
3028
|
}
|
|
2204
3029
|
),
|
|
2205
|
-
/* @__PURE__ */
|
|
3030
|
+
/* @__PURE__ */ jsx19(
|
|
2206
3031
|
"button",
|
|
2207
3032
|
{
|
|
2208
3033
|
disabled: !canRedo,
|
|
@@ -2218,7 +3043,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2218
3043
|
children: "Redo"
|
|
2219
3044
|
}
|
|
2220
3045
|
),
|
|
2221
|
-
/* @__PURE__ */
|
|
3046
|
+
/* @__PURE__ */ jsx19(
|
|
2222
3047
|
"button",
|
|
2223
3048
|
{
|
|
2224
3049
|
disabled: saving !== null,
|
|
@@ -2234,7 +3059,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2234
3059
|
children: saving === "draft" ? "Saving\u2026" : "Save Draft"
|
|
2235
3060
|
}
|
|
2236
3061
|
),
|
|
2237
|
-
/* @__PURE__ */
|
|
3062
|
+
/* @__PURE__ */ jsx19(
|
|
2238
3063
|
"button",
|
|
2239
3064
|
{
|
|
2240
3065
|
disabled: !canPublish || saving !== null,
|
|
@@ -2257,7 +3082,7 @@ function AdminStudioPageEditView(props) {
|
|
|
2257
3082
|
]
|
|
2258
3083
|
}
|
|
2259
3084
|
),
|
|
2260
|
-
/* @__PURE__ */
|
|
3085
|
+
/* @__PURE__ */ jsx19(
|
|
2261
3086
|
"iframe",
|
|
2262
3087
|
{
|
|
2263
3088
|
ref: iframeRef,
|
|
@@ -2277,11 +3102,11 @@ function AdminStudioPageEditView(props) {
|
|
|
2277
3102
|
}
|
|
2278
3103
|
|
|
2279
3104
|
// src/admin/components/studio/AdminStudioNewPageView.tsx
|
|
2280
|
-
import { useState as
|
|
3105
|
+
import { useState as useState10 } from "react";
|
|
2281
3106
|
import { useAuth as useAuth5 } from "@payloadcms/ui";
|
|
2282
|
-
import { jsx as
|
|
3107
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2283
3108
|
var pageTemplates = ["standard", "landing", "services", "contact"];
|
|
2284
|
-
var
|
|
3109
|
+
var getPropString5 = (props, key, fallback) => {
|
|
2285
3110
|
if (!props || typeof props !== "object") return fallback;
|
|
2286
3111
|
const direct = props[key];
|
|
2287
3112
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -2301,11 +3126,11 @@ var slugify = (value) => value.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "")
|
|
|
2301
3126
|
function AdminStudioNewPageView(props) {
|
|
2302
3127
|
const { user } = useAuth5();
|
|
2303
3128
|
const adminBasePath = useAdminBasePath();
|
|
2304
|
-
const pagesCollectionSlug =
|
|
2305
|
-
const [submitting, setSubmitting] =
|
|
2306
|
-
const [error, setError] =
|
|
3129
|
+
const pagesCollectionSlug = getPropString5(props, "pagesCollectionSlug", "pages");
|
|
3130
|
+
const [submitting, setSubmitting] = useState10(false);
|
|
3131
|
+
const [error, setError] = useState10(null);
|
|
2307
3132
|
if (!canManagePages(user)) {
|
|
2308
|
-
return /* @__PURE__ */
|
|
3133
|
+
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx20(
|
|
2309
3134
|
AdminPage,
|
|
2310
3135
|
{
|
|
2311
3136
|
breadcrumbs: [
|
|
@@ -2315,9 +3140,9 @@ function AdminStudioNewPageView(props) {
|
|
|
2315
3140
|
],
|
|
2316
3141
|
description: "You do not have access to create pages.",
|
|
2317
3142
|
title: "New Page",
|
|
2318
|
-
children: /* @__PURE__ */
|
|
2319
|
-
/* @__PURE__ */
|
|
2320
|
-
/* @__PURE__ */
|
|
3143
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "orion-admin-card", children: [
|
|
3144
|
+
/* @__PURE__ */ jsx20("strong", { children: "Access denied" }),
|
|
3145
|
+
/* @__PURE__ */ jsx20("span", { children: "This section is restricted to administrator and editor accounts." })
|
|
2321
3146
|
] })
|
|
2322
3147
|
}
|
|
2323
3148
|
) });
|
|
@@ -2362,7 +3187,7 @@ function AdminStudioNewPageView(props) {
|
|
|
2362
3187
|
setSubmitting(false);
|
|
2363
3188
|
}
|
|
2364
3189
|
};
|
|
2365
|
-
return /* @__PURE__ */
|
|
3190
|
+
return /* @__PURE__ */ jsx20(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx20(
|
|
2366
3191
|
AdminPage,
|
|
2367
3192
|
{
|
|
2368
3193
|
breadcrumbs: [
|
|
@@ -2372,33 +3197,33 @@ function AdminStudioNewPageView(props) {
|
|
|
2372
3197
|
],
|
|
2373
3198
|
description: "Create a new page and open it in the custom editor.",
|
|
2374
3199
|
title: "New Page",
|
|
2375
|
-
children: /* @__PURE__ */
|
|
2376
|
-
error ? /* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
3200
|
+
children: /* @__PURE__ */ jsxs17("form", { className: "orion-admin-form", onSubmit: createPage, children: [
|
|
3201
|
+
error ? /* @__PURE__ */ jsx20("div", { className: "orion-admin-error", children: error }) : null,
|
|
3202
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
2378
3203
|
"Title",
|
|
2379
|
-
/* @__PURE__ */
|
|
3204
|
+
/* @__PURE__ */ jsx20("input", { name: "title", placeholder: "Services", required: true, type: "text" })
|
|
2380
3205
|
] }),
|
|
2381
|
-
/* @__PURE__ */
|
|
3206
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
2382
3207
|
"Slug",
|
|
2383
|
-
/* @__PURE__ */
|
|
3208
|
+
/* @__PURE__ */ jsx20("input", { name: "slug", placeholder: "services", type: "text" })
|
|
2384
3209
|
] }),
|
|
2385
|
-
/* @__PURE__ */
|
|
3210
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
2386
3211
|
"Template",
|
|
2387
|
-
/* @__PURE__ */
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
/* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsxs17("select", { defaultValue: "standard", name: "template", children: [
|
|
3213
|
+
/* @__PURE__ */ jsx20("option", { value: "standard", children: "Standard" }),
|
|
3214
|
+
/* @__PURE__ */ jsx20("option", { value: "landing", children: "Landing" }),
|
|
3215
|
+
/* @__PURE__ */ jsx20("option", { value: "contact", children: "Contact" }),
|
|
3216
|
+
/* @__PURE__ */ jsx20("option", { value: "services", children: "Services" })
|
|
2392
3217
|
] })
|
|
2393
3218
|
] }),
|
|
2394
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ jsx20("button", { disabled: submitting, type: "submit", children: submitting ? "Creating..." : "Create Page" })
|
|
2395
3220
|
] })
|
|
2396
3221
|
}
|
|
2397
3222
|
) });
|
|
2398
3223
|
}
|
|
2399
3224
|
|
|
2400
3225
|
// src/admin/components/studio/AdminStudioGlobalsView.tsx
|
|
2401
|
-
import { jsx as
|
|
3226
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2402
3227
|
var getPropGlobals = (props) => {
|
|
2403
3228
|
if (!props || typeof props !== "object") return null;
|
|
2404
3229
|
const direct = props.globals;
|
|
@@ -2418,7 +3243,7 @@ function AdminStudioGlobalsView(props) {
|
|
|
2418
3243
|
{ slug: "footer", label: "Footer" },
|
|
2419
3244
|
{ slug: "social-media", label: "Social Media" }
|
|
2420
3245
|
];
|
|
2421
|
-
return /* @__PURE__ */
|
|
3246
|
+
return /* @__PURE__ */ jsx21(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx21(
|
|
2422
3247
|
AdminPage,
|
|
2423
3248
|
{
|
|
2424
3249
|
breadcrumbs: [
|
|
@@ -2427,17 +3252,17 @@ function AdminStudioGlobalsView(props) {
|
|
|
2427
3252
|
],
|
|
2428
3253
|
description: "Site-wide content and branding settings.",
|
|
2429
3254
|
title: "Globals",
|
|
2430
|
-
children: /* @__PURE__ */
|
|
3255
|
+
children: /* @__PURE__ */ jsx21("div", { className: "orion-admin-list", children: globals.map((global) => {
|
|
2431
3256
|
const href = resolveAdminPath(
|
|
2432
3257
|
adminBasePath,
|
|
2433
3258
|
typeof global.href === "string" ? global.href : `/globals/${global.slug}`
|
|
2434
3259
|
);
|
|
2435
|
-
return /* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
3260
|
+
return /* @__PURE__ */ jsxs18("a", { className: "orion-admin-list-item", href, children: [
|
|
3261
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3262
|
+
/* @__PURE__ */ jsx21("strong", { children: global.label }),
|
|
3263
|
+
/* @__PURE__ */ jsx21("div", { className: "orion-admin-list-meta", children: typeof global.description === "string" && global.description.length > 0 ? global.description : href })
|
|
2439
3264
|
] }),
|
|
2440
|
-
/* @__PURE__ */
|
|
3265
|
+
/* @__PURE__ */ jsx21("span", { className: "orion-admin-list-meta", children: "Open" })
|
|
2441
3266
|
] }, global.slug);
|
|
2442
3267
|
}) })
|
|
2443
3268
|
}
|
|
@@ -2445,9 +3270,9 @@ function AdminStudioGlobalsView(props) {
|
|
|
2445
3270
|
}
|
|
2446
3271
|
|
|
2447
3272
|
// src/admin/components/studio/AdminStudioSiteSettingsGlobalView.tsx
|
|
2448
|
-
import { useEffect as
|
|
2449
|
-
import { jsx as
|
|
2450
|
-
var
|
|
3273
|
+
import { useEffect as useEffect10, useMemo as useMemo6, useState as useState11 } from "react";
|
|
3274
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3275
|
+
var getPropString6 = (props, key, fallback) => {
|
|
2451
3276
|
if (!props || typeof props !== "object") return fallback;
|
|
2452
3277
|
const direct = props[key];
|
|
2453
3278
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -2526,18 +3351,18 @@ var serializeRows = (value, formatter) => {
|
|
|
2526
3351
|
return value.filter((item) => Boolean(item) && typeof item === "object").map((item) => formatter(item)).filter((item) => Boolean(item)).join("\n");
|
|
2527
3352
|
};
|
|
2528
3353
|
function AdminStudioSiteSettingsGlobalView(props) {
|
|
2529
|
-
const globalSlug =
|
|
2530
|
-
const globalsBasePath =
|
|
2531
|
-
const mediaCollectionSlug =
|
|
3354
|
+
const globalSlug = getPropString6(props, "globalSlug", "site-settings");
|
|
3355
|
+
const globalsBasePath = getPropString6(props, "globalsBasePath", "/globals");
|
|
3356
|
+
const mediaCollectionSlug = getPropString6(props, "mediaCollectionSlug", "media");
|
|
2532
3357
|
const adminBasePath = useAdminBasePath();
|
|
2533
3358
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2534
|
-
const [loading, setLoading] =
|
|
2535
|
-
const [saving, setSaving] =
|
|
2536
|
-
const [error, setError] =
|
|
2537
|
-
const [savedMessage, setSavedMessage] =
|
|
2538
|
-
const [globalData, setGlobalData] =
|
|
2539
|
-
const [mediaOptions, setMediaOptions] =
|
|
2540
|
-
|
|
3359
|
+
const [loading, setLoading] = useState11(true);
|
|
3360
|
+
const [saving, setSaving] = useState11(false);
|
|
3361
|
+
const [error, setError] = useState11(null);
|
|
3362
|
+
const [savedMessage, setSavedMessage] = useState11(null);
|
|
3363
|
+
const [globalData, setGlobalData] = useState11({});
|
|
3364
|
+
const [mediaOptions, setMediaOptions] = useState11([]);
|
|
3365
|
+
useEffect10(() => {
|
|
2541
3366
|
let cancelled = false;
|
|
2542
3367
|
const run = async () => {
|
|
2543
3368
|
setLoading(true);
|
|
@@ -2585,15 +3410,15 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2585
3410
|
cancelled = true;
|
|
2586
3411
|
};
|
|
2587
3412
|
}, [globalSlug, mediaCollectionSlug]);
|
|
2588
|
-
const defaultSeo =
|
|
3413
|
+
const defaultSeo = useMemo6(() => {
|
|
2589
3414
|
const value = globalData.defaultSeo;
|
|
2590
3415
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2591
3416
|
}, [globalData.defaultSeo]);
|
|
2592
|
-
const businessProfile =
|
|
3417
|
+
const businessProfile = useMemo6(() => {
|
|
2593
3418
|
const value = globalData.businessProfile;
|
|
2594
3419
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2595
3420
|
}, [globalData.businessProfile]);
|
|
2596
|
-
const openingHoursRows =
|
|
3421
|
+
const openingHoursRows = useMemo6(
|
|
2597
3422
|
() => serializeRows(businessProfile.openingHours, (item) => {
|
|
2598
3423
|
const dayOfWeek = String(item.dayOfWeek || "").trim();
|
|
2599
3424
|
const opens = String(item.opens || "").trim();
|
|
@@ -2605,14 +3430,14 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2605
3430
|
}),
|
|
2606
3431
|
[businessProfile.openingHours]
|
|
2607
3432
|
);
|
|
2608
|
-
const sameAsRows =
|
|
3433
|
+
const sameAsRows = useMemo6(
|
|
2609
3434
|
() => serializeRows(businessProfile.sameAs, (item) => {
|
|
2610
3435
|
const url = String(item.url || "").trim();
|
|
2611
3436
|
return url || null;
|
|
2612
3437
|
}),
|
|
2613
3438
|
[businessProfile.sameAs]
|
|
2614
3439
|
);
|
|
2615
|
-
const serviceCatalogRows =
|
|
3440
|
+
const serviceCatalogRows = useMemo6(
|
|
2616
3441
|
() => serializeRows(businessProfile.serviceCatalog, (item) => {
|
|
2617
3442
|
const name = String(item.name || "").trim();
|
|
2618
3443
|
const description = String(item.description || "").trim();
|
|
@@ -2683,7 +3508,7 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2683
3508
|
};
|
|
2684
3509
|
const logoID = getRelationID(globalData.logo);
|
|
2685
3510
|
const ogImageID = getRelationID(defaultSeo.ogImage);
|
|
2686
|
-
return /* @__PURE__ */
|
|
3511
|
+
return /* @__PURE__ */ jsx22(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs19(
|
|
2687
3512
|
AdminPage,
|
|
2688
3513
|
{
|
|
2689
3514
|
breadcrumbs: [
|
|
@@ -2694,126 +3519,126 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2694
3519
|
description: "Manage site-wide brand, SEO, and business metadata.",
|
|
2695
3520
|
title: "Website Settings",
|
|
2696
3521
|
children: [
|
|
2697
|
-
loading ? /* @__PURE__ */
|
|
2698
|
-
!loading ? /* @__PURE__ */
|
|
2699
|
-
error ? /* @__PURE__ */
|
|
2700
|
-
savedMessage ? /* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
3522
|
+
loading ? /* @__PURE__ */ jsx22("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
3523
|
+
!loading ? /* @__PURE__ */ jsxs19("form", { className: "orion-admin-form", onSubmit: save, children: [
|
|
3524
|
+
error ? /* @__PURE__ */ jsx22("div", { className: "orion-admin-error", children: error }) : null,
|
|
3525
|
+
savedMessage ? /* @__PURE__ */ jsx22("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
3526
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2702
3527
|
"Site Name",
|
|
2703
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(globalData.siteName || ""), name: "siteName", required: true, type: "text" })
|
|
2704
3529
|
] }),
|
|
2705
|
-
/* @__PURE__ */
|
|
3530
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2706
3531
|
"Tagline",
|
|
2707
|
-
/* @__PURE__ */
|
|
3532
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(globalData.tagline || ""), name: "tagline", type: "text" })
|
|
2708
3533
|
] }),
|
|
2709
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2710
3535
|
"Logo (media ID)",
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
3536
|
+
/* @__PURE__ */ jsxs19("select", { defaultValue: logoID ? String(logoID) : "", name: "logo", children: [
|
|
3537
|
+
/* @__PURE__ */ jsx22("option", { value: "", children: "No logo" }),
|
|
2713
3538
|
mediaOptions.map((asset) => {
|
|
2714
3539
|
const id = typeof asset.id === "string" || typeof asset.id === "number" ? String(asset.id) : "";
|
|
2715
3540
|
if (!id) return null;
|
|
2716
|
-
return /* @__PURE__ */
|
|
3541
|
+
return /* @__PURE__ */ jsx22("option", { value: id, children: asset.filename || `Media ${id}` }, id);
|
|
2717
3542
|
})
|
|
2718
3543
|
] })
|
|
2719
3544
|
] }),
|
|
2720
|
-
/* @__PURE__ */
|
|
3545
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2721
3546
|
"SEO Meta Title",
|
|
2722
|
-
/* @__PURE__ */
|
|
3547
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(defaultSeo.metaTitle || ""), name: "metaTitle", type: "text" })
|
|
2723
3548
|
] }),
|
|
2724
|
-
/* @__PURE__ */
|
|
3549
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2725
3550
|
"SEO Meta Description",
|
|
2726
|
-
/* @__PURE__ */
|
|
3551
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: String(defaultSeo.metaDescription || ""), name: "metaDescription", rows: 3 })
|
|
2727
3552
|
] }),
|
|
2728
|
-
/* @__PURE__ */
|
|
3553
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2729
3554
|
"Canonical Base URL",
|
|
2730
|
-
/* @__PURE__ */
|
|
3555
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(defaultSeo.canonicalBaseUrl || ""), name: "canonicalBaseUrl", type: "text" })
|
|
2731
3556
|
] }),
|
|
2732
|
-
/* @__PURE__ */
|
|
3557
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2733
3558
|
"SEO OG Image (media ID)",
|
|
2734
|
-
/* @__PURE__ */
|
|
2735
|
-
/* @__PURE__ */
|
|
3559
|
+
/* @__PURE__ */ jsxs19("select", { defaultValue: ogImageID ? String(ogImageID) : "", name: "ogImage", children: [
|
|
3560
|
+
/* @__PURE__ */ jsx22("option", { value: "", children: "No image" }),
|
|
2736
3561
|
mediaOptions.map((asset) => {
|
|
2737
3562
|
const id = typeof asset.id === "string" || typeof asset.id === "number" ? String(asset.id) : "";
|
|
2738
3563
|
if (!id) return null;
|
|
2739
|
-
return /* @__PURE__ */
|
|
3564
|
+
return /* @__PURE__ */ jsx22("option", { value: id, children: asset.filename || `Media ${id}` }, id);
|
|
2740
3565
|
})
|
|
2741
3566
|
] })
|
|
2742
3567
|
] }),
|
|
2743
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2744
3569
|
"Business Schema Type",
|
|
2745
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.schemaType || "Store"), name: "schemaType", type: "text" })
|
|
2746
3571
|
] }),
|
|
2747
|
-
/* @__PURE__ */
|
|
3572
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2748
3573
|
"Business Description",
|
|
2749
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: String(businessProfile.description || ""), name: "businessDescription", rows: 4 })
|
|
2750
3575
|
] }),
|
|
2751
|
-
/* @__PURE__ */
|
|
3576
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2752
3577
|
"Street Address",
|
|
2753
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.streetAddress || ""), name: "streetAddress", type: "text" })
|
|
2754
3579
|
] }),
|
|
2755
|
-
/* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2756
3581
|
"City",
|
|
2757
|
-
/* @__PURE__ */
|
|
3582
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.addressLocality || ""), name: "addressLocality", type: "text" })
|
|
2758
3583
|
] }),
|
|
2759
|
-
/* @__PURE__ */
|
|
3584
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2760
3585
|
"State / Region",
|
|
2761
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.addressRegion || ""), name: "addressRegion", type: "text" })
|
|
2762
3587
|
] }),
|
|
2763
|
-
/* @__PURE__ */
|
|
3588
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2764
3589
|
"Postal Code",
|
|
2765
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.postalCode || ""), name: "postalCode", type: "text" })
|
|
2766
3591
|
] }),
|
|
2767
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2768
3593
|
"Country Code",
|
|
2769
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.addressCountry || "US"), name: "addressCountry", type: "text" })
|
|
2770
3595
|
] }),
|
|
2771
|
-
/* @__PURE__ */
|
|
3596
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2772
3597
|
"Neighborhood",
|
|
2773
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.neighborhood || ""), name: "neighborhood", type: "text" })
|
|
2774
3599
|
] }),
|
|
2775
|
-
/* @__PURE__ */
|
|
3600
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2776
3601
|
"Latitude",
|
|
2777
|
-
/* @__PURE__ */
|
|
3602
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.latitude || ""), name: "latitude", type: "text" })
|
|
2778
3603
|
] }),
|
|
2779
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2780
3605
|
"Longitude",
|
|
2781
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.longitude || ""), name: "longitude", type: "text" })
|
|
2782
3607
|
] }),
|
|
2783
|
-
/* @__PURE__ */
|
|
3608
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2784
3609
|
"Price Range",
|
|
2785
|
-
/* @__PURE__ */
|
|
3610
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.priceRange || ""), name: "priceRange", type: "text" })
|
|
2786
3611
|
] }),
|
|
2787
|
-
/* @__PURE__ */
|
|
3612
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2788
3613
|
"Map URL",
|
|
2789
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsx22("input", { defaultValue: String(businessProfile.mapUrl || ""), name: "mapUrl", type: "text" })
|
|
2790
3615
|
] }),
|
|
2791
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2792
3617
|
"LLM Summary",
|
|
2793
|
-
/* @__PURE__ */
|
|
3618
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: String(businessProfile.llmsSummary || ""), name: "llmsSummary", rows: 4 })
|
|
2794
3619
|
] }),
|
|
2795
|
-
/* @__PURE__ */
|
|
3620
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2796
3621
|
"Opening Hours Rows",
|
|
2797
|
-
/* @__PURE__ */
|
|
2798
|
-
/* @__PURE__ */
|
|
3622
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: openingHoursRows, name: "openingHoursRows", rows: 4 }),
|
|
3623
|
+
/* @__PURE__ */ jsxs19("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: [
|
|
2799
3624
|
"One row per line: ",
|
|
2800
|
-
/* @__PURE__ */
|
|
3625
|
+
/* @__PURE__ */ jsx22("code", { children: "Monday,Tuesday,Wednesday|10:00|19:00" })
|
|
2801
3626
|
] })
|
|
2802
3627
|
] }),
|
|
2803
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2804
3629
|
"Citation / SameAs URLs",
|
|
2805
|
-
/* @__PURE__ */
|
|
2806
|
-
/* @__PURE__ */
|
|
3630
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: sameAsRows, name: "sameAsRows", rows: 4 }),
|
|
3631
|
+
/* @__PURE__ */ jsx22("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: "One absolute URL per line. Social links still come from the Social Media global." })
|
|
2807
3632
|
] }),
|
|
2808
|
-
/* @__PURE__ */
|
|
3633
|
+
/* @__PURE__ */ jsxs19("label", { children: [
|
|
2809
3634
|
"Service Schema Rows",
|
|
2810
|
-
/* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
3635
|
+
/* @__PURE__ */ jsx22("textarea", { defaultValue: serviceCatalogRows, name: "serviceCatalogRows", rows: 6 }),
|
|
3636
|
+
/* @__PURE__ */ jsxs19("span", { style: { color: "var(--orion-admin-muted)", fontSize: "0.82rem", fontWeight: 600 }, children: [
|
|
2812
3637
|
"One row per line: ",
|
|
2813
|
-
/* @__PURE__ */
|
|
3638
|
+
/* @__PURE__ */ jsx22("code", { children: "Name|Description|Optional price range|/page-path" })
|
|
2814
3639
|
] })
|
|
2815
3640
|
] }),
|
|
2816
|
-
/* @__PURE__ */
|
|
3641
|
+
/* @__PURE__ */ jsx22("button", { disabled: saving, type: "submit", children: saving ? "Saving..." : "Save Global" })
|
|
2817
3642
|
] }) : null
|
|
2818
3643
|
]
|
|
2819
3644
|
}
|
|
@@ -2821,7 +3646,7 @@ function AdminStudioSiteSettingsGlobalView(props) {
|
|
|
2821
3646
|
}
|
|
2822
3647
|
|
|
2823
3648
|
// src/admin/components/studio/AdminStudioSocialMediaGlobalView.tsx
|
|
2824
|
-
import { useEffect as
|
|
3649
|
+
import { useEffect as useEffect11, useMemo as useMemo7, useState as useState12 } from "react";
|
|
2825
3650
|
|
|
2826
3651
|
// src/shared/socialMedia.ts
|
|
2827
3652
|
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
@@ -2903,10 +3728,10 @@ var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
|
2903
3728
|
);
|
|
2904
3729
|
|
|
2905
3730
|
// src/admin/components/studio/AdminStudioSocialMediaGlobalView.tsx
|
|
2906
|
-
import { jsx as
|
|
3731
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2907
3732
|
var getSocialUrlFieldName = (platform) => `social-${platform}-url`;
|
|
2908
3733
|
var getSocialIconFieldName = (platform) => `social-${platform}-icon`;
|
|
2909
|
-
var
|
|
3734
|
+
var getPropString7 = (props, key, fallback) => {
|
|
2910
3735
|
if (!props || typeof props !== "object") return fallback;
|
|
2911
3736
|
const direct = props[key];
|
|
2912
3737
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -2954,16 +3779,16 @@ var normalizeOptionalProfileUrl = (value, platformLabel) => {
|
|
|
2954
3779
|
return parsed.toString();
|
|
2955
3780
|
};
|
|
2956
3781
|
function AdminStudioSocialMediaGlobalView(props) {
|
|
2957
|
-
const globalSlug =
|
|
2958
|
-
const globalsBasePath =
|
|
3782
|
+
const globalSlug = getPropString7(props, "globalSlug", "social-media");
|
|
3783
|
+
const globalsBasePath = getPropString7(props, "globalsBasePath", "/globals");
|
|
2959
3784
|
const adminBasePath = useAdminBasePath();
|
|
2960
3785
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2961
|
-
const [loading, setLoading] =
|
|
2962
|
-
const [saving, setSaving] =
|
|
2963
|
-
const [error, setError] =
|
|
2964
|
-
const [savedMessage, setSavedMessage] =
|
|
2965
|
-
const [globalData, setGlobalData] =
|
|
2966
|
-
|
|
3786
|
+
const [loading, setLoading] = useState12(true);
|
|
3787
|
+
const [saving, setSaving] = useState12(false);
|
|
3788
|
+
const [error, setError] = useState12(null);
|
|
3789
|
+
const [savedMessage, setSavedMessage] = useState12(null);
|
|
3790
|
+
const [globalData, setGlobalData] = useState12({});
|
|
3791
|
+
useEffect11(() => {
|
|
2967
3792
|
let cancelled = false;
|
|
2968
3793
|
const run = async () => {
|
|
2969
3794
|
setLoading(true);
|
|
@@ -2994,7 +3819,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
2994
3819
|
cancelled = true;
|
|
2995
3820
|
};
|
|
2996
3821
|
}, [globalSlug]);
|
|
2997
|
-
const socialProfiles =
|
|
3822
|
+
const socialProfiles = useMemo7(
|
|
2998
3823
|
() => normalizeSocialMediaProfiles(globalData.profiles),
|
|
2999
3824
|
[globalData.profiles]
|
|
3000
3825
|
);
|
|
@@ -3040,7 +3865,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3040
3865
|
setSaving(false);
|
|
3041
3866
|
}
|
|
3042
3867
|
};
|
|
3043
|
-
return /* @__PURE__ */
|
|
3868
|
+
return /* @__PURE__ */ jsx23(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs20(
|
|
3044
3869
|
AdminPage,
|
|
3045
3870
|
{
|
|
3046
3871
|
breadcrumbs: [
|
|
@@ -3051,16 +3876,16 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3051
3876
|
description: "Control which social profiles appear across the site.",
|
|
3052
3877
|
title: "Social Media",
|
|
3053
3878
|
children: [
|
|
3054
|
-
loading ? /* @__PURE__ */
|
|
3055
|
-
!loading ? /* @__PURE__ */
|
|
3056
|
-
error ? /* @__PURE__ */
|
|
3057
|
-
savedMessage ? /* @__PURE__ */
|
|
3058
|
-
/* @__PURE__ */
|
|
3879
|
+
loading ? /* @__PURE__ */ jsx23("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
3880
|
+
!loading ? /* @__PURE__ */ jsxs20("form", { className: "orion-admin-form", onSubmit: save, children: [
|
|
3881
|
+
error ? /* @__PURE__ */ jsx23("div", { className: "orion-admin-error", children: error }) : null,
|
|
3882
|
+
savedMessage ? /* @__PURE__ */ jsx23("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
3883
|
+
/* @__PURE__ */ jsx23("div", { style: { color: "var(--orion-admin-muted)", fontSize: "0.88rem", fontWeight: 700 }, children: "Add URLs for the platforms you use. Leave a URL blank to hide that platform." }),
|
|
3059
3884
|
SOCIAL_MEDIA_PLATFORMS.map((platform) => {
|
|
3060
3885
|
const profile = socialProfiles[platform];
|
|
3061
3886
|
const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
|
|
3062
3887
|
const placeholderDomain = platform === "x" ? "x.com" : `${platform}.com`;
|
|
3063
|
-
return /* @__PURE__ */
|
|
3888
|
+
return /* @__PURE__ */ jsxs20(
|
|
3064
3889
|
"fieldset",
|
|
3065
3890
|
{
|
|
3066
3891
|
style: {
|
|
@@ -3071,10 +3896,10 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3071
3896
|
padding: "0.85rem"
|
|
3072
3897
|
},
|
|
3073
3898
|
children: [
|
|
3074
|
-
/* @__PURE__ */
|
|
3075
|
-
/* @__PURE__ */
|
|
3899
|
+
/* @__PURE__ */ jsx23("legend", { style: { fontWeight: 700, padding: "0 0.3rem" }, children: platformLabel }),
|
|
3900
|
+
/* @__PURE__ */ jsxs20("label", { children: [
|
|
3076
3901
|
"Profile URL",
|
|
3077
|
-
/* @__PURE__ */
|
|
3902
|
+
/* @__PURE__ */ jsx23(
|
|
3078
3903
|
"input",
|
|
3079
3904
|
{
|
|
3080
3905
|
defaultValue: profile.url,
|
|
@@ -3085,16 +3910,16 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3085
3910
|
}
|
|
3086
3911
|
)
|
|
3087
3912
|
] }),
|
|
3088
|
-
/* @__PURE__ */
|
|
3913
|
+
/* @__PURE__ */ jsxs20("label", { children: [
|
|
3089
3914
|
"Icon Style",
|
|
3090
|
-
/* @__PURE__ */
|
|
3915
|
+
/* @__PURE__ */ jsx23("select", { defaultValue: profile.icon, name: getSocialIconFieldName(platform), children: SOCIAL_MEDIA_ICON_OPTIONS[platform].map((option) => /* @__PURE__ */ jsx23("option", { value: option.value, children: option.label }, option.value)) })
|
|
3091
3916
|
] })
|
|
3092
3917
|
]
|
|
3093
3918
|
},
|
|
3094
3919
|
platform
|
|
3095
3920
|
);
|
|
3096
3921
|
}),
|
|
3097
|
-
/* @__PURE__ */
|
|
3922
|
+
/* @__PURE__ */ jsx23("button", { disabled: saving, type: "submit", children: saving ? "Saving..." : "Save Global" })
|
|
3098
3923
|
] }) : null
|
|
3099
3924
|
]
|
|
3100
3925
|
}
|
|
@@ -3102,7 +3927,7 @@ function AdminStudioSocialMediaGlobalView(props) {
|
|
|
3102
3927
|
}
|
|
3103
3928
|
|
|
3104
3929
|
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
3105
|
-
import { useEffect as
|
|
3930
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useState as useState13 } from "react";
|
|
3106
3931
|
import { SetStepNav as SetStepNav2 } from "@payloadcms/ui";
|
|
3107
3932
|
|
|
3108
3933
|
// src/nextjs/utilities/socialMedia.ts
|
|
@@ -3132,8 +3957,8 @@ function resolveSocialMediaLinks(data) {
|
|
|
3132
3957
|
}
|
|
3133
3958
|
|
|
3134
3959
|
// src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
|
|
3135
|
-
import { jsx as
|
|
3136
|
-
var
|
|
3960
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3961
|
+
var getPropString8 = (props, key, fallback) => {
|
|
3137
3962
|
if (!props || typeof props !== "object") return fallback;
|
|
3138
3963
|
const direct = props[key];
|
|
3139
3964
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3189,25 +4014,25 @@ var resolveMediaURL = (value) => {
|
|
|
3189
4014
|
return "";
|
|
3190
4015
|
};
|
|
3191
4016
|
function AdminStudioHeaderGlobalView(props) {
|
|
3192
|
-
const globalSlug =
|
|
3193
|
-
const globalsBasePath =
|
|
3194
|
-
const pagesCollectionSlug =
|
|
3195
|
-
const actionHref =
|
|
3196
|
-
const actionLabel =
|
|
4017
|
+
const globalSlug = getPropString8(props, "globalSlug", "header");
|
|
4018
|
+
const globalsBasePath = getPropString8(props, "globalsBasePath", "/globals");
|
|
4019
|
+
const pagesCollectionSlug = getPropString8(props, "pagesCollectionSlug", "pages");
|
|
4020
|
+
const actionHref = getPropString8(props, "actionHref", "/contact");
|
|
4021
|
+
const actionLabel = getPropString8(props, "actionLabel", "Visit Today");
|
|
3197
4022
|
const locationSummary = getPropLocationSummary(props, "locationSummary");
|
|
3198
4023
|
const adminBasePath = useAdminBasePath();
|
|
3199
4024
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3200
4025
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
3201
|
-
const [loading, setLoading] =
|
|
3202
|
-
const [saving, setSaving] =
|
|
3203
|
-
const [error, setError] =
|
|
3204
|
-
const [savedMessage, setSavedMessage] =
|
|
3205
|
-
const [initialItems, setInitialItems] =
|
|
3206
|
-
const [liveItems, setLiveItems] =
|
|
3207
|
-
const [pages, setPages] =
|
|
3208
|
-
const [siteSettings, setSiteSettings] =
|
|
3209
|
-
const [socialMedia, setSocialMedia] =
|
|
3210
|
-
|
|
4026
|
+
const [loading, setLoading] = useState13(true);
|
|
4027
|
+
const [saving, setSaving] = useState13(false);
|
|
4028
|
+
const [error, setError] = useState13(null);
|
|
4029
|
+
const [savedMessage, setSavedMessage] = useState13(null);
|
|
4030
|
+
const [initialItems, setInitialItems] = useState13([]);
|
|
4031
|
+
const [liveItems, setLiveItems] = useState13([]);
|
|
4032
|
+
const [pages, setPages] = useState13([]);
|
|
4033
|
+
const [siteSettings, setSiteSettings] = useState13({});
|
|
4034
|
+
const [socialMedia, setSocialMedia] = useState13({});
|
|
4035
|
+
useEffect12(() => {
|
|
3211
4036
|
let cancelled = false;
|
|
3212
4037
|
const run = async () => {
|
|
3213
4038
|
setLoading(true);
|
|
@@ -3270,8 +4095,8 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3270
4095
|
cancelled = true;
|
|
3271
4096
|
};
|
|
3272
4097
|
}, [globalSlug, pagesCollectionSlug]);
|
|
3273
|
-
const pageOptions =
|
|
3274
|
-
const previewSocialLinks =
|
|
4098
|
+
const pageOptions = useMemo8(() => buildAdminPageLinkOptions(pages), [pages]);
|
|
4099
|
+
const previewSocialLinks = useMemo8(
|
|
3275
4100
|
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
3276
4101
|
label: item.label,
|
|
3277
4102
|
platform: item.platform,
|
|
@@ -3282,7 +4107,7 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3282
4107
|
const previewSiteName = typeof siteSettings.siteName === "string" && siteSettings.siteName.trim().length > 0 ? siteSettings.siteName.trim() : "Orion Studio";
|
|
3283
4108
|
const previewTagline = typeof siteSettings.tagline === "string" ? siteSettings.tagline.trim() : "";
|
|
3284
4109
|
const previewLogoUrl = resolveMediaURL(siteSettings.logo);
|
|
3285
|
-
const editorKey =
|
|
4110
|
+
const editorKey = useMemo8(() => JSON.stringify(initialItems), [initialItems]);
|
|
3286
4111
|
const save = async () => {
|
|
3287
4112
|
setSaving(true);
|
|
3288
4113
|
setError(null);
|
|
@@ -3316,8 +4141,8 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3316
4141
|
setSaving(false);
|
|
3317
4142
|
}
|
|
3318
4143
|
};
|
|
3319
|
-
return /* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */
|
|
4144
|
+
return /* @__PURE__ */ jsx24(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs21("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4145
|
+
/* @__PURE__ */ jsx24(
|
|
3321
4146
|
SetStepNav2,
|
|
3322
4147
|
{
|
|
3323
4148
|
nav: [
|
|
@@ -3326,13 +4151,13 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3326
4151
|
]
|
|
3327
4152
|
}
|
|
3328
4153
|
),
|
|
3329
|
-
/* @__PURE__ */
|
|
3330
|
-
/* @__PURE__ */
|
|
3331
|
-
loading ? /* @__PURE__ */
|
|
3332
|
-
error ? /* @__PURE__ */
|
|
3333
|
-
savedMessage ? /* @__PURE__ */
|
|
3334
|
-
!loading ? /* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
4154
|
+
/* @__PURE__ */ jsx24("h1", { style: { margin: 0 }, children: "Header & Navigation" }),
|
|
4155
|
+
/* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage the main website navigation and preview it in place." }),
|
|
4156
|
+
loading ? /* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading header settings\u2026" }) : null,
|
|
4157
|
+
error ? /* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4158
|
+
savedMessage ? /* @__PURE__ */ jsx24("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4159
|
+
!loading ? /* @__PURE__ */ jsxs21("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4160
|
+
/* @__PURE__ */ jsx24(
|
|
3336
4161
|
HeaderNavEditorWithPreview,
|
|
3337
4162
|
{
|
|
3338
4163
|
actionHref,
|
|
@@ -3349,7 +4174,7 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3349
4174
|
},
|
|
3350
4175
|
editorKey
|
|
3351
4176
|
),
|
|
3352
|
-
/* @__PURE__ */
|
|
4177
|
+
/* @__PURE__ */ jsx24("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ jsx24(
|
|
3353
4178
|
"button",
|
|
3354
4179
|
{
|
|
3355
4180
|
disabled: saving,
|
|
@@ -3373,10 +4198,10 @@ function AdminStudioHeaderGlobalView(props) {
|
|
|
3373
4198
|
}
|
|
3374
4199
|
|
|
3375
4200
|
// src/admin/components/studio/AdminStudioFooterGlobalView.tsx
|
|
3376
|
-
import { useEffect as
|
|
4201
|
+
import { useEffect as useEffect13, useMemo as useMemo9, useState as useState14 } from "react";
|
|
3377
4202
|
import { SetStepNav as SetStepNav3 } from "@payloadcms/ui";
|
|
3378
|
-
import { jsx as
|
|
3379
|
-
var
|
|
4203
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4204
|
+
var getPropString9 = (props, key, fallback) => {
|
|
3380
4205
|
if (!props || typeof props !== "object") return fallback;
|
|
3381
4206
|
const direct = props[key];
|
|
3382
4207
|
if (typeof direct === "string") return direct;
|
|
@@ -3470,29 +4295,29 @@ var deriveHours = (siteSettings) => {
|
|
|
3470
4295
|
return `${dayOfWeek} \u2022 ${opens} - ${closes}`;
|
|
3471
4296
|
};
|
|
3472
4297
|
function AdminStudioFooterGlobalView(props) {
|
|
3473
|
-
const globalSlug =
|
|
3474
|
-
const globalsBasePath =
|
|
3475
|
-
const builtByHref =
|
|
3476
|
-
const builtByLabel =
|
|
3477
|
-
const description =
|
|
4298
|
+
const globalSlug = getPropString9(props, "globalSlug", "footer");
|
|
4299
|
+
const globalsBasePath = getPropString9(props, "globalsBasePath", "/globals");
|
|
4300
|
+
const builtByHref = getPropString9(props, "builtByHref", "");
|
|
4301
|
+
const builtByLabel = getPropString9(props, "builtByLabel", "");
|
|
4302
|
+
const description = getPropString9(props, "description", "");
|
|
3478
4303
|
const footerCategories = getPropStringArray2(props, "footerCategories");
|
|
3479
4304
|
const footerLinks = getPropLinks(props, "footerLinks");
|
|
3480
4305
|
const configuredLocationSummary = getPropLocationSummary2(props, "locationSummary");
|
|
3481
4306
|
const adminBasePath = useAdminBasePath();
|
|
3482
4307
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3483
4308
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
3484
|
-
const [loading, setLoading] =
|
|
3485
|
-
const [saving, setSaving] =
|
|
3486
|
-
const [error, setError] =
|
|
3487
|
-
const [savedMessage, setSavedMessage] =
|
|
3488
|
-
const [doc, setDoc] =
|
|
4309
|
+
const [loading, setLoading] = useState14(true);
|
|
4310
|
+
const [saving, setSaving] = useState14(false);
|
|
4311
|
+
const [error, setError] = useState14(null);
|
|
4312
|
+
const [savedMessage, setSavedMessage] = useState14(null);
|
|
4313
|
+
const [doc, setDoc] = useState14({
|
|
3489
4314
|
contactEmail: "",
|
|
3490
4315
|
contactPhone: "",
|
|
3491
4316
|
copyright: ""
|
|
3492
4317
|
});
|
|
3493
|
-
const [siteSettings, setSiteSettings] =
|
|
3494
|
-
const [socialMedia, setSocialMedia] =
|
|
3495
|
-
|
|
4318
|
+
const [siteSettings, setSiteSettings] = useState14({});
|
|
4319
|
+
const [socialMedia, setSocialMedia] = useState14({});
|
|
4320
|
+
useEffect13(() => {
|
|
3496
4321
|
let cancelled = false;
|
|
3497
4322
|
const run = async () => {
|
|
3498
4323
|
setLoading(true);
|
|
@@ -3544,7 +4369,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3544
4369
|
cancelled = true;
|
|
3545
4370
|
};
|
|
3546
4371
|
}, [globalSlug]);
|
|
3547
|
-
const previewSocialLinks =
|
|
4372
|
+
const previewSocialLinks = useMemo9(
|
|
3548
4373
|
() => resolveSocialMediaLinks(socialMedia).map((item) => ({
|
|
3549
4374
|
label: item.label,
|
|
3550
4375
|
platform: item.platform,
|
|
@@ -3589,8 +4414,8 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3589
4414
|
setSaving(false);
|
|
3590
4415
|
}
|
|
3591
4416
|
};
|
|
3592
|
-
return /* @__PURE__ */
|
|
3593
|
-
/* @__PURE__ */
|
|
4417
|
+
return /* @__PURE__ */ jsx25(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs22("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4418
|
+
/* @__PURE__ */ jsx25(
|
|
3594
4419
|
SetStepNav3,
|
|
3595
4420
|
{
|
|
3596
4421
|
nav: [
|
|
@@ -3599,13 +4424,13 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3599
4424
|
]
|
|
3600
4425
|
}
|
|
3601
4426
|
),
|
|
3602
|
-
/* @__PURE__ */
|
|
3603
|
-
/* @__PURE__ */
|
|
3604
|
-
loading ? /* @__PURE__ */
|
|
3605
|
-
error ? /* @__PURE__ */
|
|
3606
|
-
savedMessage ? /* @__PURE__ */
|
|
3607
|
-
!loading ? /* @__PURE__ */
|
|
3608
|
-
/* @__PURE__ */
|
|
4427
|
+
/* @__PURE__ */ jsx25("h1", { style: { margin: 0 }, children: "Footer" }),
|
|
4428
|
+
/* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Manage footer contact details and preview the package footer in place." }),
|
|
4429
|
+
loading ? /* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading footer settings\u2026" }) : null,
|
|
4430
|
+
error ? /* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4431
|
+
savedMessage ? /* @__PURE__ */ jsx25("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4432
|
+
!loading ? /* @__PURE__ */ jsxs22("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem" }, children: [
|
|
4433
|
+
/* @__PURE__ */ jsxs22(
|
|
3609
4434
|
"label",
|
|
3610
4435
|
{
|
|
3611
4436
|
style: {
|
|
@@ -3617,7 +4442,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3617
4442
|
},
|
|
3618
4443
|
children: [
|
|
3619
4444
|
"Copyright",
|
|
3620
|
-
/* @__PURE__ */
|
|
4445
|
+
/* @__PURE__ */ jsx25(
|
|
3621
4446
|
"input",
|
|
3622
4447
|
{
|
|
3623
4448
|
onChange: (event) => setDoc((current) => ({ ...current, copyright: event.target.value })),
|
|
@@ -3638,7 +4463,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3638
4463
|
]
|
|
3639
4464
|
}
|
|
3640
4465
|
),
|
|
3641
|
-
/* @__PURE__ */
|
|
4466
|
+
/* @__PURE__ */ jsxs22(
|
|
3642
4467
|
"label",
|
|
3643
4468
|
{
|
|
3644
4469
|
style: {
|
|
@@ -3650,7 +4475,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3650
4475
|
},
|
|
3651
4476
|
children: [
|
|
3652
4477
|
"Contact Email",
|
|
3653
|
-
/* @__PURE__ */
|
|
4478
|
+
/* @__PURE__ */ jsx25(
|
|
3654
4479
|
"input",
|
|
3655
4480
|
{
|
|
3656
4481
|
onChange: (event) => setDoc((current) => ({ ...current, contactEmail: event.target.value })),
|
|
@@ -3671,7 +4496,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3671
4496
|
]
|
|
3672
4497
|
}
|
|
3673
4498
|
),
|
|
3674
|
-
/* @__PURE__ */
|
|
4499
|
+
/* @__PURE__ */ jsxs22(
|
|
3675
4500
|
"label",
|
|
3676
4501
|
{
|
|
3677
4502
|
style: {
|
|
@@ -3683,7 +4508,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3683
4508
|
},
|
|
3684
4509
|
children: [
|
|
3685
4510
|
"Contact Phone",
|
|
3686
|
-
/* @__PURE__ */
|
|
4511
|
+
/* @__PURE__ */ jsx25(
|
|
3687
4512
|
"input",
|
|
3688
4513
|
{
|
|
3689
4514
|
onChange: (event) => setDoc((current) => ({ ...current, contactPhone: event.target.value })),
|
|
@@ -3704,8 +4529,8 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3704
4529
|
]
|
|
3705
4530
|
}
|
|
3706
4531
|
),
|
|
3707
|
-
/* @__PURE__ */
|
|
3708
|
-
/* @__PURE__ */
|
|
4532
|
+
/* @__PURE__ */ jsx25("div", { className: "orion-admin-preview-label", children: "Footer Preview" }),
|
|
4533
|
+
/* @__PURE__ */ jsx25("div", { className: "orion-admin-preview-frame", children: /* @__PURE__ */ jsx25("div", { className: "orion-admin-preview-surface", children: /* @__PURE__ */ jsx25(
|
|
3709
4534
|
SiteFooterPreview,
|
|
3710
4535
|
{
|
|
3711
4536
|
site: {
|
|
@@ -3724,7 +4549,7 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3724
4549
|
}
|
|
3725
4550
|
}
|
|
3726
4551
|
) }) }),
|
|
3727
|
-
/* @__PURE__ */
|
|
4552
|
+
/* @__PURE__ */ jsx25("div", { style: { display: "flex", gap: "0.6rem" }, children: /* @__PURE__ */ jsx25(
|
|
3728
4553
|
"button",
|
|
3729
4554
|
{
|
|
3730
4555
|
disabled: saving,
|
|
@@ -3748,9 +4573,9 @@ function AdminStudioFooterGlobalView(props) {
|
|
|
3748
4573
|
}
|
|
3749
4574
|
|
|
3750
4575
|
// src/admin/components/studio/AdminStudioContactFormView.tsx
|
|
3751
|
-
import { useEffect as
|
|
4576
|
+
import { useEffect as useEffect14, useMemo as useMemo10, useState as useState15 } from "react";
|
|
3752
4577
|
import { SetStepNav as SetStepNav4 } from "@payloadcms/ui";
|
|
3753
|
-
import { jsx as
|
|
4578
|
+
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3754
4579
|
var defaultDoc = {
|
|
3755
4580
|
disabledMessage: "This form is temporarily unavailable. Please call us for immediate service.",
|
|
3756
4581
|
enabled: true,
|
|
@@ -3765,7 +4590,7 @@ var defaultDoc = {
|
|
|
3765
4590
|
submitButtonLabel: "Send Request",
|
|
3766
4591
|
successMessage: "Thanks, your request has been received. We will follow up shortly."
|
|
3767
4592
|
};
|
|
3768
|
-
var
|
|
4593
|
+
var getPropString10 = (props, key, fallback) => {
|
|
3769
4594
|
if (!props || typeof props !== "object") return fallback;
|
|
3770
4595
|
const direct = props[key];
|
|
3771
4596
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -3834,17 +4659,17 @@ var ghostButtonStyle = {
|
|
|
3834
4659
|
color: "var(--theme-elevation-900)"
|
|
3835
4660
|
};
|
|
3836
4661
|
function AdminStudioContactFormView(props) {
|
|
3837
|
-
const globalSlug =
|
|
3838
|
-
const globalsBasePath =
|
|
4662
|
+
const globalSlug = getPropString10(props, "globalSlug", "contact-form");
|
|
4663
|
+
const globalsBasePath = getPropString10(props, "globalsBasePath", "/globals");
|
|
3839
4664
|
const adminBasePath = useAdminBasePath();
|
|
3840
4665
|
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
3841
4666
|
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
3842
|
-
const [doc, setDoc] =
|
|
3843
|
-
const [error, setError] =
|
|
3844
|
-
const [isLoading, setIsLoading] =
|
|
3845
|
-
const [isSaving, setIsSaving] =
|
|
3846
|
-
const [savedMessage, setSavedMessage] =
|
|
3847
|
-
|
|
4667
|
+
const [doc, setDoc] = useState15(defaultDoc);
|
|
4668
|
+
const [error, setError] = useState15(null);
|
|
4669
|
+
const [isLoading, setIsLoading] = useState15(true);
|
|
4670
|
+
const [isSaving, setIsSaving] = useState15(false);
|
|
4671
|
+
const [savedMessage, setSavedMessage] = useState15(null);
|
|
4672
|
+
useEffect14(() => {
|
|
3848
4673
|
let mounted = true;
|
|
3849
4674
|
const load = async () => {
|
|
3850
4675
|
setIsLoading(true);
|
|
@@ -3874,7 +4699,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3874
4699
|
mounted = false;
|
|
3875
4700
|
};
|
|
3876
4701
|
}, [globalSlug]);
|
|
3877
|
-
const payload =
|
|
4702
|
+
const payload = useMemo10(
|
|
3878
4703
|
() => ({
|
|
3879
4704
|
disabledMessage: doc.disabledMessage,
|
|
3880
4705
|
enabled: doc.enabled,
|
|
@@ -3911,8 +4736,8 @@ function AdminStudioContactFormView(props) {
|
|
|
3911
4736
|
setIsSaving(false);
|
|
3912
4737
|
}
|
|
3913
4738
|
};
|
|
3914
|
-
return /* @__PURE__ */
|
|
3915
|
-
/* @__PURE__ */
|
|
4739
|
+
return /* @__PURE__ */ jsx26(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs23("div", { style: { paddingBottom: "2rem" }, children: [
|
|
4740
|
+
/* @__PURE__ */ jsx26(
|
|
3916
4741
|
SetStepNav4,
|
|
3917
4742
|
{
|
|
3918
4743
|
nav: [
|
|
@@ -3921,14 +4746,14 @@ function AdminStudioContactFormView(props) {
|
|
|
3921
4746
|
]
|
|
3922
4747
|
}
|
|
3923
4748
|
),
|
|
3924
|
-
/* @__PURE__ */
|
|
3925
|
-
/* @__PURE__ */
|
|
3926
|
-
isLoading ? /* @__PURE__ */
|
|
3927
|
-
error ? /* @__PURE__ */
|
|
3928
|
-
savedMessage ? /* @__PURE__ */
|
|
3929
|
-
!isLoading ? /* @__PURE__ */
|
|
3930
|
-
/* @__PURE__ */
|
|
3931
|
-
/* @__PURE__ */
|
|
4749
|
+
/* @__PURE__ */ jsx26("h1", { style: { margin: 0 }, children: "Contact Form" }),
|
|
4750
|
+
/* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Edit form behavior and submission messaging without leaving Studio." }),
|
|
4751
|
+
isLoading ? /* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading form settings\u2026" }) : null,
|
|
4752
|
+
error ? /* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
4753
|
+
savedMessage ? /* @__PURE__ */ jsx26("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
4754
|
+
!isLoading ? /* @__PURE__ */ jsxs23("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem", maxWidth: 900 }, children: [
|
|
4755
|
+
/* @__PURE__ */ jsxs23("label", { style: { ...fieldLabelStyle, alignItems: "center", display: "flex", gap: "0.6rem" }, children: [
|
|
4756
|
+
/* @__PURE__ */ jsx26(
|
|
3932
4757
|
"input",
|
|
3933
4758
|
{
|
|
3934
4759
|
checked: doc.enabled,
|
|
@@ -3938,9 +4763,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3938
4763
|
),
|
|
3939
4764
|
"Form enabled"
|
|
3940
4765
|
] }),
|
|
3941
|
-
/* @__PURE__ */
|
|
4766
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3942
4767
|
"Notification Email",
|
|
3943
|
-
/* @__PURE__ */
|
|
4768
|
+
/* @__PURE__ */ jsx26(
|
|
3944
4769
|
"input",
|
|
3945
4770
|
{
|
|
3946
4771
|
onChange: (event) => setDoc((prev) => ({ ...prev, notificationEmail: event.target.value })),
|
|
@@ -3950,9 +4775,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3950
4775
|
}
|
|
3951
4776
|
)
|
|
3952
4777
|
] }),
|
|
3953
|
-
/* @__PURE__ */
|
|
4778
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3954
4779
|
"Submit Button Label",
|
|
3955
|
-
/* @__PURE__ */
|
|
4780
|
+
/* @__PURE__ */ jsx26(
|
|
3956
4781
|
"input",
|
|
3957
4782
|
{
|
|
3958
4783
|
onChange: (event) => setDoc((prev) => ({ ...prev, submitButtonLabel: event.target.value })),
|
|
@@ -3962,9 +4787,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3962
4787
|
}
|
|
3963
4788
|
)
|
|
3964
4789
|
] }),
|
|
3965
|
-
/* @__PURE__ */
|
|
4790
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3966
4791
|
"Success Message",
|
|
3967
|
-
/* @__PURE__ */
|
|
4792
|
+
/* @__PURE__ */ jsx26(
|
|
3968
4793
|
"input",
|
|
3969
4794
|
{
|
|
3970
4795
|
onChange: (event) => setDoc((prev) => ({ ...prev, successMessage: event.target.value })),
|
|
@@ -3974,9 +4799,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3974
4799
|
}
|
|
3975
4800
|
)
|
|
3976
4801
|
] }),
|
|
3977
|
-
/* @__PURE__ */
|
|
4802
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3978
4803
|
"Error Message",
|
|
3979
|
-
/* @__PURE__ */
|
|
4804
|
+
/* @__PURE__ */ jsx26(
|
|
3980
4805
|
"input",
|
|
3981
4806
|
{
|
|
3982
4807
|
onChange: (event) => setDoc((prev) => ({ ...prev, errorMessage: event.target.value })),
|
|
@@ -3986,9 +4811,9 @@ function AdminStudioContactFormView(props) {
|
|
|
3986
4811
|
}
|
|
3987
4812
|
)
|
|
3988
4813
|
] }),
|
|
3989
|
-
/* @__PURE__ */
|
|
4814
|
+
/* @__PURE__ */ jsxs23("label", { style: fieldLabelStyle, children: [
|
|
3990
4815
|
"Disabled Message",
|
|
3991
|
-
/* @__PURE__ */
|
|
4816
|
+
/* @__PURE__ */ jsx26(
|
|
3992
4817
|
"input",
|
|
3993
4818
|
{
|
|
3994
4819
|
onChange: (event) => setDoc((prev) => ({ ...prev, disabledMessage: event.target.value })),
|
|
@@ -3998,7 +4823,7 @@ function AdminStudioContactFormView(props) {
|
|
|
3998
4823
|
}
|
|
3999
4824
|
)
|
|
4000
4825
|
] }),
|
|
4001
|
-
/* @__PURE__ */
|
|
4826
|
+
/* @__PURE__ */ jsxs23(
|
|
4002
4827
|
"div",
|
|
4003
4828
|
{
|
|
4004
4829
|
style: {
|
|
@@ -4008,9 +4833,9 @@ function AdminStudioContactFormView(props) {
|
|
|
4008
4833
|
padding: "0.85rem"
|
|
4009
4834
|
},
|
|
4010
4835
|
children: [
|
|
4011
|
-
/* @__PURE__ */
|
|
4012
|
-
/* @__PURE__ */
|
|
4013
|
-
/* @__PURE__ */
|
|
4836
|
+
/* @__PURE__ */ jsx26("div", { style: { fontWeight: 900, marginBottom: "0.65rem" }, children: "Service Options" }),
|
|
4837
|
+
/* @__PURE__ */ jsx26("div", { style: { display: "grid", gap: "0.55rem" }, children: doc.serviceOptions.map((option, index) => /* @__PURE__ */ jsxs23("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
4838
|
+
/* @__PURE__ */ jsx26(
|
|
4014
4839
|
"input",
|
|
4015
4840
|
{
|
|
4016
4841
|
onChange: (event) => setDoc((prev) => ({
|
|
@@ -4024,7 +4849,7 @@ function AdminStudioContactFormView(props) {
|
|
|
4024
4849
|
value: option.label
|
|
4025
4850
|
}
|
|
4026
4851
|
),
|
|
4027
|
-
/* @__PURE__ */
|
|
4852
|
+
/* @__PURE__ */ jsx26(
|
|
4028
4853
|
"button",
|
|
4029
4854
|
{
|
|
4030
4855
|
onClick: () => setDoc((prev) => ({
|
|
@@ -4037,7 +4862,7 @@ function AdminStudioContactFormView(props) {
|
|
|
4037
4862
|
}
|
|
4038
4863
|
)
|
|
4039
4864
|
] }, `${index}-${option.label}`)) }),
|
|
4040
|
-
/* @__PURE__ */
|
|
4865
|
+
/* @__PURE__ */ jsx26(
|
|
4041
4866
|
"button",
|
|
4042
4867
|
{
|
|
4043
4868
|
onClick: () => setDoc((prev) => ({
|
|
@@ -4052,9 +4877,9 @@ function AdminStudioContactFormView(props) {
|
|
|
4052
4877
|
]
|
|
4053
4878
|
}
|
|
4054
4879
|
),
|
|
4055
|
-
/* @__PURE__ */
|
|
4056
|
-
/* @__PURE__ */
|
|
4057
|
-
/* @__PURE__ */
|
|
4880
|
+
/* @__PURE__ */ jsxs23("div", { style: { display: "flex", gap: "0.6rem" }, children: [
|
|
4881
|
+
/* @__PURE__ */ jsx26("button", { disabled: isSaving, onClick: () => void save(), style: buttonStyle, type: "button", children: isSaving ? "Saving\u2026" : "Save Form Settings" }),
|
|
4882
|
+
/* @__PURE__ */ jsx26(
|
|
4058
4883
|
"a",
|
|
4059
4884
|
{
|
|
4060
4885
|
href: rawGlobalPath,
|
|
@@ -4074,10 +4899,10 @@ function AdminStudioContactFormView(props) {
|
|
|
4074
4899
|
}
|
|
4075
4900
|
|
|
4076
4901
|
// src/admin/components/studio/AdminStudioMediaView.tsx
|
|
4077
|
-
import { useEffect as
|
|
4078
|
-
import { jsx as
|
|
4902
|
+
import { useEffect as useEffect15, useMemo as useMemo11, useState as useState16 } from "react";
|
|
4903
|
+
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4079
4904
|
var MEDIA_LIBRARY_SYNC_EVENT = "orion-media-library-updated";
|
|
4080
|
-
var
|
|
4905
|
+
var getPropString11 = (props, key, fallback) => {
|
|
4081
4906
|
if (!props || typeof props !== "object") return fallback;
|
|
4082
4907
|
const direct = props[key];
|
|
4083
4908
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -4089,12 +4914,12 @@ var getPropString10 = (props, key, fallback) => {
|
|
|
4089
4914
|
return fallback;
|
|
4090
4915
|
};
|
|
4091
4916
|
function AdminStudioMediaView(props) {
|
|
4092
|
-
const mediaCollectionSlug =
|
|
4917
|
+
const mediaCollectionSlug = getPropString11(props, "mediaCollectionSlug", "media");
|
|
4093
4918
|
const adminBasePath = useAdminBasePath();
|
|
4094
|
-
const [docs, setDocs] =
|
|
4095
|
-
const [loading, setLoading] =
|
|
4096
|
-
const [error, setError] =
|
|
4097
|
-
const apiURL =
|
|
4919
|
+
const [docs, setDocs] = useState16([]);
|
|
4920
|
+
const [loading, setLoading] = useState16(true);
|
|
4921
|
+
const [error, setError] = useState16(null);
|
|
4922
|
+
const apiURL = useMemo11(() => {
|
|
4098
4923
|
const params = new URLSearchParams({
|
|
4099
4924
|
depth: "0",
|
|
4100
4925
|
draft: "true",
|
|
@@ -4103,7 +4928,7 @@ function AdminStudioMediaView(props) {
|
|
|
4103
4928
|
});
|
|
4104
4929
|
return `/api/${mediaCollectionSlug}?${params.toString()}`;
|
|
4105
4930
|
}, [mediaCollectionSlug]);
|
|
4106
|
-
|
|
4931
|
+
useEffect15(() => {
|
|
4107
4932
|
let cancelled = false;
|
|
4108
4933
|
const run = async () => {
|
|
4109
4934
|
setLoading(true);
|
|
@@ -4139,7 +4964,7 @@ function AdminStudioMediaView(props) {
|
|
|
4139
4964
|
window.removeEventListener("storage", rerun);
|
|
4140
4965
|
};
|
|
4141
4966
|
}, [apiURL]);
|
|
4142
|
-
return /* @__PURE__ */
|
|
4967
|
+
return /* @__PURE__ */ jsx27(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs24(
|
|
4143
4968
|
AdminPage,
|
|
4144
4969
|
{
|
|
4145
4970
|
breadcrumbs: [
|
|
@@ -4149,18 +4974,18 @@ function AdminStudioMediaView(props) {
|
|
|
4149
4974
|
description: `${docs.length} asset${docs.length === 1 ? "" : "s"} \u2014 Upload assets here, including logos used in Site Settings branding.`,
|
|
4150
4975
|
title: "Media",
|
|
4151
4976
|
children: [
|
|
4152
|
-
/* @__PURE__ */
|
|
4153
|
-
loading ? /* @__PURE__ */
|
|
4154
|
-
error ? /* @__PURE__ */
|
|
4155
|
-
/* @__PURE__ */
|
|
4156
|
-
!loading && !error && docs.length === 0 ? /* @__PURE__ */
|
|
4157
|
-
/* @__PURE__ */
|
|
4158
|
-
/* @__PURE__ */
|
|
4977
|
+
/* @__PURE__ */ jsx27(MediaUploadForm, {}),
|
|
4978
|
+
loading ? /* @__PURE__ */ jsx27("div", { className: "orion-admin-list-meta", style: { marginTop: "1rem" }, children: "Loading..." }) : null,
|
|
4979
|
+
error ? /* @__PURE__ */ jsx27("div", { className: "orion-admin-error", style: { marginTop: "1rem" }, children: error }) : null,
|
|
4980
|
+
/* @__PURE__ */ jsxs24("div", { className: "orion-admin-list", style: { marginTop: "1rem" }, children: [
|
|
4981
|
+
!loading && !error && docs.length === 0 ? /* @__PURE__ */ jsxs24("div", { className: "orion-admin-card", children: [
|
|
4982
|
+
/* @__PURE__ */ jsx27("strong", { children: "No media found" }),
|
|
4983
|
+
/* @__PURE__ */ jsx27("span", { children: "Upload an image to get started." })
|
|
4159
4984
|
] }) : null,
|
|
4160
4985
|
docs.map((doc) => {
|
|
4161
4986
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
4162
4987
|
if (!id) return null;
|
|
4163
|
-
return /* @__PURE__ */
|
|
4988
|
+
return /* @__PURE__ */ jsx27(
|
|
4164
4989
|
MediaListItem,
|
|
4165
4990
|
{
|
|
4166
4991
|
alt: doc.alt,
|
|
@@ -4183,9 +5008,9 @@ function AdminStudioMediaView(props) {
|
|
|
4183
5008
|
}
|
|
4184
5009
|
|
|
4185
5010
|
// src/admin/components/studio/AdminStudioMediaItemView.tsx
|
|
4186
|
-
import { useEffect as
|
|
4187
|
-
import { jsx as
|
|
4188
|
-
var
|
|
5011
|
+
import { useEffect as useEffect16, useMemo as useMemo12, useState as useState17 } from "react";
|
|
5012
|
+
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5013
|
+
var getPropString12 = (props, key, fallback) => {
|
|
4189
5014
|
if (!props || typeof props !== "object") return fallback;
|
|
4190
5015
|
const direct = props[key];
|
|
4191
5016
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -4211,16 +5036,16 @@ var getMediaIDFromPathname = (pathname) => {
|
|
|
4211
5036
|
return id ? decodeURIComponent(id) : null;
|
|
4212
5037
|
};
|
|
4213
5038
|
function AdminStudioMediaItemView(props) {
|
|
4214
|
-
const mediaCollectionSlug =
|
|
5039
|
+
const mediaCollectionSlug = getPropString12(props, "mediaCollectionSlug", "media");
|
|
4215
5040
|
const adminBasePath = useAdminBasePath();
|
|
4216
5041
|
const mediaPath = resolveAdminPath(adminBasePath, "/media");
|
|
4217
|
-
const mediaIDFromParams =
|
|
4218
|
-
const [mediaID, setMediaID] =
|
|
4219
|
-
const [doc, setDoc] =
|
|
4220
|
-
const [loading, setLoading] =
|
|
4221
|
-
const [error, setError] =
|
|
4222
|
-
const [savedMessage, setSavedMessage] =
|
|
4223
|
-
|
|
5042
|
+
const mediaIDFromParams = useMemo12(() => getParam2(props.params, "id"), [props.params]);
|
|
5043
|
+
const [mediaID, setMediaID] = useState17(mediaIDFromParams);
|
|
5044
|
+
const [doc, setDoc] = useState17(null);
|
|
5045
|
+
const [loading, setLoading] = useState17(true);
|
|
5046
|
+
const [error, setError] = useState17(null);
|
|
5047
|
+
const [savedMessage, setSavedMessage] = useState17(null);
|
|
5048
|
+
useEffect16(() => {
|
|
4224
5049
|
if (mediaIDFromParams) {
|
|
4225
5050
|
setMediaID(mediaIDFromParams);
|
|
4226
5051
|
return;
|
|
@@ -4248,7 +5073,7 @@ function AdminStudioMediaItemView(props) {
|
|
|
4248
5073
|
setLoading(false);
|
|
4249
5074
|
}
|
|
4250
5075
|
};
|
|
4251
|
-
|
|
5076
|
+
useEffect16(() => {
|
|
4252
5077
|
if (!mediaID) return;
|
|
4253
5078
|
void loadDoc(mediaID);
|
|
4254
5079
|
}, [mediaCollectionSlug, mediaID]);
|
|
@@ -4294,7 +5119,7 @@ function AdminStudioMediaItemView(props) {
|
|
|
4294
5119
|
setError(deleteError instanceof Error ? deleteError.message : "Failed to delete media item.");
|
|
4295
5120
|
}
|
|
4296
5121
|
};
|
|
4297
|
-
return /* @__PURE__ */
|
|
5122
|
+
return /* @__PURE__ */ jsx28(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs25(
|
|
4298
5123
|
AdminPage,
|
|
4299
5124
|
{
|
|
4300
5125
|
breadcrumbs: [
|
|
@@ -4305,10 +5130,10 @@ function AdminStudioMediaItemView(props) {
|
|
|
4305
5130
|
description: "Update metadata or remove the selected asset.",
|
|
4306
5131
|
title: "Media Asset",
|
|
4307
5132
|
children: [
|
|
4308
|
-
loading ? /* @__PURE__ */
|
|
4309
|
-
error ? /* @__PURE__ */
|
|
4310
|
-
savedMessage ? /* @__PURE__ */
|
|
4311
|
-
!loading && !error && doc && mediaID ? /* @__PURE__ */
|
|
5133
|
+
loading ? /* @__PURE__ */ jsx28("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5134
|
+
error ? /* @__PURE__ */ jsx28("div", { className: "orion-admin-error", children: error }) : null,
|
|
5135
|
+
savedMessage ? /* @__PURE__ */ jsx28("div", { className: "orion-admin-success", children: savedMessage }) : null,
|
|
5136
|
+
!loading && !error && doc && mediaID ? /* @__PURE__ */ jsx28(
|
|
4312
5137
|
MediaDetailPanel,
|
|
4313
5138
|
{
|
|
4314
5139
|
alt: doc.alt,
|
|
@@ -4330,10 +5155,10 @@ function AdminStudioMediaItemView(props) {
|
|
|
4330
5155
|
}
|
|
4331
5156
|
|
|
4332
5157
|
// src/admin/components/studio/AdminStudioFormsView.tsx
|
|
4333
|
-
import
|
|
4334
|
-
import { useEffect as
|
|
5158
|
+
import Link3 from "next/link";
|
|
5159
|
+
import { useEffect as useEffect17, useMemo as useMemo13, useState as useState18 } from "react";
|
|
4335
5160
|
import { useAuth as useAuth6 } from "@payloadcms/ui";
|
|
4336
|
-
import { jsx as
|
|
5161
|
+
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4337
5162
|
var FORM_TONES = [
|
|
4338
5163
|
{
|
|
4339
5164
|
accent: "var(--orion-cms-tone-1, var(--orion-cms-accent, var(--orion-admin-accent)))",
|
|
@@ -4384,8 +5209,8 @@ var isEditor2 = (user) => {
|
|
|
4384
5209
|
const role = user.role;
|
|
4385
5210
|
return typeof role === "string" && role === "editor";
|
|
4386
5211
|
};
|
|
4387
|
-
var
|
|
4388
|
-
var
|
|
5212
|
+
var canReviewForms2 = (user) => isAdmin3(user) || isEditor2(user);
|
|
5213
|
+
var getPropString13 = (props, key, fallback) => {
|
|
4389
5214
|
if (!props || typeof props !== "object") return fallback;
|
|
4390
5215
|
const direct = props[key];
|
|
4391
5216
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -4413,7 +5238,7 @@ var getFieldCount = (form) => Array.isArray(form.steps) ? form.steps.reduce((cou
|
|
|
4413
5238
|
const fields = step.fields;
|
|
4414
5239
|
return count + (Array.isArray(fields) ? fields.length : 0);
|
|
4415
5240
|
}, 0) : 0;
|
|
4416
|
-
var
|
|
5241
|
+
var getFormID2 = (value) => {
|
|
4417
5242
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
4418
5243
|
if (value && typeof value === "object") {
|
|
4419
5244
|
const id = value.id;
|
|
@@ -4534,7 +5359,7 @@ var getSecondaryIdentity = (identity, previewFields, uploads) => {
|
|
|
4534
5359
|
if (identity.email) return "Email response";
|
|
4535
5360
|
return "Response preview unavailable";
|
|
4536
5361
|
};
|
|
4537
|
-
var
|
|
5362
|
+
var loadCollection2 = async (slug, params) => {
|
|
4538
5363
|
const response = await fetch(`/api/${slug}?${params.toString()}`, {
|
|
4539
5364
|
credentials: "include"
|
|
4540
5365
|
});
|
|
@@ -4545,19 +5370,19 @@ var loadCollection = async (slug, params) => {
|
|
|
4545
5370
|
const payload = await response.json();
|
|
4546
5371
|
return Array.isArray(payload.docs) ? payload.docs : [];
|
|
4547
5372
|
};
|
|
4548
|
-
var renderEmptyMessage = (message) => /* @__PURE__ */
|
|
4549
|
-
/* @__PURE__ */
|
|
4550
|
-
/* @__PURE__ */
|
|
5373
|
+
var renderEmptyMessage = (message) => /* @__PURE__ */ jsxs26("div", { className: "orion-admin-empty-state", children: [
|
|
5374
|
+
/* @__PURE__ */ jsx29("strong", { children: "No responses yet" }),
|
|
5375
|
+
/* @__PURE__ */ jsx29("span", { children: message })
|
|
4551
5376
|
] });
|
|
4552
5377
|
function AdminStudioFormsView(props) {
|
|
4553
5378
|
const { user } = useAuth6();
|
|
4554
|
-
const formsCollectionSlug =
|
|
4555
|
-
const formSubmissionsCollectionSlug =
|
|
5379
|
+
const formsCollectionSlug = getPropString13(props, "formsCollectionSlug", "forms");
|
|
5380
|
+
const formSubmissionsCollectionSlug = getPropString13(
|
|
4556
5381
|
props,
|
|
4557
5382
|
"formSubmissionsCollectionSlug",
|
|
4558
5383
|
"form-submissions"
|
|
4559
5384
|
);
|
|
4560
|
-
const formUploadsCollectionSlug =
|
|
5385
|
+
const formUploadsCollectionSlug = getPropString13(props, "formUploadsCollectionSlug", "form-uploads");
|
|
4561
5386
|
const adminBasePath = useAdminBasePath();
|
|
4562
5387
|
const rawFormsPath = resolveAdminPath(adminBasePath, `/collections/${formsCollectionSlug}`);
|
|
4563
5388
|
const rawSubmissionsPath = resolveAdminPath(
|
|
@@ -4565,12 +5390,12 @@ function AdminStudioFormsView(props) {
|
|
|
4565
5390
|
`/collections/${formSubmissionsCollectionSlug}`
|
|
4566
5391
|
);
|
|
4567
5392
|
const rawUploadsPath = resolveAdminPath(adminBasePath, `/collections/${formUploadsCollectionSlug}`);
|
|
4568
|
-
const [forms, setForms] =
|
|
4569
|
-
const [submissions, setSubmissions] =
|
|
4570
|
-
const [loading, setLoading] =
|
|
4571
|
-
const [error, setError] =
|
|
4572
|
-
|
|
4573
|
-
if (!
|
|
5393
|
+
const [forms, setForms] = useState18([]);
|
|
5394
|
+
const [submissions, setSubmissions] = useState18([]);
|
|
5395
|
+
const [loading, setLoading] = useState18(true);
|
|
5396
|
+
const [error, setError] = useState18(null);
|
|
5397
|
+
useEffect17(() => {
|
|
5398
|
+
if (!canReviewForms2(user)) {
|
|
4574
5399
|
return;
|
|
4575
5400
|
}
|
|
4576
5401
|
let cancelled = false;
|
|
@@ -4589,8 +5414,8 @@ function AdminStudioFormsView(props) {
|
|
|
4589
5414
|
sort: "-submittedAt"
|
|
4590
5415
|
});
|
|
4591
5416
|
const [nextForms, nextSubmissions] = await Promise.all([
|
|
4592
|
-
|
|
4593
|
-
|
|
5417
|
+
loadCollection2(formsCollectionSlug, formsParams),
|
|
5418
|
+
loadCollection2(formSubmissionsCollectionSlug, submissionsParams)
|
|
4594
5419
|
]);
|
|
4595
5420
|
if (cancelled) return;
|
|
4596
5421
|
setForms(nextForms);
|
|
@@ -4610,10 +5435,10 @@ function AdminStudioFormsView(props) {
|
|
|
4610
5435
|
cancelled = true;
|
|
4611
5436
|
};
|
|
4612
5437
|
}, [formSubmissionsCollectionSlug, formsCollectionSlug, user]);
|
|
4613
|
-
const submissionsByForm =
|
|
5438
|
+
const submissionsByForm = useMemo13(() => {
|
|
4614
5439
|
const map = /* @__PURE__ */ new Map();
|
|
4615
5440
|
for (const submission of submissions) {
|
|
4616
|
-
const formID =
|
|
5441
|
+
const formID = getFormID2(submission.form);
|
|
4617
5442
|
if (!formID) continue;
|
|
4618
5443
|
const current = map.get(formID) || [];
|
|
4619
5444
|
current.push(submission);
|
|
@@ -4621,7 +5446,7 @@ function AdminStudioFormsView(props) {
|
|
|
4621
5446
|
}
|
|
4622
5447
|
return map;
|
|
4623
5448
|
}, [submissions]);
|
|
4624
|
-
const busiestForm =
|
|
5449
|
+
const busiestForm = useMemo13(
|
|
4625
5450
|
() => forms.reduce((current, form) => {
|
|
4626
5451
|
const title = typeof form.title === "string" && form.title.trim().length > 0 ? form.title : "Untitled Form";
|
|
4627
5452
|
const count = (typeof form.id === "string" || typeof form.id === "number" ? submissionsByForm.get(String(form.id)) : null)?.length || 0;
|
|
@@ -4632,8 +5457,8 @@ function AdminStudioFormsView(props) {
|
|
|
4632
5457
|
}, null),
|
|
4633
5458
|
[forms, submissionsByForm]
|
|
4634
5459
|
);
|
|
4635
|
-
if (!
|
|
4636
|
-
return /* @__PURE__ */
|
|
5460
|
+
if (!canReviewForms2(user)) {
|
|
5461
|
+
return /* @__PURE__ */ jsx29(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx29(
|
|
4637
5462
|
AdminPage,
|
|
4638
5463
|
{
|
|
4639
5464
|
breadcrumbs: [
|
|
@@ -4642,14 +5467,14 @@ function AdminStudioFormsView(props) {
|
|
|
4642
5467
|
],
|
|
4643
5468
|
description: "You do not have access to this section.",
|
|
4644
5469
|
title: "Forms",
|
|
4645
|
-
children: /* @__PURE__ */
|
|
4646
|
-
/* @__PURE__ */
|
|
4647
|
-
/* @__PURE__ */
|
|
5470
|
+
children: /* @__PURE__ */ jsxs26("div", { className: "orion-admin-card", children: [
|
|
5471
|
+
/* @__PURE__ */ jsx29("strong", { children: "Access denied" }),
|
|
5472
|
+
/* @__PURE__ */ jsx29("span", { children: "This section is restricted to editor and administrator accounts." })
|
|
4648
5473
|
] })
|
|
4649
5474
|
}
|
|
4650
5475
|
) });
|
|
4651
5476
|
}
|
|
4652
|
-
return /* @__PURE__ */
|
|
5477
|
+
return /* @__PURE__ */ jsx29(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs26(
|
|
4653
5478
|
AdminPage,
|
|
4654
5479
|
{
|
|
4655
5480
|
breadcrumbs: [
|
|
@@ -4659,30 +5484,30 @@ function AdminStudioFormsView(props) {
|
|
|
4659
5484
|
description: "Review live forms, recent responses, and uploaded files.",
|
|
4660
5485
|
title: "Forms",
|
|
4661
5486
|
children: [
|
|
4662
|
-
loading ? /* @__PURE__ */
|
|
4663
|
-
error ? /* @__PURE__ */
|
|
4664
|
-
!loading && !error ? /* @__PURE__ */
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4667
|
-
/* @__PURE__ */
|
|
4668
|
-
/* @__PURE__ */
|
|
4669
|
-
/* @__PURE__ */
|
|
5487
|
+
loading ? /* @__PURE__ */ jsx29("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5488
|
+
error ? /* @__PURE__ */ jsx29("div", { className: "orion-admin-error", children: error }) : null,
|
|
5489
|
+
!loading && !error ? /* @__PURE__ */ jsxs26("div", { className: "orion-admin-forms-dashboard", children: [
|
|
5490
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-forms-summary-grid", children: [
|
|
5491
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-overview-stat", children: [
|
|
5492
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-overview-stat-label", children: "Configured forms" }),
|
|
5493
|
+
/* @__PURE__ */ jsx29("strong", { children: forms.length }),
|
|
5494
|
+
/* @__PURE__ */ jsx29("p", { children: "Published or draft forms currently available inside the CMS." })
|
|
4670
5495
|
] }),
|
|
4671
|
-
/* @__PURE__ */
|
|
4672
|
-
/* @__PURE__ */
|
|
4673
|
-
/* @__PURE__ */
|
|
4674
|
-
/* @__PURE__ */
|
|
5496
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-overview-stat", children: [
|
|
5497
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-overview-stat-label", children: "Recent submissions" }),
|
|
5498
|
+
/* @__PURE__ */ jsx29("strong", { children: submissions.length }),
|
|
5499
|
+
/* @__PURE__ */ jsx29("p", { children: "Latest 200 responses collected across every form." })
|
|
4675
5500
|
] }),
|
|
4676
|
-
/* @__PURE__ */
|
|
4677
|
-
/* @__PURE__ */
|
|
4678
|
-
/* @__PURE__ */
|
|
4679
|
-
/* @__PURE__ */
|
|
5501
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-overview-stat", children: [
|
|
5502
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-overview-stat-label", children: "Most active form" }),
|
|
5503
|
+
/* @__PURE__ */ jsx29("strong", { children: busiestForm && busiestForm.count > 0 ? busiestForm.title : "No activity yet" }),
|
|
5504
|
+
/* @__PURE__ */ jsx29("p", { children: busiestForm && busiestForm.count > 0 ? `${busiestForm.count} response${busiestForm.count === 1 ? "" : "s"} in this view.` : "Submissions will surface here once a form starts receiving traffic." })
|
|
4680
5505
|
] })
|
|
4681
5506
|
] }),
|
|
4682
|
-
forms.length === 0 ? /* @__PURE__ */
|
|
4683
|
-
/* @__PURE__ */
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
] }) : /* @__PURE__ */
|
|
5507
|
+
forms.length === 0 ? /* @__PURE__ */ jsxs26("div", { className: "orion-admin-card", children: [
|
|
5508
|
+
/* @__PURE__ */ jsx29("strong", { children: "No forms found" }),
|
|
5509
|
+
/* @__PURE__ */ jsx29("span", { children: "Create a form in Payload to start collecting responses." })
|
|
5510
|
+
] }) : /* @__PURE__ */ jsx29("div", { className: "orion-admin-forms-board-list", children: forms.map((form) => {
|
|
4686
5511
|
const id = typeof form.id === "string" || typeof form.id === "number" ? String(form.id) : "";
|
|
4687
5512
|
if (!id) return null;
|
|
4688
5513
|
const title = typeof form.title === "string" && form.title.trim().length > 0 ? form.title : "Untitled Form";
|
|
@@ -4697,31 +5522,31 @@ function AdminStudioFormsView(props) {
|
|
|
4697
5522
|
const updatedMeta = form.updatedAt ? `Updated ${formatDate(form.updatedAt)}` : "Update time unavailable";
|
|
4698
5523
|
const toneStyle = getFormToneStyle(slug, title || id);
|
|
4699
5524
|
const isResponsePanelScrollable = formSubmissions.length > RESPONSE_SCROLL_THRESHOLD;
|
|
4700
|
-
return /* @__PURE__ */
|
|
4701
|
-
/* @__PURE__ */
|
|
4702
|
-
/* @__PURE__ */
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
/* @__PURE__ */
|
|
5525
|
+
return /* @__PURE__ */ jsxs26("section", { className: "orion-admin-form-board", style: toneStyle, children: [
|
|
5526
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-header", children: [
|
|
5527
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-heading", children: [
|
|
5528
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-kicker-row", children: [
|
|
5529
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-board-kicker", children: slug || "No slug set" }),
|
|
5530
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-board-meta", children: updatedMeta })
|
|
4706
5531
|
] }),
|
|
4707
|
-
/* @__PURE__ */
|
|
4708
|
-
/* @__PURE__ */
|
|
4709
|
-
/* @__PURE__ */
|
|
4710
|
-
/* @__PURE__ */
|
|
4711
|
-
/* @__PURE__ */
|
|
5532
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-title-row", children: [
|
|
5533
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-form-board-mark", children: getInitials(title, slug) }),
|
|
5534
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-copy", children: [
|
|
5535
|
+
/* @__PURE__ */ jsx29("h2", { className: "orion-admin-form-board-title", children: title }),
|
|
5536
|
+
/* @__PURE__ */ jsx29("p", { className: "orion-admin-form-board-subtitle", children: latestResponse ? `Latest response ${latestResponseLabel}` : "Awaiting the first submission" })
|
|
4712
5537
|
] })
|
|
4713
5538
|
] })
|
|
4714
5539
|
] }),
|
|
4715
|
-
/* @__PURE__ */
|
|
4716
|
-
/* @__PURE__ */
|
|
4717
|
-
/* @__PURE__ */
|
|
4718
|
-
/* @__PURE__ */
|
|
5540
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-actions", children: [
|
|
5541
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-count", children: [
|
|
5542
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-board-count-value", children: formSubmissions.length }),
|
|
5543
|
+
/* @__PURE__ */ jsxs26("span", { className: "orion-admin-form-board-count-label", children: [
|
|
4719
5544
|
"response",
|
|
4720
5545
|
formSubmissions.length === 1 ? "" : "s"
|
|
4721
5546
|
] })
|
|
4722
5547
|
] }),
|
|
4723
|
-
/* @__PURE__ */
|
|
4724
|
-
|
|
5548
|
+
/* @__PURE__ */ jsx29(
|
|
5549
|
+
Link3,
|
|
4725
5550
|
{
|
|
4726
5551
|
className: "orion-admin-action-button orion-admin-action-button--soft",
|
|
4727
5552
|
href: `${rawFormsPath}/${id}`,
|
|
@@ -4730,35 +5555,35 @@ function AdminStudioFormsView(props) {
|
|
|
4730
5555
|
)
|
|
4731
5556
|
] })
|
|
4732
5557
|
] }),
|
|
4733
|
-
/* @__PURE__ */
|
|
4734
|
-
/* @__PURE__ */
|
|
4735
|
-
/* @__PURE__ */
|
|
4736
|
-
/* @__PURE__ */
|
|
5558
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-board-metrics", children: [
|
|
5559
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5560
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Workflow steps" }),
|
|
5561
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value", children: stepCount })
|
|
4737
5562
|
] }),
|
|
4738
|
-
/* @__PURE__ */
|
|
4739
|
-
/* @__PURE__ */
|
|
4740
|
-
/* @__PURE__ */
|
|
5563
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5564
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Fields" }),
|
|
5565
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value", children: fieldCount })
|
|
4741
5566
|
] }),
|
|
4742
|
-
/* @__PURE__ */
|
|
4743
|
-
/* @__PURE__ */
|
|
4744
|
-
/* @__PURE__ */
|
|
5567
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5568
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Submit button" }),
|
|
5569
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value is-copy", children: submitLabel })
|
|
4745
5570
|
] }),
|
|
4746
|
-
/* @__PURE__ */
|
|
4747
|
-
/* @__PURE__ */
|
|
4748
|
-
/* @__PURE__ */
|
|
5571
|
+
/* @__PURE__ */ jsxs26("article", { className: "orion-admin-form-metric", children: [
|
|
5572
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-metric-label", children: "Latest response" }),
|
|
5573
|
+
/* @__PURE__ */ jsx29("strong", { className: "orion-admin-form-metric-value is-copy", children: latestResponseLabel })
|
|
4749
5574
|
] })
|
|
4750
5575
|
] }),
|
|
4751
|
-
/* @__PURE__ */
|
|
4752
|
-
/* @__PURE__ */
|
|
4753
|
-
/* @__PURE__ */
|
|
4754
|
-
/* @__PURE__ */
|
|
4755
|
-
/* @__PURE__ */
|
|
5576
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-response-panel", children: [
|
|
5577
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-form-response-panel-header", children: [
|
|
5578
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
5579
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-form-section-label", children: "Response stream" }),
|
|
5580
|
+
/* @__PURE__ */ jsx29("strong", { children: formSubmissions.length > 0 ? `${formSubmissions.length} recent submission${formSubmissions.length === 1 ? "" : "s"}` : "No responses yet" })
|
|
4756
5581
|
] }),
|
|
4757
|
-
isResponsePanelScrollable ? /* @__PURE__ */
|
|
5582
|
+
isResponsePanelScrollable ? /* @__PURE__ */ jsx29("span", { className: "orion-admin-form-panel-note", children: "Latest 3 visible. Scroll for older responses." }) : formSubmissions.length > 0 ? /* @__PURE__ */ jsx29("span", { className: "orion-admin-form-panel-note", children: "Showing all recent activity" }) : null
|
|
4758
5583
|
] }),
|
|
4759
5584
|
formSubmissions.length === 0 ? renderEmptyMessage(
|
|
4760
5585
|
"This form will start filling this lane as soon as the first submission arrives."
|
|
4761
|
-
) : /* @__PURE__ */
|
|
5586
|
+
) : /* @__PURE__ */ jsx29(
|
|
4762
5587
|
"div",
|
|
4763
5588
|
{
|
|
4764
5589
|
className: [
|
|
@@ -4782,33 +5607,33 @@ function AdminStudioFormsView(props) {
|
|
|
4782
5607
|
);
|
|
4783
5608
|
const visibleUploads = uploads.slice(0, 2);
|
|
4784
5609
|
const hiddenUploadCount = uploads.length - visibleUploads.length;
|
|
4785
|
-
return /* @__PURE__ */
|
|
5610
|
+
return /* @__PURE__ */ jsxs26(
|
|
4786
5611
|
"article",
|
|
4787
5612
|
{
|
|
4788
5613
|
className: "orion-admin-response-card",
|
|
4789
5614
|
children: [
|
|
4790
|
-
/* @__PURE__ */
|
|
4791
|
-
/* @__PURE__ */
|
|
4792
|
-
/* @__PURE__ */
|
|
4793
|
-
/* @__PURE__ */
|
|
4794
|
-
/* @__PURE__ */
|
|
4795
|
-
/* @__PURE__ */
|
|
5615
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-card-main", children: [
|
|
5616
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-card-top", children: [
|
|
5617
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-response-badge", children: getInitials(identity.name, identity.email, title) }),
|
|
5618
|
+
/* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-heading", children: [
|
|
5619
|
+
/* @__PURE__ */ jsx29("strong", { children: primaryIdentity }),
|
|
5620
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-response-secondary", children: secondaryIdentity })
|
|
4796
5621
|
] }),
|
|
4797
|
-
/* @__PURE__ */
|
|
5622
|
+
/* @__PURE__ */ jsx29("div", { className: "orion-admin-response-date", children: formatDate(submission.submittedAt) })
|
|
4798
5623
|
] }),
|
|
4799
|
-
previewFields.length > 0 ? /* @__PURE__ */
|
|
5624
|
+
previewFields.length > 0 ? /* @__PURE__ */ jsx29("div", { className: "orion-admin-response-chip-row", children: previewFields.map((field, index) => /* @__PURE__ */ jsxs26(
|
|
4800
5625
|
"div",
|
|
4801
5626
|
{
|
|
4802
5627
|
className: "orion-admin-response-chip",
|
|
4803
5628
|
children: [
|
|
4804
|
-
/* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
5629
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-response-chip-label", children: field.label }),
|
|
5630
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-response-chip-value", children: field.value })
|
|
4806
5631
|
]
|
|
4807
5632
|
},
|
|
4808
5633
|
`${submissionID}-${field.label}-${index}`
|
|
4809
|
-
)) }) : /* @__PURE__ */
|
|
4810
|
-
uploads.length > 0 ? /* @__PURE__ */
|
|
4811
|
-
/* @__PURE__ */
|
|
5634
|
+
)) }) : /* @__PURE__ */ jsx29("div", { className: "orion-admin-response-empty", children: "No preview fields are available for this submission." }),
|
|
5635
|
+
uploads.length > 0 ? /* @__PURE__ */ jsxs26("div", { className: "orion-admin-response-upload-row", children: [
|
|
5636
|
+
/* @__PURE__ */ jsx29("span", { className: "orion-admin-upload-label", children: "Uploads" }),
|
|
4812
5637
|
visibleUploads.map((upload) => {
|
|
4813
5638
|
const uploadID = typeof upload.id === "string" || typeof upload.id === "number" ? String(upload.id) : "";
|
|
4814
5639
|
if (!uploadID) return null;
|
|
@@ -4822,8 +5647,8 @@ function AdminStudioFormsView(props) {
|
|
|
4822
5647
|
),
|
|
4823
5648
|
38
|
|
4824
5649
|
);
|
|
4825
|
-
return /* @__PURE__ */
|
|
4826
|
-
|
|
5650
|
+
return /* @__PURE__ */ jsx29(
|
|
5651
|
+
Link3,
|
|
4827
5652
|
{
|
|
4828
5653
|
className: "orion-admin-upload-chip",
|
|
4829
5654
|
href: `${rawUploadsPath}/${uploadID}`,
|
|
@@ -4832,15 +5657,15 @@ function AdminStudioFormsView(props) {
|
|
|
4832
5657
|
uploadID
|
|
4833
5658
|
);
|
|
4834
5659
|
}),
|
|
4835
|
-
hiddenUploadCount > 0 ? /* @__PURE__ */
|
|
5660
|
+
hiddenUploadCount > 0 ? /* @__PURE__ */ jsxs26("span", { className: "orion-admin-upload-chip is-passive", children: [
|
|
4836
5661
|
"+",
|
|
4837
5662
|
hiddenUploadCount,
|
|
4838
5663
|
" more"
|
|
4839
5664
|
] }) : null
|
|
4840
5665
|
] }) : null
|
|
4841
5666
|
] }),
|
|
4842
|
-
/* @__PURE__ */
|
|
4843
|
-
|
|
5667
|
+
/* @__PURE__ */ jsx29(
|
|
5668
|
+
Link3,
|
|
4844
5669
|
{
|
|
4845
5670
|
className: "orion-admin-action-button orion-admin-action-button--ghost",
|
|
4846
5671
|
href: `${rawSubmissionsPath}/${submissionID}`,
|
|
@@ -4864,9 +5689,9 @@ function AdminStudioFormsView(props) {
|
|
|
4864
5689
|
}
|
|
4865
5690
|
|
|
4866
5691
|
// src/admin/components/studio/AdminStudioToolsView.tsx
|
|
4867
|
-
import { useEffect as
|
|
5692
|
+
import { useEffect as useEffect18, useState as useState19 } from "react";
|
|
4868
5693
|
import { useAuth as useAuth7 } from "@payloadcms/ui";
|
|
4869
|
-
import { jsx as
|
|
5694
|
+
import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4870
5695
|
var userRoles = ["admin", "client", "editor"];
|
|
4871
5696
|
var isAdmin4 = (user) => {
|
|
4872
5697
|
if (!user || typeof user !== "object") return false;
|
|
@@ -4877,14 +5702,14 @@ var normalizeRole = (value) => userRoles.includes(value) ? value : "editor";
|
|
|
4877
5702
|
function AdminStudioToolsView(props) {
|
|
4878
5703
|
const { user } = useAuth7();
|
|
4879
5704
|
const adminBasePath = useAdminBasePath();
|
|
4880
|
-
const [docs, setDocs] =
|
|
4881
|
-
const [loading, setLoading] =
|
|
4882
|
-
const [error, setError] =
|
|
4883
|
-
const [savedMessage, setSavedMessage] =
|
|
4884
|
-
const [createSubmitting, setCreateSubmitting] =
|
|
4885
|
-
const [updatingUserID, setUpdatingUserID] =
|
|
5705
|
+
const [docs, setDocs] = useState19([]);
|
|
5706
|
+
const [loading, setLoading] = useState19(true);
|
|
5707
|
+
const [error, setError] = useState19(null);
|
|
5708
|
+
const [savedMessage, setSavedMessage] = useState19(null);
|
|
5709
|
+
const [createSubmitting, setCreateSubmitting] = useState19(false);
|
|
5710
|
+
const [updatingUserID, setUpdatingUserID] = useState19(null);
|
|
4886
5711
|
if (!isAdmin4(user)) {
|
|
4887
|
-
return /* @__PURE__ */
|
|
5712
|
+
return /* @__PURE__ */ jsx30(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsx30(
|
|
4888
5713
|
AdminPage,
|
|
4889
5714
|
{
|
|
4890
5715
|
breadcrumbs: [
|
|
@@ -4893,9 +5718,9 @@ function AdminStudioToolsView(props) {
|
|
|
4893
5718
|
],
|
|
4894
5719
|
description: "You do not have access to this section.",
|
|
4895
5720
|
title: "Admin Tools",
|
|
4896
|
-
children: /* @__PURE__ */
|
|
4897
|
-
/* @__PURE__ */
|
|
4898
|
-
/* @__PURE__ */
|
|
5721
|
+
children: /* @__PURE__ */ jsxs27("div", { className: "orion-admin-card", children: [
|
|
5722
|
+
/* @__PURE__ */ jsx30("strong", { children: "Access denied" }),
|
|
5723
|
+
/* @__PURE__ */ jsx30("span", { children: "This section is restricted to administrator accounts." })
|
|
4899
5724
|
] })
|
|
4900
5725
|
}
|
|
4901
5726
|
) });
|
|
@@ -4924,7 +5749,7 @@ function AdminStudioToolsView(props) {
|
|
|
4924
5749
|
setLoading(false);
|
|
4925
5750
|
}
|
|
4926
5751
|
};
|
|
4927
|
-
|
|
5752
|
+
useEffect18(() => {
|
|
4928
5753
|
void loadUsers();
|
|
4929
5754
|
}, []);
|
|
4930
5755
|
const createUser = async (event) => {
|
|
@@ -4995,7 +5820,7 @@ function AdminStudioToolsView(props) {
|
|
|
4995
5820
|
setUpdatingUserID(null);
|
|
4996
5821
|
}
|
|
4997
5822
|
};
|
|
4998
|
-
return /* @__PURE__ */
|
|
5823
|
+
return /* @__PURE__ */ jsx30(StudioSectionLayout, { navProps: props, children: /* @__PURE__ */ jsxs27(
|
|
4999
5824
|
AdminPage,
|
|
5000
5825
|
{
|
|
5001
5826
|
breadcrumbs: [
|
|
@@ -5005,53 +5830,53 @@ function AdminStudioToolsView(props) {
|
|
|
5005
5830
|
description: "Manage users and fallback links to Payload native admin.",
|
|
5006
5831
|
title: "Admin Tools",
|
|
5007
5832
|
children: [
|
|
5008
|
-
/* @__PURE__ */
|
|
5009
|
-
error ? /* @__PURE__ */
|
|
5010
|
-
savedMessage ? /* @__PURE__ */
|
|
5011
|
-
/* @__PURE__ */
|
|
5012
|
-
/* @__PURE__ */
|
|
5013
|
-
/* @__PURE__ */
|
|
5833
|
+
/* @__PURE__ */ jsx30("div", { className: "orion-admin-inline-actions", style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsx30("a", { className: "orion-admin-action-button", href: "/admin-core", target: "_blank", children: "Open Payload Core Admin" }) }),
|
|
5834
|
+
error ? /* @__PURE__ */ jsx30("div", { className: "orion-admin-error", style: { marginBottom: "1rem" }, children: error }) : null,
|
|
5835
|
+
savedMessage ? /* @__PURE__ */ jsx30("div", { className: "orion-admin-success", style: { marginBottom: "1rem" }, children: savedMessage }) : null,
|
|
5836
|
+
/* @__PURE__ */ jsxs27("form", { className: "orion-admin-form", onSubmit: createUser, style: { marginBottom: "1rem" }, children: [
|
|
5837
|
+
/* @__PURE__ */ jsx30("strong", { children: "Create User" }),
|
|
5838
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5014
5839
|
"Email",
|
|
5015
|
-
/* @__PURE__ */
|
|
5840
|
+
/* @__PURE__ */ jsx30("input", { name: "email", required: true, type: "email" })
|
|
5016
5841
|
] }),
|
|
5017
|
-
/* @__PURE__ */
|
|
5842
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5018
5843
|
"Full Name",
|
|
5019
|
-
/* @__PURE__ */
|
|
5844
|
+
/* @__PURE__ */ jsx30("input", { name: "fullName", type: "text" })
|
|
5020
5845
|
] }),
|
|
5021
|
-
/* @__PURE__ */
|
|
5846
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5022
5847
|
"Password",
|
|
5023
|
-
/* @__PURE__ */
|
|
5848
|
+
/* @__PURE__ */ jsx30("input", { name: "password", required: true, type: "password" })
|
|
5024
5849
|
] }),
|
|
5025
|
-
/* @__PURE__ */
|
|
5850
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
5026
5851
|
"Role",
|
|
5027
|
-
/* @__PURE__ */
|
|
5028
|
-
/* @__PURE__ */
|
|
5029
|
-
/* @__PURE__ */
|
|
5030
|
-
/* @__PURE__ */
|
|
5852
|
+
/* @__PURE__ */ jsxs27("select", { defaultValue: "editor", name: "role", children: [
|
|
5853
|
+
/* @__PURE__ */ jsx30("option", { value: "admin", children: "admin" }),
|
|
5854
|
+
/* @__PURE__ */ jsx30("option", { value: "editor", children: "editor" }),
|
|
5855
|
+
/* @__PURE__ */ jsx30("option", { value: "client", children: "client" })
|
|
5031
5856
|
] })
|
|
5032
5857
|
] }),
|
|
5033
|
-
/* @__PURE__ */
|
|
5858
|
+
/* @__PURE__ */ jsx30("button", { disabled: createSubmitting, type: "submit", children: createSubmitting ? "Creating..." : "Create User" })
|
|
5034
5859
|
] }),
|
|
5035
|
-
loading ? /* @__PURE__ */
|
|
5036
|
-
/* @__PURE__ */
|
|
5860
|
+
loading ? /* @__PURE__ */ jsx30("div", { className: "orion-admin-list-meta", children: "Loading..." }) : null,
|
|
5861
|
+
/* @__PURE__ */ jsx30("div", { className: "orion-admin-list", children: docs.map((doc) => {
|
|
5037
5862
|
const id = typeof doc.id === "string" || typeof doc.id === "number" ? String(doc.id) : "";
|
|
5038
5863
|
if (!id) return null;
|
|
5039
5864
|
const email = typeof doc.email === "string" ? doc.email : `user-${id}`;
|
|
5040
5865
|
const fullName = typeof doc.fullName === "string" ? doc.fullName : "";
|
|
5041
5866
|
const currentRole = typeof doc.role === "string" ? normalizeRole(doc.role) : "editor";
|
|
5042
|
-
return /* @__PURE__ */
|
|
5043
|
-
/* @__PURE__ */
|
|
5044
|
-
/* @__PURE__ */
|
|
5045
|
-
/* @__PURE__ */
|
|
5867
|
+
return /* @__PURE__ */ jsxs27("div", { className: "orion-admin-list-item", children: [
|
|
5868
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
5869
|
+
/* @__PURE__ */ jsx30("strong", { children: email }),
|
|
5870
|
+
/* @__PURE__ */ jsx30("div", { className: "orion-admin-list-meta", children: fullName || "No full name set" })
|
|
5046
5871
|
] }),
|
|
5047
|
-
/* @__PURE__ */
|
|
5048
|
-
/* @__PURE__ */
|
|
5049
|
-
/* @__PURE__ */
|
|
5050
|
-
/* @__PURE__ */
|
|
5051
|
-
/* @__PURE__ */
|
|
5052
|
-
/* @__PURE__ */
|
|
5872
|
+
/* @__PURE__ */ jsxs27("form", { className: "orion-admin-inline-actions", onSubmit: updateUserRole, children: [
|
|
5873
|
+
/* @__PURE__ */ jsx30("input", { name: "id", type: "hidden", value: id }),
|
|
5874
|
+
/* @__PURE__ */ jsxs27("select", { defaultValue: currentRole, name: "role", children: [
|
|
5875
|
+
/* @__PURE__ */ jsx30("option", { value: "admin", children: "admin" }),
|
|
5876
|
+
/* @__PURE__ */ jsx30("option", { value: "editor", children: "editor" }),
|
|
5877
|
+
/* @__PURE__ */ jsx30("option", { value: "client", children: "client" })
|
|
5053
5878
|
] }),
|
|
5054
|
-
/* @__PURE__ */
|
|
5879
|
+
/* @__PURE__ */ jsx30("button", { disabled: updatingUserID === id, type: "submit", children: updatingUserID === id ? "Updating..." : "Update" })
|
|
5055
5880
|
] })
|
|
5056
5881
|
] }, id);
|
|
5057
5882
|
}) })
|
|
@@ -5062,14 +5887,14 @@ function AdminStudioToolsView(props) {
|
|
|
5062
5887
|
|
|
5063
5888
|
// src/admin/components/studio/OpenInStudioMenuItem.tsx
|
|
5064
5889
|
import { useDocumentInfo } from "@payloadcms/ui";
|
|
5065
|
-
import { jsx as
|
|
5890
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
5066
5891
|
function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
5067
5892
|
const documentInfo = useDocumentInfo();
|
|
5068
5893
|
const id = documentInfo?.id;
|
|
5069
5894
|
if (!id) {
|
|
5070
5895
|
return null;
|
|
5071
5896
|
}
|
|
5072
|
-
return /* @__PURE__ */
|
|
5897
|
+
return /* @__PURE__ */ jsx31(
|
|
5073
5898
|
"a",
|
|
5074
5899
|
{
|
|
5075
5900
|
href: `${pagesPathBase}/${id}`,
|
|
@@ -5088,19 +5913,19 @@ function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
|
|
|
5088
5913
|
}
|
|
5089
5914
|
|
|
5090
5915
|
// src/admin/components/studio/PageEditRedirectToStudio.tsx
|
|
5091
|
-
import { useEffect as
|
|
5916
|
+
import { useEffect as useEffect19 } from "react";
|
|
5092
5917
|
import { useDocumentInfo as useDocumentInfo2 } from "@payloadcms/ui";
|
|
5093
|
-
import { jsx as
|
|
5918
|
+
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5094
5919
|
function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
5095
5920
|
const documentInfo = useDocumentInfo2();
|
|
5096
5921
|
const id = documentInfo?.id;
|
|
5097
|
-
|
|
5922
|
+
useEffect19(() => {
|
|
5098
5923
|
if (!id) {
|
|
5099
5924
|
return;
|
|
5100
5925
|
}
|
|
5101
5926
|
window.location.replace(`${pagesPathBase}/${id}`);
|
|
5102
5927
|
}, [id, pagesPathBase]);
|
|
5103
|
-
return /* @__PURE__ */
|
|
5928
|
+
return /* @__PURE__ */ jsxs28(
|
|
5104
5929
|
"div",
|
|
5105
5930
|
{
|
|
5106
5931
|
style: {
|
|
@@ -5112,18 +5937,18 @@ function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
|
|
|
5112
5937
|
minHeight: "50vh"
|
|
5113
5938
|
},
|
|
5114
5939
|
children: [
|
|
5115
|
-
/* @__PURE__ */
|
|
5116
|
-
/* @__PURE__ */
|
|
5117
|
-
id ? /* @__PURE__ */
|
|
5940
|
+
/* @__PURE__ */ jsx32("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
|
|
5941
|
+
/* @__PURE__ */ jsx32("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
|
|
5942
|
+
id ? /* @__PURE__ */ jsx32("a", { href: `${pagesPathBase}/${id}`, children: "Continue to Editor" }) : /* @__PURE__ */ jsx32("a", { href: pagesPathBase, children: "Open Pages" })
|
|
5118
5943
|
]
|
|
5119
5944
|
}
|
|
5120
5945
|
);
|
|
5121
5946
|
}
|
|
5122
5947
|
|
|
5123
5948
|
// src/admin/components/studio/StudioBackBreadcrumb.tsx
|
|
5124
|
-
import { useEffect as
|
|
5949
|
+
import { useEffect as useEffect20, useState as useState20 } from "react";
|
|
5125
5950
|
import { SetStepNav as SetStepNav5 } from "@payloadcms/ui";
|
|
5126
|
-
import { jsx as
|
|
5951
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
5127
5952
|
var toTitle = (slug) => slug.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
5128
5953
|
var buildNav = (pathname, adminBasePath) => {
|
|
5129
5954
|
if (pathname.includes("/globals/")) {
|
|
@@ -5168,8 +5993,8 @@ var buildNav = (pathname, adminBasePath) => {
|
|
|
5168
5993
|
};
|
|
5169
5994
|
function StudioBackBreadcrumb() {
|
|
5170
5995
|
const adminBasePath = useAdminBasePath();
|
|
5171
|
-
const [pathname, setPathname] =
|
|
5172
|
-
|
|
5996
|
+
const [pathname, setPathname] = useState20("");
|
|
5997
|
+
useEffect20(() => {
|
|
5173
5998
|
const update = () => setPathname(window.location.pathname);
|
|
5174
5999
|
update();
|
|
5175
6000
|
window.addEventListener("popstate", update);
|
|
@@ -5177,13 +6002,13 @@ function StudioBackBreadcrumb() {
|
|
|
5177
6002
|
}, []);
|
|
5178
6003
|
const nav = buildNav(pathname, adminBasePath);
|
|
5179
6004
|
if (!nav) return null;
|
|
5180
|
-
return /* @__PURE__ */
|
|
6005
|
+
return /* @__PURE__ */ jsx33(SetStepNav5, { nav });
|
|
5181
6006
|
}
|
|
5182
6007
|
|
|
5183
6008
|
// src/admin/components/studio/StudioContactFormRedirect.tsx
|
|
5184
|
-
import { useEffect as
|
|
5185
|
-
import { jsx as
|
|
5186
|
-
var
|
|
6009
|
+
import { useEffect as useEffect21 } from "react";
|
|
6010
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6011
|
+
var getPropString14 = (props, key, fallback) => {
|
|
5187
6012
|
if (!props || typeof props !== "object") return fallback;
|
|
5188
6013
|
const direct = props[key];
|
|
5189
6014
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -5196,13 +6021,13 @@ var getPropString13 = (props, key, fallback) => {
|
|
|
5196
6021
|
};
|
|
5197
6022
|
function StudioContactFormRedirect(props) {
|
|
5198
6023
|
const adminBasePath = useAdminBasePath();
|
|
5199
|
-
const studioContactFormPath =
|
|
6024
|
+
const studioContactFormPath = getPropString14(props, "studioContactFormPath", "/contact-form");
|
|
5200
6025
|
const targetPath = resolveAdminPath(adminBasePath, studioContactFormPath);
|
|
5201
|
-
|
|
6026
|
+
useEffect21(() => {
|
|
5202
6027
|
if (window.location.pathname === targetPath) return;
|
|
5203
6028
|
window.location.replace(targetPath);
|
|
5204
6029
|
}, [targetPath]);
|
|
5205
|
-
return /* @__PURE__ */
|
|
6030
|
+
return /* @__PURE__ */ jsxs29(
|
|
5206
6031
|
"div",
|
|
5207
6032
|
{
|
|
5208
6033
|
style: {
|
|
@@ -5215,8 +6040,8 @@ function StudioContactFormRedirect(props) {
|
|
|
5215
6040
|
minHeight: "40vh"
|
|
5216
6041
|
},
|
|
5217
6042
|
children: [
|
|
5218
|
-
/* @__PURE__ */
|
|
5219
|
-
/* @__PURE__ */
|
|
6043
|
+
/* @__PURE__ */ jsx34("h2", { style: { margin: 0 }, children: "Opening Contact Form Editor..." }),
|
|
6044
|
+
/* @__PURE__ */ jsx34("a", { href: targetPath, children: "Continue" })
|
|
5220
6045
|
]
|
|
5221
6046
|
}
|
|
5222
6047
|
);
|
|
@@ -5225,6 +6050,7 @@ export {
|
|
|
5225
6050
|
AdminLoginIntro,
|
|
5226
6051
|
AdminLoginPasswordToggle,
|
|
5227
6052
|
AdminStudioContactFormView,
|
|
6053
|
+
AdminStudioDashboard,
|
|
5228
6054
|
AdminStudioFooterGlobalView,
|
|
5229
6055
|
AdminStudioFormsView,
|
|
5230
6056
|
AdminStudioGlobalsView,
|