admin-lib-cms 1.1.9 → 1.2.1
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/auth.d.mts +2 -0
- package/dist/auth.d.ts +2 -0
- package/dist/auth.js +18 -1
- package/dist/auth.mjs +19 -2
- package/dist/chunk-4KJKAYIC.mjs +153 -0
- package/dist/emails/index.js +2 -1
- package/dist/emails/index.mjs +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +319 -139
- package/dist/index.mjs +481 -302
- package/dist/types.d.mts +7 -3
- package/dist/types.d.ts +7 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import "./chunk-WBQAMGXK.mjs";
|
|
|
3
3
|
import {
|
|
4
4
|
generateDefaultTemplate,
|
|
5
5
|
sendEmailNotification
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4KJKAYIC.mjs";
|
|
7
7
|
|
|
8
8
|
// src/provider.tsx
|
|
9
9
|
import {
|
|
@@ -422,14 +422,14 @@ function useSubmit(formId) {
|
|
|
422
422
|
|
|
423
423
|
// src/editable.tsx
|
|
424
424
|
import { createElement, useEffect as useEffect3 } from "react";
|
|
425
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
426
|
-
function useRegister(id, type, label, section, pageId, defaultValue, itemSchema, fixedLength) {
|
|
425
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
426
|
+
function useRegister(id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search) {
|
|
427
427
|
const ctx = useCmsOptional();
|
|
428
428
|
useEffect3(() => {
|
|
429
429
|
if (!ctx) return;
|
|
430
|
-
ctx.registerEditable({ id, type, label, section, pageId, defaultValue, itemSchema, fixedLength });
|
|
430
|
+
ctx.registerEditable({ id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search });
|
|
431
431
|
return () => ctx.unregisterEditable(id);
|
|
432
|
-
}, [ctx?.registerEditable, ctx?.unregisterEditable, id, type, label, section, pageId, defaultValue, itemSchema, fixedLength]);
|
|
432
|
+
}, [ctx?.registerEditable, ctx?.unregisterEditable, id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search]);
|
|
433
433
|
return ctx;
|
|
434
434
|
}
|
|
435
435
|
function editableClasses(active, selected) {
|
|
@@ -452,6 +452,8 @@ function EditableText({
|
|
|
452
452
|
const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? String(ctx.overrides[id] ?? "") : children;
|
|
453
453
|
const active = !!ctx?.editMode;
|
|
454
454
|
const selected = ctx?.selectedId === id;
|
|
455
|
+
const isEmpty = !value || String(value).trim() === "";
|
|
456
|
+
const renderValue = active && isEmpty ? `[Empty: ${label || id}]` : value;
|
|
455
457
|
const onClick = (e) => {
|
|
456
458
|
if (!active || !ctx) return;
|
|
457
459
|
e.preventDefault();
|
|
@@ -461,11 +463,15 @@ function EditableText({
|
|
|
461
463
|
return createElement(
|
|
462
464
|
as,
|
|
463
465
|
{
|
|
464
|
-
className: [
|
|
466
|
+
className: [
|
|
467
|
+
className,
|
|
468
|
+
editableClasses(active, selected),
|
|
469
|
+
active && isEmpty ? "opacity-50" : ""
|
|
470
|
+
].filter(Boolean).join(" "),
|
|
465
471
|
"data-cms-id": id,
|
|
466
472
|
onClick: active ? onClick : void 0
|
|
467
473
|
},
|
|
468
|
-
|
|
474
|
+
renderValue
|
|
469
475
|
);
|
|
470
476
|
}
|
|
471
477
|
function EditableImage({
|
|
@@ -578,6 +584,9 @@ function EditableLink({
|
|
|
578
584
|
const isExternal = hrefValue.startsWith("http");
|
|
579
585
|
const computedTarget = target || (isExternal ? "_blank" : void 0);
|
|
580
586
|
const computedRel = computedTarget === "_blank" ? "noopener noreferrer" : void 0;
|
|
587
|
+
const content = typeof children !== "undefined" ? children : textValue;
|
|
588
|
+
const isEmpty = !content || String(content).trim() === "";
|
|
589
|
+
const renderContent = active && isEmpty ? `[Empty Link: ${label || id}]` : content;
|
|
581
590
|
return /* @__PURE__ */ jsx4(
|
|
582
591
|
"a",
|
|
583
592
|
{
|
|
@@ -586,8 +595,12 @@ function EditableLink({
|
|
|
586
595
|
rel: computedRel,
|
|
587
596
|
"data-cms-id": id,
|
|
588
597
|
onClick: active ? onClick : void 0,
|
|
589
|
-
className: [
|
|
590
|
-
|
|
598
|
+
className: [
|
|
599
|
+
className,
|
|
600
|
+
editableClasses(active, selected),
|
|
601
|
+
active && isEmpty ? "opacity-50" : ""
|
|
602
|
+
].filter(Boolean).join(" "),
|
|
603
|
+
children: renderContent
|
|
591
604
|
}
|
|
592
605
|
);
|
|
593
606
|
}
|
|
@@ -602,9 +615,10 @@ function EditableList({
|
|
|
602
615
|
itemSchema,
|
|
603
616
|
fixedLength,
|
|
604
617
|
className,
|
|
605
|
-
listClassName
|
|
618
|
+
listClassName,
|
|
619
|
+
search
|
|
606
620
|
}) {
|
|
607
|
-
const ctx = useRegister(id, "list", label, section, pageId, initialItems, itemSchema, fixedLength);
|
|
621
|
+
const ctx = useRegister(id, "list", label, section, pageId, initialItems, itemSchema, fixedLength, search);
|
|
608
622
|
const rawValue = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? ctx.overrides[id] : initialItems;
|
|
609
623
|
const value = Array.isArray(rawValue) ? rawValue : initialItems;
|
|
610
624
|
const active = !!ctx?.editMode;
|
|
@@ -615,13 +629,20 @@ function EditableList({
|
|
|
615
629
|
e.stopPropagation();
|
|
616
630
|
ctx.setSelectedId(id);
|
|
617
631
|
};
|
|
618
|
-
return /* @__PURE__ */
|
|
632
|
+
return /* @__PURE__ */ jsxs3(
|
|
619
633
|
"div",
|
|
620
634
|
{
|
|
621
635
|
"data-cms-id": id,
|
|
622
636
|
onClick: active ? onClick : void 0,
|
|
623
637
|
className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
|
|
624
|
-
children:
|
|
638
|
+
children: [
|
|
639
|
+
renderList ? renderList(value) : /* @__PURE__ */ jsx4("div", { className: listClassName, children: renderItem && value.map(renderItem) }),
|
|
640
|
+
active && value.length === 0 && /* @__PURE__ */ jsxs3("div", { style: { padding: "2rem", textAlign: "center", fontSize: "0.875rem", color: "#737373", backgroundColor: "rgba(245, 245, 245, 0.5)", border: "2px dashed #d4d4d4", borderRadius: "0.75rem", width: "100%", cursor: "pointer" }, children: [
|
|
641
|
+
"Empty List ",
|
|
642
|
+
label ? `(${label})` : "",
|
|
643
|
+
" \u2014 Click to add items"
|
|
644
|
+
] })
|
|
645
|
+
]
|
|
625
646
|
}
|
|
626
647
|
);
|
|
627
648
|
}
|
|
@@ -657,7 +678,7 @@ import {
|
|
|
657
678
|
ExternalLink as ExternalLink2
|
|
658
679
|
} from "lucide-react";
|
|
659
680
|
import { CreditCard as CreditCard2 } from "lucide-react";
|
|
660
|
-
import { Fragment as Fragment2, jsx as jsx5, jsxs as
|
|
681
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
661
682
|
async function handleImageFile(file, onUrl, uploadImage) {
|
|
662
683
|
if (uploadImage) {
|
|
663
684
|
try {
|
|
@@ -680,7 +701,22 @@ function AdminApp({ apiUrl, projectId, email }) {
|
|
|
680
701
|
}
|
|
681
702
|
function AdminAppContent() {
|
|
682
703
|
const [section, setSection] = useState4("pages");
|
|
704
|
+
const [authChecking, setAuthChecking] = useState4(true);
|
|
705
|
+
const [authenticated, setAuthenticated] = useState4(false);
|
|
683
706
|
const ctx = useCmsContext();
|
|
707
|
+
useEffect4(() => {
|
|
708
|
+
fetch("/api/admin/auth").then((res) => res.json()).then((data) => {
|
|
709
|
+
if (data && data.authenticated) {
|
|
710
|
+
setAuthenticated(true);
|
|
711
|
+
} else {
|
|
712
|
+
window.location.href = "/admin/login";
|
|
713
|
+
}
|
|
714
|
+
}).catch(() => {
|
|
715
|
+
window.location.href = "/admin/login";
|
|
716
|
+
}).finally(() => {
|
|
717
|
+
setAuthChecking(false);
|
|
718
|
+
});
|
|
719
|
+
}, []);
|
|
684
720
|
let subscriptionCtx = null;
|
|
685
721
|
try {
|
|
686
722
|
subscriptionCtx = useSubscription();
|
|
@@ -688,26 +724,35 @@ function AdminAppContent() {
|
|
|
688
724
|
}
|
|
689
725
|
const isSubscriptionActive = subscriptionCtx?.isSubscriptionActive ?? true;
|
|
690
726
|
const daysOverdue = subscriptionCtx?.daysOverdue ?? 0;
|
|
727
|
+
if (authChecking) {
|
|
728
|
+
return /* @__PURE__ */ jsx5("div", { className: "flex h-screen w-full items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 text-slate-500 font-medium text-sm", children: [
|
|
729
|
+
/* @__PURE__ */ jsx5("div", { className: "w-5 h-5 border-2 border-indigo-600 border-t-transparent rounded-full animate-spin" }),
|
|
730
|
+
"Authenticating Admin..."
|
|
731
|
+
] }) });
|
|
732
|
+
}
|
|
733
|
+
if (!authenticated) {
|
|
734
|
+
return null;
|
|
735
|
+
}
|
|
691
736
|
if (!isSubscriptionActive) {
|
|
692
737
|
return /* @__PURE__ */ jsx5("div", { className: "flex flex-col lg:flex-row h-screen w-full overflow-hidden bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900", children: /* @__PURE__ */ jsx5(SubscriptionPage, {}) });
|
|
693
738
|
}
|
|
694
|
-
return /* @__PURE__ */
|
|
739
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col h-screen w-full bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900 overflow-hidden", children: [
|
|
695
740
|
daysOverdue > 0 && daysOverdue <= 15 && /* @__PURE__ */ jsx5("div", { className: "bg-amber-400 text-amber-950 px-4 py-2.5 text-center text-sm font-semibold shadow-sm z-50", children: "Your account has an overdue balance. Please update your payment." }),
|
|
696
741
|
daysOverdue > 15 && daysOverdue < 30 && /* @__PURE__ */ jsx5("div", { className: "bg-rose-600 text-white px-4 py-2.5 text-center text-sm font-bold shadow-sm z-50", children: "Attention: If you do not settle your balance, your account will be suspended soon." }),
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */ jsx5("div", { className: "lg:hidden flex items-center justify-between bg-white/80 backdrop-blur-xl border-b border-slate-200 px-4 py-3 shrink-0 z-20 relative", children: /* @__PURE__ */
|
|
742
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row flex-1 overflow-hidden relative", children: [
|
|
743
|
+
/* @__PURE__ */ jsx5("div", { className: "lg:hidden flex items-center justify-between bg-white/80 backdrop-blur-xl border-b border-slate-200 px-4 py-3 shrink-0 z-20 relative", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
699
744
|
ctx.overrides?.["global-logo"] ? /* @__PURE__ */ jsx5("img", { src: String(ctx.overrides["global-logo"]), alt: "Logo", className: "h-5 w-auto object-contain" }) : /* @__PURE__ */ jsx5("div", { className: "w-2 h-2 rounded-full bg-indigo-500 shadow-[0_0_8px_rgba(99,102,241,0.8)]" }),
|
|
700
745
|
/* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 tracking-tight", children: "Admin CMS" })
|
|
701
746
|
] }) }),
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
/* @__PURE__ */
|
|
747
|
+
/* @__PURE__ */ jsxs4("aside", { className: "flex w-full lg:w-64 shrink-0 flex-col border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/80 backdrop-blur-xl shadow-sm z-10 overflow-hidden", children: [
|
|
748
|
+
/* @__PURE__ */ jsxs4("div", { className: "hidden lg:block border-b border-slate-200 px-6 py-5 bg-white/50", children: [
|
|
749
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 mb-1", children: [
|
|
705
750
|
ctx.overrides?.["global-logo"] ? /* @__PURE__ */ jsx5("img", { src: String(ctx.overrides["global-logo"]), alt: "Logo", className: "h-5 w-auto object-contain" }) : /* @__PURE__ */ jsx5("div", { className: "w-2 h-2 rounded-full bg-indigo-500 shadow-[0_0_8px_rgba(99,102,241,0.8)]" }),
|
|
706
751
|
/* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: "Admin CMS" })
|
|
707
752
|
] }),
|
|
708
753
|
/* @__PURE__ */ jsx5("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
|
|
709
754
|
] }),
|
|
710
|
-
/* @__PURE__ */
|
|
755
|
+
/* @__PURE__ */ jsxs4("nav", { className: "flex flex-row lg:flex-col overflow-x-auto lg:overflow-visible space-x-2 lg:space-x-0 lg:space-y-1.5 p-3 lg:p-4 text-sm font-medium hide-scrollbar", children: [
|
|
711
756
|
/* @__PURE__ */ jsx5(
|
|
712
757
|
SideItem,
|
|
713
758
|
{
|
|
@@ -763,12 +808,12 @@ function AdminAppContent() {
|
|
|
763
808
|
}
|
|
764
809
|
)
|
|
765
810
|
] }),
|
|
766
|
-
/* @__PURE__ */
|
|
767
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ jsxs4("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: [
|
|
812
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-xs text-slate-500 mb-4", children: [
|
|
768
813
|
/* @__PURE__ */ jsx5("span", { children: "Storage Adapter" }),
|
|
769
814
|
/* @__PURE__ */ jsx5("span", { className: "font-semibold px-2 py-0.5 rounded-full bg-slate-200 text-slate-700", children: ctx.adapter.name })
|
|
770
815
|
] }),
|
|
771
|
-
/* @__PURE__ */
|
|
816
|
+
/* @__PURE__ */ jsxs4(
|
|
772
817
|
"button",
|
|
773
818
|
{
|
|
774
819
|
onClick: async () => {
|
|
@@ -784,7 +829,7 @@ function AdminAppContent() {
|
|
|
784
829
|
)
|
|
785
830
|
] })
|
|
786
831
|
] }),
|
|
787
|
-
/* @__PURE__ */
|
|
832
|
+
/* @__PURE__ */ jsxs4("main", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
|
|
788
833
|
section === "pages" && /* @__PURE__ */ jsx5(PagesSection, {}),
|
|
789
834
|
section === "collections" && /* @__PURE__ */ jsx5(CollectionsSection, {}),
|
|
790
835
|
section === "submissions" && /* @__PURE__ */ jsx5(SubmissionsSection, {}),
|
|
@@ -801,7 +846,7 @@ function SideItem({
|
|
|
801
846
|
icon,
|
|
802
847
|
children
|
|
803
848
|
}) {
|
|
804
|
-
return /* @__PURE__ */
|
|
849
|
+
return /* @__PURE__ */ jsxs4(
|
|
805
850
|
"button",
|
|
806
851
|
{
|
|
807
852
|
onClick,
|
|
@@ -813,24 +858,80 @@ function SideItem({
|
|
|
813
858
|
}
|
|
814
859
|
);
|
|
815
860
|
}
|
|
861
|
+
function PageListItem({
|
|
862
|
+
p,
|
|
863
|
+
selected,
|
|
864
|
+
onSelect,
|
|
865
|
+
depth = 0
|
|
866
|
+
}) {
|
|
867
|
+
const [expanded, setExpanded] = useState4(false);
|
|
868
|
+
if (p.isSeparator) {
|
|
869
|
+
return /* @__PURE__ */ jsx5("li", { className: "my-2 border-t border-slate-200/60" });
|
|
870
|
+
}
|
|
871
|
+
const hasChildren = p.children && p.children.length > 0;
|
|
872
|
+
const isSelected = selected?.id === p.id;
|
|
873
|
+
const hasSelectedChild = hasChildren && p.children?.some((child) => child.id === selected?.id);
|
|
874
|
+
useEffect4(() => {
|
|
875
|
+
if (hasSelectedChild) {
|
|
876
|
+
setExpanded(true);
|
|
877
|
+
}
|
|
878
|
+
}, [hasSelectedChild]);
|
|
879
|
+
return /* @__PURE__ */ jsxs4("li", { className: "shrink-0 lg:w-full", children: [
|
|
880
|
+
/* @__PURE__ */ jsx5("div", { className: "flex items-center", children: /* @__PURE__ */ jsx5(
|
|
881
|
+
"button",
|
|
882
|
+
{
|
|
883
|
+
onClick: () => {
|
|
884
|
+
if (hasChildren) {
|
|
885
|
+
setExpanded(!expanded);
|
|
886
|
+
}
|
|
887
|
+
if (p.path || !hasChildren) {
|
|
888
|
+
onSelect(p);
|
|
889
|
+
}
|
|
890
|
+
},
|
|
891
|
+
className: `flex-1 w-full rounded-lg py-2.5 text-left text-sm transition-all duration-200 ${depth === 0 ? "px-3" : "px-3 ml-2"} ${isSelected ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
|
|
892
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
|
|
893
|
+
/* @__PURE__ */ jsx5(
|
|
894
|
+
"div",
|
|
895
|
+
{
|
|
896
|
+
className: `truncate ${isSelected ? "text-slate-900" : "text-slate-700"}`,
|
|
897
|
+
children: p.name
|
|
898
|
+
}
|
|
899
|
+
),
|
|
900
|
+
hasChildren && /* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: expanded ? /* @__PURE__ */ jsx5(ChevronUp, { size: 14 }) : /* @__PURE__ */ jsx5(ChevronDown, { size: 14 }) })
|
|
901
|
+
] })
|
|
902
|
+
}
|
|
903
|
+
) }),
|
|
904
|
+
hasChildren && expanded && /* @__PURE__ */ jsx5("ul", { className: `mt-1 space-y-1 ${depth === 0 ? "ml-4 border-l-2 border-slate-100 pl-1" : "ml-2"}`, children: p.children.map((child) => /* @__PURE__ */ jsx5(
|
|
905
|
+
PageListItem,
|
|
906
|
+
{
|
|
907
|
+
p: child,
|
|
908
|
+
selected,
|
|
909
|
+
onSelect,
|
|
910
|
+
depth: depth + 1
|
|
911
|
+
},
|
|
912
|
+
child.id
|
|
913
|
+
)) })
|
|
914
|
+
] });
|
|
915
|
+
}
|
|
816
916
|
function PagesSection() {
|
|
817
917
|
const ctx = useCmsContext();
|
|
818
918
|
const [selected, setSelected] = useState4(
|
|
819
919
|
ctx.config.pages[0] ?? null
|
|
820
920
|
);
|
|
821
921
|
const [showList, setShowList] = useState4(true);
|
|
822
|
-
return /* @__PURE__ */
|
|
823
|
-
showList && /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row h-full", children: [
|
|
923
|
+
showList && /* @__PURE__ */ jsxs4("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
|
|
824
924
|
/* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Pages" }),
|
|
825
|
-
/* @__PURE__ */
|
|
826
|
-
ctx.config.pages.map((p) => /* @__PURE__ */ jsx5(
|
|
827
|
-
|
|
925
|
+
/* @__PURE__ */ jsxs4("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
|
|
926
|
+
ctx.config.pages.map((p) => /* @__PURE__ */ jsx5(
|
|
927
|
+
PageListItem,
|
|
828
928
|
{
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
}
|
|
833
|
-
|
|
929
|
+
p,
|
|
930
|
+
selected,
|
|
931
|
+
onSelect: setSelected
|
|
932
|
+
},
|
|
933
|
+
p.id
|
|
934
|
+
)),
|
|
834
935
|
ctx.config.pages.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200 w-full", children: "No pages registered." })
|
|
835
936
|
] })
|
|
836
937
|
] }),
|
|
@@ -893,21 +994,21 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
893
994
|
);
|
|
894
995
|
const selectedMeta = registered.find((r) => r.id === selectedId) ?? null;
|
|
895
996
|
const [viewMode, setViewMode] = useState4("desktop");
|
|
896
|
-
return /* @__PURE__ */
|
|
897
|
-
/* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
997
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex h-full flex-col", children: [
|
|
998
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 border-b border-slate-200 bg-white/80 backdrop-blur px-4 py-3 shadow-sm z-10 shrink-0", children: [
|
|
999
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 text-sm shrink-0", children: [
|
|
899
1000
|
/* @__PURE__ */ jsx5("button", { onClick: onToggleList, className: "text-slate-400 hover:text-slate-700 p-1 hidden lg:block", title: "Toggle Pages Menu", children: showList ? /* @__PURE__ */ jsx5(PanelLeftClose, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx5(PanelLeftOpen, { className: "w-5 h-5" }) }),
|
|
900
1001
|
/* @__PURE__ */ jsx5("span", { className: "font-bold text-slate-800 text-sm md:text-base", children: page.name }),
|
|
901
1002
|
/* @__PURE__ */ jsx5("span", { className: "text-slate-300 hidden sm:inline", children: "|" }),
|
|
902
1003
|
/* @__PURE__ */ jsx5("span", { className: "text-slate-500 font-mono text-[10px] md:text-xs bg-slate-100 px-2 py-1 rounded hidden sm:inline-block", children: page.path })
|
|
903
1004
|
] }),
|
|
904
|
-
/* @__PURE__ */
|
|
905
|
-
/* @__PURE__ */
|
|
1005
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 overflow-x-auto w-full sm:w-auto pb-1 sm:pb-0 hide-scrollbar shrink-0", children: [
|
|
1006
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex bg-slate-100/80 p-0.5 rounded-lg mr-2 shrink-0", children: [
|
|
906
1007
|
/* @__PURE__ */ jsx5("button", { onClick: () => setViewMode("desktop"), className: `p-1.5 rounded-md transition-all ${viewMode === "desktop" ? "bg-white shadow-sm text-indigo-600" : "text-slate-500 hover:text-slate-800"}`, title: "Desktop View", children: /* @__PURE__ */ jsx5(Monitor, { className: "w-4 h-4" }) }),
|
|
907
1008
|
/* @__PURE__ */ jsx5("button", { onClick: () => setViewMode("tablet"), className: `p-1.5 rounded-md transition-all ${viewMode === "tablet" ? "bg-white shadow-sm text-indigo-600" : "text-slate-500 hover:text-slate-800"}`, title: "Tablet View", children: /* @__PURE__ */ jsx5(Tablet, { className: "w-4 h-4" }) }),
|
|
908
1009
|
/* @__PURE__ */ jsx5("button", { onClick: () => setViewMode("mobile"), className: `p-1.5 rounded-md transition-all ${viewMode === "mobile" ? "bg-white shadow-sm text-indigo-600" : "text-slate-500 hover:text-slate-800"}`, title: "Mobile View", children: /* @__PURE__ */ jsx5(Smartphone, { className: "w-4 h-4" }) })
|
|
909
1010
|
] }),
|
|
910
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ jsxs4(
|
|
911
1012
|
"button",
|
|
912
1013
|
{
|
|
913
1014
|
onClick: () => setPreview((v) => !v),
|
|
@@ -918,7 +1019,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
918
1019
|
]
|
|
919
1020
|
}
|
|
920
1021
|
),
|
|
921
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ jsxs4(
|
|
922
1023
|
"a",
|
|
923
1024
|
{
|
|
924
1025
|
href: page.path,
|
|
@@ -931,7 +1032,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
931
1032
|
]
|
|
932
1033
|
}
|
|
933
1034
|
),
|
|
934
|
-
/* @__PURE__ */
|
|
1035
|
+
/* @__PURE__ */ jsxs4(
|
|
935
1036
|
"button",
|
|
936
1037
|
{
|
|
937
1038
|
onClick: () => ctx.reset(),
|
|
@@ -943,7 +1044,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
943
1044
|
]
|
|
944
1045
|
}
|
|
945
1046
|
),
|
|
946
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ jsxs4(
|
|
947
1048
|
"button",
|
|
948
1049
|
{
|
|
949
1050
|
onClick: () => ctx.save(),
|
|
@@ -957,7 +1058,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
957
1058
|
)
|
|
958
1059
|
] })
|
|
959
1060
|
] }),
|
|
960
|
-
/* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row flex-1 overflow-hidden", children: [
|
|
961
1062
|
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-hidden bg-slate-100/80 p-2 sm:p-4 flex flex-col items-center", children: /* @__PURE__ */ jsx5("div", { className: `flex-1 rounded-xl overflow-hidden border border-slate-200 bg-white shadow-lg ring-1 ring-slate-900/5 min-h-[300px] transition-all duration-300 w-full ${viewMode === "mobile" ? "max-w-[375px]" : viewMode === "tablet" ? "max-w-[768px]" : "w-full"}`, children: /* @__PURE__ */ jsx5(
|
|
962
1063
|
"iframe",
|
|
963
1064
|
{
|
|
@@ -968,11 +1069,11 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
968
1069
|
},
|
|
969
1070
|
src
|
|
970
1071
|
) }) }),
|
|
971
|
-
/* @__PURE__ */
|
|
972
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ jsxs4("aside", { className: `w-full sm:w-[320px] lg:w-[360px] shrink-0 overflow-y-auto border-t sm:border-t-0 sm:border-l border-slate-200 bg-white shadow-[-4px_0_15px_-3px_rgba(0,0,0,0.05)] z-10 hide-scrollbar transition-all duration-300 ${drawerState === "min" ? "max-h-[52px] sm:max-h-none" : drawerState === "full" ? "max-h-[85vh] sm:max-h-none" : "max-h-[50vh] sm:max-h-none"}`, children: [
|
|
1073
|
+
/* @__PURE__ */ jsxs4("div", { className: "sticky top-0 bg-white/90 backdrop-blur border-b border-slate-200 px-5 py-3 md:py-4 z-10 flex items-center justify-between", children: [
|
|
973
1074
|
/* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: selectedMeta ? "Edit Field" : "Editable Elements" }),
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
|
|
1076
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 sm:hidden", children: [
|
|
976
1077
|
/* @__PURE__ */ jsx5(
|
|
977
1078
|
"button",
|
|
978
1079
|
{
|
|
@@ -995,7 +1096,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
995
1096
|
selectedMeta && /* @__PURE__ */ jsx5("button", { onClick: () => setSelectedId(null), className: "sm:hidden text-slate-400 hover:text-slate-700 text-xs font-bold uppercase tracking-widest", children: "Close" })
|
|
996
1097
|
] })
|
|
997
1098
|
] }),
|
|
998
|
-
/* @__PURE__ */
|
|
1099
|
+
/* @__PURE__ */ jsxs4("div", { className: drawerState === "min" ? "hidden sm:block" : "block", children: [
|
|
999
1100
|
!selectedMeta && /* @__PURE__ */ jsx5("div", { className: "px-5 mt-1 mb-2", children: /* @__PURE__ */ jsx5("p", { className: "text-[10px] md:text-xs text-slate-400", children: "Select an element on the left to edit it." }) }),
|
|
1000
1101
|
selectedMeta ? /* @__PURE__ */ jsx5(
|
|
1001
1102
|
FieldEditor,
|
|
@@ -1017,20 +1118,38 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
1017
1118
|
},
|
|
1018
1119
|
onClose: () => setSelectedId(null)
|
|
1019
1120
|
}
|
|
1020
|
-
) : /* @__PURE__ */
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1121
|
+
) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1122
|
+
page.hideable && /* @__PURE__ */ jsxs4("div", { className: "px-5 py-4 border-b border-slate-100 bg-slate-50/50", children: [
|
|
1123
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-3", children: [
|
|
1124
|
+
/* @__PURE__ */ jsx5(
|
|
1125
|
+
"input",
|
|
1126
|
+
{
|
|
1127
|
+
type: "checkbox",
|
|
1128
|
+
id: `page-visible-toggle-${page.id}`,
|
|
1129
|
+
checked: ctx.overrides[`page-${page.id}-visible`] !== false,
|
|
1130
|
+
onChange: (e) => updateOverride(`page-${page.id}-visible`, e.target.checked),
|
|
1131
|
+
className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
|
|
1132
|
+
}
|
|
1133
|
+
),
|
|
1134
|
+
/* @__PURE__ */ jsx5("label", { htmlFor: `page-visible-toggle-${page.id}`, className: "text-sm font-medium text-slate-800 cursor-pointer flex-1", children: "Page is Visible" })
|
|
1135
|
+
] }),
|
|
1136
|
+
/* @__PURE__ */ jsx5("p", { className: "text-[11px] text-slate-500 mt-1.5 pl-8", children: "If unchecked, this page will be hidden from navigation and URL access." })
|
|
1137
|
+
] }),
|
|
1138
|
+
/* @__PURE__ */ jsx5(
|
|
1139
|
+
SectionAccordion,
|
|
1140
|
+
{
|
|
1141
|
+
registered,
|
|
1142
|
+
onSelect: (id) => {
|
|
1143
|
+
setSelectedId(id);
|
|
1144
|
+
setDrawerState((prev) => prev === "min" ? "half" : prev);
|
|
1145
|
+
iframeRef.current?.contentWindow?.postMessage(
|
|
1146
|
+
{ __cms: true, type: "cms:select", id },
|
|
1147
|
+
"*"
|
|
1148
|
+
);
|
|
1149
|
+
}
|
|
1031
1150
|
}
|
|
1032
|
-
|
|
1033
|
-
)
|
|
1151
|
+
)
|
|
1152
|
+
] })
|
|
1034
1153
|
] })
|
|
1035
1154
|
] })
|
|
1036
1155
|
] })
|
|
@@ -1042,7 +1161,7 @@ function SectionAccordion({
|
|
|
1042
1161
|
}) {
|
|
1043
1162
|
const [expanded, setExpanded] = useState4({});
|
|
1044
1163
|
if (registered.length === 0) {
|
|
1045
|
-
return /* @__PURE__ */
|
|
1164
|
+
return /* @__PURE__ */ jsxs4("div", { className: "px-4 py-8 text-center text-sm text-slate-500", children: [
|
|
1046
1165
|
/* @__PURE__ */ jsx5("div", { className: "w-12 h-12 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-3", children: /* @__PURE__ */ jsx5(Pencil, { className: "h-5 w-5 text-slate-400" }) }),
|
|
1047
1166
|
"No editable fields detected on this page."
|
|
1048
1167
|
] });
|
|
@@ -1056,19 +1175,19 @@ function SectionAccordion({
|
|
|
1056
1175
|
const sectionNames = Object.keys(groups).filter((n) => n !== "Unsectioned");
|
|
1057
1176
|
const unsectionedFields = groups["Unsectioned"] || [];
|
|
1058
1177
|
const toggle = (name) => setExpanded((prev) => ({ ...prev, [name]: !prev[name] }));
|
|
1059
|
-
return /* @__PURE__ */
|
|
1178
|
+
return /* @__PURE__ */ jsxs4("div", { className: "p-2 space-y-3", children: [
|
|
1060
1179
|
unsectionedFields.length > 0 && /* @__PURE__ */ jsx5("ul", { className: "divide-y divide-slate-100 bg-white rounded-lg border border-slate-200 overflow-hidden shadow-sm", children: unsectionedFields.map((m) => /* @__PURE__ */ jsx5(FieldListItem, { meta: m, onSelect }, m.id)) }),
|
|
1061
1180
|
sectionNames.map((sectionName) => {
|
|
1062
1181
|
const isOpen = expanded[sectionName] ?? false;
|
|
1063
1182
|
const fields = groups[sectionName];
|
|
1064
|
-
return /* @__PURE__ */
|
|
1065
|
-
/* @__PURE__ */
|
|
1183
|
+
return /* @__PURE__ */ jsxs4("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
|
|
1184
|
+
/* @__PURE__ */ jsxs4(
|
|
1066
1185
|
"button",
|
|
1067
1186
|
{
|
|
1068
1187
|
onClick: () => toggle(sectionName),
|
|
1069
1188
|
className: "flex w-full items-center justify-between px-3 py-2.5 bg-slate-50/80 hover:bg-slate-100 transition-colors text-left",
|
|
1070
1189
|
children: [
|
|
1071
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2", children: [
|
|
1072
1191
|
/* @__PURE__ */ jsx5("span", { className: "font-semibold text-sm text-slate-800", children: sectionName }),
|
|
1073
1192
|
/* @__PURE__ */ jsx5("span", { className: "text-[10px] font-mono text-slate-400 bg-slate-200/70 px-1.5 py-0.5 rounded-full", children: fields.length })
|
|
1074
1193
|
] }),
|
|
@@ -1092,15 +1211,15 @@ function SectionAccordion({
|
|
|
1092
1211
|
] });
|
|
1093
1212
|
}
|
|
1094
1213
|
function FieldListItem({ meta, onSelect }) {
|
|
1095
|
-
return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */
|
|
1214
|
+
return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs4(
|
|
1096
1215
|
"button",
|
|
1097
1216
|
{
|
|
1098
1217
|
onClick: () => onSelect(meta.id),
|
|
1099
1218
|
className: "flex w-full items-center justify-between gap-2 rounded-md px-3 py-2.5 text-left hover:bg-slate-50 group transition-colors",
|
|
1100
1219
|
children: [
|
|
1101
|
-
/* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ jsxs4("span", { className: "overflow-hidden", children: [
|
|
1102
1221
|
/* @__PURE__ */ jsx5("span", { className: "block font-medium text-slate-800 text-sm truncate", children: meta.label ?? meta.id }),
|
|
1103
|
-
/* @__PURE__ */
|
|
1222
|
+
/* @__PURE__ */ jsxs4("span", { className: "block text-[10px] md:text-xs text-slate-400 truncate mt-0.5 font-mono", children: [
|
|
1104
1223
|
meta.type,
|
|
1105
1224
|
" ",
|
|
1106
1225
|
/* @__PURE__ */ jsx5("span", { className: "text-slate-300 mx-1", children: "\xB7" }),
|
|
@@ -1121,13 +1240,28 @@ function FieldEditor({
|
|
|
1121
1240
|
onClose
|
|
1122
1241
|
}) {
|
|
1123
1242
|
const ctx = useCmsContext();
|
|
1124
|
-
|
|
1125
|
-
|
|
1243
|
+
const [expandedItems, setExpandedItems] = useState4({});
|
|
1244
|
+
const [searchQuery, setSearchQuery] = useState4("");
|
|
1245
|
+
return /* @__PURE__ */ jsxs4("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
|
|
1246
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-5", children: [
|
|
1126
1247
|
/* @__PURE__ */ jsx5("div", { className: "inline-flex items-center gap-1.5 px-2 py-1 rounded bg-indigo-50 text-indigo-700 text-[10px] font-bold uppercase tracking-wider mb-2", children: meta.type }),
|
|
1127
1248
|
/* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 text-lg leading-tight", children: meta.label ?? meta.id }),
|
|
1128
1249
|
/* @__PURE__ */ jsx5("div", { className: "text-xs font-mono text-slate-400 mt-1", children: meta.id })
|
|
1129
1250
|
] }),
|
|
1130
|
-
/* @__PURE__ */
|
|
1251
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
1252
|
+
meta.type === "boolean" && /* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-3 py-1", children: [
|
|
1253
|
+
/* @__PURE__ */ jsx5(
|
|
1254
|
+
"input",
|
|
1255
|
+
{
|
|
1256
|
+
type: "checkbox",
|
|
1257
|
+
id: meta.id,
|
|
1258
|
+
checked: value === void 0 ? meta.defaultValue : !!value,
|
|
1259
|
+
onChange: (e) => onChange(e.target.checked),
|
|
1260
|
+
className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
|
|
1261
|
+
}
|
|
1262
|
+
),
|
|
1263
|
+
/* @__PURE__ */ jsx5("label", { htmlFor: meta.id, className: "text-sm font-medium text-slate-700 cursor-pointer", children: meta.label || "Enabled" })
|
|
1264
|
+
] }),
|
|
1131
1265
|
meta.type === "text" && /* @__PURE__ */ jsx5(
|
|
1132
1266
|
"input",
|
|
1133
1267
|
{
|
|
@@ -1146,8 +1280,8 @@ function FieldEditor({
|
|
|
1146
1280
|
className: "w-full rounded-xl border border-slate-200 px-4 py-3 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all resize-y"
|
|
1147
1281
|
}
|
|
1148
1282
|
),
|
|
1149
|
-
meta.type === "image" && /* @__PURE__ */
|
|
1150
|
-
/* @__PURE__ */
|
|
1283
|
+
meta.type === "image" && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
1284
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1151
1285
|
/* @__PURE__ */ jsx5(
|
|
1152
1286
|
"input",
|
|
1153
1287
|
{
|
|
@@ -1158,7 +1292,7 @@ function FieldEditor({
|
|
|
1158
1292
|
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1159
1293
|
}
|
|
1160
1294
|
),
|
|
1161
|
-
/* @__PURE__ */
|
|
1295
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1162
1296
|
"Upload",
|
|
1163
1297
|
/* @__PURE__ */ jsx5(
|
|
1164
1298
|
"input",
|
|
@@ -1176,7 +1310,7 @@ function FieldEditor({
|
|
|
1176
1310
|
)
|
|
1177
1311
|
] })
|
|
1178
1312
|
] }),
|
|
1179
|
-
value ? /* @__PURE__ */
|
|
1313
|
+
value ? /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group", children: [
|
|
1180
1314
|
/* @__PURE__ */ jsx5(
|
|
1181
1315
|
"img",
|
|
1182
1316
|
{
|
|
@@ -1188,8 +1322,8 @@ function FieldEditor({
|
|
|
1188
1322
|
/* @__PURE__ */ jsx5("div", { className: "absolute inset-0 bg-black/40 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx5("span", { className: "text-white text-xs font-medium px-2 py-1 bg-black/50 rounded backdrop-blur", children: "Preview" }) })
|
|
1189
1323
|
] }) : null
|
|
1190
1324
|
] }),
|
|
1191
|
-
meta.type === "file" && /* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
1325
|
+
meta.type === "file" && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
1326
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1193
1327
|
/* @__PURE__ */ jsx5(
|
|
1194
1328
|
"input",
|
|
1195
1329
|
{
|
|
@@ -1200,7 +1334,7 @@ function FieldEditor({
|
|
|
1200
1334
|
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1201
1335
|
}
|
|
1202
1336
|
),
|
|
1203
|
-
/* @__PURE__ */
|
|
1337
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-indigo-50 px-4 py-2.5 text-sm font-semibold text-indigo-700 hover:bg-indigo-100 transition-colors border border-indigo-100 flex items-center justify-center", children: [
|
|
1204
1338
|
"Upload File",
|
|
1205
1339
|
/* @__PURE__ */ jsx5(
|
|
1206
1340
|
"input",
|
|
@@ -1218,13 +1352,13 @@ function FieldEditor({
|
|
|
1218
1352
|
)
|
|
1219
1353
|
] })
|
|
1220
1354
|
] }),
|
|
1221
|
-
value ? /* @__PURE__ */
|
|
1355
|
+
value ? /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-3 bg-slate-50 text-xs font-mono text-slate-600 truncate flex items-center gap-2", children: [
|
|
1222
1356
|
/* @__PURE__ */ jsx5("span", { children: "\u{1F4C4} File URL:" }),
|
|
1223
1357
|
/* @__PURE__ */ jsx5("span", { className: "truncate text-indigo-600 font-semibold", children: String(value) })
|
|
1224
1358
|
] }) : null
|
|
1225
1359
|
] }),
|
|
1226
|
-
meta.type === "link" && /* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1360
|
+
meta.type === "link" && /* @__PURE__ */ jsxs4("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
|
|
1361
|
+
/* @__PURE__ */ jsxs4("label", { className: "block", children: [
|
|
1228
1362
|
/* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "Link Text" }),
|
|
1229
1363
|
/* @__PURE__ */ jsx5(
|
|
1230
1364
|
"input",
|
|
@@ -1235,7 +1369,7 @@ function FieldEditor({
|
|
|
1235
1369
|
}
|
|
1236
1370
|
)
|
|
1237
1371
|
] }),
|
|
1238
|
-
/* @__PURE__ */
|
|
1372
|
+
/* @__PURE__ */ jsxs4("label", { className: "block", children: [
|
|
1239
1373
|
/* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "URL Target" }),
|
|
1240
1374
|
/* @__PURE__ */ jsx5(
|
|
1241
1375
|
"input",
|
|
@@ -1248,7 +1382,7 @@ function FieldEditor({
|
|
|
1248
1382
|
)
|
|
1249
1383
|
] })
|
|
1250
1384
|
] }),
|
|
1251
|
-
meta.type === "color" && /* @__PURE__ */
|
|
1385
|
+
meta.type === "color" && /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 bg-slate-50 p-2 rounded-xl border border-slate-100", children: [
|
|
1252
1386
|
/* @__PURE__ */ jsx5(
|
|
1253
1387
|
"input",
|
|
1254
1388
|
{
|
|
@@ -1277,140 +1411,185 @@ function FieldEditor({
|
|
|
1277
1411
|
className: "w-full rounded-xl border border-slate-200 px-4 py-3 font-mono text-xs text-slate-700 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all resize-y"
|
|
1278
1412
|
}
|
|
1279
1413
|
),
|
|
1280
|
-
meta.type === "list" && /* @__PURE__ */
|
|
1281
|
-
|
|
1282
|
-
/* @__PURE__ */ jsx5(
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1305
|
-
onChange(arr);
|
|
1306
|
-
},
|
|
1307
|
-
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1308
|
-
}
|
|
1309
|
-
) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
|
|
1310
|
-
/* @__PURE__ */ jsx5(
|
|
1311
|
-
"input",
|
|
1414
|
+
meta.type === "list" && /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
1415
|
+
meta.search && /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
1416
|
+
/* @__PURE__ */ jsx5(Search, { className: "absolute left-3 top-2.5 h-4 w-4 text-slate-400" }),
|
|
1417
|
+
/* @__PURE__ */ jsx5(
|
|
1418
|
+
"input",
|
|
1419
|
+
{
|
|
1420
|
+
type: "text",
|
|
1421
|
+
placeholder: "Search by title...",
|
|
1422
|
+
value: searchQuery,
|
|
1423
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
1424
|
+
className: "w-full rounded-lg border border-slate-200 pl-9 pr-3 py-2 text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1425
|
+
}
|
|
1426
|
+
)
|
|
1427
|
+
] }),
|
|
1428
|
+
(Array.isArray(value) ? value : []).map((item, idx) => {
|
|
1429
|
+
if (meta.search && searchQuery) {
|
|
1430
|
+
const title = String(item?.title || item?.name || "").toLowerCase();
|
|
1431
|
+
if (!title.includes(searchQuery.toLowerCase())) return null;
|
|
1432
|
+
}
|
|
1433
|
+
const isExpanded = expandedItems[idx] ?? false;
|
|
1434
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex gap-3 items-start bg-slate-50 p-3 rounded-xl border border-slate-100 relative group", children: [
|
|
1435
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 space-y-3 w-full", children: [
|
|
1436
|
+
/* @__PURE__ */ jsxs4(
|
|
1437
|
+
"div",
|
|
1312
1438
|
{
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
},
|
|
1320
|
-
className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
|
|
1439
|
+
className: "flex items-center justify-between cursor-pointer py-1 select-none",
|
|
1440
|
+
onClick: () => setExpandedItems((prev) => ({ ...prev, [idx]: !isExpanded })),
|
|
1441
|
+
children: [
|
|
1442
|
+
/* @__PURE__ */ jsx5("div", { className: "font-semibold text-slate-700 text-sm flex-1 truncate pr-4", children: meta.itemSchema ? item?.title || item?.name || `Item ${idx + 1}` : String(item) }),
|
|
1443
|
+
isExpanded ? /* @__PURE__ */ jsx5(ChevronUp, { className: "w-4 h-4 text-slate-500 shrink-0" }) : /* @__PURE__ */ jsx5(ChevronDown, { className: "w-4 h-4 text-slate-500 shrink-0" })
|
|
1444
|
+
]
|
|
1321
1445
|
}
|
|
1322
1446
|
),
|
|
1323
|
-
/* @__PURE__ */ jsx5("
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1447
|
+
isExpanded && /* @__PURE__ */ jsx5("div", { className: "pt-3 border-t border-slate-200 mt-2 space-y-3", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ jsxs4("div", { children: [
|
|
1448
|
+
/* @__PURE__ */ jsx5("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
|
|
1449
|
+
schemaField.type === "icon" ? /* @__PURE__ */ jsx5(
|
|
1450
|
+
SearchableSelect,
|
|
1451
|
+
{
|
|
1452
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1453
|
+
options: schemaField.options ?? [],
|
|
1454
|
+
placeholder: "Search icon...",
|
|
1455
|
+
iconMap: ctx.iconMap,
|
|
1456
|
+
onChange: (val) => {
|
|
1457
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1458
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: val };
|
|
1459
|
+
onChange(arr);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx5(
|
|
1463
|
+
"textarea",
|
|
1328
1464
|
{
|
|
1329
|
-
|
|
1465
|
+
rows: 3,
|
|
1330
1466
|
value: String(item?.[schemaField.key] ?? ""),
|
|
1331
1467
|
onChange: (e) => {
|
|
1332
1468
|
const arr = Array.isArray(value) ? [...value] : [];
|
|
1333
1469
|
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1334
1470
|
onChange(arr);
|
|
1335
1471
|
},
|
|
1336
|
-
placeholder: "https://...",
|
|
1337
1472
|
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1338
1473
|
}
|
|
1339
|
-
),
|
|
1340
|
-
/* @__PURE__ */ jsxs3("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1341
|
-
"Upload",
|
|
1474
|
+
) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
|
|
1342
1475
|
/* @__PURE__ */ jsx5(
|
|
1343
1476
|
"input",
|
|
1344
1477
|
{
|
|
1345
|
-
type: "
|
|
1346
|
-
|
|
1347
|
-
className: "hidden",
|
|
1478
|
+
type: "checkbox",
|
|
1479
|
+
checked: !!item?.[schemaField.key],
|
|
1348
1480
|
onChange: (e) => {
|
|
1349
|
-
const
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1481
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1482
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.checked };
|
|
1483
|
+
onChange(arr);
|
|
1484
|
+
},
|
|
1485
|
+
className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
|
|
1486
|
+
}
|
|
1487
|
+
),
|
|
1488
|
+
/* @__PURE__ */ jsx5("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
|
|
1489
|
+
] }) : schemaField.type === "image" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3 mt-1", children: [
|
|
1490
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1491
|
+
/* @__PURE__ */ jsx5(
|
|
1492
|
+
"input",
|
|
1493
|
+
{
|
|
1494
|
+
type: "url",
|
|
1495
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1496
|
+
onChange: (e) => {
|
|
1497
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1498
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1499
|
+
onChange(arr);
|
|
1500
|
+
},
|
|
1501
|
+
placeholder: "https://...",
|
|
1502
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1361
1503
|
}
|
|
1504
|
+
),
|
|
1505
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1506
|
+
"Upload",
|
|
1507
|
+
/* @__PURE__ */ jsx5(
|
|
1508
|
+
"input",
|
|
1509
|
+
{
|
|
1510
|
+
type: "file",
|
|
1511
|
+
accept: "image/*",
|
|
1512
|
+
className: "hidden",
|
|
1513
|
+
onChange: (e) => {
|
|
1514
|
+
const file = e.target.files?.[0];
|
|
1515
|
+
if (file) {
|
|
1516
|
+
void handleImageFile(
|
|
1517
|
+
file,
|
|
1518
|
+
(url) => {
|
|
1519
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1520
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: url };
|
|
1521
|
+
onChange(arr);
|
|
1522
|
+
},
|
|
1523
|
+
ctx.uploadImage
|
|
1524
|
+
);
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
)
|
|
1529
|
+
] })
|
|
1530
|
+
] }),
|
|
1531
|
+
item?.[schemaField.key] ? /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: /* @__PURE__ */ jsx5(
|
|
1532
|
+
"img",
|
|
1533
|
+
{
|
|
1534
|
+
src: String(item?.[schemaField.key]),
|
|
1535
|
+
alt: "",
|
|
1536
|
+
className: "w-full h-auto max-h-32 object-contain rounded-md"
|
|
1362
1537
|
}
|
|
1363
|
-
)
|
|
1364
|
-
] })
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1538
|
+
) }) : null
|
|
1539
|
+
] }) : schemaField.type === "select" ? /* @__PURE__ */ jsx5(
|
|
1540
|
+
"select",
|
|
1541
|
+
{
|
|
1542
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1543
|
+
onChange: (e) => {
|
|
1544
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1545
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1546
|
+
onChange(arr);
|
|
1547
|
+
},
|
|
1548
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 bg-white",
|
|
1549
|
+
children: schemaField.options?.map((opt) => /* @__PURE__ */ jsx5("option", { value: opt, children: opt }, opt))
|
|
1550
|
+
}
|
|
1551
|
+
) : /* @__PURE__ */ jsx5(
|
|
1552
|
+
"input",
|
|
1553
|
+
{
|
|
1554
|
+
type: "text",
|
|
1555
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1556
|
+
onChange: (e) => {
|
|
1557
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1558
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1559
|
+
onChange(arr);
|
|
1560
|
+
},
|
|
1561
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1562
|
+
}
|
|
1563
|
+
)
|
|
1564
|
+
] }, schemaField.key)) : /* @__PURE__ */ jsx5(
|
|
1565
|
+
"input",
|
|
1368
1566
|
{
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1567
|
+
type: "text",
|
|
1568
|
+
value: String(item),
|
|
1569
|
+
onChange: (e) => {
|
|
1570
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1571
|
+
arr[idx] = e.target.value;
|
|
1572
|
+
onChange(arr);
|
|
1573
|
+
},
|
|
1574
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1372
1575
|
}
|
|
1373
|
-
) })
|
|
1374
|
-
] })
|
|
1375
|
-
|
|
1576
|
+
) })
|
|
1577
|
+
] }),
|
|
1578
|
+
!meta.fixedLength && /* @__PURE__ */ jsx5(
|
|
1579
|
+
"button",
|
|
1376
1580
|
{
|
|
1377
|
-
|
|
1378
|
-
value: String(item?.[schemaField.key] ?? ""),
|
|
1379
|
-
onChange: (e) => {
|
|
1581
|
+
onClick: () => {
|
|
1380
1582
|
const arr = Array.isArray(value) ? [...value] : [];
|
|
1381
|
-
arr
|
|
1583
|
+
arr.splice(idx, 1);
|
|
1382
1584
|
onChange(arr);
|
|
1383
1585
|
},
|
|
1384
|
-
className: "
|
|
1586
|
+
className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
|
|
1587
|
+
children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
|
|
1385
1588
|
}
|
|
1386
1589
|
)
|
|
1387
|
-
] },
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
type: "text",
|
|
1391
|
-
value: String(item),
|
|
1392
|
-
onChange: (e) => {
|
|
1393
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1394
|
-
arr[idx] = e.target.value;
|
|
1395
|
-
onChange(arr);
|
|
1396
|
-
},
|
|
1397
|
-
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1398
|
-
}
|
|
1399
|
-
) }),
|
|
1400
|
-
!meta.fixedLength && /* @__PURE__ */ jsx5(
|
|
1401
|
-
"button",
|
|
1402
|
-
{
|
|
1403
|
-
onClick: () => {
|
|
1404
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1405
|
-
arr.splice(idx, 1);
|
|
1406
|
-
onChange(arr);
|
|
1407
|
-
},
|
|
1408
|
-
className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
|
|
1409
|
-
children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
|
|
1410
|
-
}
|
|
1411
|
-
)
|
|
1412
|
-
] }, idx)),
|
|
1413
|
-
!meta.fixedLength && /* @__PURE__ */ jsxs3(
|
|
1590
|
+
] }, idx);
|
|
1591
|
+
}),
|
|
1592
|
+
!meta.fixedLength && /* @__PURE__ */ jsxs4(
|
|
1414
1593
|
"button",
|
|
1415
1594
|
{
|
|
1416
1595
|
onClick: () => {
|
|
@@ -1436,8 +1615,8 @@ function FieldEditor({
|
|
|
1436
1615
|
] }),
|
|
1437
1616
|
" "
|
|
1438
1617
|
] }),
|
|
1439
|
-
/* @__PURE__ */
|
|
1440
|
-
/* @__PURE__ */
|
|
1618
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
|
|
1619
|
+
/* @__PURE__ */ jsxs4(
|
|
1441
1620
|
"button",
|
|
1442
1621
|
{
|
|
1443
1622
|
onClick: onReset,
|
|
@@ -1473,18 +1652,18 @@ function CollectionsSection() {
|
|
|
1473
1652
|
});
|
|
1474
1653
|
});
|
|
1475
1654
|
}, [ctx.adapter, collections]);
|
|
1476
|
-
return /* @__PURE__ */
|
|
1477
|
-
/* @__PURE__ */
|
|
1655
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
|
|
1656
|
+
/* @__PURE__ */ jsxs4("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
|
|
1478
1657
|
/* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
|
|
1479
|
-
/* @__PURE__ */
|
|
1480
|
-
collections.map((c) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */
|
|
1658
|
+
/* @__PURE__ */ jsxs4("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
|
|
1659
|
+
collections.map((c) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs4(
|
|
1481
1660
|
"button",
|
|
1482
1661
|
{
|
|
1483
1662
|
onClick: () => setSelected(c),
|
|
1484
1663
|
className: `w-full rounded-lg px-3 py-2.5 text-left text-sm transition-all duration-200 ${selected?.id === c.id ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
|
|
1485
1664
|
children: [
|
|
1486
1665
|
/* @__PURE__ */ jsx5("div", { className: selected?.id === c.id ? "text-slate-900" : "text-slate-700", children: c.name }),
|
|
1487
|
-
/* @__PURE__ */
|
|
1666
|
+
/* @__PURE__ */ jsxs4("div", { className: `text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-500" : "text-slate-400"}`, children: [
|
|
1488
1667
|
counts[c.id] ?? 0,
|
|
1489
1668
|
" items"
|
|
1490
1669
|
] })
|
|
@@ -1494,7 +1673,7 @@ function CollectionsSection() {
|
|
|
1494
1673
|
collections.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200", children: "No collections registered." })
|
|
1495
1674
|
] })
|
|
1496
1675
|
] }),
|
|
1497
|
-
/* @__PURE__ */
|
|
1676
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
|
|
1498
1677
|
/* @__PURE__ */ jsx5("div", { className: "absolute inset-0 bg-grid-slate-100 [mask-image:linear-gradient(0deg,white,rgba(255,255,255,0.6))] -z-10 pointer-events-none" }),
|
|
1499
1678
|
selected ? /* @__PURE__ */ jsx5(CollectionEditor, { collection: selected }, selected.id) : /* @__PURE__ */ jsx5("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a collection to manage its entries." })
|
|
1500
1679
|
] })
|
|
@@ -1532,7 +1711,7 @@ function CollectionEditor({ collection }) {
|
|
|
1532
1711
|
} else if (f.defaultValue !== void 0) {
|
|
1533
1712
|
base[f.id] = f.defaultValue;
|
|
1534
1713
|
} else {
|
|
1535
|
-
base[f.id] = f.type === "boolean" ? false : f.type === "number" ? 0 : "";
|
|
1714
|
+
base[f.id] = f.type === "boolean" ? false : f.type === "number" ? 0 : f.type === "select" ? f.options?.[0] ?? "" : "";
|
|
1536
1715
|
}
|
|
1537
1716
|
});
|
|
1538
1717
|
setEditing(base);
|
|
@@ -1595,13 +1774,13 @@ function CollectionEditor({ collection }) {
|
|
|
1595
1774
|
setDragOverIdx(null);
|
|
1596
1775
|
};
|
|
1597
1776
|
const visibleFields = collection.fields.filter((f) => !["richtext", "list", "password"].includes(f.type) && f.id !== "order").slice(0, 5);
|
|
1598
|
-
return /* @__PURE__ */
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mx-auto max-w-5xl", children: [
|
|
1778
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-8 flex items-center justify-between", children: [
|
|
1779
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1601
1780
|
/* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: collection.name }),
|
|
1602
1781
|
collection.description && /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: collection.description })
|
|
1603
1782
|
] }),
|
|
1604
|
-
/* @__PURE__ */
|
|
1783
|
+
/* @__PURE__ */ jsxs4(
|
|
1605
1784
|
"button",
|
|
1606
1785
|
{
|
|
1607
1786
|
onClick: startNew,
|
|
@@ -1613,13 +1792,13 @@ function CollectionEditor({ collection }) {
|
|
|
1613
1792
|
}
|
|
1614
1793
|
)
|
|
1615
1794
|
] }),
|
|
1616
|
-
editing && /* @__PURE__ */
|
|
1617
|
-
/* @__PURE__ */
|
|
1795
|
+
editing && /* @__PURE__ */ jsxs4("div", { className: "mb-8 rounded-2xl border border-indigo-100 bg-white p-6 shadow-xl shadow-indigo-100/50 animate-in fade-in slide-in-from-top-4", children: [
|
|
1796
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 mb-6", children: [
|
|
1618
1797
|
/* @__PURE__ */ jsx5("div", { className: "w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-600", children: /* @__PURE__ */ jsx5(Pencil, { className: "w-4 h-4" }) }),
|
|
1619
1798
|
/* @__PURE__ */ jsx5("h3", { className: "text-lg font-bold text-slate-900", children: "Edit Entry" })
|
|
1620
1799
|
] }),
|
|
1621
|
-
/* @__PURE__ */ jsx5("div", { className: "grid gap-5 md:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order").map((f) => /* @__PURE__ */
|
|
1622
|
-
/* @__PURE__ */
|
|
1800
|
+
/* @__PURE__ */ jsx5("div", { className: "grid gap-5 md:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order").map((f) => /* @__PURE__ */ jsxs4("label", { className: `block ${f.type === "richtext" ? "md:col-span-2" : ""}`, children: [
|
|
1801
|
+
/* @__PURE__ */ jsxs4("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
|
|
1623
1802
|
f.label,
|
|
1624
1803
|
/* @__PURE__ */ jsx5("span", { className: "text-[10px] font-mono text-slate-300 bg-slate-50 px-1.5 py-0.5 rounded", children: f.type })
|
|
1625
1804
|
] }),
|
|
@@ -1656,7 +1835,7 @@ function CollectionEditor({ collection }) {
|
|
|
1656
1835
|
placeholder: `Search ${f.label.toLowerCase()}...`,
|
|
1657
1836
|
iconMap: ctx.iconMap
|
|
1658
1837
|
}
|
|
1659
|
-
) : f.type === "slug" ? /* @__PURE__ */
|
|
1838
|
+
) : f.type === "slug" ? /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1660
1839
|
/* @__PURE__ */ jsx5(
|
|
1661
1840
|
"input",
|
|
1662
1841
|
{
|
|
@@ -1680,7 +1859,7 @@ function CollectionEditor({ collection }) {
|
|
|
1680
1859
|
children: "Generate"
|
|
1681
1860
|
}
|
|
1682
1861
|
)
|
|
1683
|
-
] }) : f.type === "select" ? /* @__PURE__ */
|
|
1862
|
+
] }) : f.type === "select" ? /* @__PURE__ */ jsxs4("div", { children: [
|
|
1684
1863
|
/* @__PURE__ */ jsx5(
|
|
1685
1864
|
"input",
|
|
1686
1865
|
{
|
|
@@ -1695,8 +1874,8 @@ function CollectionEditor({ collection }) {
|
|
|
1695
1874
|
const lab = typeof opt === "string" ? opt : opt.label;
|
|
1696
1875
|
return /* @__PURE__ */ jsx5("option", { value: val, children: lab }, val);
|
|
1697
1876
|
}) })
|
|
1698
|
-
] }) : f.type === "image" ? /* @__PURE__ */
|
|
1699
|
-
/* @__PURE__ */
|
|
1877
|
+
] }) : f.type === "image" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
1878
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1700
1879
|
/* @__PURE__ */ jsx5(
|
|
1701
1880
|
"input",
|
|
1702
1881
|
{
|
|
@@ -1707,7 +1886,7 @@ function CollectionEditor({ collection }) {
|
|
|
1707
1886
|
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1708
1887
|
}
|
|
1709
1888
|
),
|
|
1710
|
-
/* @__PURE__ */
|
|
1889
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1711
1890
|
"Upload",
|
|
1712
1891
|
/* @__PURE__ */ jsx5(
|
|
1713
1892
|
"input",
|
|
@@ -1743,7 +1922,7 @@ function CollectionEditor({ collection }) {
|
|
|
1743
1922
|
value: String(editing[f.id] ?? ""),
|
|
1744
1923
|
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
1745
1924
|
}
|
|
1746
|
-
) : f.type === "color" && !f.multiple ? /* @__PURE__ */
|
|
1925
|
+
) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
|
|
1747
1926
|
/* @__PURE__ */ jsx5(
|
|
1748
1927
|
"input",
|
|
1749
1928
|
{
|
|
@@ -1770,11 +1949,11 @@ function CollectionEditor({ collection }) {
|
|
|
1770
1949
|
style: { backgroundColor: String(editing[f.id] ?? "#000000") }
|
|
1771
1950
|
}
|
|
1772
1951
|
)
|
|
1773
|
-
] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */
|
|
1952
|
+
] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
1774
1953
|
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : []).map((item, idx) => {
|
|
1775
1954
|
const colorVal = String(item ?? "").trim();
|
|
1776
1955
|
const validHex = colorVal.startsWith("#") && (colorVal.length === 4 || colorVal.length === 7) ? colorVal : "#000000";
|
|
1777
|
-
return /* @__PURE__ */
|
|
1956
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 items-center", children: [
|
|
1778
1957
|
/* @__PURE__ */ jsx5(
|
|
1779
1958
|
"input",
|
|
1780
1959
|
{
|
|
@@ -1824,7 +2003,7 @@ function CollectionEditor({ collection }) {
|
|
|
1824
2003
|
)
|
|
1825
2004
|
] }, idx);
|
|
1826
2005
|
}),
|
|
1827
|
-
/* @__PURE__ */
|
|
2006
|
+
/* @__PURE__ */ jsxs4(
|
|
1828
2007
|
"button",
|
|
1829
2008
|
{
|
|
1830
2009
|
type: "button",
|
|
@@ -1840,8 +2019,8 @@ function CollectionEditor({ collection }) {
|
|
|
1840
2019
|
]
|
|
1841
2020
|
}
|
|
1842
2021
|
)
|
|
1843
|
-
] }) : f.type === "list" ? /* @__PURE__ */
|
|
1844
|
-
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => /* @__PURE__ */
|
|
2022
|
+
] }) : f.type === "list" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
2023
|
+
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 items-center", children: [
|
|
1845
2024
|
/* @__PURE__ */ jsx5(
|
|
1846
2025
|
"input",
|
|
1847
2026
|
{
|
|
@@ -1869,7 +2048,7 @@ function CollectionEditor({ collection }) {
|
|
|
1869
2048
|
}
|
|
1870
2049
|
)
|
|
1871
2050
|
] }, idx)),
|
|
1872
|
-
/* @__PURE__ */
|
|
2051
|
+
/* @__PURE__ */ jsxs4(
|
|
1873
2052
|
"button",
|
|
1874
2053
|
{
|
|
1875
2054
|
type: "button",
|
|
@@ -1894,7 +2073,7 @@ function CollectionEditor({ collection }) {
|
|
|
1894
2073
|
}
|
|
1895
2074
|
)
|
|
1896
2075
|
] }, f.id)) }),
|
|
1897
|
-
/* @__PURE__ */
|
|
2076
|
+
/* @__PURE__ */ jsxs4("div", { className: "mt-8 flex justify-end gap-3 pt-5 border-t border-slate-100", children: [
|
|
1898
2077
|
/* @__PURE__ */ jsx5(
|
|
1899
2078
|
"button",
|
|
1900
2079
|
{
|
|
@@ -1910,8 +2089,8 @@ function CollectionEditor({ collection }) {
|
|
|
1910
2089
|
onClick: save,
|
|
1911
2090
|
disabled: saving,
|
|
1912
2091
|
className: "inline-flex items-center gap-2 rounded-xl bg-slate-900 px-6 py-2.5 text-sm font-bold text-white shadow-sm hover:bg-slate-800 hover:shadow transition-all disabled:opacity-60",
|
|
1913
|
-
children: saving ? /* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */
|
|
2092
|
+
children: saving ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
2093
|
+
/* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-4 w-4 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
1915
2094
|
/* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1916
2095
|
/* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
|
|
1917
2096
|
] }),
|
|
@@ -1921,19 +2100,19 @@ function CollectionEditor({ collection }) {
|
|
|
1921
2100
|
)
|
|
1922
2101
|
] })
|
|
1923
2102
|
] }),
|
|
1924
|
-
/* @__PURE__ */ jsx5("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */
|
|
1925
|
-
/* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */
|
|
2103
|
+
/* @__PURE__ */ jsx5("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs4("table", { className: "w-full text-sm text-left", children: [
|
|
2104
|
+
/* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs4("tr", { children: [
|
|
1926
2105
|
visibleFields.map((f) => /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: f.label }, f.id)),
|
|
1927
2106
|
/* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-right text-xs font-bold text-slate-500 uppercase tracking-wider sticky right-0 bg-slate-50 border-l border-slate-200 z-10", children: "Actions" })
|
|
1928
2107
|
] }) }),
|
|
1929
2108
|
/* @__PURE__ */ jsx5("tbody", { className: "divide-y divide-slate-100", children: loadingEntries ? (
|
|
1930
2109
|
// Loading skeleton rows
|
|
1931
|
-
Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */
|
|
2110
|
+
Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs4("tr", { children: [
|
|
1932
2111
|
visibleFields.map((f) => /* @__PURE__ */ jsx5("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsx5("div", { className: "h-4 bg-slate-100 rounded animate-pulse", style: { width: `${60 + i * 13 % 30}%` } }) }, f.id)),
|
|
1933
2112
|
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 sticky right-0 bg-white border-l border-slate-100", children: /* @__PURE__ */ jsx5("div", { className: "h-4 w-16 bg-slate-100 rounded animate-pulse ml-auto" }) })
|
|
1934
2113
|
] }, i))
|
|
1935
|
-
) : /* @__PURE__ */
|
|
1936
|
-
entries.map((e, idx) => /* @__PURE__ */
|
|
2114
|
+
) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
2115
|
+
entries.map((e, idx) => /* @__PURE__ */ jsxs4(
|
|
1937
2116
|
"tr",
|
|
1938
2117
|
{
|
|
1939
2118
|
draggable: true,
|
|
@@ -1944,7 +2123,7 @@ function CollectionEditor({ collection }) {
|
|
|
1944
2123
|
className: `hover:bg-slate-50/50 transition-colors group cursor-grab active:cursor-grabbing ${deletingId === e.id ? "opacity-50" : ""} ${dragOverIdx === idx ? "border-t-2 border-t-indigo-500" : ""}`,
|
|
1945
2124
|
children: [
|
|
1946
2125
|
visibleFields.map((f) => /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-slate-700 max-w-[200px] truncate", children: f.type === "boolean" ? e[f.id] ? /* @__PURE__ */ jsx5("span", { className: "inline-flex px-2 py-1 rounded bg-green-100 text-green-700 text-xs font-bold", children: "Yes" }) : /* @__PURE__ */ jsx5("span", { className: "inline-flex px-2 py-1 rounded bg-slate-100 text-slate-500 text-xs font-bold", children: "No" }) : f.type === "image" && e[f.id] ? /* @__PURE__ */ jsx5("img", { src: String(e[f.id]), alt: "", className: "h-8 w-8 object-cover rounded shadow-sm ring-1 ring-slate-200" }) : f.type === "image" ? /* @__PURE__ */ jsx5("div", { className: "h-8 w-8 rounded bg-slate-100 ring-1 ring-slate-200/50 flex items-center justify-center text-slate-300", children: /* @__PURE__ */ jsx5("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx5("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) }) : String(e[f.id] ?? "") }, f.id)),
|
|
1947
|
-
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", children: /* @__PURE__ */
|
|
2126
|
+
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-2", children: [
|
|
1948
2127
|
/* @__PURE__ */ jsx5("div", { className: "p-2 text-slate-300 cursor-grab active:cursor-grabbing", title: "Drag to reorder", children: /* @__PURE__ */ jsx5("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "w-4 h-4", children: /* @__PURE__ */ jsx5("path", { d: "M5.5 3C6.32843 3 7 3.67157 7 4.5C7 5.32843 6.32843 6 5.5 6C4.67157 6 4 5.32843 4 4.5C4 3.67157 4.67157 3 5.5 3ZM9.5 3C10.3284 3 11 3.67157 11 4.5C11 5.32843 10.3284 6 9.5 6C8.67157 6 8 5.32843 8 4.5C8 3.67157 8.67157 3 9.5 3ZM5.5 7.5C6.32843 7.5 7 8.17157 7 9C7 9.82843 6.32843 10.5 5.5 10.5C4.67157 10.5 4 9.82843 4 9C4 8.17157 4.67157 7.5 5.5 7.5ZM9.5 7.5C10.3284 7.5 11 8.17157 11 9C11 9.82843 10.3284 10.5 9.5 10.5C8.67157 10.5 8 9.82843 8 9C8 8.17157 8.67157 7.5 9.5 7.5ZM5.5 12C6.32843 12 7 12.6716 7 13.5C7 14.3284 6.32843 15 5.5 15C4.67157 15 4 14.3284 4 13.5C4 12.6716 4.67157 12 5.5 12ZM9.5 12C10.3284 12 11 12.6716 11 13.5C11 14.3284 10.3284 15 9.5 15C8.67157 15 8 14.3284 8 13.5C8 12.6716 8.67157 12 9.5 12Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }) }),
|
|
1949
2128
|
/* @__PURE__ */ jsx5(
|
|
1950
2129
|
"button",
|
|
@@ -1962,7 +2141,7 @@ function CollectionEditor({ collection }) {
|
|
|
1962
2141
|
disabled: deletingId === e.id,
|
|
1963
2142
|
className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors disabled:opacity-50",
|
|
1964
2143
|
title: "Delete",
|
|
1965
|
-
children: deletingId === e.id ? /* @__PURE__ */
|
|
2144
|
+
children: deletingId === e.id ? /* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
1966
2145
|
/* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1967
2146
|
/* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
|
|
1968
2147
|
] }) : /* @__PURE__ */ jsx5(Trash2, { className: "h-4 w-4" })
|
|
@@ -1978,7 +2157,7 @@ function CollectionEditor({ collection }) {
|
|
|
1978
2157
|
{
|
|
1979
2158
|
colSpan: visibleFields.length + 1,
|
|
1980
2159
|
className: "px-6 py-12 text-center text-slate-500",
|
|
1981
|
-
children: /* @__PURE__ */
|
|
2160
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center", children: [
|
|
1982
2161
|
/* @__PURE__ */ jsx5(Boxes, { className: "h-10 w-10 text-slate-300 mb-3" }),
|
|
1983
2162
|
/* @__PURE__ */ jsx5("p", { children: 'No entries yet. Click "New Entry" to create one.' })
|
|
1984
2163
|
] })
|
|
@@ -2009,18 +2188,18 @@ function SubmissionsSection() {
|
|
|
2009
2188
|
setSelectedFormId(formIds[0]);
|
|
2010
2189
|
}
|
|
2011
2190
|
}, [formIds, selectedFormId]);
|
|
2012
|
-
return /* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2191
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
|
|
2192
|
+
/* @__PURE__ */ jsxs4("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
|
|
2014
2193
|
/* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Data Collections" }),
|
|
2015
|
-
/* @__PURE__ */
|
|
2016
|
-
formIds.map((id) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */
|
|
2194
|
+
/* @__PURE__ */ jsxs4("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
|
|
2195
|
+
formIds.map((id) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs4(
|
|
2017
2196
|
"button",
|
|
2018
2197
|
{
|
|
2019
2198
|
onClick: () => setSelectedFormId(id),
|
|
2020
2199
|
className: `w-full rounded-lg px-3 py-2.5 text-left text-sm transition-all duration-200 ${selectedFormId === id ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
|
|
2021
2200
|
children: [
|
|
2022
2201
|
/* @__PURE__ */ jsx5("div", { className: selectedFormId === id ? "text-slate-900" : "text-slate-700 capitalize", children: id }),
|
|
2023
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ jsxs4("div", { className: `text-xs mt-0.5 ${selectedFormId === id ? "text-indigo-500" : "text-slate-400"}`, children: [
|
|
2024
2203
|
submissions.filter((s) => s.formId === id).length,
|
|
2025
2204
|
" items"
|
|
2026
2205
|
] })
|
|
@@ -2030,7 +2209,7 @@ function SubmissionsSection() {
|
|
|
2030
2209
|
formIds.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200", children: "No data collected." })
|
|
2031
2210
|
] })
|
|
2032
2211
|
] }),
|
|
2033
|
-
/* @__PURE__ */
|
|
2212
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
|
|
2034
2213
|
/* @__PURE__ */ jsx5("div", { className: "absolute inset-0 bg-grid-slate-100 [mask-image:linear-gradient(0deg,white,rgba(255,255,255,0.6))] -z-10 pointer-events-none" }),
|
|
2035
2214
|
selectedFormId ? /* @__PURE__ */ jsx5(
|
|
2036
2215
|
SubmissionsList,
|
|
@@ -2079,8 +2258,8 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2079
2258
|
}
|
|
2080
2259
|
};
|
|
2081
2260
|
if (detail) {
|
|
2082
|
-
return /* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2261
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl", children: [
|
|
2262
|
+
/* @__PURE__ */ jsxs4(
|
|
2084
2263
|
"button",
|
|
2085
2264
|
{
|
|
2086
2265
|
onClick: () => setDetail(null),
|
|
@@ -2091,9 +2270,9 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2091
2270
|
]
|
|
2092
2271
|
}
|
|
2093
2272
|
),
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */ jsx5("div", { className: "px-8 py-6 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */
|
|
2096
|
-
/* @__PURE__ */
|
|
2273
|
+
/* @__PURE__ */ jsxs4("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
|
|
2274
|
+
/* @__PURE__ */ jsx5("div", { className: "px-8 py-6 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
|
|
2275
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2097
2276
|
/* @__PURE__ */ jsx5("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-indigo-100 px-3 py-1 text-xs font-bold text-indigo-700 mb-2 capitalize", children: detail.formId }),
|
|
2098
2277
|
/* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-400", children: formatDate(detail.submittedAt) })
|
|
2099
2278
|
] }),
|
|
@@ -2111,9 +2290,9 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2111
2290
|
const strVal = String(val ?? "\u2014");
|
|
2112
2291
|
const isImage = typeof val === "string" && (val.startsWith("data:image/") || /\.(jpg|jpeg|png|webp|avif|gif|svg)(\?.*)?$/i.test(val) || val.includes("/images/") && val.includes("sanity.io"));
|
|
2113
2292
|
const isUrl = typeof val === "string" && /^https?:\/\//i.test(val);
|
|
2114
|
-
return /* @__PURE__ */
|
|
2293
|
+
return /* @__PURE__ */ jsxs4("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
|
|
2115
2294
|
/* @__PURE__ */ jsx5("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
|
|
2116
|
-
/* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */
|
|
2295
|
+
/* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
|
|
2117
2296
|
/* @__PURE__ */ jsx5(
|
|
2118
2297
|
"a",
|
|
2119
2298
|
{
|
|
@@ -2131,7 +2310,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2131
2310
|
)
|
|
2132
2311
|
}
|
|
2133
2312
|
),
|
|
2134
|
-
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */
|
|
2313
|
+
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsxs4(
|
|
2135
2314
|
"a",
|
|
2136
2315
|
{
|
|
2137
2316
|
href: strVal,
|
|
@@ -2144,7 +2323,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2144
2323
|
]
|
|
2145
2324
|
}
|
|
2146
2325
|
) })
|
|
2147
|
-
] }) : isUrl ? /* @__PURE__ */
|
|
2326
|
+
] }) : isUrl ? /* @__PURE__ */ jsxs4(
|
|
2148
2327
|
"a",
|
|
2149
2328
|
{
|
|
2150
2329
|
href: strVal,
|
|
@@ -2163,16 +2342,16 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2163
2342
|
] })
|
|
2164
2343
|
] });
|
|
2165
2344
|
}
|
|
2166
|
-
return /* @__PURE__ */
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
/* @__PURE__ */
|
|
2169
|
-
/* @__PURE__ */
|
|
2345
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-5xl flex flex-col h-full gap-6", children: [
|
|
2346
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
|
|
2347
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2348
|
+
/* @__PURE__ */ jsxs4("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight flex items-center gap-3 capitalize", children: [
|
|
2170
2349
|
formId,
|
|
2171
2350
|
unreadCount > 0 && /* @__PURE__ */ jsx5("span", { className: "inline-flex h-6 min-w-[24px] items-center justify-center rounded-full bg-indigo-600 px-2 text-xs font-bold text-white", children: unreadCount })
|
|
2172
2351
|
] }),
|
|
2173
2352
|
/* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Data received for this collection." })
|
|
2174
2353
|
] }),
|
|
2175
|
-
/* @__PURE__ */
|
|
2354
|
+
/* @__PURE__ */ jsxs4(
|
|
2176
2355
|
"button",
|
|
2177
2356
|
{
|
|
2178
2357
|
onClick: onLoad,
|
|
@@ -2185,7 +2364,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2185
2364
|
}
|
|
2186
2365
|
)
|
|
2187
2366
|
] }),
|
|
2188
|
-
/* @__PURE__ */
|
|
2367
|
+
/* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
2189
2368
|
/* @__PURE__ */ jsx5(Search, { className: "absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
|
|
2190
2369
|
/* @__PURE__ */ jsx5(
|
|
2191
2370
|
"input",
|
|
@@ -2200,28 +2379,28 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2200
2379
|
}
|
|
2201
2380
|
)
|
|
2202
2381
|
] }),
|
|
2203
|
-
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */
|
|
2204
|
-
/* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */
|
|
2382
|
+
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs4("table", { className: "w-full text-sm text-left", children: [
|
|
2383
|
+
/* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */ jsxs4("tr", { children: [
|
|
2205
2384
|
/* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Summary" }),
|
|
2206
2385
|
/* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Received" }),
|
|
2207
2386
|
/* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-right text-xs font-bold text-slate-500 uppercase tracking-wider sticky right-0 bg-slate-50 border-l border-slate-200 z-10", children: "Actions" })
|
|
2208
2387
|
] }) }),
|
|
2209
|
-
/* @__PURE__ */
|
|
2388
|
+
/* @__PURE__ */ jsxs4("tbody", { className: "divide-y divide-slate-100", children: [
|
|
2210
2389
|
paginated.map((s) => {
|
|
2211
2390
|
const firstVal = Object.values(s.data)[0];
|
|
2212
2391
|
const preview = firstVal ? String(firstVal).slice(0, 60) : "\u2014";
|
|
2213
|
-
return /* @__PURE__ */
|
|
2392
|
+
return /* @__PURE__ */ jsxs4(
|
|
2214
2393
|
"tr",
|
|
2215
2394
|
{
|
|
2216
2395
|
className: `hover:bg-slate-50/50 transition-colors group cursor-pointer ${!s.read ? "bg-indigo-50/40" : ""}`,
|
|
2217
2396
|
onClick: () => openDetail(s),
|
|
2218
2397
|
children: [
|
|
2219
|
-
/* @__PURE__ */
|
|
2398
|
+
/* @__PURE__ */ jsxs4("td", { className: "px-6 py-4", children: [
|
|
2220
2399
|
/* @__PURE__ */ jsx5("span", { className: "text-slate-600 max-w-[400px] truncate block", children: preview }),
|
|
2221
2400
|
!s.read && /* @__PURE__ */ jsx5("span", { className: "ml-2 inline-block h-2 w-2 rounded-full bg-indigo-500" })
|
|
2222
2401
|
] }),
|
|
2223
2402
|
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-slate-500 whitespace-nowrap", children: formatDate(s.submittedAt) }),
|
|
2224
|
-
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */
|
|
2403
|
+
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-1", children: [
|
|
2225
2404
|
/* @__PURE__ */ jsx5(
|
|
2226
2405
|
"button",
|
|
2227
2406
|
{
|
|
@@ -2246,19 +2425,19 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2246
2425
|
s.id
|
|
2247
2426
|
);
|
|
2248
2427
|
}),
|
|
2249
|
-
paginated.length === 0 && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 3, className: "px-6 py-16 text-center", children: /* @__PURE__ */
|
|
2428
|
+
paginated.length === 0 && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 3, className: "px-6 py-16 text-center", children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-3 text-slate-400", children: [
|
|
2250
2429
|
/* @__PURE__ */ jsx5(Inbox, { className: "h-12 w-12 text-slate-200" }),
|
|
2251
2430
|
/* @__PURE__ */ jsx5("p", { className: "text-sm font-medium", children: search ? "No matches." : "No data yet." })
|
|
2252
2431
|
] }) }) })
|
|
2253
2432
|
] })
|
|
2254
2433
|
] }) }),
|
|
2255
|
-
totalPages > 1 && /* @__PURE__ */
|
|
2256
|
-
/* @__PURE__ */
|
|
2434
|
+
totalPages > 1 && /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
|
|
2435
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2257
2436
|
filtered.length,
|
|
2258
2437
|
" item",
|
|
2259
2438
|
filtered.length !== 1 ? "s" : ""
|
|
2260
2439
|
] }),
|
|
2261
|
-
/* @__PURE__ */
|
|
2440
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
2262
2441
|
/* @__PURE__ */ jsx5(
|
|
2263
2442
|
"button",
|
|
2264
2443
|
{
|
|
@@ -2268,7 +2447,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2268
2447
|
children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
|
|
2269
2448
|
}
|
|
2270
2449
|
),
|
|
2271
|
-
/* @__PURE__ */
|
|
2450
|
+
/* @__PURE__ */ jsxs4("span", { className: "font-medium text-slate-700", children: [
|
|
2272
2451
|
"Page ",
|
|
2273
2452
|
page,
|
|
2274
2453
|
" of ",
|
|
@@ -2289,14 +2468,14 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2289
2468
|
}
|
|
2290
2469
|
function SettingsSection() {
|
|
2291
2470
|
const ctx = useCmsContext();
|
|
2292
|
-
return /* @__PURE__ */ jsx5("div", { className: "flex h-full bg-slate-50 p-8 overflow-y-auto", children: /* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
2471
|
+
return /* @__PURE__ */ jsx5("div", { className: "flex h-full bg-slate-50 p-8 overflow-y-auto", children: /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl space-y-8", children: [
|
|
2472
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2294
2473
|
/* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "System Settings" }),
|
|
2295
2474
|
/* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Current configuration and statistics for your CMS instance." })
|
|
2296
2475
|
] }),
|
|
2297
|
-
/* @__PURE__ */
|
|
2476
|
+
/* @__PURE__ */ jsxs4("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
|
|
2298
2477
|
/* @__PURE__ */ jsx5("div", { className: "px-6 py-4 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsx5("h3", { className: "font-bold text-slate-800", children: "Configuration Snapshot" }) }),
|
|
2299
|
-
/* @__PURE__ */
|
|
2478
|
+
/* @__PURE__ */ jsxs4("dl", { className: "divide-y divide-slate-100 text-sm", children: [
|
|
2300
2479
|
/* @__PURE__ */ jsx5(Row, { label: "Site Name", value: ctx.config.siteName ?? "\u2014" }),
|
|
2301
2480
|
/* @__PURE__ */ jsx5(Row, { label: "Active Storage Adapter", value: ctx.adapter.name, highlight: true }),
|
|
2302
2481
|
/* @__PURE__ */ jsx5(Row, { label: "Registered Pages", value: String(ctx.config.pages.length) }),
|
|
@@ -2339,10 +2518,10 @@ function ConfigSection() {
|
|
|
2339
2518
|
},
|
|
2340
2519
|
[ctx]
|
|
2341
2520
|
);
|
|
2342
|
-
return /* @__PURE__ */
|
|
2343
|
-
/* @__PURE__ */
|
|
2521
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row h-full", children: [
|
|
2522
|
+
/* @__PURE__ */ jsxs4("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
|
|
2344
2523
|
/* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Configuration Groups" }),
|
|
2345
|
-
/* @__PURE__ */
|
|
2524
|
+
/* @__PURE__ */ jsxs4("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
|
|
2346
2525
|
globals.map((g) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 w-32 lg:w-full", children: /* @__PURE__ */ jsx5(
|
|
2347
2526
|
"button",
|
|
2348
2527
|
{
|
|
@@ -2354,14 +2533,14 @@ function ConfigSection() {
|
|
|
2354
2533
|
globals.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200 w-full", children: "No global configurations." })
|
|
2355
2534
|
] })
|
|
2356
2535
|
] }),
|
|
2357
|
-
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-auto bg-slate-50 p-6 lg:p-10 relative", children: /* @__PURE__ */
|
|
2358
|
-
/* @__PURE__ */
|
|
2359
|
-
/* @__PURE__ */
|
|
2536
|
+
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-auto bg-slate-50 p-6 lg:p-10 relative", children: /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl", children: [
|
|
2537
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between mb-8", children: [
|
|
2538
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2360
2539
|
/* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "Configuration" }),
|
|
2361
2540
|
/* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Edit global content like headers and footers." })
|
|
2362
2541
|
] }),
|
|
2363
|
-
/* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2542
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
2543
|
+
/* @__PURE__ */ jsxs4(
|
|
2365
2544
|
"button",
|
|
2366
2545
|
{
|
|
2367
2546
|
onClick: () => ctx.reset(),
|
|
@@ -2373,7 +2552,7 @@ function ConfigSection() {
|
|
|
2373
2552
|
]
|
|
2374
2553
|
}
|
|
2375
2554
|
),
|
|
2376
|
-
/* @__PURE__ */
|
|
2555
|
+
/* @__PURE__ */ jsxs4(
|
|
2377
2556
|
"button",
|
|
2378
2557
|
{
|
|
2379
2558
|
onClick: () => ctx.save(),
|
|
@@ -2387,7 +2566,7 @@ function ConfigSection() {
|
|
|
2387
2566
|
)
|
|
2388
2567
|
] })
|
|
2389
2568
|
] }),
|
|
2390
|
-
selectedGroup ? /* @__PURE__ */
|
|
2569
|
+
selectedGroup ? /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
2391
2570
|
/* @__PURE__ */ jsx5("h3", { className: "font-bold text-slate-800 text-lg", children: selectedGroup.label }),
|
|
2392
2571
|
/* @__PURE__ */ jsx5("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden divide-y divide-slate-100", children: selectedGroup.fields.map((field) => /* @__PURE__ */ jsx5("div", { className: "p-4", children: /* @__PURE__ */ jsx5(
|
|
2393
2572
|
FieldEditor,
|
|
@@ -2400,7 +2579,7 @@ function ConfigSection() {
|
|
|
2400
2579
|
}
|
|
2401
2580
|
}
|
|
2402
2581
|
) }, field.id)) })
|
|
2403
|
-
] }) : /* @__PURE__ */
|
|
2582
|
+
] }) : /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center p-16 text-center border-2 border-dashed border-slate-200 rounded-2xl bg-white/50", children: [
|
|
2404
2583
|
/* @__PURE__ */ jsx5(SettingsIcon, { className: "w-12 h-12 text-slate-300 mb-4" }),
|
|
2405
2584
|
/* @__PURE__ */ jsx5("p", { className: "text-slate-500 font-medium", children: "Select a setting group on the left to edit." })
|
|
2406
2585
|
] })
|
|
@@ -2413,7 +2592,7 @@ function Row({
|
|
|
2413
2592
|
highlight,
|
|
2414
2593
|
status
|
|
2415
2594
|
}) {
|
|
2416
|
-
return /* @__PURE__ */
|
|
2595
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-6 py-4 hover:bg-slate-50/50 transition-colors", children: [
|
|
2417
2596
|
/* @__PURE__ */ jsx5("dt", { className: "text-slate-500 font-medium", children: label }),
|
|
2418
2597
|
/* @__PURE__ */ jsx5("dd", { className: `font-semibold ${highlight ? "text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded" : status === "warning" ? "text-amber-600" : status === "success" ? "text-emerald-600" : "text-slate-900"}`, children: value })
|
|
2419
2598
|
] });
|
|
@@ -2424,8 +2603,8 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2424
2603
|
const filtered = options.filter((o) => o.toLowerCase().includes(search.toLowerCase()));
|
|
2425
2604
|
const capped = filtered.slice(0, 80);
|
|
2426
2605
|
const SelectedIcon = iconMap && value ? iconMap[value] : null;
|
|
2427
|
-
return /* @__PURE__ */
|
|
2428
|
-
/* @__PURE__ */
|
|
2606
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
2607
|
+
/* @__PURE__ */ jsxs4(
|
|
2429
2608
|
"button",
|
|
2430
2609
|
{
|
|
2431
2610
|
type: "button",
|
|
@@ -2435,7 +2614,7 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2435
2614
|
},
|
|
2436
2615
|
className: "w-full flex items-center justify-between rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm hover:border-slate-300 focus:border-indigo-500 bg-white transition-colors",
|
|
2437
2616
|
children: [
|
|
2438
|
-
/* @__PURE__ */
|
|
2617
|
+
/* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2 truncate", children: [
|
|
2439
2618
|
SelectedIcon && /* @__PURE__ */ jsx5(SelectedIcon, { className: "w-4 h-4 text-indigo-600 shrink-0" }),
|
|
2440
2619
|
/* @__PURE__ */ jsx5("span", { className: "truncate", children: value || placeholder || "Select..." })
|
|
2441
2620
|
] }),
|
|
@@ -2443,10 +2622,10 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2443
2622
|
]
|
|
2444
2623
|
}
|
|
2445
2624
|
),
|
|
2446
|
-
open && /* @__PURE__ */
|
|
2625
|
+
open && /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
2447
2626
|
/* @__PURE__ */ jsx5("div", { className: "fixed inset-0 z-[100]", onClick: () => setOpen(false) }),
|
|
2448
|
-
/* @__PURE__ */
|
|
2449
|
-
/* @__PURE__ */
|
|
2627
|
+
/* @__PURE__ */ jsxs4("div", { className: "absolute z-[101] mt-1 w-full rounded-xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in slide-in-from-top-1 duration-150", children: [
|
|
2628
|
+
/* @__PURE__ */ jsxs4("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
|
|
2450
2629
|
/* @__PURE__ */ jsx5(Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
|
|
2451
2630
|
/* @__PURE__ */ jsx5(
|
|
2452
2631
|
"input",
|
|
@@ -2461,15 +2640,15 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2461
2640
|
),
|
|
2462
2641
|
search && /* @__PURE__ */ jsx5("span", { className: "text-[10px] font-bold text-slate-400 bg-slate-100 px-1.5 py-0.5 rounded-full shrink-0 tabular-nums", children: filtered.length })
|
|
2463
2642
|
] }),
|
|
2464
|
-
/* @__PURE__ */
|
|
2465
|
-
filtered.length === 0 && /* @__PURE__ */
|
|
2643
|
+
/* @__PURE__ */ jsxs4("div", { className: "overflow-y-auto flex-1 p-1", children: [
|
|
2644
|
+
filtered.length === 0 && /* @__PURE__ */ jsxs4("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
|
|
2466
2645
|
'No results for "',
|
|
2467
2646
|
search,
|
|
2468
2647
|
'"'
|
|
2469
2648
|
] }),
|
|
2470
2649
|
capped.map((opt) => {
|
|
2471
2650
|
const OptIcon = iconMap ? iconMap[opt] : null;
|
|
2472
|
-
return /* @__PURE__ */
|
|
2651
|
+
return /* @__PURE__ */ jsxs4(
|
|
2473
2652
|
"button",
|
|
2474
2653
|
{
|
|
2475
2654
|
type: "button",
|
|
@@ -2486,7 +2665,7 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2486
2665
|
opt
|
|
2487
2666
|
);
|
|
2488
2667
|
}),
|
|
2489
|
-
filtered.length > 80 && /* @__PURE__ */
|
|
2668
|
+
filtered.length > 80 && /* @__PURE__ */ jsxs4("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
|
|
2490
2669
|
"Showing 80 of ",
|
|
2491
2670
|
filtered.length,
|
|
2492
2671
|
" \u2014 type to narrow results"
|
|
@@ -2501,7 +2680,7 @@ function PasswordField({ value, onChange }) {
|
|
|
2501
2680
|
const isHash = value.startsWith("$2a$") || value.startsWith("$2b$");
|
|
2502
2681
|
const [displayValue, setDisplayValue] = useState4(isHash ? "" : value);
|
|
2503
2682
|
const [pristine, setPristine] = useState4(isHash);
|
|
2504
|
-
return /* @__PURE__ */
|
|
2683
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
2505
2684
|
/* @__PURE__ */ jsx5(
|
|
2506
2685
|
"input",
|
|
2507
2686
|
{
|
|
@@ -2531,7 +2710,7 @@ function PasswordField({ value, onChange }) {
|
|
|
2531
2710
|
// src/admin/AdminLogin.tsx
|
|
2532
2711
|
import { useState as useState5, useEffect as useEffect5 } from "react";
|
|
2533
2712
|
import { Lock, UserPlus } from "lucide-react";
|
|
2534
|
-
import { jsx as jsx6, jsxs as
|
|
2713
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2535
2714
|
function AdminLogin({
|
|
2536
2715
|
authApiRoute = "/api/admin/auth",
|
|
2537
2716
|
redirectRoute = "/admin"
|
|
@@ -2577,19 +2756,19 @@ function AdminLogin({
|
|
|
2577
2756
|
}
|
|
2578
2757
|
};
|
|
2579
2758
|
if (view === "checking") {
|
|
2580
|
-
return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */
|
|
2759
|
+
return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs5("svg", { className: "animate-spin h-8 w-8 text-indigo-600", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
2581
2760
|
/* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
2582
2761
|
/* @__PURE__ */ jsx6("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
2583
2762
|
] }) });
|
|
2584
2763
|
}
|
|
2585
|
-
return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */
|
|
2586
|
-
/* @__PURE__ */
|
|
2764
|
+
return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs5("div", { className: "max-w-md w-full bg-white rounded-2xl shadow-xl border border-slate-100 overflow-hidden", children: [
|
|
2765
|
+
/* @__PURE__ */ jsxs5("div", { className: "p-8", children: [
|
|
2587
2766
|
/* @__PURE__ */ jsx6("div", { className: "w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-6", children: view === "register" ? /* @__PURE__ */ jsx6(UserPlus, { className: "w-6 h-6 text-indigo-600" }) : /* @__PURE__ */ jsx6(Lock, { className: "w-6 h-6 text-indigo-600" }) }),
|
|
2588
2767
|
/* @__PURE__ */ jsx6("h1", { className: "text-2xl font-bold text-slate-900 text-center mb-2", children: view === "register" ? "Create Admin Account" : "Admin Login" }),
|
|
2589
2768
|
/* @__PURE__ */ jsx6("p", { className: "text-sm text-slate-500 text-center mb-8", children: view === "register" ? "No admin users found. Create the first admin account to get started." : "Sign in to manage your content." }),
|
|
2590
2769
|
error && /* @__PURE__ */ jsx6("div", { className: "mb-6 bg-red-50 text-red-700 p-3 rounded-lg text-sm border border-red-100", children: error }),
|
|
2591
|
-
/* @__PURE__ */
|
|
2592
|
-
/* @__PURE__ */
|
|
2770
|
+
/* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
|
|
2771
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
2593
2772
|
/* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Email Address" }),
|
|
2594
2773
|
/* @__PURE__ */ jsx6(
|
|
2595
2774
|
"input",
|
|
@@ -2603,7 +2782,7 @@ function AdminLogin({
|
|
|
2603
2782
|
}
|
|
2604
2783
|
)
|
|
2605
2784
|
] }),
|
|
2606
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
2607
2786
|
/* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Password" }),
|
|
2608
2787
|
/* @__PURE__ */ jsx6(
|
|
2609
2788
|
"input",
|
|
@@ -2623,7 +2802,7 @@ function AdminLogin({
|
|
|
2623
2802
|
type: "submit",
|
|
2624
2803
|
disabled: loading,
|
|
2625
2804
|
className: "w-full bg-indigo-600 text-white font-semibold rounded-xl px-4 py-3 hover:bg-indigo-700 focus:outline-none focus:ring-4 focus:ring-indigo-500/20 transition-all shadow-md disabled:opacity-70 flex justify-center items-center",
|
|
2626
|
-
children: loading ? /* @__PURE__ */
|
|
2805
|
+
children: loading ? /* @__PURE__ */ jsxs5("svg", { className: "animate-spin h-5 w-5 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
2627
2806
|
/* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
2628
2807
|
/* @__PURE__ */ jsx6("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
2629
2808
|
] }) : view === "register" ? "Create Account" : "Sign In"
|