@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,146 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
-
import { n as A, h as P } from "./index-BuXZJnGo.js";
|
|
3
|
-
import { Dialog as z, DialogContent as E, DialogHeader as L, DialogTitle as S, DialogDescription as U, Label as b, Textarea as B, Input as R, Button as o, DialogFooter as j } from "@chaibuilder/sdk/ui";
|
|
4
|
-
import { startCase as w } from "lodash-es";
|
|
5
|
-
import { Tag as O, File as X, ImageIcon as _, X as H } from "lucide-react";
|
|
6
|
-
import { useState as c, useRef as K, useCallback as Z } from "react";
|
|
7
|
-
import { toast as y } from "sonner";
|
|
8
|
-
const $ = 1 * 1024 * 1024, ee = ({ page: r, onClose: d }) => {
|
|
9
|
-
const [f, m] = c(!1), [g, k] = c(""), [i, x] = c(""), [N, p] = c(!1), n = K(null), I = A(), { data: u } = P(), h = u == null ? void 0 : u.find((t) => t.key === r.pageType), C = (h == null ? void 0 : h.name) || w(r.pageType), T = Z((t) => {
|
|
10
|
-
var v;
|
|
11
|
-
const l = (v = t.target.files) == null ? void 0 : v[0];
|
|
12
|
-
if (l) {
|
|
13
|
-
if (l.size > $) {
|
|
14
|
-
y.error("File too large", {
|
|
15
|
-
description: `Maximum file size is 1MB. Selected file is ${(l.size / 1024).toFixed(2)}KB.`
|
|
16
|
-
}), n.current && (n.current.value = "");
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
p(!0);
|
|
21
|
-
const s = new FileReader();
|
|
22
|
-
s.onloadend = () => {
|
|
23
|
-
x(s.result), p(!1);
|
|
24
|
-
}, s.readAsDataURL(l);
|
|
25
|
-
} catch (s) {
|
|
26
|
-
console.error("Error reading file:", s), p(!1), y.error("Failed to process image", {
|
|
27
|
-
description: s instanceof Error ? s.message : "Unknown error"
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}, []), D = () => {
|
|
32
|
-
x(""), n.current && (n.current.value = "");
|
|
33
|
-
}, F = () => {
|
|
34
|
-
var t;
|
|
35
|
-
(t = n.current) == null || t.click();
|
|
36
|
-
}, M = () => {
|
|
37
|
-
m(!0), I.mutate(
|
|
38
|
-
{
|
|
39
|
-
page: r,
|
|
40
|
-
name: r.name,
|
|
41
|
-
description: g.trim() || void 0,
|
|
42
|
-
pageType: r.pageType,
|
|
43
|
-
...i ? { previewImage: i } : {}
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
onSuccess: () => {
|
|
47
|
-
m(!1), d();
|
|
48
|
-
},
|
|
49
|
-
onError: () => {
|
|
50
|
-
m(!1);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
return /* @__PURE__ */ e(z, { open: !0, onOpenChange: d, children: /* @__PURE__ */ a(E, { children: [
|
|
56
|
-
/* @__PURE__ */ a(L, { children: [
|
|
57
|
-
/* @__PURE__ */ e(S, { children: "Mark as template" }),
|
|
58
|
-
/* @__PURE__ */ a(U, { className: "space-y-1 py-4 text-xs text-slate-500", children: [
|
|
59
|
-
"Are you sure you want to mark this page as a template?",
|
|
60
|
-
/* @__PURE__ */ e("br", {}),
|
|
61
|
-
"Templates can be used to create new pages with the same content."
|
|
62
|
-
] })
|
|
63
|
-
] }),
|
|
64
|
-
/* @__PURE__ */ a("div", { className: "mb-4 space-y-4 text-xs", children: [
|
|
65
|
-
/* @__PURE__ */ a("div", { className: "space-y-3 rounded border bg-slate-50 p-4", children: [
|
|
66
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
67
|
-
/* @__PURE__ */ e(O, { className: "h-4 w-4 text-slate-500" }),
|
|
68
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500", children: "Page Name:" }),
|
|
69
|
-
/* @__PURE__ */ e("span", { className: "font-semibold", children: w(r.name) })
|
|
70
|
-
] }),
|
|
71
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
72
|
-
/* @__PURE__ */ e(X, { className: "h-4 w-4 text-slate-500" }),
|
|
73
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500", children: "Type:" }),
|
|
74
|
-
/* @__PURE__ */ e("span", { className: "font-semibold", children: C })
|
|
75
|
-
] })
|
|
76
|
-
] }),
|
|
77
|
-
/* @__PURE__ */ a("div", { children: [
|
|
78
|
-
/* @__PURE__ */ e(b, { htmlFor: "description", className: "text-xs font-medium", children: "Description (Optional)" }),
|
|
79
|
-
/* @__PURE__ */ e(
|
|
80
|
-
B,
|
|
81
|
-
{
|
|
82
|
-
id: "description",
|
|
83
|
-
placeholder: "Describe this template's purpose",
|
|
84
|
-
className: "mt-1 h-24 resize-none text-xs",
|
|
85
|
-
value: g,
|
|
86
|
-
onChange: (t) => k(t.target.value)
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
] }),
|
|
90
|
-
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
91
|
-
/* @__PURE__ */ e(b, { htmlFor: "previewImage", className: "text-xs font-medium", children: "Preview Image (Optional)" }),
|
|
92
|
-
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
93
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
94
|
-
/* @__PURE__ */ e(
|
|
95
|
-
R,
|
|
96
|
-
{
|
|
97
|
-
type: "file",
|
|
98
|
-
id: "previewImage",
|
|
99
|
-
ref: n,
|
|
100
|
-
onChange: T,
|
|
101
|
-
accept: "image/*",
|
|
102
|
-
className: "hidden"
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
/* @__PURE__ */ e(
|
|
106
|
-
o,
|
|
107
|
-
{
|
|
108
|
-
type: "button",
|
|
109
|
-
variant: "outline",
|
|
110
|
-
onClick: F,
|
|
111
|
-
disabled: N,
|
|
112
|
-
className: "w-full",
|
|
113
|
-
children: N ? /* @__PURE__ */ a("span", { className: "flex items-center gap-2", children: [
|
|
114
|
-
/* @__PURE__ */ e("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
115
|
-
"Uploading..."
|
|
116
|
-
] }) : /* @__PURE__ */ a("span", { className: "flex items-center gap-2", children: [
|
|
117
|
-
/* @__PURE__ */ e(_, { className: "h-4 w-4" }),
|
|
118
|
-
"Select image"
|
|
119
|
-
] })
|
|
120
|
-
}
|
|
121
|
-
),
|
|
122
|
-
i && /* @__PURE__ */ e(o, { type: "button", variant: "outline", size: "icon", onClick: D, children: /* @__PURE__ */ e(H, { className: "h-4 w-4" }) })
|
|
123
|
-
] }),
|
|
124
|
-
i && /* @__PURE__ */ e("div", { className: "aspect-video overflow-hidden rounded-md border", children: /* @__PURE__ */ e("img", { src: i, alt: "Preview", className: "h-full max-h-[200px] w-full object-contain" }) }),
|
|
125
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "max 1mb" })
|
|
126
|
-
] })
|
|
127
|
-
] })
|
|
128
|
-
] }),
|
|
129
|
-
/* @__PURE__ */ a(j, { className: f ? "pointer-events-none opacity-75" : "", children: [
|
|
130
|
-
/* @__PURE__ */ e(
|
|
131
|
-
o,
|
|
132
|
-
{
|
|
133
|
-
variant: "outline",
|
|
134
|
-
onClick: (t) => {
|
|
135
|
-
t.stopPropagation(), d();
|
|
136
|
-
},
|
|
137
|
-
children: "Cancel"
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
/* @__PURE__ */ e(o, { variant: "default", disabled: f, onClick: M, children: "Mark as template" })
|
|
141
|
-
] })
|
|
142
|
-
] }) });
|
|
143
|
-
};
|
|
144
|
-
export {
|
|
145
|
-
ee as default
|
|
146
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as a, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { i as m, j as h, L as u, B as w } from "./index-BuXZJnGo.js";
|
|
3
|
-
import { useLanguages as p } from "@chaibuilder/sdk";
|
|
4
|
-
import { Card as f, CardHeader as P, CardTitle as C, CardContent as S, CardFooter as L, Button as x } from "@chaibuilder/sdk/ui";
|
|
5
|
-
import { get as N } from "lodash-es";
|
|
6
|
-
import { LockIcon as v } from "lucide-react";
|
|
7
|
-
const k = () => {
|
|
8
|
-
const [o, c] = m(), r = o.get("lang"), l = h(r), { setSelectedLang: i } = p(), g = () => {
|
|
9
|
-
const t = new URLSearchParams(window.location.search);
|
|
10
|
-
t.delete("lang");
|
|
11
|
-
const s = t.toString(), d = `${window.location.pathname}${s ? `?${s}` : ""}`;
|
|
12
|
-
window.history.pushState({}, "", d), c(t), i(""), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
13
|
-
};
|
|
14
|
-
if (l) return null;
|
|
15
|
-
const e = N(u, r);
|
|
16
|
-
return /* @__PURE__ */ a(w, { children: /* @__PURE__ */ n(f, { className: "mx-auto w-full max-w-md", children: [
|
|
17
|
-
/* @__PURE__ */ a(P, { className: "space-y-1", children: /* @__PURE__ */ n(C, { className: "flex items-center gap-2 text-2xl", children: [
|
|
18
|
-
/* @__PURE__ */ a(v, { className: "h-6 w-6 text-yellow-500" }),
|
|
19
|
-
'Page missing for "',
|
|
20
|
-
e,
|
|
21
|
-
'" language.'
|
|
22
|
-
] }) }),
|
|
23
|
-
/* @__PURE__ */ a(S, { className: "grid gap-4", children: /* @__PURE__ */ n("div", { children: [
|
|
24
|
-
'Page is not available in the "',
|
|
25
|
-
e,
|
|
26
|
-
'" language. Either create the page in the "',
|
|
27
|
-
e,
|
|
28
|
-
'" language or switch to the base language.'
|
|
29
|
-
] }) }),
|
|
30
|
-
/* @__PURE__ */ a(L, { children: /* @__PURE__ */ a(x, { onClick: g, className: "w-full", variant: "destructive", children: "Switch to default language" }) })
|
|
31
|
-
] }) });
|
|
32
|
-
};
|
|
33
|
-
export {
|
|
34
|
-
k as default
|
|
35
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-Cds1vIhw.cjs"),h=require("@chaibuilder/sdk"),a=require("@chaibuilder/sdk/ui"),m=require("lodash-es"),w=require("lucide-react"),x=()=>{const[o,i]=t.useSearchParams(),r=o.get("lang"),l=t.useIsLanguagePageCreated(r),{setSelectedLang:g}=h.useLanguages(),u=()=>{const s=new URLSearchParams(window.location.search);s.delete("lang");const c=s.toString(),d=`${window.location.pathname}${c?`?${c}`:""}`;window.history.pushState({},"",d),i(s),g(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(l)return null;const n=m.get(t.LANGUAGES,r);return e.jsx(t.BlurContainer,{children:e.jsxs(a.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(a.CardHeader,{className:"space-y-1",children:e.jsxs(a.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(w.LockIcon,{className:"h-6 w-6 text-yellow-500"}),'Page missing for "',n,'" language.']})}),e.jsx(a.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:['Page is not available in the "',n,'" language. Either create the page in the "',n,'" language or switch to the base language.']})}),e.jsx(a.CardFooter,{children:e.jsx(a.Button,{onClick:u,className:"w-full",variant:"destructive",children:"Switch to default language"})})]})})};exports.default=x;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a, Fragment as l } from "react/jsx-runtime";
|
|
2
|
-
import { aj as N, ak as w, B as h } from "./index-BuXZJnGo.js";
|
|
3
|
-
import { Card as x, CardHeader as T, CardTitle as b, CardContent as v, CardFooter as y, Button as m } from "@chaibuilder/sdk/ui";
|
|
4
|
-
import { Loader as u, TableIcon as B, CheckCircle as q, Target as _, Edit as f, Check as j, X as A } from "lucide-react";
|
|
5
|
-
import { useState as I, useEffect as O } from "react";
|
|
6
|
-
const k = ({ userId: i }) => {
|
|
7
|
-
const { data: r } = N(i);
|
|
8
|
-
return (r == null ? void 0 : r.name) || "Unknown";
|
|
9
|
-
}, F = ({
|
|
10
|
-
isChecking: i,
|
|
11
|
-
lockingStatus: r,
|
|
12
|
-
onContinue: g
|
|
13
|
-
}) => {
|
|
14
|
-
const [d, o] = I(!1), s = r === "page_is_active_in_other_tab", n = (r == null ? void 0 : r.length) > 0, { pageLock: t, acceptTakeOver: c, rejectTakeOver: p } = w(), C = () => {
|
|
15
|
-
o(!0), n || s ? g() : c(), setTimeout(() => {
|
|
16
|
-
o(!1);
|
|
17
|
-
}, 3e3);
|
|
18
|
-
};
|
|
19
|
-
return O(() => {
|
|
20
|
-
(t == null ? void 0 : t.requestedBy) === "ANOTHER_TAB" && c();
|
|
21
|
-
}, [t, c]), (t == null ? void 0 : t.requestedBy) === "ANOTHER_TAB" ? null : i ? /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(u, { className: "h-5 w-5 animate-spin text-primary" }) }) : /* @__PURE__ */ e(h, { children: /* @__PURE__ */ a(x, { className: "mx-auto w-full max-w-md", children: [
|
|
22
|
-
/* @__PURE__ */ e(T, { className: "space-y-1", children: /* @__PURE__ */ a(b, { className: "flex items-center gap-2 text-xl font-medium", children: [
|
|
23
|
-
d ? /* @__PURE__ */ e(u, { className: "h-6 w-6 animate-spin text-gray-500" }) : s ? /* @__PURE__ */ e(B, { className: "h-6 w-6 text-green-500" }) : n ? /* @__PURE__ */ e(q, { className: "h-6 w-6 text-green-500" }) : /* @__PURE__ */ e(_, { className: "h-6 w-6 text-green-500" }),
|
|
24
|
-
s ? "Page is active in other tab" : n ? "You can edit the page now." : "Page take over request"
|
|
25
|
-
] }) }),
|
|
26
|
-
/* @__PURE__ */ e(v, { className: "grid gap-4", children: /* @__PURE__ */ e("div", { children: s ? /* @__PURE__ */ e("p", { children: 'You are already editing this page in another tab. To continue editing here, click on "Continue editing here".' }) : n ? /* @__PURE__ */ e("p", { children: "This page is released by other user you can continue editing now." }) : /* @__PURE__ */ a("p", { children: [
|
|
27
|
-
/* @__PURE__ */ a("b", { children: [
|
|
28
|
-
" ",
|
|
29
|
-
/* @__PURE__ */ e(k, { userId: t == null ? void 0 : t.requestedBy })
|
|
30
|
-
] }),
|
|
31
|
-
" ",
|
|
32
|
-
"has requested to take over this page.",
|
|
33
|
-
/* @__PURE__ */ e("br", {}),
|
|
34
|
-
" If you accept, your unsaved changes will be saved."
|
|
35
|
-
] }) }) }),
|
|
36
|
-
/* @__PURE__ */ a(y, { className: "flex items-center justify-end gap-2", children: [
|
|
37
|
-
/* @__PURE__ */ e(
|
|
38
|
-
m,
|
|
39
|
-
{
|
|
40
|
-
disabled: d,
|
|
41
|
-
onClick: C,
|
|
42
|
-
className: n ? "" : "bg-green-500 hover:bg-green-600",
|
|
43
|
-
children: s ? /* @__PURE__ */ a(l, { children: [
|
|
44
|
-
/* @__PURE__ */ e(f, { className: "h-5 w-5" }),
|
|
45
|
-
" Continue editing here"
|
|
46
|
-
] }) : n ? /* @__PURE__ */ a(l, { children: [
|
|
47
|
-
/* @__PURE__ */ e(f, { className: "h-5 w-5" }),
|
|
48
|
-
" Continue to edit"
|
|
49
|
-
] }) : /* @__PURE__ */ a(l, { children: [
|
|
50
|
-
/* @__PURE__ */ e(j, { className: "h-5 w-5" }),
|
|
51
|
-
" Accept"
|
|
52
|
-
] })
|
|
53
|
-
}
|
|
54
|
-
),
|
|
55
|
-
!n && /* @__PURE__ */ a(m, { variant: "outline", onClick: p, children: [
|
|
56
|
-
/* @__PURE__ */ e(A, { className: "h-5 w-5" }),
|
|
57
|
-
" Reject"
|
|
58
|
-
] })
|
|
59
|
-
] })
|
|
60
|
-
] }) });
|
|
61
|
-
};
|
|
62
|
-
export {
|
|
63
|
-
F as default
|
|
64
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-Cds1vIhw.cjs"),a=require("@chaibuilder/sdk/ui"),t=require("lucide-react"),h=require("react"),g=({userId:l})=>{const{data:n}=c.useChaiUserInfo(l);return(n==null?void 0:n.name)||"Unknown"},C=({isChecking:l,lockingStatus:n,onContinue:x})=>{const[o,u]=h.useState(!1),i=n==="page_is_active_in_other_tab",r=(n==null?void 0:n.length)>0,{pageLock:s,acceptTakeOver:d,rejectTakeOver:j}=c.usePageLockRequestTakeOver(),m=()=>{u(!0),r||i?x():d(),setTimeout(()=>{u(!1)},3e3)};return h.useEffect(()=>{(s==null?void 0:s.requestedBy)==="ANOTHER_TAB"&&d()},[s,d]),(s==null?void 0:s.requestedBy)==="ANOTHER_TAB"?null:l?e.jsx(c.BlurContainer,{children:e.jsx(t.Loader,{className:"h-5 w-5 animate-spin text-primary"})}):e.jsx(c.BlurContainer,{children:e.jsxs(a.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(a.CardHeader,{className:"space-y-1",children:e.jsxs(a.CardTitle,{className:"flex items-center gap-2 text-xl font-medium",children:[o?e.jsx(t.Loader,{className:"h-6 w-6 animate-spin text-gray-500"}):i?e.jsx(t.TableIcon,{className:"h-6 w-6 text-green-500"}):r?e.jsx(t.CheckCircle,{className:"h-6 w-6 text-green-500"}):e.jsx(t.Target,{className:"h-6 w-6 text-green-500"}),i?"Page is active in other tab":r?"You can edit the page now.":"Page take over request"]})}),e.jsx(a.CardContent,{className:"grid gap-4",children:e.jsx("div",{children:i?e.jsx("p",{children:'You are already editing this page in another tab. To continue editing here, click on "Continue editing here".'}):r?e.jsx("p",{children:"This page is released by other user you can continue editing now."}):e.jsxs("p",{children:[e.jsxs("b",{children:[" ",e.jsx(g,{userId:s==null?void 0:s.requestedBy})]})," ","has requested to take over this page.",e.jsx("br",{})," If you accept, your unsaved changes will be saved."]})})}),e.jsxs(a.CardFooter,{className:"flex items-center justify-end gap-2",children:[e.jsx(a.Button,{disabled:o,onClick:m,className:r?"":"bg-green-500 hover:bg-green-600",children:i?e.jsxs(e.Fragment,{children:[e.jsx(t.Edit,{className:"h-5 w-5"})," Continue editing here"]}):r?e.jsxs(e.Fragment,{children:[e.jsx(t.Edit,{className:"h-5 w-5"})," Continue to edit"]}):e.jsxs(e.Fragment,{children:[e.jsx(t.Check,{className:"h-5 w-5"})," Accept"]})}),!r&&e.jsxs(a.Button,{variant:"outline",onClick:j,children:[e.jsx(t.X,{className:"h-5 w-5"})," Reject"]})]})]})})};exports.default=C;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("@chaibuilder/sdk/ui"),m=require("date-fns"),r=require("lucide-react"),h=require("react"),j=require("./index-Cds1vIhw.cjs");function p({avatar:d,name:a,email:l,lastSaved:n,onTakeOver:u,isRequestRejected:c,isFetchingUserInfo:t}){const[i,o]=h.useState(!1),x=()=>{o(!0),setTimeout(()=>{o(!1)},15e3),u()};return e.jsx(j.BlurContainer,{children:e.jsxs(s.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(s.CardHeader,{className:"space-y-1",children:e.jsxs(s.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(r.LockKeyhole,{className:"h-8 w-8 rounded-md bg-sky-500/20 p-1.5 text-sky-500"}),"Page is locked for editing"]})}),e.jsx(s.CardContent,{className:"w-md grid w-full pt-2",children:e.jsxs("div",{children:[e.jsxs("div",{className:"relative mx-auto flex w-96 items-center space-x-4 rounded-md border border-green-500 px-2 pb-2 pt-4",children:[e.jsx("div",{className:"absolute -top-2.5 left-3 w-max rounded-full bg-green-500 px-3 py-1 text-xs font-medium leading-3 text-white",children:"Locked By"}),d&&!t?e.jsx("img",{src:d,alt:a,className:"h-14 w-14 rounded-full border border-gray-300"}):e.jsx(r.UserIcon,{className:"h-14 w-14 flex-shrink-0 rounded-full bg-gradient-to-br from-purple-400 to-pink-500 p-2 text-white"}),e.jsxs("div",{className:t?"space-y-1.5":"space-y-0",children:[t?e.jsx(s.Skeleton,{className:"h-4 w-40 rounded"}):e.jsx("span",{className:"truncate font-medium text-black",children:a}),l&&!t?e.jsx("p",{className:"truncate text-sm text-muted-foreground",children:l}):e.jsx(s.Skeleton,{className:"h-4 w-60 rounded"}),n&&!t?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Last saved:"," ",m.formatDistanceToNow(new Date(n),{addSuffix:!0})]}):e.jsx(s.Skeleton,{className:"h-4 w-40 rounded"})]})]}),e.jsx("div",{className:"mt-4 text-sm",children:e.jsxs("p",{className:"py-4 text-center text-gray-600",children:["This page is currently being edited by ",e.jsx("span",{className:"font-bold",children:a}),".",e.jsx("br",{}),e.jsx("br",{})," You can either wait until they finish editing or request to take over the page."]})}),c&&e.jsxs("div",{className:"mt-4 flex w-full items-center justify-center gap-x-2 rounded border border-red-500 bg-red-50 p-2 text-center font-medium text-red-500",children:[e.jsx(r.Info,{className:"h-5 w-5"})," Page take over request is rejected"]})]})}),e.jsx(s.CardFooter,{children:e.jsxs(s.Button,{disabled:i,onClick:x,className:"w-full",variant:"destructive",children:[e.jsx(r.KeyIcon,{className:"h-5 w-5"}),i?"Page take is requested.":c?"Request take over again":"Request take over"]})})]})})}exports.default=p;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import { Card as p, CardHeader as x, CardTitle as f, CardContent as h, Skeleton as d, CardFooter as N, Button as g } from "@chaibuilder/sdk/ui";
|
|
3
|
-
import { formatDistanceToNow as b } from "date-fns";
|
|
4
|
-
import { LockKeyhole as w, UserIcon as k, Info as y, KeyIcon as v } from "lucide-react";
|
|
5
|
-
import { useState as C } from "react";
|
|
6
|
-
import { B } from "./index-BuXZJnGo.js";
|
|
7
|
-
function K({
|
|
8
|
-
avatar: s,
|
|
9
|
-
name: a,
|
|
10
|
-
email: l,
|
|
11
|
-
lastSaved: o,
|
|
12
|
-
onTakeOver: m,
|
|
13
|
-
isRequestRejected: i,
|
|
14
|
-
isFetchingUserInfo: r
|
|
15
|
-
}) {
|
|
16
|
-
const [n, c] = C(!1), u = () => {
|
|
17
|
-
c(!0), setTimeout(() => {
|
|
18
|
-
c(!1);
|
|
19
|
-
}, 15e3), m();
|
|
20
|
-
};
|
|
21
|
-
return /* @__PURE__ */ e(B, { children: /* @__PURE__ */ t(p, { className: "mx-auto w-full max-w-md", children: [
|
|
22
|
-
/* @__PURE__ */ e(x, { className: "space-y-1", children: /* @__PURE__ */ t(f, { className: "flex items-center gap-2 text-xl", children: [
|
|
23
|
-
/* @__PURE__ */ e(w, { className: "h-8 w-8 rounded-md bg-sky-500/20 p-1.5 text-sky-500" }),
|
|
24
|
-
"Page is locked for editing"
|
|
25
|
-
] }) }),
|
|
26
|
-
/* @__PURE__ */ e(h, { className: "w-md grid w-full pt-2", children: /* @__PURE__ */ t("div", { children: [
|
|
27
|
-
/* @__PURE__ */ t("div", { className: "relative mx-auto flex w-96 items-center space-x-4 rounded-md border border-green-500 px-2 pb-2 pt-4", children: [
|
|
28
|
-
/* @__PURE__ */ e("div", { className: "absolute -top-2.5 left-3 w-max rounded-full bg-green-500 px-3 py-1 text-xs font-medium leading-3 text-white", children: "Locked By" }),
|
|
29
|
-
s && !r ? /* @__PURE__ */ e("img", { src: s, alt: a, className: "h-14 w-14 rounded-full border border-gray-300" }) : /* @__PURE__ */ e(k, { className: "h-14 w-14 flex-shrink-0 rounded-full bg-gradient-to-br from-purple-400 to-pink-500 p-2 text-white" }),
|
|
30
|
-
/* @__PURE__ */ t("div", { className: r ? "space-y-1.5" : "space-y-0", children: [
|
|
31
|
-
r ? /* @__PURE__ */ e(d, { className: "h-4 w-40 rounded" }) : /* @__PURE__ */ e("span", { className: "truncate font-medium text-black", children: a }),
|
|
32
|
-
l && !r ? /* @__PURE__ */ e("p", { className: "truncate text-sm text-muted-foreground", children: l }) : /* @__PURE__ */ e(d, { className: "h-4 w-60 rounded" }),
|
|
33
|
-
o && !r ? /* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: [
|
|
34
|
-
"Last saved:",
|
|
35
|
-
" ",
|
|
36
|
-
b(new Date(o), {
|
|
37
|
-
addSuffix: !0
|
|
38
|
-
})
|
|
39
|
-
] }) : /* @__PURE__ */ e(d, { className: "h-4 w-40 rounded" })
|
|
40
|
-
] })
|
|
41
|
-
] }),
|
|
42
|
-
/* @__PURE__ */ e("div", { className: "mt-4 text-sm", children: /* @__PURE__ */ t("p", { className: "py-4 text-center text-gray-600", children: [
|
|
43
|
-
"This page is currently being edited by ",
|
|
44
|
-
/* @__PURE__ */ e("span", { className: "font-bold", children: a }),
|
|
45
|
-
".",
|
|
46
|
-
/* @__PURE__ */ e("br", {}),
|
|
47
|
-
/* @__PURE__ */ e("br", {}),
|
|
48
|
-
" You can either wait until they finish editing or request to take over the page."
|
|
49
|
-
] }) }),
|
|
50
|
-
i && /* @__PURE__ */ t("div", { className: "mt-4 flex w-full items-center justify-center gap-x-2 rounded border border-red-500 bg-red-50 p-2 text-center font-medium text-red-500", children: [
|
|
51
|
-
/* @__PURE__ */ e(y, { className: "h-5 w-5" }),
|
|
52
|
-
" Page take over request is rejected"
|
|
53
|
-
] })
|
|
54
|
-
] }) }),
|
|
55
|
-
/* @__PURE__ */ e(N, { children: /* @__PURE__ */ t(g, { disabled: n, onClick: u, className: "w-full", variant: "destructive", children: [
|
|
56
|
-
/* @__PURE__ */ e(v, { className: "h-5 w-5" }),
|
|
57
|
-
n ? "Page take is requested." : i ? "Request take over again" : "Request take over"
|
|
58
|
-
] }) })
|
|
59
|
-
] }) });
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
K as default
|
|
63
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),x=require("./index-Cds1vIhw.cjs"),B=require("./use-page-expand-manager-2KjeYfVS.cjs"),n=require("lodash-es"),Q=require("@chaibuilder/sdk"),se=require("jotai"),v=require("lucide-react"),l=require("react"),V=(e,r)=>!e||!Array.isArray(e)?[]:n.isEmpty(r)?e:n.compact(n.filter(e,a=>{const t=n.toLower(r);return n.includes(n.toLower((a==null?void 0:a.name)||""),t)||n.includes(n.toLower((a==null?void 0:a.slug)||""),t)})),te=(e,r)=>{const a=new Set,t=n.keyBy(e,"id");return r.forEach(o=>{let c=o;for(;c.parent&&t[c.parent];)a.add(c.parent),c=t[c.parent]}),Array.from(a).map(o=>t[o])},$=(e,r,a)=>n.isEmpty(r)?e:e.map(t=>{if(!a(t.pageType))return{...t,shouldExpandOnSearch:!0,children:t.children?$(t.children,r,a):[]};const o=t.children&&t.children.some(c=>n.includes(n.toLower(c.name||""),n.toLower(r))||n.includes(n.toLower(c.slug||""),n.toLower(r)));return{...t,shouldExpandOnSearch:o,children:t.children?$(t.children,r,a):[]}}),ne=e=>{if(!e||!e.length)return[];const r={};e.forEach(t=>{r[t.id]={...t,children:[]}});const a=[];return Object.values(r).forEach(t=>{t.parent&&r[t.parent]?r[t.parent].children.push(t):a.push(t)}),a},J=e=>!e||!e.length?[]:[...e].sort((a,t)=>(a.name||"").localeCompare(t.name||"")).map(a=>({...a,children:a.children?J(a.children):[]})),re=(e,r,a,t)=>{if(!e||!e.length)return[];let o=e;if(a!=="all"&&(o=n.compact(n.filter(e,{pageType:a}))),n.isEmpty(r))o=V(o,r);else{const m=V(o,r),d=te(e,m);o=n.uniqBy([...m,...d],"id")}const c=J(ne(o)),b=$(c,r,t),y=n.filter(b,m=>t(m.pageType)).sort((m,d)=>(m.name||"").localeCompare(d.name||"")),p=n.filter(b,m=>!t(m.pageType));let f=[];if(a==="all"){const m=n.keyBy(p,"pageType");f=Object.values(n.mapValues(m,(d,j)=>({...d,id:j,name:n.startCase(j),isPartialGroup:!0,children:b.filter(N=>N.pageType===j)})))}else f=p.sort((m,d)=>(m.name||"").localeCompare(d.name||""));return[...y,...f]},ae=({page:e})=>{var t,o;const{isExpanded:r,toggleExpanded:a}=B.usePageExpandManager(e==null?void 0:e.id);return s.jsx("button",{onClick:c=>{c.stopPropagation(),a()},disabled:!((t=e==null?void 0:e.children)!=null&&t.length),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 ${(o=e==null?void 0:e.children)!=null&&o.length?"hover:text-blue-400":"opacity-0"}`,children:s.jsx(v.ChevronRight,{size:12,className:`stroke-[4] transition-transform duration-200 ${r?"rotate-90":""}`})})},le=({page:e,pageType:r})=>s.jsx("div",{className:"flex h-full items-center justify-center gap-x-1",children:e.dynamic?s.jsx(v.StarsIcon,{size:12,className:"text-yellow-400"}):r!=null&&r.icon?s.jsx("div",{className:"flex h-4 max-h-4 w-4 max-w-4 items-center justify-center stroke-[1] text-slate-500",dangerouslySetInnerHTML:{__html:r.icon}}):r!=null&&r.hasSlug?s.jsx(v.File,{size:12,className:"stroke-[1] text-slate-500"}):s.jsx(v.Globe,{size:12,className:"stroke-[1] text-slate-500"})}),ie=({isOnline:e})=>s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-300":"bg-gray-300"}`}),oe=({page:e,pageTypes:r,currentPage:a,onClickAction:t,languagePages:o,selectedLanguage:c,showUntranslatedPages:b})=>{const[y]=x.usePageUserMapping(),p=x.useFallbackLang(),f=a===e.id,m=!!e.isTemplate,d=l.useMemo(()=>n.find(r,{key:e.pageType}),[r,e.pageType]),j=y==null?void 0:y[e.id],{data:N}=x.useChaiUserInfo(j),g=N?N==null?void 0:N.name:null;let h=n.get(o,e==null?void 0:e.id);h=n.get(h,"lang")===c?h:null;const E=c===p||!!h,L=(h==null?void 0:h.name)||(e==null?void 0:e.name)||"No name";let S=(h==null?void 0:h.slug)||(e==null?void 0:e.slug)||"";const C=S+(e!=null&&e.dynamic?`/${d==null?void 0:d.dynamicSlug}`:"")+(e!=null&&e.dynamicSlugCustom?`${e.dynamicSlugCustom}`:"");if(S.startsWith("/")&&!b){const u=S.split("/").pop();S=S.endsWith(u)&&e.dynamic?"":`/${u}`}const q=l.useMemo(()=>{const u="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=`${f?"border-primary/30 bg-primary/5":"border-transparent hover:border-gray-200 hover:bg-gray-100"}`;return E?`${u} ${T} ${g?"opacity-60":""}`:`${u} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`},[E,f,g]);return s.jsxs("div",{className:"group relative",children:[s.jsxs("div",{onClick:()=>!e.isPartialGroup&&E&&t("select",e==null?void 0:e.id),className:q,children:[s.jsx(ae,{page:e}),!e.isPartialGroup&&s.jsx(ie,{isOnline:h?h.online:e.online}),s.jsx(le,{page:e,pageType:d}),s.jsx(x.Tooltip,{content:L,side:"top",showTooltip:L.length>35,children:s.jsx("span",{className:"max-w-[40%] truncate font-medium text-black",children:L})}),(S||e.dynamic)&&s.jsx(x.Tooltip,{content:C,side:"top",showTooltip:!0,children:s.jsxs("span",{className:"max-w-[40%] truncate font-mono text-xs text-muted-foreground",children:[S,e.dynamic&&(d==null?void 0:d.dynamicSlug)&&s.jsxs("span",{className:"text-xs text-gray-500",children:["/",d==null?void 0:d.dynamicSlug,e.dynamicSlugCustom]})]})}),m&&s.jsx(x.Tooltip,{content:"Template",side:"top",children:s.jsx("span",{className:"text-blue-500",children:s.jsx(v.NotepadText,{size:16})})}),!e.isPartialGroup&&E&&!g?s.jsx("div",{className:"duration absolute right-0.5 top-[3px]",children:s.jsx(x.PageActionsDropdown,{isLanguagePage:!!h,page:h||e,setDuplicatePage:u=>t("duplicate",u),setAddEditPage:u=>t("edit",h||u),setUnpublishPage:u=>t("unpublish",u),setDeletePage:u=>t("delete",h||u),setMarkAsTemplate:u=>t("markAsTemplate",u),setUnmarkAsTemplate:u=>t("unmarkAsTemplate",u),children:s.jsx("div",{className:"m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white",children:s.jsx(v.MoreHorizontal,{className:"h-4 w-4",onClick:u=>u.stopPropagation()})})})}):g?s.jsx("span",{className:"duration absolute right-1.5 top-1/2 -translate-y-1/2 text-xs text-gray-500",children:s.jsx(v.Lock,{className:"h-3.5 w-3.5 fill-red-200 text-red-500"})}):null]}),s.jsx(s.Fragment,{children:g&&s.jsxs("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:[s.jsx(v.Edit,{size:12,className:"stroke-[3]"})," ",s.jsx("span",{className:"font-medium",children:g})," is editing this page"]})}),s.jsx(s.Fragment,{children:!E&&!e.isPartialGroup&&!g&&s.jsxs("button",{onClick:u=>{u.stopPropagation(),t("addLanguagePage",{language:c,page:e})},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",children:[s.jsx(v.Plus,{size:12,className:"stroke-[3]"})," ",s.jsxs("span",{className:"text-[10px]",children:["Add ",n.get(x.LANGUAGES,c)," Page"]})]})})]})},K=({pages:e,tier:r,pageTypes:a,currentPage:t,onClickAction:o,languagePages:c,selectedLanguage:b,showUntranslatedPages:y})=>{const{expandedPages:p}=B.usePageExpandManager();return s.jsx("div",{className:"space-y-0.5",style:{paddingLeft:`${r*10}px`},children:e.map(f=>s.jsxs(s.Fragment,{children:[s.jsx(oe,{page:f,pageTypes:a,currentPage:t,onClickAction:o,languagePages:c,selectedLanguage:b,showUntranslatedPages:y}),f.children&&f.children.length>0&&(p==null?void 0:p.includes(f.id))&&s.jsx(K,{pages:f.children,tier:r+1,pageTypes:a,currentPage:t,onClickAction:o,languagePages:c,selectedLanguage:b,showUntranslatedPages:y})]},f.id))})},ce=l.lazy(()=>Promise.resolve().then(()=>require("./page-manager-search-and-filter-z2b4sgvb.cjs"))),de=l.lazy(()=>Promise.resolve().then(()=>require("./add-new-page-YpzILOYq.cjs"))),ue=l.lazy(()=>Promise.resolve().then(()=>require("./delete-page-w64MO7db.cjs"))),me=l.lazy(()=>Promise.resolve().then(()=>require("./duplicate-page-DB_c7V2t.cjs"))),he=l.lazy(()=>Promise.resolve().then(()=>require("./mark-as-template-C4wH4UKf.cjs"))),xe=l.lazy(()=>Promise.resolve().then(()=>require("./unmark-as-template-C8hTjRVk.cjs"))),fe=l.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-gtGfNOAq.cjs"))),Pe=({close:e})=>{const{languages:r,setSelectedLang:a}=Q.useLanguages(),{data:t}=x.usePageTypes(),{data:o,isFetching:c}=x.useWebsitePages(),[b,y]=x.useSearchParams(),{updateForSelectedPage:p,expandPagesOnSearch:f}=B.usePageExpandManager(null),m=x.useFallbackLang(),d=b.get("page"),[j,N]=l.useState(""),[g,h]=l.useState(null),[E,L]=l.useState(null),[S,C]=l.useState(null),[q,u]=l.useState(null),[T,F]=l.useState(""),[I,G]=l.useState(null),[O,R]=l.useState(null),[k,X]=l.useState(m),[Y,Z]=l.useState(!1),[,D]=se.useAtom(x.addNewLangAtom),M=Y&&k!==m,{data:A,isFetching:ee}=x.useWebsiteLanguagePages(k),W=l.useCallback(P=>{var i;return(i=n.find(t,{key:P}))==null?void 0:i.hasSlug},[t]),w=l.useMemo(()=>o?M?n.filter(o,P=>!(A!=null&&A[P.id])):re(o,j,T,W):[],[o,W,j,T,A,M]);l.useEffect(()=>{a(m)},[m,a]),l.useEffect(()=>{if(!n.isEmpty(T))return;const P=sessionStorage.getItem("pageTypeFilter")||"all";!n.isEmpty(t)&&P&&(n.find(t,{key:P})?F(P):F("all"))},[t,T]),l.useEffect(()=>{if(d&&!c&&!n.find(o,{id:d})){const i=n.find(o,{slug:"/"});if(i){const z=new URLSearchParams({page:i.id});x.navigateToPage(z,y)}else x.navigateToPage(new URLSearchParams({}),y,!0)}},[o,d,c,y]),l.useEffect(()=>{d&&!c&&!n.isEmpty(w)&&p(w,d)},[d,c,w,p]),l.useEffect(()=>{!n.isEmpty(j)&&!n.isEmpty(w)&&f(w)},[j,w,f]);const{setSelectedLang:U}=Q.useLanguages(),_=l.useCallback(P=>{const i=new URLSearchParams({page:P});k!==m?(i.set("lang",k),U(k)):U(""),x.navigateToPage(i,y),e()},[e,y,U,k,m]),H=(P,i)=>{var z;if(i)switch(P){case"add":L(i);break;case"select":_(i);break;case"edit":k!==m?D({edit:!0,id:i==null?void 0:i.id,primaryPage:i==null?void 0:i.primaryPage}):L(i);break;case"delete":h(i);break;case"unpublish":C(i);break;case"markAsTemplate":u(i);break;case"unmarkAsTemplate":R(i);break;case"duplicate":G(i);break;case"addLanguagePage":D({edit:!1,primaryPage:((z=i==null?void 0:i.page)==null?void 0:z.id)||"",preselectedLang:(i==null?void 0:i.language)||k});break}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex h-full flex-col justify-between",children:[s.jsx(l.Suspense,{children:s.jsx(ce,{pages:w,search:j,setSearch:N,languages:[m,...r],selectedLanguage:k,setSelectedLanguage:X,selectedPageType:T,setSelectedPageType:F,onAddPage:P=>H("add",P),showUntranslatedPages:M,setShowUntranslatedPages:Z})}),s.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-6 pt-2",children:c||ee?s.jsx("div",{className:"space-y-2",children:n.map([...Array(15).keys()],P=>s.jsx("div",{className:"h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200"},P))}):n.isEmpty(w)?s.jsxs("div",{className:"flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500",children:[s.jsx(v.File,{className:"h-6 w-6 stroke-[1]"}),"Empty List!",s.jsx("span",{className:"font-light",children:"Add new page to start"})]}):s.jsx(K,{tier:0,pages:w,pageTypes:t,currentPage:d||"",onClickAction:H,languagePages:A,selectedLanguage:k,showUntranslatedPages:M})})]}),E&&s.jsx(l.Suspense,{children:s.jsx(de,{closePanel:e,editPage:_,addEditPage:E,setAddEditPage:L})}),g&&s.jsx(l.Suspense,{children:s.jsx(ue,{page:g,onClose:()=>h(null)})}),S&&s.jsx(l.Suspense,{children:s.jsx(fe,{page:S,onClose:()=>C(null)})}),q&&s.jsx(l.Suspense,{children:s.jsx(he,{page:q,onClose:()=>u(null)})}),O&&s.jsx(l.Suspense,{children:s.jsx(xe,{page:O,onClose:()=>R(null)})}),I&&s.jsx(l.Suspense,{children:s.jsx(me,{page:I,onClose:()=>G(null),closePanel:e})})]})};exports.default=Pe;
|