@chaibuilder/pages 0.15.3 → 0.15.6
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/{2AITGKQY-o6FgGSqg.cjs → 2AITGKQY-BnzAO102.cjs} +1 -1
- package/dist/{2AITGKQY-DhC0sF1x.js → 2AITGKQY-tXLat8E2.js} +2 -2
- package/dist/{NCMVHL6D-D7HU3akD.js → NCMVHL6D-BwDANa-N.js} +2 -2
- package/dist/{NCMVHL6D-BPM6RHYa.cjs → NCMVHL6D-DooF4Fqf.cjs} +1 -1
- package/dist/{ZDWCUMSJ-Cr1v3giV.js → ZDWCUMSJ-DWeYRRkj.js} +1 -1
- package/dist/{ZDWCUMSJ-NVCxv9uE.cjs → ZDWCUMSJ-DiH9kc7o.cjs} +1 -1
- package/dist/add-new-language-page-BCUrfgTy.cjs +1 -0
- package/dist/add-new-language-page-DZhjVBBf.js +401 -0
- package/dist/add-new-page-DWHANcUx.cjs +1 -0
- package/dist/add-new-page-DYuuentN.js +31 -0
- package/dist/delete-page-1dSWwUBg.js +40 -0
- package/dist/delete-page-m-Cuz7rG.cjs +1 -0
- package/dist/digital-asset-manager-BWZlrwFf.js +913 -0
- package/dist/digital-asset-manager-By_JTIbb.cjs +1 -0
- package/dist/duplicate-page-Dzs8ya8l.cjs +1 -0
- package/dist/duplicate-page-fUuBTAs7.js +133 -0
- package/dist/{dynamic-page-selector-CF9nb6i_.cjs → dynamic-page-selector-CwhL4z6F.cjs} +1 -1
- package/dist/{dynamic-page-selector-DTk4oull.js → dynamic-page-selector-X2qgdiNQ.js} +1 -1
- package/dist/image-editor-CeSSNbFY.js +108 -0
- package/dist/image-editor-CnDnY97s.cjs +1 -0
- package/dist/index-0cMGDekp.cjs +5 -0
- package/dist/{index-BuXZJnGo.js → index-Bk8tPO5R.js} +1605 -1571
- package/dist/index.cjs +1 -1
- package/dist/index.js +8 -8
- package/dist/{json-diff-viewer-zBoPBSd3.cjs → json-diff-viewer-Cfa9BjZ6.cjs} +1 -1
- package/dist/{json-diff-viewer-oyxMD3Hc.js → json-diff-viewer-Cm84g19X.js} +1 -1
- package/dist/lang-panel-CaSKOJ8G.js +225 -0
- package/dist/lang-panel-CkSfJqr8.cjs +1 -0
- package/dist/mark-as-template-Ci82hbOm.cjs +1 -0
- package/dist/mark-as-template-CwsW86Zv.js +153 -0
- package/dist/no-language-page-content-CPt4aPy9.cjs +1 -0
- package/dist/no-language-page-content-DDz81nqg.js +42 -0
- package/dist/{page-creator-BG2hc82u.cjs → page-creator-Cd2LrG4u.cjs} +1 -1
- package/dist/{page-creator-y6kl3nw5.js → page-creator-Dr566_Yf.js} +2 -2
- package/dist/page-lock-request-Bw_Wye1t.cjs +1 -0
- package/dist/page-lock-request-ECxkQMdS.js +75 -0
- package/dist/page-locked-by-dialog-AbutJT_V.cjs +1 -0
- package/dist/page-locked-by-dialog-CnkVUpjt.js +68 -0
- package/dist/page-manager-new-DLMvOata.cjs +1 -0
- package/dist/page-manager-new-DkqNLZ5C.js +354 -0
- package/dist/page-manager-search-and-filter-B98nz9xS.js +201 -0
- package/dist/page-manager-search-and-filter-CfEfWFeo.cjs +1 -0
- package/dist/{page-revisions-content-BaTqBnko.js → page-revisions-content-CBQPYFZI.js} +18 -18
- package/dist/{page-revisions-content-Tb3T6zvU.cjs → page-revisions-content-D12GEp8C.cjs} +1 -1
- package/dist/{publish-pages-content-C9CgEWo0.js → publish-pages-content-BF5yMo_L.js} +6 -6
- package/dist/{publish-pages-content-BGkEZ3GK.cjs → publish-pages-content-LNCr9tKv.cjs} +1 -1
- package/dist/{save-to-lib-DNK4GPNw.cjs → save-to-lib-C1B6tWEF.cjs} +1 -1
- package/dist/{save-to-lib-DGtyTG6H.js → save-to-lib-SpilaoOL.js} +1 -1
- package/dist/{seo-panel-CrK7z4bR.cjs → seo-panel-DkgkJUT6.cjs} +1 -1
- package/dist/{seo-panel-DESVAQM5.js → seo-panel-sbYoo746.js} +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +96 -96
- package/dist/shared-json-ld-CEUgLAev.cjs +1 -0
- package/dist/shared-json-ld-D_YyVPk3.js +565 -0
- package/dist/{slug-input-DMYhARDW.cjs → slug-input-Cqj9EBju.cjs} +1 -1
- package/dist/{slug-input-DfAsMPg8.js → slug-input-Df-BG6xl.js} +1 -1
- package/dist/theme-panel-footer-B6leVWSV.js +25 -0
- package/dist/theme-panel-footer-Ca1UF5DA.cjs +1 -0
- package/dist/unmark-as-template-BOE-nKOb.cjs +1 -0
- package/dist/unmark-as-template-Cho9B4RN.js +39 -0
- package/dist/unpublish-page-BcxxZ8pr.cjs +1 -0
- package/dist/unpublish-page-Dr4qbwUx.js +27 -0
- package/dist/{web-preview-DNgPjdgZ.js → web-preview-Cq82TNaS.js} +1 -1
- package/dist/{web-preview-BcULgiw_.cjs → web-preview-ued-fdxs.cjs} +1 -1
- package/package.json +3 -4
- package/dist/add-new-language-page-8q4Ku3eg.js +0 -390
- package/dist/add-new-language-page-D3PSLiUv.cjs +0 -1
- package/dist/add-new-page-BpvpSM4X.js +0 -30
- package/dist/add-new-page-YpzILOYq.cjs +0 -1
- package/dist/delete-page-CXRJjJ4o.js +0 -38
- package/dist/delete-page-w64MO7db.cjs +0 -1
- package/dist/digital-asset-manager-B2m5T22s.js +0 -1001
- package/dist/digital-asset-manager-BGyKKd_6.cjs +0 -1
- package/dist/duplicate-page-CSQs2MOp.js +0 -120
- package/dist/duplicate-page-DB_c7V2t.cjs +0 -1
- package/dist/image-editor-D9MPdtxC.js +0 -107
- package/dist/image-editor-Da6lrqkL.cjs +0 -1
- package/dist/index-Cds1vIhw.cjs +0 -5
- package/dist/lang-panel-B_HcsPPo.js +0 -218
- package/dist/lang-panel-D2YUMeJZ.cjs +0 -1
- package/dist/mark-as-template-C4wH4UKf.cjs +0 -1
- package/dist/mark-as-template-CPEPYXg7.js +0 -146
- package/dist/no-language-page-content-CVyOpT9h.js +0 -35
- package/dist/no-language-page-content-ECt0SxFX.cjs +0 -1
- package/dist/page-lock-request-DC62b588.js +0 -64
- package/dist/page-lock-request-fGZbOFTp.cjs +0 -1
- package/dist/page-locked-by-dialog-BIC-c0Jl.cjs +0 -1
- package/dist/page-locked-by-dialog-D-vXaoga.js +0 -63
- package/dist/page-manager-new-CUfjlMed.cjs +0 -1
- package/dist/page-manager-new-Cto2r7Va.js +0 -354
- package/dist/page-manager-search-and-filter-sVnGlF46.js +0 -197
- package/dist/page-manager-search-and-filter-z2b4sgvb.cjs +0 -1
- package/dist/shared-json-ld-BMfQzOWc.js +0 -650
- package/dist/shared-json-ld-_ozYsSHn.cjs +0 -1
- package/dist/theme-panel-footer-Bj2yHtxO.cjs +0 -1
- package/dist/theme-panel-footer-RrxiDGoD.js +0 -25
- package/dist/unmark-as-template-BjetSrYF.js +0 -38
- package/dist/unmark-as-template-C8hTjRVk.cjs +0 -1
- package/dist/unpublish-page-BTPEVAkv.js +0 -26
- package/dist/unpublish-page-gtGfNOAq.cjs +0 -1
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
import { jsxs as p, jsx as s, Fragment as D } from "react/jsx-runtime";
|
|
2
|
-
import { au as pe, f as oe, aj as be, T as _, aC as ye, L as ge, h as ke, b as Ne, i as we, ap as ve, aD as Se, aE as q } from "./index-BuXZJnGo.js";
|
|
3
|
-
import { u as J } from "./use-page-expand-manager-D6T75I11.js";
|
|
4
|
-
import { compact as ie, filter as z, isEmpty as v, uniqBy as Ae, keyBy as ce, mapValues as Le, startCase as Te, toLower as E, includes as O, find as j, get as H, map as Ce } from "lodash-es";
|
|
5
|
-
import { useLanguages as re } from "@chaibuilder/sdk";
|
|
6
|
-
import { useAtom as Ee } from "jotai";
|
|
7
|
-
import { NotepadText as Ue, MoreHorizontal as $e, Lock as Me, Edit as je, Plus as ze, ChevronRight as Fe, StarsIcon as Be, Globe as Ie, File as de } from "lucide-react";
|
|
8
|
-
import { useMemo as Q, lazy as U, useState as N, useCallback as ae, useEffect as M, Suspense as C } from "react";
|
|
9
|
-
const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
10
|
-
z(e, (r) => {
|
|
11
|
-
const t = E(n);
|
|
12
|
-
return O(E((r == null ? void 0 : r.name) || ""), t) || O(E((r == null ? void 0 : r.slug) || ""), t);
|
|
13
|
-
})
|
|
14
|
-
), Ge = (e, n) => {
|
|
15
|
-
const r = /* @__PURE__ */ new Set(), t = ce(e, "id");
|
|
16
|
-
return n.forEach((l) => {
|
|
17
|
-
let o = l;
|
|
18
|
-
for (; o.parent && t[o.parent]; )
|
|
19
|
-
r.add(o.parent), o = t[o.parent];
|
|
20
|
-
}), Array.from(r).map((l) => t[l]);
|
|
21
|
-
}, V = (e, n, r) => v(n) ? e : e.map((t) => {
|
|
22
|
-
if (!r(t.pageType))
|
|
23
|
-
return {
|
|
24
|
-
...t,
|
|
25
|
-
shouldExpandOnSearch: !0,
|
|
26
|
-
children: t.children ? V(t.children, n, r) : []
|
|
27
|
-
};
|
|
28
|
-
const l = t.children && t.children.some(
|
|
29
|
-
(o) => O(E(o.name || ""), E(n)) || O(E(o.slug || ""), E(n))
|
|
30
|
-
);
|
|
31
|
-
return {
|
|
32
|
-
...t,
|
|
33
|
-
shouldExpandOnSearch: l,
|
|
34
|
-
children: t.children ? V(t.children, n, r) : []
|
|
35
|
-
};
|
|
36
|
-
}), De = (e) => {
|
|
37
|
-
if (!e || !e.length) return [];
|
|
38
|
-
const n = {};
|
|
39
|
-
e.forEach((t) => {
|
|
40
|
-
n[t.id] = { ...t, children: [] };
|
|
41
|
-
});
|
|
42
|
-
const r = [];
|
|
43
|
-
return Object.values(n).forEach((t) => {
|
|
44
|
-
t.parent && n[t.parent] ? n[t.parent].children.push(t) : r.push(t);
|
|
45
|
-
}), r;
|
|
46
|
-
}, ue = (e) => !e || !e.length ? [] : [...e].sort(
|
|
47
|
-
(r, t) => (r.name || "").localeCompare(t.name || "")
|
|
48
|
-
).map((r) => ({
|
|
49
|
-
...r,
|
|
50
|
-
children: r.children ? ue(r.children) : []
|
|
51
|
-
})), Oe = (e, n, r, t) => {
|
|
52
|
-
if (!e || !e.length) return [];
|
|
53
|
-
let l = e;
|
|
54
|
-
if (r !== "all" && (l = ie(z(e, { pageType: r }))), v(n))
|
|
55
|
-
l = le(l, n);
|
|
56
|
-
else {
|
|
57
|
-
const d = le(l, n), i = Ge(e, d);
|
|
58
|
-
l = Ae([...d, ...i], "id");
|
|
59
|
-
}
|
|
60
|
-
const o = ue(De(l)), b = V(o, n, t), f = z(b, (d) => t(d.pageType)).sort((d, i) => (d.name || "").localeCompare(i.name || "")), x = z(b, (d) => !t(d.pageType));
|
|
61
|
-
let m = [];
|
|
62
|
-
if (r === "all") {
|
|
63
|
-
const d = ce(x, "pageType");
|
|
64
|
-
m = Object.values(
|
|
65
|
-
Le(d, (i, P) => ({
|
|
66
|
-
...i,
|
|
67
|
-
id: P,
|
|
68
|
-
name: Te(P),
|
|
69
|
-
isPartialGroup: !0,
|
|
70
|
-
children: b.filter((S) => S.pageType === P)
|
|
71
|
-
}))
|
|
72
|
-
);
|
|
73
|
-
} else
|
|
74
|
-
m = x.sort((d, i) => (d.name || "").localeCompare(i.name || ""));
|
|
75
|
-
return [...f, ...m];
|
|
76
|
-
}, Re = ({ page: e }) => {
|
|
77
|
-
var t, l;
|
|
78
|
-
const { isExpanded: n, toggleExpanded: r } = J(e == null ? void 0 : e.id);
|
|
79
|
-
return /* @__PURE__ */ s(
|
|
80
|
-
"button",
|
|
81
|
-
{
|
|
82
|
-
onClick: (o) => {
|
|
83
|
-
o.stopPropagation(), r();
|
|
84
|
-
},
|
|
85
|
-
disabled: !((t = e == null ? void 0 : e.children) != null && t.length),
|
|
86
|
-
className: `flex h-[calc(100%-2px)] w-5 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-200 hover:px-1 hover:text-gray-500 ${(l = e == null ? void 0 : e.children) != null && l.length ? "hover:text-blue-400" : "opacity-0"}`,
|
|
87
|
-
children: /* @__PURE__ */ s(
|
|
88
|
-
Fe,
|
|
89
|
-
{
|
|
90
|
-
size: 12,
|
|
91
|
-
className: `stroke-[4] transition-transform duration-200 ${n ? "rotate-90" : ""}`
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
}, We = ({ page: e, pageType: n }) => /* @__PURE__ */ s("div", { className: "flex h-full items-center justify-center gap-x-1", children: e.dynamic ? /* @__PURE__ */ s(Be, { size: 12, className: "text-yellow-400" }) : n != null && n.icon ? /* @__PURE__ */ s(
|
|
97
|
-
"div",
|
|
98
|
-
{
|
|
99
|
-
className: "flex h-4 max-h-4 w-4 max-w-4 items-center justify-center stroke-[1] text-slate-500",
|
|
100
|
-
dangerouslySetInnerHTML: { __html: n.icon }
|
|
101
|
-
}
|
|
102
|
-
) : n != null && n.hasSlug ? /* @__PURE__ */ s(de, { size: 12, className: "stroke-[1] text-slate-500" }) : /* @__PURE__ */ s(Ie, { size: 12, className: "stroke-[1] text-slate-500" }) }), _e = ({ isOnline: e }) => /* @__PURE__ */ s("div", { className: `h-2 w-2 rounded-full ${e ? "bg-green-300" : "bg-gray-300"}` }), qe = ({
|
|
103
|
-
page: e,
|
|
104
|
-
pageTypes: n,
|
|
105
|
-
currentPage: r,
|
|
106
|
-
onClickAction: t,
|
|
107
|
-
languagePages: l,
|
|
108
|
-
selectedLanguage: o,
|
|
109
|
-
showUntranslatedPages: b
|
|
110
|
-
}) => {
|
|
111
|
-
const [f] = pe(), x = oe(), m = r === e.id, d = !!e.isTemplate, i = Q(() => j(n, { key: e.pageType }), [n, e.pageType]), P = f == null ? void 0 : f[e.id], { data: S } = be(P), y = S ? S == null ? void 0 : S.name : null;
|
|
112
|
-
let u = H(l, e == null ? void 0 : e.id);
|
|
113
|
-
u = H(u, "lang") === o ? u : null;
|
|
114
|
-
const A = o === x || !!u, L = (u == null ? void 0 : u.name) || (e == null ? void 0 : e.name) || "No name";
|
|
115
|
-
let g = (u == null ? void 0 : u.slug) || (e == null ? void 0 : e.slug) || "";
|
|
116
|
-
const F = g + (e != null && e.dynamic ? `/${i == null ? void 0 : i.dynamicSlug}` : "") + (e != null && e.dynamicSlugCustom ? `${e.dynamicSlugCustom}` : "");
|
|
117
|
-
if (g.startsWith("/") && !b) {
|
|
118
|
-
const c = g.split("/").pop();
|
|
119
|
-
g = g.endsWith(c) && e.dynamic ? "" : `/${c}`;
|
|
120
|
-
}
|
|
121
|
-
const B = Q(() => {
|
|
122
|
-
const c = "flex h-7 min-w-0 flex-1 cursor-pointer select-none items-center gap-x-1.5 rounded px-px text-xs duration-300 border-[1px]", T = `${m ? "border-primary/30 bg-primary/5" : "border-transparent hover:border-gray-200 hover:bg-gray-100"}`;
|
|
123
|
-
return A ? `${c} ${T} ${y ? "opacity-60" : ""}` : `${c} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`;
|
|
124
|
-
}, [A, m, y]);
|
|
125
|
-
return /* @__PURE__ */ p("div", { className: "group relative", children: [
|
|
126
|
-
/* @__PURE__ */ p(
|
|
127
|
-
"div",
|
|
128
|
-
{
|
|
129
|
-
onClick: () => !e.isPartialGroup && A && t("select", e == null ? void 0 : e.id),
|
|
130
|
-
className: B,
|
|
131
|
-
children: [
|
|
132
|
-
/* @__PURE__ */ s(Re, { page: e }),
|
|
133
|
-
!e.isPartialGroup && /* @__PURE__ */ s(_e, { isOnline: u ? u.online : e.online }),
|
|
134
|
-
/* @__PURE__ */ s(We, { page: e, pageType: i }),
|
|
135
|
-
/* @__PURE__ */ s(_, { content: L, side: "top", showTooltip: L.length > 35, children: /* @__PURE__ */ s("span", { className: "max-w-[40%] truncate font-medium text-black", children: L }) }),
|
|
136
|
-
(g || e.dynamic) && /* @__PURE__ */ s(_, { content: F, side: "top", showTooltip: !0, children: /* @__PURE__ */ p("span", { className: "max-w-[40%] truncate font-mono text-xs text-muted-foreground", children: [
|
|
137
|
-
g,
|
|
138
|
-
e.dynamic && (i == null ? void 0 : i.dynamicSlug) && /* @__PURE__ */ p("span", { className: "text-xs text-gray-500", children: [
|
|
139
|
-
"/",
|
|
140
|
-
i == null ? void 0 : i.dynamicSlug,
|
|
141
|
-
e.dynamicSlugCustom
|
|
142
|
-
] })
|
|
143
|
-
] }) }),
|
|
144
|
-
d && /* @__PURE__ */ s(_, { content: "Template", side: "top", children: /* @__PURE__ */ s("span", { className: "text-blue-500", children: /* @__PURE__ */ s(Ue, { size: 16 }) }) }),
|
|
145
|
-
!e.isPartialGroup && A && !y ? /* @__PURE__ */ s("div", { className: "duration absolute right-0.5 top-[3px]", children: /* @__PURE__ */ s(
|
|
146
|
-
ye,
|
|
147
|
-
{
|
|
148
|
-
isLanguagePage: !!u,
|
|
149
|
-
page: u || e,
|
|
150
|
-
setDuplicatePage: (c) => t("duplicate", c),
|
|
151
|
-
setAddEditPage: (c) => t("edit", u || c),
|
|
152
|
-
setUnpublishPage: (c) => t("unpublish", c),
|
|
153
|
-
setDeletePage: (c) => t("delete", u || c),
|
|
154
|
-
setMarkAsTemplate: (c) => t("markAsTemplate", c),
|
|
155
|
-
setUnmarkAsTemplate: (c) => t("unmarkAsTemplate", c),
|
|
156
|
-
children: /* @__PURE__ */ s("div", { className: "m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white", children: /* @__PURE__ */ s($e, { className: "h-4 w-4", onClick: (c) => c.stopPropagation() }) })
|
|
157
|
-
}
|
|
158
|
-
) }) : y ? /* @__PURE__ */ s("span", { className: "duration absolute right-1.5 top-1/2 -translate-y-1/2 text-xs text-gray-500", children: /* @__PURE__ */ s(Me, { className: "h-3.5 w-3.5 fill-red-200 text-red-500" }) }) : null
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
),
|
|
162
|
-
/* @__PURE__ */ s(D, { children: y && /* @__PURE__ */ p("button", { className: "absolute right-0 top-0 flex h-full items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100", children: [
|
|
163
|
-
/* @__PURE__ */ s(je, { size: 12, className: "stroke-[3]" }),
|
|
164
|
-
" ",
|
|
165
|
-
/* @__PURE__ */ s("span", { className: "font-medium", children: y }),
|
|
166
|
-
" is editing this page"
|
|
167
|
-
] }) }),
|
|
168
|
-
/* @__PURE__ */ s(D, { children: !A && !e.isPartialGroup && !y && /* @__PURE__ */ p(
|
|
169
|
-
"button",
|
|
170
|
-
{
|
|
171
|
-
onClick: (c) => {
|
|
172
|
-
c.stopPropagation(), t("addLanguagePage", { language: o, page: e });
|
|
173
|
-
},
|
|
174
|
-
className: "absolute left-1/2 top-1 flex -translate-x-1/2 items-center gap-x-1 rounded bg-blue-500 px-2 py-0.5 text-xs text-white opacity-0 duration-200 hover:bg-blue-700 group-hover:opacity-100",
|
|
175
|
-
children: [
|
|
176
|
-
/* @__PURE__ */ s(ze, { size: 12, className: "stroke-[3]" }),
|
|
177
|
-
" ",
|
|
178
|
-
/* @__PURE__ */ p("span", { className: "text-[10px]", children: [
|
|
179
|
-
"Add ",
|
|
180
|
-
H(ge, o),
|
|
181
|
-
" Page"
|
|
182
|
-
] })
|
|
183
|
-
]
|
|
184
|
-
}
|
|
185
|
-
) })
|
|
186
|
-
] });
|
|
187
|
-
}, me = ({
|
|
188
|
-
pages: e,
|
|
189
|
-
tier: n,
|
|
190
|
-
pageTypes: r,
|
|
191
|
-
currentPage: t,
|
|
192
|
-
onClickAction: l,
|
|
193
|
-
languagePages: o,
|
|
194
|
-
selectedLanguage: b,
|
|
195
|
-
showUntranslatedPages: f
|
|
196
|
-
}) => {
|
|
197
|
-
const { expandedPages: x } = J();
|
|
198
|
-
return /* @__PURE__ */ s("div", { className: "space-y-0.5", style: { paddingLeft: `${n * 10}px` }, children: e.map((m) => /* @__PURE__ */ p(D, { children: [
|
|
199
|
-
/* @__PURE__ */ s(
|
|
200
|
-
qe,
|
|
201
|
-
{
|
|
202
|
-
page: m,
|
|
203
|
-
pageTypes: r,
|
|
204
|
-
currentPage: t,
|
|
205
|
-
onClickAction: l,
|
|
206
|
-
languagePages: o,
|
|
207
|
-
selectedLanguage: b,
|
|
208
|
-
showUntranslatedPages: f
|
|
209
|
-
}
|
|
210
|
-
),
|
|
211
|
-
m.children && m.children.length > 0 && (x == null ? void 0 : x.includes(m.id)) && /* @__PURE__ */ s(
|
|
212
|
-
me,
|
|
213
|
-
{
|
|
214
|
-
pages: m.children,
|
|
215
|
-
tier: n + 1,
|
|
216
|
-
pageTypes: r,
|
|
217
|
-
currentPage: t,
|
|
218
|
-
onClickAction: l,
|
|
219
|
-
languagePages: o,
|
|
220
|
-
selectedLanguage: b,
|
|
221
|
-
showUntranslatedPages: f
|
|
222
|
-
}
|
|
223
|
-
)
|
|
224
|
-
] }, m.id)) });
|
|
225
|
-
}, He = U(() => import("./page-manager-search-and-filter-sVnGlF46.js")), Qe = U(() => import("./add-new-page-BpvpSM4X.js")), Ve = U(() => import("./delete-page-CXRJjJ4o.js")), Je = U(() => import("./duplicate-page-CSQs2MOp.js")), Ke = U(() => import("./mark-as-template-CPEPYXg7.js")), Xe = U(() => import("./unmark-as-template-BjetSrYF.js")), Ye = U(() => import("./unpublish-page-BTPEVAkv.js")), ot = ({ close: e }) => {
|
|
226
|
-
const { languages: n, setSelectedLang: r } = re(), { data: t } = ke(), { data: l, isFetching: o } = Ne(), [b, f] = we(), { updateForSelectedPage: x, expandPagesOnSearch: m } = J(null), d = oe(), i = b.get("page"), [P, S] = N(""), [y, u] = N(null), [A, L] = N(null), [g, F] = N(null), [B, c] = N(null), [T, R] = N(""), [K, X] = N(null), [Y, Z] = N(null), [k, he] = N(d), [fe, xe] = N(!1), [, ee] = Ee(ve), I = fe && k !== d, { data: $, isFetching: Pe } = Se(k), te = ae(
|
|
227
|
-
(h) => {
|
|
228
|
-
var a;
|
|
229
|
-
return (a = j(t, { key: h })) == null ? void 0 : a.hasSlug;
|
|
230
|
-
},
|
|
231
|
-
[t]
|
|
232
|
-
), w = Q(() => l ? I ? z(l, (h) => !($ != null && $[h.id])) : Oe(l, P, T, te) : [], [l, te, P, T, $, I]);
|
|
233
|
-
M(() => {
|
|
234
|
-
r(d);
|
|
235
|
-
}, [d, r]), M(() => {
|
|
236
|
-
if (!v(T)) return;
|
|
237
|
-
const h = sessionStorage.getItem("pageTypeFilter") || "all";
|
|
238
|
-
!v(t) && h && (j(t, { key: h }) ? R(h) : R("all"));
|
|
239
|
-
}, [t, T]), M(() => {
|
|
240
|
-
if (i && !o && !j(l, { id: i })) {
|
|
241
|
-
const a = j(l, { slug: "/" });
|
|
242
|
-
if (a) {
|
|
243
|
-
const G = new URLSearchParams({ page: a.id });
|
|
244
|
-
q(G, f);
|
|
245
|
-
} else
|
|
246
|
-
q(new URLSearchParams({}), f, !0);
|
|
247
|
-
}
|
|
248
|
-
}, [l, i, o, f]), M(() => {
|
|
249
|
-
i && !o && !v(w) && x(w, i);
|
|
250
|
-
}, [i, o, w, x]), M(() => {
|
|
251
|
-
!v(P) && !v(w) && m(w);
|
|
252
|
-
}, [P, w, m]);
|
|
253
|
-
const { setSelectedLang: W } = re(), se = ae(
|
|
254
|
-
(h) => {
|
|
255
|
-
const a = new URLSearchParams({ page: h });
|
|
256
|
-
k !== d ? (a.set("lang", k), W(k)) : W(""), q(a, f), e();
|
|
257
|
-
},
|
|
258
|
-
[e, f, W, k, d]
|
|
259
|
-
), ne = (h, a) => {
|
|
260
|
-
var G;
|
|
261
|
-
if (a)
|
|
262
|
-
switch (h) {
|
|
263
|
-
case "add":
|
|
264
|
-
L(a);
|
|
265
|
-
break;
|
|
266
|
-
case "select":
|
|
267
|
-
se(a);
|
|
268
|
-
break;
|
|
269
|
-
case "edit":
|
|
270
|
-
k !== d ? ee({
|
|
271
|
-
edit: !0,
|
|
272
|
-
id: a == null ? void 0 : a.id,
|
|
273
|
-
primaryPage: a == null ? void 0 : a.primaryPage
|
|
274
|
-
}) : L(a);
|
|
275
|
-
break;
|
|
276
|
-
case "delete":
|
|
277
|
-
u(a);
|
|
278
|
-
break;
|
|
279
|
-
case "unpublish":
|
|
280
|
-
F(a);
|
|
281
|
-
break;
|
|
282
|
-
case "markAsTemplate":
|
|
283
|
-
c(a);
|
|
284
|
-
break;
|
|
285
|
-
case "unmarkAsTemplate":
|
|
286
|
-
Z(a);
|
|
287
|
-
break;
|
|
288
|
-
case "duplicate":
|
|
289
|
-
X(a);
|
|
290
|
-
break;
|
|
291
|
-
case "addLanguagePage":
|
|
292
|
-
ee({
|
|
293
|
-
edit: !1,
|
|
294
|
-
primaryPage: ((G = a == null ? void 0 : a.page) == null ? void 0 : G.id) || "",
|
|
295
|
-
preselectedLang: (a == null ? void 0 : a.language) || k
|
|
296
|
-
});
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
return /* @__PURE__ */ p(D, { children: [
|
|
301
|
-
/* @__PURE__ */ p("div", { className: "flex h-full flex-col justify-between", children: [
|
|
302
|
-
/* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(
|
|
303
|
-
He,
|
|
304
|
-
{
|
|
305
|
-
pages: w,
|
|
306
|
-
search: P,
|
|
307
|
-
setSearch: S,
|
|
308
|
-
languages: [d, ...n],
|
|
309
|
-
selectedLanguage: k,
|
|
310
|
-
setSelectedLanguage: he,
|
|
311
|
-
selectedPageType: T,
|
|
312
|
-
setSelectedPageType: R,
|
|
313
|
-
onAddPage: (h) => ne("add", h),
|
|
314
|
-
showUntranslatedPages: I,
|
|
315
|
-
setShowUntranslatedPages: xe
|
|
316
|
-
}
|
|
317
|
-
) }),
|
|
318
|
-
/* @__PURE__ */ s("div", { className: "flex-1 overflow-y-auto px-4 pb-6 pt-2", children: o || Pe ? /* @__PURE__ */ s("div", { className: "space-y-2", children: Ce([...Array(15).keys()], (h) => /* @__PURE__ */ s("div", { className: "h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200" }, h)) }) : v(w) ? /* @__PURE__ */ p("div", { className: "flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500", children: [
|
|
319
|
-
/* @__PURE__ */ s(de, { className: "h-6 w-6 stroke-[1]" }),
|
|
320
|
-
"Empty List!",
|
|
321
|
-
/* @__PURE__ */ s("span", { className: "font-light", children: "Add new page to start" })
|
|
322
|
-
] }) : /* @__PURE__ */ s(
|
|
323
|
-
me,
|
|
324
|
-
{
|
|
325
|
-
tier: 0,
|
|
326
|
-
pages: w,
|
|
327
|
-
pageTypes: t,
|
|
328
|
-
currentPage: i || "",
|
|
329
|
-
onClickAction: ne,
|
|
330
|
-
languagePages: $,
|
|
331
|
-
selectedLanguage: k,
|
|
332
|
-
showUntranslatedPages: I
|
|
333
|
-
}
|
|
334
|
-
) })
|
|
335
|
-
] }),
|
|
336
|
-
A && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(
|
|
337
|
-
Qe,
|
|
338
|
-
{
|
|
339
|
-
closePanel: e,
|
|
340
|
-
editPage: se,
|
|
341
|
-
addEditPage: A,
|
|
342
|
-
setAddEditPage: L
|
|
343
|
-
}
|
|
344
|
-
) }),
|
|
345
|
-
y && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Ve, { page: y, onClose: () => u(null) }) }),
|
|
346
|
-
g && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Ye, { page: g, onClose: () => F(null) }) }),
|
|
347
|
-
B && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Ke, { page: B, onClose: () => c(null) }) }),
|
|
348
|
-
Y && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Xe, { page: Y, onClose: () => Z(null) }) }),
|
|
349
|
-
K && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Je, { page: K, onClose: () => X(null), closePanel: e }) })
|
|
350
|
-
] });
|
|
351
|
-
};
|
|
352
|
-
export {
|
|
353
|
-
ot as default
|
|
354
|
-
};
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as r, Fragment as w } from "react/jsx-runtime";
|
|
2
|
-
import { f as P, L, h as F, A as I } from "./index-BuXZJnGo.js";
|
|
3
|
-
import { u as z } from "./use-page-expand-manager-D6T75I11.js";
|
|
4
|
-
import { Button as m, Tooltip as f, TooltipTrigger as v, TooltipContent as g, Select as j, SelectTrigger as $, SelectContent as G, Input as S, SelectItem as b } from "@chaibuilder/sdk/ui";
|
|
5
|
-
import { useQueryClient as T } from "@tanstack/react-query";
|
|
6
|
-
import { isEmpty as y, filter as u, map as C, get as o } from "lodash-es";
|
|
7
|
-
import { Star as D, Plus as M, FilterXIcon as R, Filter as W, ListFilter as q, Search as A, ChevronsUpDown as B, ChevronsDownUp as K, RefreshCw as Q } from "lucide-react";
|
|
8
|
-
import { useState as _ } from "react";
|
|
9
|
-
const O = ({ selectedPageType: a, setSelectedPageType: i }) => {
|
|
10
|
-
const [s, l] = _(""), { data: n } = F(), c = (t) => {
|
|
11
|
-
if (!s) return !0;
|
|
12
|
-
const d = s.toLowerCase(), h = (x) => String(o(t, x, "")).toLowerCase().includes(d);
|
|
13
|
-
return h("name") || h("key");
|
|
14
|
-
}, p = n.find((t) => t.key === a);
|
|
15
|
-
return /* @__PURE__ */ r(j, { onValueChange: i, value: a, children: [
|
|
16
|
-
/* @__PURE__ */ e(
|
|
17
|
-
$,
|
|
18
|
-
{
|
|
19
|
-
className: `${a === "all" ? "bg-gray-100/30 hover:bg-gray-100" : "gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,
|
|
20
|
-
children: /* @__PURE__ */ r("div", { className: "flex w-full items-center justify-between gap-x-1.5", children: [
|
|
21
|
-
/* @__PURE__ */ e("span", { className: "max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight", children: (p == null ? void 0 : p.name) || "All" }),
|
|
22
|
-
/* @__PURE__ */ e(
|
|
23
|
-
q,
|
|
24
|
-
{
|
|
25
|
-
className: `${a !== "all" ? "fill-sky-50 text-sky-500" : ""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`
|
|
26
|
-
}
|
|
27
|
-
)
|
|
28
|
-
] })
|
|
29
|
-
}
|
|
30
|
-
),
|
|
31
|
-
/* @__PURE__ */ r(G, { children: [
|
|
32
|
-
/* @__PURE__ */ e("div", { className: "sticky top-0 z-10 bg-white pb-2", children: /* @__PURE__ */ r("div", { className: "relative", children: [
|
|
33
|
-
/* @__PURE__ */ e(A, { strokeWidth: 2, className: "absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400" }),
|
|
34
|
-
/* @__PURE__ */ e(
|
|
35
|
-
S,
|
|
36
|
-
{
|
|
37
|
-
placeholder: "Search page types...",
|
|
38
|
-
className: "h-8 w-full rounded border pl-8 text-xs shadow-none",
|
|
39
|
-
value: s,
|
|
40
|
-
onChange: (t) => l(t.target.value),
|
|
41
|
-
onKeyDown: (t) => t.stopPropagation()
|
|
42
|
-
}
|
|
43
|
-
)
|
|
44
|
-
] }) }),
|
|
45
|
-
/* @__PURE__ */ e(b, { value: "all", children: "All" }),
|
|
46
|
-
!y(u(n, (t) => t.hasSlug && c(t))) && /* @__PURE__ */ r(w, { children: [
|
|
47
|
-
/* @__PURE__ */ e("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: "Pages" }),
|
|
48
|
-
C(
|
|
49
|
-
[...u(n, (t) => t.hasSlug && c(t))].sort(
|
|
50
|
-
(t, d) => o(t, "name", "").localeCompare(o(d, "name", ""))
|
|
51
|
-
),
|
|
52
|
-
(t) => /* @__PURE__ */ e(b, { value: o(t, "key"), children: o(t, "name") }, o(t, "key"))
|
|
53
|
-
)
|
|
54
|
-
] }),
|
|
55
|
-
!y(u(n, (t) => !t.hasSlug && c(t))) && /* @__PURE__ */ r(w, { children: [
|
|
56
|
-
/* @__PURE__ */ e("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: "Partials" }),
|
|
57
|
-
C(
|
|
58
|
-
[...u(n, (t) => !t.hasSlug && c(t))].sort(
|
|
59
|
-
(t, d) => o(t, "name", "").localeCompare(o(d, "name", ""))
|
|
60
|
-
),
|
|
61
|
-
(t) => /* @__PURE__ */ e(b, { value: o(t, "key"), children: o(t, "name") }, o(t, "key"))
|
|
62
|
-
)
|
|
63
|
-
] }),
|
|
64
|
-
y(u(n, c)) && /* @__PURE__ */ e("div", { className: "px-3 py-2 text-center text-sm text-gray-500", children: "No matching page types found" })
|
|
65
|
-
] })
|
|
66
|
-
] });
|
|
67
|
-
}, U = ({ search: a, setSearch: i }) => /* @__PURE__ */ r("div", { className: "relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5", children: [
|
|
68
|
-
/* @__PURE__ */ e("label", { htmlFor: "page-search-input", className: "sr-only", children: "Search Pages" }),
|
|
69
|
-
/* @__PURE__ */ e(
|
|
70
|
-
A,
|
|
71
|
-
{
|
|
72
|
-
className: `${a ? "fill-sky-50 text-sky-500" : ""} pointer-events-none h-4 w-4 text-muted-foreground`,
|
|
73
|
-
"aria-hidden": "true"
|
|
74
|
-
}
|
|
75
|
-
),
|
|
76
|
-
/* @__PURE__ */ e(
|
|
77
|
-
S,
|
|
78
|
-
{
|
|
79
|
-
id: "page-search-input",
|
|
80
|
-
placeholder: "Search pages",
|
|
81
|
-
value: a,
|
|
82
|
-
onChange: (s) => i(s.target.value),
|
|
83
|
-
className: "border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",
|
|
84
|
-
autoComplete: "off"
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
] }), V = ({ pages: a }) => {
|
|
88
|
-
const { expandAll: i, collapseAll: s, expandedPages: l } = z(null);
|
|
89
|
-
return /* @__PURE__ */ r("div", { className: "flex gap-1", children: [
|
|
90
|
-
/* @__PURE__ */ r(f, { children: [
|
|
91
|
-
/* @__PURE__ */ e(v, { asChild: !0, children: /* @__PURE__ */ e(m, { variant: "outline", size: "icon", onClick: () => i(a), className: "rounded p-1 text-gray-500", children: /* @__PURE__ */ e(B, {}) }) }),
|
|
92
|
-
/* @__PURE__ */ e(g, { children: "Expand All" })
|
|
93
|
-
] }),
|
|
94
|
-
/* @__PURE__ */ r(f, { children: [
|
|
95
|
-
/* @__PURE__ */ e(v, { asChild: !0, children: /* @__PURE__ */ e(
|
|
96
|
-
m,
|
|
97
|
-
{
|
|
98
|
-
disabled: l.length === 0,
|
|
99
|
-
variant: "outline",
|
|
100
|
-
size: "icon",
|
|
101
|
-
onClick: () => s(),
|
|
102
|
-
className: "rounded p-1 text-gray-500",
|
|
103
|
-
children: /* @__PURE__ */ e(K, {})
|
|
104
|
-
}
|
|
105
|
-
) }),
|
|
106
|
-
/* @__PURE__ */ e(g, { children: "Collapse All" })
|
|
107
|
-
] })
|
|
108
|
-
] });
|
|
109
|
-
}, X = ({ languages: a, selectedLanguage: i, setSelectedLanguage: s }) => {
|
|
110
|
-
const l = P();
|
|
111
|
-
return /* @__PURE__ */ e("div", { className: "scrollbar-hide flex gap-1 overflow-x-auto pb-1", children: a.map((n) => /* @__PURE__ */ r(
|
|
112
|
-
m,
|
|
113
|
-
{
|
|
114
|
-
variant: i === n ? "default" : "outline",
|
|
115
|
-
size: "sm",
|
|
116
|
-
className: `h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${i === n ? "bg-black text-white hover:bg-black" : "text-gray-500"}`,
|
|
117
|
-
onClick: () => s(n.toLowerCase()),
|
|
118
|
-
children: [
|
|
119
|
-
n === l && /* @__PURE__ */ e(D, { size: 4, className: `p-0.5 ${i === l ? "fill-white" : "fill-black"}` }),
|
|
120
|
-
L[n] || ""
|
|
121
|
-
]
|
|
122
|
-
},
|
|
123
|
-
n
|
|
124
|
-
)) });
|
|
125
|
-
}, k = () => {
|
|
126
|
-
const a = T();
|
|
127
|
-
return /* @__PURE__ */ r(f, { children: [
|
|
128
|
-
/* @__PURE__ */ e(v, { asChild: !0, children: /* @__PURE__ */ e(
|
|
129
|
-
m,
|
|
130
|
-
{
|
|
131
|
-
size: "sm",
|
|
132
|
-
variant: "ghost",
|
|
133
|
-
onClick: () => a.invalidateQueries({ queryKey: [I.GET_WEBSITE_PAGES] }),
|
|
134
|
-
className: "mt-1 h-6 w-6",
|
|
135
|
-
children: /* @__PURE__ */ e(Q, {})
|
|
136
|
-
}
|
|
137
|
-
) }),
|
|
138
|
-
/* @__PURE__ */ e(g, { side: "bottom", children: "Refresh pages list" })
|
|
139
|
-
] });
|
|
140
|
-
}, le = ({
|
|
141
|
-
pages: a,
|
|
142
|
-
search: i,
|
|
143
|
-
setSearch: s,
|
|
144
|
-
languages: l,
|
|
145
|
-
onAddPage: n,
|
|
146
|
-
selectedLanguage: c,
|
|
147
|
-
setSelectedLanguage: p,
|
|
148
|
-
selectedPageType: t,
|
|
149
|
-
setSelectedPageType: d,
|
|
150
|
-
showUntranslatedPages: h,
|
|
151
|
-
setShowUntranslatedPages: x
|
|
152
|
-
}) => {
|
|
153
|
-
const N = l.length > 1;
|
|
154
|
-
return /* @__PURE__ */ r("div", { className: "space-y-3 border-b border-b-gray-200 px-4 pb-1", children: [
|
|
155
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-x-2", children: [
|
|
156
|
-
/* @__PURE__ */ e(O, { selectedPageType: t, setSelectedPageType: d }),
|
|
157
|
-
/* @__PURE__ */ e(U, { search: i, setSearch: s }),
|
|
158
|
-
/* @__PURE__ */ e(V, { pages: a }),
|
|
159
|
-
/* @__PURE__ */ r(m, { variant: "default", onClick: n, className: "rounded px-3 font-normal", children: [
|
|
160
|
-
/* @__PURE__ */ e(M, { strokeWidth: 2, className: "stroke-white stroke-[3]" }),
|
|
161
|
-
/* @__PURE__ */ e("span", { className: "font-normal text-white", children: "Add Page" })
|
|
162
|
-
] }),
|
|
163
|
-
!N && /* @__PURE__ */ e(k, {})
|
|
164
|
-
] }),
|
|
165
|
-
N ? /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2", children: [
|
|
166
|
-
/* @__PURE__ */ e(
|
|
167
|
-
X,
|
|
168
|
-
{
|
|
169
|
-
languages: l,
|
|
170
|
-
selectedLanguage: c,
|
|
171
|
-
setSelectedLanguage: (E) => {
|
|
172
|
-
p(E), x(h && (l == null ? void 0 : l[0]) !== c);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
),
|
|
176
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-x-2", children: [
|
|
177
|
-
(l == null ? void 0 : l[0]) !== c && /* @__PURE__ */ r(f, { children: [
|
|
178
|
-
/* @__PURE__ */ e(v, { asChild: !0, children: /* @__PURE__ */ e(
|
|
179
|
-
m,
|
|
180
|
-
{
|
|
181
|
-
variant: "ghost",
|
|
182
|
-
onClick: () => x(!h),
|
|
183
|
-
className: "h-6 rounded px-3 py-1 text-xs font-normal",
|
|
184
|
-
children: h ? /* @__PURE__ */ e(R, {}) : /* @__PURE__ */ e(W, {})
|
|
185
|
-
}
|
|
186
|
-
) }),
|
|
187
|
-
/* @__PURE__ */ e(g, { side: "bottom", children: "Toggle Untranslated Pages" })
|
|
188
|
-
] }),
|
|
189
|
-
/* @__PURE__ */ e(k, {})
|
|
190
|
-
] })
|
|
191
|
-
] }) : /* @__PURE__ */ e("div", { className: "flex items-center justify-between gap-2" })
|
|
192
|
-
] });
|
|
193
|
-
};
|
|
194
|
-
export {
|
|
195
|
-
X as LanguageSelector,
|
|
196
|
-
le as default
|
|
197
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-Cds1vIhw.cjs"),y=require("./use-page-expand-manager-2KjeYfVS.cjs"),s=require("@chaibuilder/sdk/ui"),b=require("@tanstack/react-query"),r=require("lodash-es"),c=require("lucide-react"),N=require("react"),w=({selectedPageType:n,setSelectedPageType:a})=>{const[o,l]=N.useState(""),{data:i}=m.usePageTypes(),d=t=>{if(!o)return!0;const x=o.toLowerCase(),h=p=>String(r.get(t,p,"")).toLowerCase().includes(x);return h("name")||h("key")},u=i.find(t=>t.key===n);return e.jsxs(s.Select,{onValueChange:a,value:n,children:[e.jsx(s.SelectTrigger,{className:`${n==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(u==null?void 0:u.name)||"All"}),e.jsx(c.ListFilter,{className:`${n!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(s.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(c.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(s.Input,{placeholder:"Search page types...",className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:o,onChange:t=>l(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(s.SelectItem,{value:"all",children:"All"}),!r.isEmpty(r.filter(i,t=>t.hasSlug&&d(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:"Pages"}),r.map([...r.filter(i,t=>t.hasSlug&&d(t))].sort((t,x)=>r.get(t,"name","").localeCompare(r.get(x,"name",""))),t=>e.jsx(s.SelectItem,{value:r.get(t,"key"),children:r.get(t,"name")},r.get(t,"key")))]}),!r.isEmpty(r.filter(i,t=>!t.hasSlug&&d(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:"Partials"}),r.map([...r.filter(i,t=>!t.hasSlug&&d(t))].sort((t,x)=>r.get(t,"name","").localeCompare(r.get(x,"name",""))),t=>e.jsx(s.SelectItem,{value:r.get(t,"key"),children:r.get(t,"name")},r.get(t,"key")))]}),r.isEmpty(r.filter(i,d))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:"No matching page types found"})]})]})},C=({search:n,setSearch:a})=>e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:"Search Pages"}),e.jsx(c.Search,{className:`${n?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(s.Input,{id:"page-search-input",placeholder:"Search pages",value:n,onChange:o=>a(o.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off"})]}),S=({pages:n})=>{const{expandAll:a,collapseAll:o,expandedPages:l}=y.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"outline",size:"icon",onClick:()=>a(n),className:"rounded p-1 text-gray-500",children:e.jsx(c.ChevronsUpDown,{})})}),e.jsx(s.TooltipContent,{children:"Expand All"})]}),e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{disabled:l.length===0,variant:"outline",size:"icon",onClick:()=>o(),className:"rounded p-1 text-gray-500",children:e.jsx(c.ChevronsDownUp,{})})}),e.jsx(s.TooltipContent,{children:"Collapse All"})]})]})},f=({languages:n,selectedLanguage:a,setSelectedLanguage:o})=>{const l=m.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:n.map(i=>e.jsxs(s.Button,{variant:a===i?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${a===i?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>o(i.toLowerCase()),children:[i===l&&e.jsx(c.Star,{size:4,className:`p-0.5 ${a===l?"fill-white":"fill-black"}`}),m.LANGUAGES[i]||""]},i))})},j=()=>{const n=b.useQueryClient();return e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:()=>n.invalidateQueries({queryKey:[m.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(c.RefreshCw,{})})}),e.jsx(s.TooltipContent,{side:"bottom",children:"Refresh pages list"})]})},k=({pages:n,search:a,setSearch:o,languages:l,onAddPage:i,selectedLanguage:d,setSelectedLanguage:u,selectedPageType:t,setSelectedPageType:x,showUntranslatedPages:h,setShowUntranslatedPages:p})=>{const g=l.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(w,{selectedPageType:t,setSelectedPageType:x}),e.jsx(C,{search:a,setSearch:o}),e.jsx(S,{pages:n}),e.jsxs(s.Button,{variant:"default",onClick:i,className:"rounded px-3 font-normal",children:[e.jsx(c.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:"Add Page"})]}),!g&&e.jsx(j,{})]}),g?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(f,{languages:l,selectedLanguage:d,setSelectedLanguage:v=>{u(v),p(h&&(l==null?void 0:l[0])!==d)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(l==null?void 0:l[0])!==d&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"ghost",onClick:()=>p(!h),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:h?e.jsx(c.FilterXIcon,{}):e.jsx(c.Filter,{})})}),e.jsx(s.TooltipContent,{side:"bottom",children:"Toggle Untranslated Pages"})]}),e.jsx(j,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=f;exports.default=k;
|