mario-core 2.0.107-release → 2.0.108-release
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/Dashboard-BoYmBZNH.js +1 -0
- package/dist/Dashboard-BohWITqY.mjs +206 -0
- package/dist/Dashboard-CNeLkxKn.mjs +206 -0
- package/dist/Dashboard-CdE8azYL.mjs +206 -0
- package/dist/Dashboard-J2_aB4nr.js +1 -0
- package/dist/Dashboard-UaTWEdw7.js +1 -0
- package/dist/EmailTemplateDetail-BUXh0rmo.mjs +443 -0
- package/dist/EmailTemplateDetail-BVvZIx3m.js +1 -0
- package/dist/EmailTemplateDetail-B__EDhB8.mjs +443 -0
- package/dist/EmailTemplateDetail-CCjCTnSu.js +1 -0
- package/dist/EmailTemplateDetail-CxZ-vu_-.js +1 -0
- package/dist/EmailTemplateDetail-Qhx-osUA.mjs +443 -0
- package/dist/EmailTemplateList-B8f6wVB3.js +1 -0
- package/dist/EmailTemplateList-CUCMBqBJ.js +1 -0
- package/dist/EmailTemplateList-CzfA-3kQ.mjs +170 -0
- package/dist/EmailTemplateList-DBKq5mG7.mjs +170 -0
- package/dist/EmailTemplateList-DEmHB3bi.mjs +170 -0
- package/dist/EmailTemplateList-uuxfqcEO.js +1 -0
- package/dist/GalleryList-Bgwjxzce.js +1 -0
- package/dist/GalleryList-Bi89gGR2.mjs +329 -0
- package/dist/GalleryList-Dlc2e9PL.mjs +329 -0
- package/dist/GalleryList-DnhQAwOw.js +1 -0
- package/dist/GalleryList-P4_Es_iv.mjs +329 -0
- package/dist/GalleryList-w-ECfc3W.js +1 -0
- package/dist/Login-BNjTZptP.js +1 -0
- package/dist/Login-BtTGTO_G.js +1 -0
- package/dist/Login-CPYV_-gQ.mjs +1697 -0
- package/dist/Login-CSmQdSBL.js +1 -0
- package/dist/Login-CbC6Q-Yk.mjs +1697 -0
- package/dist/Login-Dx5u6cvm.mjs +1697 -0
- package/dist/NotificationList-BChmo09j.js +2 -0
- package/dist/NotificationList-BOytZRAN.mjs +3982 -0
- package/dist/NotificationList-BafFtIAD.js +2 -0
- package/dist/NotificationList-Bvy5c_o1.mjs +3982 -0
- package/dist/NotificationList-CubwqBsm.mjs +3982 -0
- package/dist/NotificationList-KmXVzoAr.js +2 -0
- package/dist/SkillList-CFZ22qQ9.mjs +386 -0
- package/dist/SkillList-C_1JfxfB.js +1 -0
- package/dist/SkillList-DKcDkv94.js +1 -0
- package/dist/SkillList-DmC__72S.mjs +386 -0
- package/dist/SkillList-IVVDVSZy.js +1 -0
- package/dist/SkillList-jK0IHAIH.mjs +386 -0
- package/dist/TeacherSelector-BpES1FKj.js +1 -0
- package/dist/TeacherSelector-BuhI-rGs.mjs +30 -0
- package/dist/TeacherSelector-De6mBvx2.mjs +30 -0
- package/dist/TeacherSelector-HTemy-Ez.js +1 -0
- package/dist/TeacherSelector-fEPchTjh.js +1 -0
- package/dist/TeacherSelector-lR6Ch-At.mjs +30 -0
- package/dist/TheContent-BHBSuj40.mjs +38 -0
- package/dist/TheContent-C-xV_3xT.js +1 -0
- package/dist/TheContent-DEgi129y.js +1 -0
- package/dist/TheContent-Di5D7Gbr.mjs +38 -0
- package/dist/TheContent-GAKUlCji.mjs +38 -0
- package/dist/TheContent-ZKcVU5qk.js +1 -0
- package/dist/UserContainer--xRA0JQU.js +5 -0
- package/dist/UserContainer-B6yMu-I3.js +5 -0
- package/dist/UserContainer-CkZ53kH4.mjs +2902 -0
- package/dist/UserContainer-D3Xz2HUW.mjs +2902 -0
- package/dist/UserContainer-DSQ-U3F0.js +5 -0
- package/dist/UserContainer-Dyn6ibh1.mjs +2902 -0
- package/dist/UserDetail-7FH_HSWR.mjs +903 -0
- package/dist/UserDetail-BKnlgUEz.js +1 -0
- package/dist/UserDetail-DBpzl5fo.mjs +903 -0
- package/dist/UserDetail-DQOnt-wM.js +1 -0
- package/dist/UserDetail-fUJTkzDg.mjs +903 -0
- package/dist/UserDetail-oF6NNexq.js +1 -0
- package/dist/UserList-B50qyfjL.mjs +1261 -0
- package/dist/UserList-C2Aaq5z8.js +7 -0
- package/dist/UserList-Cenxl6uR.mjs +1261 -0
- package/dist/UserList-DhIaXh_s.mjs +1261 -0
- package/dist/UserList-EX5eXQba.js +7 -0
- package/dist/UserList-EcYGduyj.js +7 -0
- package/dist/constants--_acGsaz.js +1 -0
- package/dist/constants-B9hWa6_R.mjs +286 -0
- package/dist/constants-BjESNXd6.mjs +286 -0
- package/dist/constants-C5BtfcR2.js +1 -0
- package/dist/constants-C5WkZZdL.mjs +286 -0
- package/dist/constants-DsRvQ2-W.js +1 -0
- package/dist/index-BGTGhZlt.js +15 -0
- package/dist/index-CO_pMkbk.mjs +19148 -0
- package/dist/index-CVKal53K.mjs +19158 -0
- package/dist/index-D0HO9-Jy.js +15 -0
- package/dist/index-DaEyv-Te.mjs +19158 -0
- package/dist/index-txMWO23Z.js +15 -0
- package/dist/index.js +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/mailCategoryService-B2QTjf12.js +1 -0
- package/dist/mailCategoryService-BFfwPcnM.mjs +11 -0
- package/dist/mailCategoryService-Bnr7gh_G.js +1 -0
- package/dist/mailCategoryService-D00fI25v.js +1 -0
- package/dist/mailCategoryService-DprdWJcz.mjs +11 -0
- package/dist/mailCategoryService-RFcp_8SH.mjs +11 -0
- package/dist/userService-B50oEL_l.mjs +56 -0
- package/dist/userService-B_lNnb--.js +1 -0
- package/dist/userService-C4d9YEpa.js +1 -0
- package/dist/userService-CiQiZh4G.mjs +56 -0
- package/dist/userService-DTLWpqzW.js +1 -0
- package/dist/userService-fA4Xahnz.mjs +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { Row as k, Col as u, Input as R, Button as y, Label as g, Card as E, CardImg as S, CardBody as w, CardTitle as M, CardHeader as B, CardText as j } from "reactstrap";
|
|
3
|
+
import { useSelector as q } from "react-redux";
|
|
4
|
+
import { forwardRef as H, memo as v, useRef as U, useState as K } from "react";
|
|
5
|
+
import { a0 as W, E as L, ar as z, as as P, at as T, au as Q, av as J, aw as X, ax as C, h as Y, a2 as Z, $ as ee, ay as le, m as ae } from "./index-DaEyv-Te.mjs";
|
|
6
|
+
import { Formik as ne } from "formik";
|
|
7
|
+
import * as b from "yup";
|
|
8
|
+
import { useTranslation as A } from "react-i18next";
|
|
9
|
+
const re = b.object({
|
|
10
|
+
name: b.string().required("Name is required")
|
|
11
|
+
}), se = (l, n) => {
|
|
12
|
+
const { targetMedia: r, onConfirm: i } = l, a = r?.key ? "Update" : "Create", d = r?.key ? "Rename" : "Folder";
|
|
13
|
+
return /* @__PURE__ */ e(
|
|
14
|
+
ne,
|
|
15
|
+
{
|
|
16
|
+
initialValues: { name: r?.name },
|
|
17
|
+
enableReinitialize: !0,
|
|
18
|
+
validationSchema: re,
|
|
19
|
+
onSubmit: (o, m) => {
|
|
20
|
+
i && i(o), m.resetForm();
|
|
21
|
+
},
|
|
22
|
+
children: (o) => {
|
|
23
|
+
const {
|
|
24
|
+
values: m,
|
|
25
|
+
touched: I,
|
|
26
|
+
errors: p,
|
|
27
|
+
handleChange: D,
|
|
28
|
+
handleBlur: O,
|
|
29
|
+
handleSubmit: f
|
|
30
|
+
} = o;
|
|
31
|
+
return /* @__PURE__ */ e(
|
|
32
|
+
W,
|
|
33
|
+
{
|
|
34
|
+
header: d,
|
|
35
|
+
confirmText: a,
|
|
36
|
+
onConfirm: f,
|
|
37
|
+
ref: n,
|
|
38
|
+
children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ s(u, { md: 12, children: [
|
|
39
|
+
/* @__PURE__ */ e(
|
|
40
|
+
R,
|
|
41
|
+
{
|
|
42
|
+
name: "name",
|
|
43
|
+
placeholder: `Enter your ${r?.key ? "file" : "folder"} name`,
|
|
44
|
+
value: m.name,
|
|
45
|
+
onChange: D,
|
|
46
|
+
onBlur: O("question")
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
I.name && p.name && /* @__PURE__ */ e(
|
|
50
|
+
L,
|
|
51
|
+
{
|
|
52
|
+
text: p.name
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] }) })
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}, te = H(se), ie = ({
|
|
62
|
+
isLibrary: l,
|
|
63
|
+
step: n,
|
|
64
|
+
breadcumb: r,
|
|
65
|
+
currentPrefix: i,
|
|
66
|
+
targetMedia: a,
|
|
67
|
+
handleSelectFile: d,
|
|
68
|
+
handleCreateFolder: o,
|
|
69
|
+
handleRenameFile: m,
|
|
70
|
+
handleGoBack: I,
|
|
71
|
+
handleDownloadMedia: p,
|
|
72
|
+
handleDeleteMediaOrFolder: D,
|
|
73
|
+
showErrorAlert: O
|
|
74
|
+
}) => {
|
|
75
|
+
const f = U(null), x = U(null), { t: F } = A(), N = () => f?.current?.toggle();
|
|
76
|
+
return /* @__PURE__ */ s("div", { children: [
|
|
77
|
+
/* @__PURE__ */ s(k, { className: "p-2 pl-3", style: { gap: "8px" }, children: [
|
|
78
|
+
!!n && /* @__PURE__ */ s(
|
|
79
|
+
y,
|
|
80
|
+
{
|
|
81
|
+
className: "mr-2",
|
|
82
|
+
color: "secondary",
|
|
83
|
+
onClick: I,
|
|
84
|
+
style: { width: "auto", display: "flex", gap: "4px" },
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ e(z, {}),
|
|
87
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Go up" })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
a && !a.isFolder && /* @__PURE__ */ s(
|
|
92
|
+
y,
|
|
93
|
+
{
|
|
94
|
+
className: "mr-2",
|
|
95
|
+
color: "success",
|
|
96
|
+
onClick: p,
|
|
97
|
+
style: { width: "auto", display: "flex", gap: "4px" },
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ e(P, {}),
|
|
100
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Download" })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
a && !l && /* @__PURE__ */ s(
|
|
105
|
+
y,
|
|
106
|
+
{
|
|
107
|
+
className: "mr-2",
|
|
108
|
+
color: "danger",
|
|
109
|
+
onClick: D,
|
|
110
|
+
style: { width: "auto", display: "flex", gap: "4px" },
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ e(T, {}),
|
|
113
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Delete" })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
a && !l && !a.isFolder && /* @__PURE__ */ s(y, { className: "mr-2", color: "primary", onClick: N, style: { width: "auto", display: "flex", gap: "4px" }, children: [
|
|
118
|
+
/* @__PURE__ */ e(Q, {}),
|
|
119
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Rename" })
|
|
120
|
+
] }),
|
|
121
|
+
!a && !l && /* @__PURE__ */ s(y, { className: "mr-2", color: "success", onClick: N, style: { width: "auto", display: "flex", gap: "4px" }, children: [
|
|
122
|
+
/* @__PURE__ */ e(J, {}),
|
|
123
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: F("new_folder") })
|
|
124
|
+
] }),
|
|
125
|
+
!a && !l && /* @__PURE__ */ s(
|
|
126
|
+
y,
|
|
127
|
+
{
|
|
128
|
+
className: "mr-2",
|
|
129
|
+
color: "info",
|
|
130
|
+
onClick: () => x?.current?.click(),
|
|
131
|
+
style: { width: "auto", display: "flex", gap: "4px" },
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ e(X, {}),
|
|
134
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: F("upload") })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
r && /* @__PURE__ */ e(u, { className: "h-100 d-flex align-items-center", children: r })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ e(
|
|
141
|
+
te,
|
|
142
|
+
{
|
|
143
|
+
ref: f,
|
|
144
|
+
targetMedia: a,
|
|
145
|
+
onConfirm: async (h) => {
|
|
146
|
+
h.name != "" ? a && !a.isFolder ? (N(), await m(h.name)) : (N(), await o(i, h.name)) : O("Name can't be empty");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ e(
|
|
151
|
+
"input",
|
|
152
|
+
{
|
|
153
|
+
type: "file",
|
|
154
|
+
id: "customMediaUpload",
|
|
155
|
+
ref: x,
|
|
156
|
+
style: { display: "none" },
|
|
157
|
+
onChange: async (h) => {
|
|
158
|
+
const c = h?.target?.files[0];
|
|
159
|
+
c && await d({ key: i, file: c });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] });
|
|
164
|
+
}, oe = v(ie), _ = {
|
|
165
|
+
"media-wrapper": "_media-wrapper_1nc2k_6",
|
|
166
|
+
"media-image": "_media-image_1nc2k_11",
|
|
167
|
+
"media-image-selected": "_media-image-selected_1nc2k_17",
|
|
168
|
+
"media-title": "_media-title_1nc2k_21",
|
|
169
|
+
"filter-media-file": "_filter-media-file_1nc2k_30"
|
|
170
|
+
};
|
|
171
|
+
var t = /* @__PURE__ */ ((l) => (l[l.IMAGE = 0] = "IMAGE", l[l.VIDEO = 1] = "VIDEO", l[l.AUDIO = 2] = "AUDIO", l[l.DOC = 3] = "DOC", l[l.UNKNOW = 4] = "UNKNOW", l))(t || {});
|
|
172
|
+
const ce = ["png", "jpg", "jpeg", "gif"], de = ["mp4", "mp4v"], me = ["txt", "pdf", "doc", "docx", "xls", "csv"], he = ["wav", "mp3"], V = (l) => {
|
|
173
|
+
if (l) {
|
|
174
|
+
if (ce.includes(l)) return t.IMAGE;
|
|
175
|
+
if (de.includes(l)) return t.VIDEO;
|
|
176
|
+
if (me.includes(l)) return t.DOC;
|
|
177
|
+
if (he.includes(l)) return t.AUDIO;
|
|
178
|
+
}
|
|
179
|
+
return t.UNKNOW;
|
|
180
|
+
}, ue = (l) => {
|
|
181
|
+
if (l.isFolder) return C.FOLDER_IMAGE;
|
|
182
|
+
const n = V(l.extension);
|
|
183
|
+
return n === t.IMAGE ? C.PHOTO_IMAGE : n === t.VIDEO ? C.VIDEO_IMAGE : n === t.AUDIO ? C.AUDIO_IMAGE : n === t.DOC ? C.DOCS_IMAGE : C.UNKNOW_IMAGE;
|
|
184
|
+
}, pe = ({ media: l, isTarget: n }) => {
|
|
185
|
+
const r = ue(l);
|
|
186
|
+
return /* @__PURE__ */ s(E, { className: `${n ? _["media-image-selected"] : ""} border-0 `, children: [
|
|
187
|
+
/* @__PURE__ */ e(
|
|
188
|
+
S,
|
|
189
|
+
{
|
|
190
|
+
className: `${_["media-image"]} p-1`,
|
|
191
|
+
top: !0,
|
|
192
|
+
width: "90%",
|
|
193
|
+
src: Y(r),
|
|
194
|
+
alt: l.name
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ e(w, { className: "p-1", style: { height: 45 }, children: /* @__PURE__ */ e(M, { tag: "h6", className: _["media-title"], children: l.name }) })
|
|
198
|
+
] });
|
|
199
|
+
}, fe = v(pe), Ne = [
|
|
200
|
+
{ value: t.IMAGE, label: "images" },
|
|
201
|
+
{ value: t.AUDIO, label: "audios" },
|
|
202
|
+
{ value: t.DOC, label: "docs" },
|
|
203
|
+
{ value: t.VIDEO, label: "videos" }
|
|
204
|
+
], ye = ({
|
|
205
|
+
changeFilters: l
|
|
206
|
+
// filters
|
|
207
|
+
}) => {
|
|
208
|
+
const [n, r] = K(), { t: i } = A();
|
|
209
|
+
return /* @__PURE__ */ s(k, { className: `${_["filter-media-file"]}`, children: [
|
|
210
|
+
/* @__PURE__ */ e(u, { sm: 8, children: /* @__PURE__ */ e(
|
|
211
|
+
Z,
|
|
212
|
+
{
|
|
213
|
+
initValue: "",
|
|
214
|
+
onSearch: (a) => l({
|
|
215
|
+
searchString: a
|
|
216
|
+
}),
|
|
217
|
+
placeholder: i("type_something_to_search_by_file_name")
|
|
218
|
+
}
|
|
219
|
+
) }),
|
|
220
|
+
/* @__PURE__ */ e(u, { sm: 4, children: /* @__PURE__ */ e(
|
|
221
|
+
ee,
|
|
222
|
+
{
|
|
223
|
+
value: n,
|
|
224
|
+
isMulti: !0,
|
|
225
|
+
options: Ne.map((a) => ({ ...a, label: i(a.label) })),
|
|
226
|
+
onChange: (a) => {
|
|
227
|
+
r(a);
|
|
228
|
+
const d = a.map((o) => o.value);
|
|
229
|
+
l({ types: d });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
) })
|
|
233
|
+
] });
|
|
234
|
+
}, ge = ({ height: l, isLibrary: n }) => {
|
|
235
|
+
const {
|
|
236
|
+
filters: r,
|
|
237
|
+
mediaList: i,
|
|
238
|
+
targetMedia: a,
|
|
239
|
+
router: d,
|
|
240
|
+
breadcrumb: o,
|
|
241
|
+
changeFilters: m,
|
|
242
|
+
handleOpenFolder: I,
|
|
243
|
+
handleSelectMedia: p,
|
|
244
|
+
handleSelectFile: D,
|
|
245
|
+
handleCreateFolder: O,
|
|
246
|
+
handleRenameFile: f,
|
|
247
|
+
handleDownloadMedia: x,
|
|
248
|
+
handleDeleteMediaOrFolder: F,
|
|
249
|
+
handleGoBack: N,
|
|
250
|
+
showErrorAlert: G
|
|
251
|
+
} = le(n), h = () => i.map((c) => {
|
|
252
|
+
const $ = a?.key === c.key;
|
|
253
|
+
return /* @__PURE__ */ e(u, { className: "p-2", xs: "auto", children: /* @__PURE__ */ e(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
onDoubleClick: () => I(c),
|
|
257
|
+
onClick: () => p(c),
|
|
258
|
+
className: _["media-wrapper"],
|
|
259
|
+
children: /* @__PURE__ */ e(fe, { media: c, isTarget: $ })
|
|
260
|
+
}
|
|
261
|
+
) }, c.key);
|
|
262
|
+
});
|
|
263
|
+
return /* @__PURE__ */ s(E, { children: [
|
|
264
|
+
/* @__PURE__ */ s(B, { children: [
|
|
265
|
+
/* @__PURE__ */ e(ye, { changeFilters: m, filters: r }),
|
|
266
|
+
/* @__PURE__ */ e(
|
|
267
|
+
oe,
|
|
268
|
+
{
|
|
269
|
+
isLibrary: n,
|
|
270
|
+
step: d.step,
|
|
271
|
+
breadcumb: o,
|
|
272
|
+
currentPrefix: r.prefix || "",
|
|
273
|
+
targetMedia: a,
|
|
274
|
+
handleSelectFile: D,
|
|
275
|
+
handleCreateFolder: O,
|
|
276
|
+
handleRenameFile: f,
|
|
277
|
+
handleDownloadMedia: x,
|
|
278
|
+
handleDeleteMediaOrFolder: F,
|
|
279
|
+
handleGoBack: N,
|
|
280
|
+
showErrorAlert: G
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
] }),
|
|
284
|
+
/* @__PURE__ */ e(w, { style: { minHeight: l }, children: /* @__PURE__ */ e(k, { className: "p-1", children: h() }) })
|
|
285
|
+
] });
|
|
286
|
+
}, Ce = ({ targetMedia: l }) => {
|
|
287
|
+
if (!l || l?.isFolder) return /* @__PURE__ */ e("div", {});
|
|
288
|
+
const n = V(l.extension), r = ae(l.key || "");
|
|
289
|
+
return /* @__PURE__ */ s(E, { className: "position-sticky", children: [
|
|
290
|
+
/* @__PURE__ */ e(B, { children: l?.name || "Media name" }),
|
|
291
|
+
n === t.IMAGE && /* @__PURE__ */ e(S, { className: "p-2", src: r, loading: "lazy" }),
|
|
292
|
+
n === t.VIDEO && /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(
|
|
293
|
+
"video",
|
|
294
|
+
{
|
|
295
|
+
id: l.key,
|
|
296
|
+
width: "100%",
|
|
297
|
+
height: "100%",
|
|
298
|
+
controls: !0,
|
|
299
|
+
children: /* @__PURE__ */ e("source", { src: r })
|
|
300
|
+
}
|
|
301
|
+
) }),
|
|
302
|
+
n === t.AUDIO && /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("audio", { controls: !0, className: "w-100", children: /* @__PURE__ */ e("source", { src: r }) }) }),
|
|
303
|
+
/* @__PURE__ */ s(w, { children: [
|
|
304
|
+
/* @__PURE__ */ e(M, { tag: "h6", children: "General Info" }),
|
|
305
|
+
/* @__PURE__ */ s(j, { children: [
|
|
306
|
+
"File extension: ",
|
|
307
|
+
l.extension?.toUpperCase()
|
|
308
|
+
] })
|
|
309
|
+
] })
|
|
310
|
+
] });
|
|
311
|
+
}, Ie = v(Ce), De = "media_gallery", ve = ({ isLibrary: l }) => {
|
|
312
|
+
const n = q((i) => i.gallery.targetMedia), { t: r } = A();
|
|
313
|
+
return /* @__PURE__ */ s("div", { className: "fadeIn animated", children: [
|
|
314
|
+
!l && /* @__PURE__ */ e("h5", { className: "mb-2", children: r(De) }),
|
|
315
|
+
/* @__PURE__ */ s(k, { className: "mb-2", children: [
|
|
316
|
+
/* @__PURE__ */ e(u, { md: 8, children: /* @__PURE__ */ e(ge, { height: "100vh", isLibrary: l }) }),
|
|
317
|
+
/* @__PURE__ */ e(u, { md: 4, children: /* @__PURE__ */ e(
|
|
318
|
+
Ie,
|
|
319
|
+
{
|
|
320
|
+
targetMedia: n
|
|
321
|
+
},
|
|
322
|
+
n?.key
|
|
323
|
+
) })
|
|
324
|
+
] })
|
|
325
|
+
] });
|
|
326
|
+
};
|
|
327
|
+
export {
|
|
328
|
+
ve as default
|
|
329
|
+
};
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { Row as k, Col as u, Input as R, Button as y, Label as g, Card as E, CardImg as S, CardBody as w, CardTitle as M, CardHeader as B, CardText as j } from "reactstrap";
|
|
3
|
+
import { useSelector as q } from "react-redux";
|
|
4
|
+
import { forwardRef as H, memo as v, useRef as U, useState as K } from "react";
|
|
5
|
+
import { a0 as W, E as L, ar as z, as as P, at as T, au as Q, av as J, aw as X, ax as C, h as Y, a2 as Z, $ as ee, ay as le, m as ae } from "./index-CVKal53K.mjs";
|
|
6
|
+
import { Formik as ne } from "formik";
|
|
7
|
+
import * as b from "yup";
|
|
8
|
+
import { useTranslation as A } from "react-i18next";
|
|
9
|
+
const re = b.object({
|
|
10
|
+
name: b.string().required("Name is required")
|
|
11
|
+
}), se = (l, n) => {
|
|
12
|
+
const { targetMedia: r, onConfirm: i } = l, a = r?.key ? "Update" : "Create", d = r?.key ? "Rename" : "Folder";
|
|
13
|
+
return /* @__PURE__ */ e(
|
|
14
|
+
ne,
|
|
15
|
+
{
|
|
16
|
+
initialValues: { name: r?.name },
|
|
17
|
+
enableReinitialize: !0,
|
|
18
|
+
validationSchema: re,
|
|
19
|
+
onSubmit: (o, m) => {
|
|
20
|
+
i && i(o), m.resetForm();
|
|
21
|
+
},
|
|
22
|
+
children: (o) => {
|
|
23
|
+
const {
|
|
24
|
+
values: m,
|
|
25
|
+
touched: I,
|
|
26
|
+
errors: p,
|
|
27
|
+
handleChange: D,
|
|
28
|
+
handleBlur: O,
|
|
29
|
+
handleSubmit: f
|
|
30
|
+
} = o;
|
|
31
|
+
return /* @__PURE__ */ e(
|
|
32
|
+
W,
|
|
33
|
+
{
|
|
34
|
+
header: d,
|
|
35
|
+
confirmText: a,
|
|
36
|
+
onConfirm: f,
|
|
37
|
+
ref: n,
|
|
38
|
+
children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ s(u, { md: 12, children: [
|
|
39
|
+
/* @__PURE__ */ e(
|
|
40
|
+
R,
|
|
41
|
+
{
|
|
42
|
+
name: "name",
|
|
43
|
+
placeholder: `Enter your ${r?.key ? "file" : "folder"} name`,
|
|
44
|
+
value: m.name,
|
|
45
|
+
onChange: D,
|
|
46
|
+
onBlur: O("question")
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
I.name && p.name && /* @__PURE__ */ e(
|
|
50
|
+
L,
|
|
51
|
+
{
|
|
52
|
+
text: p.name
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] }) })
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}, te = H(se), ie = ({
|
|
62
|
+
isLibrary: l,
|
|
63
|
+
step: n,
|
|
64
|
+
breadcumb: r,
|
|
65
|
+
currentPrefix: i,
|
|
66
|
+
targetMedia: a,
|
|
67
|
+
handleSelectFile: d,
|
|
68
|
+
handleCreateFolder: o,
|
|
69
|
+
handleRenameFile: m,
|
|
70
|
+
handleGoBack: I,
|
|
71
|
+
handleDownloadMedia: p,
|
|
72
|
+
handleDeleteMediaOrFolder: D,
|
|
73
|
+
showErrorAlert: O
|
|
74
|
+
}) => {
|
|
75
|
+
const f = U(null), x = U(null), { t: F } = A(), N = () => f?.current?.toggle();
|
|
76
|
+
return /* @__PURE__ */ s("div", { children: [
|
|
77
|
+
/* @__PURE__ */ s(k, { className: "p-2 pl-3", style: { gap: "8px" }, children: [
|
|
78
|
+
!!n && /* @__PURE__ */ s(
|
|
79
|
+
y,
|
|
80
|
+
{
|
|
81
|
+
className: "mr-2",
|
|
82
|
+
color: "secondary",
|
|
83
|
+
onClick: I,
|
|
84
|
+
style: { width: "auto", display: "flex", gap: "4px" },
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ e(z, {}),
|
|
87
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Go up" })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
a && !a.isFolder && /* @__PURE__ */ s(
|
|
92
|
+
y,
|
|
93
|
+
{
|
|
94
|
+
className: "mr-2",
|
|
95
|
+
color: "success",
|
|
96
|
+
onClick: p,
|
|
97
|
+
style: { width: "auto", display: "flex", gap: "4px" },
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ e(P, {}),
|
|
100
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Download" })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
a && !l && /* @__PURE__ */ s(
|
|
105
|
+
y,
|
|
106
|
+
{
|
|
107
|
+
className: "mr-2",
|
|
108
|
+
color: "danger",
|
|
109
|
+
onClick: D,
|
|
110
|
+
style: { width: "auto", display: "flex", gap: "4px" },
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ e(T, {}),
|
|
113
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Delete" })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
a && !l && !a.isFolder && /* @__PURE__ */ s(y, { className: "mr-2", color: "primary", onClick: N, style: { width: "auto", display: "flex", gap: "4px" }, children: [
|
|
118
|
+
/* @__PURE__ */ e(Q, {}),
|
|
119
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Rename" })
|
|
120
|
+
] }),
|
|
121
|
+
!a && !l && /* @__PURE__ */ s(y, { className: "mr-2", color: "success", onClick: N, style: { width: "auto", display: "flex", gap: "4px" }, children: [
|
|
122
|
+
/* @__PURE__ */ e(J, {}),
|
|
123
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: F("new_folder") })
|
|
124
|
+
] }),
|
|
125
|
+
!a && !l && /* @__PURE__ */ s(
|
|
126
|
+
y,
|
|
127
|
+
{
|
|
128
|
+
className: "mr-2",
|
|
129
|
+
color: "info",
|
|
130
|
+
onClick: () => x?.current?.click(),
|
|
131
|
+
style: { width: "auto", display: "flex", gap: "4px" },
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ e(X, {}),
|
|
134
|
+
/* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: F("upload") })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
r && /* @__PURE__ */ e(u, { className: "h-100 d-flex align-items-center", children: r })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ e(
|
|
141
|
+
te,
|
|
142
|
+
{
|
|
143
|
+
ref: f,
|
|
144
|
+
targetMedia: a,
|
|
145
|
+
onConfirm: async (h) => {
|
|
146
|
+
h.name != "" ? a && !a.isFolder ? (N(), await m(h.name)) : (N(), await o(i, h.name)) : O("Name can't be empty");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ e(
|
|
151
|
+
"input",
|
|
152
|
+
{
|
|
153
|
+
type: "file",
|
|
154
|
+
id: "customMediaUpload",
|
|
155
|
+
ref: x,
|
|
156
|
+
style: { display: "none" },
|
|
157
|
+
onChange: async (h) => {
|
|
158
|
+
const c = h?.target?.files[0];
|
|
159
|
+
c && await d({ key: i, file: c });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] });
|
|
164
|
+
}, oe = v(ie), _ = {
|
|
165
|
+
"media-wrapper": "_media-wrapper_1nc2k_6",
|
|
166
|
+
"media-image": "_media-image_1nc2k_11",
|
|
167
|
+
"media-image-selected": "_media-image-selected_1nc2k_17",
|
|
168
|
+
"media-title": "_media-title_1nc2k_21",
|
|
169
|
+
"filter-media-file": "_filter-media-file_1nc2k_30"
|
|
170
|
+
};
|
|
171
|
+
var t = /* @__PURE__ */ ((l) => (l[l.IMAGE = 0] = "IMAGE", l[l.VIDEO = 1] = "VIDEO", l[l.AUDIO = 2] = "AUDIO", l[l.DOC = 3] = "DOC", l[l.UNKNOW = 4] = "UNKNOW", l))(t || {});
|
|
172
|
+
const ce = ["png", "jpg", "jpeg", "gif"], de = ["mp4", "mp4v"], me = ["txt", "pdf", "doc", "docx", "xls", "csv"], he = ["wav", "mp3"], V = (l) => {
|
|
173
|
+
if (l) {
|
|
174
|
+
if (ce.includes(l)) return t.IMAGE;
|
|
175
|
+
if (de.includes(l)) return t.VIDEO;
|
|
176
|
+
if (me.includes(l)) return t.DOC;
|
|
177
|
+
if (he.includes(l)) return t.AUDIO;
|
|
178
|
+
}
|
|
179
|
+
return t.UNKNOW;
|
|
180
|
+
}, ue = (l) => {
|
|
181
|
+
if (l.isFolder) return C.FOLDER_IMAGE;
|
|
182
|
+
const n = V(l.extension);
|
|
183
|
+
return n === t.IMAGE ? C.PHOTO_IMAGE : n === t.VIDEO ? C.VIDEO_IMAGE : n === t.AUDIO ? C.AUDIO_IMAGE : n === t.DOC ? C.DOCS_IMAGE : C.UNKNOW_IMAGE;
|
|
184
|
+
}, pe = ({ media: l, isTarget: n }) => {
|
|
185
|
+
const r = ue(l);
|
|
186
|
+
return /* @__PURE__ */ s(E, { className: `${n ? _["media-image-selected"] : ""} border-0 `, children: [
|
|
187
|
+
/* @__PURE__ */ e(
|
|
188
|
+
S,
|
|
189
|
+
{
|
|
190
|
+
className: `${_["media-image"]} p-1`,
|
|
191
|
+
top: !0,
|
|
192
|
+
width: "90%",
|
|
193
|
+
src: Y(r),
|
|
194
|
+
alt: l.name
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ e(w, { className: "p-1", style: { height: 45 }, children: /* @__PURE__ */ e(M, { tag: "h6", className: _["media-title"], children: l.name }) })
|
|
198
|
+
] });
|
|
199
|
+
}, fe = v(pe), Ne = [
|
|
200
|
+
{ value: t.IMAGE, label: "images" },
|
|
201
|
+
{ value: t.AUDIO, label: "audios" },
|
|
202
|
+
{ value: t.DOC, label: "docs" },
|
|
203
|
+
{ value: t.VIDEO, label: "videos" }
|
|
204
|
+
], ye = ({
|
|
205
|
+
changeFilters: l
|
|
206
|
+
// filters
|
|
207
|
+
}) => {
|
|
208
|
+
const [n, r] = K(), { t: i } = A();
|
|
209
|
+
return /* @__PURE__ */ s(k, { className: `${_["filter-media-file"]}`, children: [
|
|
210
|
+
/* @__PURE__ */ e(u, { sm: 8, children: /* @__PURE__ */ e(
|
|
211
|
+
Z,
|
|
212
|
+
{
|
|
213
|
+
initValue: "",
|
|
214
|
+
onSearch: (a) => l({
|
|
215
|
+
searchString: a
|
|
216
|
+
}),
|
|
217
|
+
placeholder: i("type_something_to_search_by_file_name")
|
|
218
|
+
}
|
|
219
|
+
) }),
|
|
220
|
+
/* @__PURE__ */ e(u, { sm: 4, children: /* @__PURE__ */ e(
|
|
221
|
+
ee,
|
|
222
|
+
{
|
|
223
|
+
value: n,
|
|
224
|
+
isMulti: !0,
|
|
225
|
+
options: Ne.map((a) => ({ ...a, label: i(a.label) })),
|
|
226
|
+
onChange: (a) => {
|
|
227
|
+
r(a);
|
|
228
|
+
const d = a.map((o) => o.value);
|
|
229
|
+
l({ types: d });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
) })
|
|
233
|
+
] });
|
|
234
|
+
}, ge = ({ height: l, isLibrary: n }) => {
|
|
235
|
+
const {
|
|
236
|
+
filters: r,
|
|
237
|
+
mediaList: i,
|
|
238
|
+
targetMedia: a,
|
|
239
|
+
router: d,
|
|
240
|
+
breadcrumb: o,
|
|
241
|
+
changeFilters: m,
|
|
242
|
+
handleOpenFolder: I,
|
|
243
|
+
handleSelectMedia: p,
|
|
244
|
+
handleSelectFile: D,
|
|
245
|
+
handleCreateFolder: O,
|
|
246
|
+
handleRenameFile: f,
|
|
247
|
+
handleDownloadMedia: x,
|
|
248
|
+
handleDeleteMediaOrFolder: F,
|
|
249
|
+
handleGoBack: N,
|
|
250
|
+
showErrorAlert: G
|
|
251
|
+
} = le(n), h = () => i.map((c) => {
|
|
252
|
+
const $ = a?.key === c.key;
|
|
253
|
+
return /* @__PURE__ */ e(u, { className: "p-2", xs: "auto", children: /* @__PURE__ */ e(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
onDoubleClick: () => I(c),
|
|
257
|
+
onClick: () => p(c),
|
|
258
|
+
className: _["media-wrapper"],
|
|
259
|
+
children: /* @__PURE__ */ e(fe, { media: c, isTarget: $ })
|
|
260
|
+
}
|
|
261
|
+
) }, c.key);
|
|
262
|
+
});
|
|
263
|
+
return /* @__PURE__ */ s(E, { children: [
|
|
264
|
+
/* @__PURE__ */ s(B, { children: [
|
|
265
|
+
/* @__PURE__ */ e(ye, { changeFilters: m, filters: r }),
|
|
266
|
+
/* @__PURE__ */ e(
|
|
267
|
+
oe,
|
|
268
|
+
{
|
|
269
|
+
isLibrary: n,
|
|
270
|
+
step: d.step,
|
|
271
|
+
breadcumb: o,
|
|
272
|
+
currentPrefix: r.prefix || "",
|
|
273
|
+
targetMedia: a,
|
|
274
|
+
handleSelectFile: D,
|
|
275
|
+
handleCreateFolder: O,
|
|
276
|
+
handleRenameFile: f,
|
|
277
|
+
handleDownloadMedia: x,
|
|
278
|
+
handleDeleteMediaOrFolder: F,
|
|
279
|
+
handleGoBack: N,
|
|
280
|
+
showErrorAlert: G
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
] }),
|
|
284
|
+
/* @__PURE__ */ e(w, { style: { minHeight: l }, children: /* @__PURE__ */ e(k, { className: "p-1", children: h() }) })
|
|
285
|
+
] });
|
|
286
|
+
}, Ce = ({ targetMedia: l }) => {
|
|
287
|
+
if (!l || l?.isFolder) return /* @__PURE__ */ e("div", {});
|
|
288
|
+
const n = V(l.extension), r = ae(l.key || "");
|
|
289
|
+
return /* @__PURE__ */ s(E, { className: "position-sticky", children: [
|
|
290
|
+
/* @__PURE__ */ e(B, { children: l?.name || "Media name" }),
|
|
291
|
+
n === t.IMAGE && /* @__PURE__ */ e(S, { className: "p-2", src: r, loading: "lazy" }),
|
|
292
|
+
n === t.VIDEO && /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(
|
|
293
|
+
"video",
|
|
294
|
+
{
|
|
295
|
+
id: l.key,
|
|
296
|
+
width: "100%",
|
|
297
|
+
height: "100%",
|
|
298
|
+
controls: !0,
|
|
299
|
+
children: /* @__PURE__ */ e("source", { src: r })
|
|
300
|
+
}
|
|
301
|
+
) }),
|
|
302
|
+
n === t.AUDIO && /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("audio", { controls: !0, className: "w-100", children: /* @__PURE__ */ e("source", { src: r }) }) }),
|
|
303
|
+
/* @__PURE__ */ s(w, { children: [
|
|
304
|
+
/* @__PURE__ */ e(M, { tag: "h6", children: "General Info" }),
|
|
305
|
+
/* @__PURE__ */ s(j, { children: [
|
|
306
|
+
"File extension: ",
|
|
307
|
+
l.extension?.toUpperCase()
|
|
308
|
+
] })
|
|
309
|
+
] })
|
|
310
|
+
] });
|
|
311
|
+
}, Ie = v(Ce), De = "media_gallery", ve = ({ isLibrary: l }) => {
|
|
312
|
+
const n = q((i) => i.gallery.targetMedia), { t: r } = A();
|
|
313
|
+
return /* @__PURE__ */ s("div", { className: "fadeIn animated", children: [
|
|
314
|
+
!l && /* @__PURE__ */ e("h5", { className: "mb-2", children: r(De) }),
|
|
315
|
+
/* @__PURE__ */ s(k, { className: "mb-2", children: [
|
|
316
|
+
/* @__PURE__ */ e(u, { md: 8, children: /* @__PURE__ */ e(ge, { height: "100vh", isLibrary: l }) }),
|
|
317
|
+
/* @__PURE__ */ e(u, { md: 4, children: /* @__PURE__ */ e(
|
|
318
|
+
Ie,
|
|
319
|
+
{
|
|
320
|
+
targetMedia: n
|
|
321
|
+
},
|
|
322
|
+
n?.key
|
|
323
|
+
) })
|
|
324
|
+
] })
|
|
325
|
+
] });
|
|
326
|
+
};
|
|
327
|
+
export {
|
|
328
|
+
ve as default
|
|
329
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("reactstrap"),F=require("react-redux"),x=require("react"),t=require("./index-D0HO9-Jy.js"),v=require("formik"),E=require("yup"),D=require("react-i18next");function A(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const a in s)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(n,a,i.get?i:{enumerable:!0,get:()=>s[a]})}}return n.default=s,Object.freeze(n)}const b=A(E),G=b.object({name:b.string().required("Name is required")}),U=(s,n)=>{const{targetMedia:a,onConfirm:i}=s,r=a?.key?"Update":"Create",m=a?.key?"Rename":"Folder";return e.jsx(v.Formik,{initialValues:{name:a?.name},enableReinitialize:!0,validationSchema:G,onSubmit:(c,u)=>{i&&i(c),u.resetForm()},children:c=>{const{values:u,touched:g,errors:p,handleChange:y,handleBlur:C,handleSubmit:j}=c;return e.jsx(t.CommonModal,{header:m,confirmText:r,onConfirm:j,ref:n,children:e.jsx(l.Row,{children:e.jsxs(l.Col,{md:12,children:[e.jsx(l.Input,{name:"name",placeholder:`Enter your ${a?.key?"file":"folder"} name`,value:u.name,onChange:y,onBlur:C("question")}),g.name&&p.name&&e.jsx(t.ErrorHandler,{text:p.name})]})})})}})},R=x.forwardRef(U),S=({isLibrary:s,step:n,breadcumb:a,currentPrefix:i,targetMedia:r,handleSelectFile:m,handleCreateFolder:c,handleRenameFile:u,handleGoBack:g,handleDownloadMedia:p,handleDeleteMediaOrFolder:y,showErrorAlert:C})=>{const j=x.useRef(null),I=x.useRef(null),{t:O}=D.useTranslation(),f=()=>j?.current?.toggle(),_=()=>e.jsxs(l.Row,{className:"p-2 pl-3",style:{gap:"8px"},children:[!!n&&e.jsxs(l.Button,{className:"mr-2",color:"secondary",onClick:g,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaArrowLeft,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Go up"})]}),r&&!r.isFolder&&e.jsxs(l.Button,{className:"mr-2",color:"success",onClick:p,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaDownload,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Download"})]}),r&&!s&&e.jsxs(l.Button,{className:"mr-2",color:"danger",onClick:y,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaTrash,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Delete"})]}),r&&!s&&!r.isFolder&&e.jsxs(l.Button,{className:"mr-2",color:"primary",onClick:f,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaEdit,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Rename"})]}),!r&&!s&&e.jsxs(l.Button,{className:"mr-2",color:"success",onClick:f,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaFolderPlus,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:O("new_folder")})]}),!r&&!s&&e.jsxs(l.Button,{className:"mr-2",color:"info",onClick:()=>I?.current?.click(),style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaFileUpload,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:O("upload")})]}),a&&e.jsx(l.Col,{className:"h-100 d-flex align-items-center",children:a})]});return e.jsxs("div",{children:[_(),e.jsx(R,{ref:j,targetMedia:r,onConfirm:async h=>{h.name!=""?r&&!r.isFolder?(f(),await u(h.name)):(f(),await c(i,h.name)):C("Name can't be empty")}}),e.jsx("input",{type:"file",id:"customMediaUpload",ref:I,style:{display:"none"},onChange:async h=>{const d=h?.target?.files[0];d&&await m({key:i,file:d})}})]})},B=x.memo(S),N={"media-wrapper":"_media-wrapper_1nc2k_6","media-image":"_media-image_1nc2k_11","media-image-selected":"_media-image-selected_1nc2k_17","media-title":"_media-title_1nc2k_21","filter-media-file":"_filter-media-file_1nc2k_30"};var o=(s=>(s[s.IMAGE=0]="IMAGE",s[s.VIDEO=1]="VIDEO",s[s.AUDIO=2]="AUDIO",s[s.DOC=3]="DOC",s[s.UNKNOW=4]="UNKNOW",s))(o||{});const q=["png","jpg","jpeg","gif"],M=["mp4","mp4v"],V=["txt","pdf","doc","docx","xls","csv"],L=["wav","mp3"],k=s=>{if(s){if(q.includes(s))return o.IMAGE;if(M.includes(s))return o.VIDEO;if(V.includes(s))return o.DOC;if(L.includes(s))return o.AUDIO}return o.UNKNOW},$=s=>{if(s.isFolder)return t.Images.FOLDER_IMAGE;const n=k(s.extension);return n===o.IMAGE?t.Images.PHOTO_IMAGE:n===o.VIDEO?t.Images.VIDEO_IMAGE:n===o.AUDIO?t.Images.AUDIO_IMAGE:n===o.DOC?t.Images.DOCS_IMAGE:t.Images.UNKNOW_IMAGE},T=({media:s,isTarget:n})=>{const a=$(s);return e.jsxs(l.Card,{className:`${n?N["media-image-selected"]:""} border-0 `,children:[e.jsx(l.CardImg,{className:`${N["media-image"]} p-1`,top:!0,width:"90%",src:t.getStaticFileUrl(a),alt:s.name}),e.jsx(l.CardBody,{className:"p-1",style:{height:45},children:e.jsx(l.CardTitle,{tag:"h6",className:N["media-title"],children:s.name})})]})},H=x.memo(T),P=[{value:o.IMAGE,label:"images"},{value:o.AUDIO,label:"audios"},{value:o.DOC,label:"docs"},{value:o.VIDEO,label:"videos"}],K=({changeFilters:s})=>{const[n,a]=x.useState(),{t:i}=D.useTranslation();return e.jsxs(l.Row,{className:`${N["filter-media-file"]}`,children:[e.jsx(l.Col,{sm:8,children:e.jsx(t.SearchBox,{initValue:"",onSearch:r=>s({searchString:r}),placeholder:i("type_something_to_search_by_file_name")})}),e.jsx(l.Col,{sm:4,children:e.jsx(t.CustomSelector,{value:n,isMulti:!0,options:P.map(r=>({...r,label:i(r.label)})),onChange:r=>{a(r);const m=r.map(c=>c.value);s({types:m})}})})]})},W=({height:s,isLibrary:n})=>{const{filters:a,mediaList:i,targetMedia:r,router:m,breadcrumb:c,changeFilters:u,handleOpenFolder:g,handleSelectMedia:p,handleSelectFile:y,handleCreateFolder:C,handleRenameFile:j,handleDownloadMedia:I,handleDeleteMediaOrFolder:O,handleGoBack:f,showErrorAlert:_}=t.useGalleryList(n),h=()=>i.map(d=>{const w=r?.key===d.key;return e.jsx(l.Col,{className:"p-2",xs:"auto",children:e.jsx("div",{onDoubleClick:()=>g(d),onClick:()=>p(d),className:N["media-wrapper"],children:e.jsx(H,{media:d,isTarget:w})})},d.key)});return e.jsxs(l.Card,{children:[e.jsxs(l.CardHeader,{children:[e.jsx(K,{changeFilters:u,filters:a}),e.jsx(B,{isLibrary:n,step:m.step,breadcumb:c,currentPrefix:a.prefix||"",targetMedia:r,handleSelectFile:y,handleCreateFolder:C,handleRenameFile:j,handleDownloadMedia:I,handleDeleteMediaOrFolder:O,handleGoBack:f,showErrorAlert:_})]}),e.jsx(l.CardBody,{style:{minHeight:s},children:e.jsx(l.Row,{className:"p-1",children:h()})})]})},z=({targetMedia:s})=>{if(!s||s?.isFolder)return e.jsx("div",{});const n=k(s.extension),a=t.getFileUrl(s.key||"");return e.jsxs(l.Card,{className:"position-sticky",children:[e.jsx(l.CardHeader,{children:s?.name||"Media name"}),n===o.IMAGE&&e.jsx(l.CardImg,{className:"p-2",src:a,loading:"lazy"}),n===o.VIDEO&&e.jsx("div",{className:"p-2",children:e.jsx("video",{id:s.key,width:"100%",height:"100%",controls:!0,children:e.jsx("source",{src:a})})}),n===o.AUDIO&&e.jsx("div",{className:"p-2",children:e.jsx("audio",{controls:!0,className:"w-100",children:e.jsx("source",{src:a})})}),e.jsxs(l.CardBody,{children:[e.jsx(l.CardTitle,{tag:"h6",children:"General Info"}),e.jsxs(l.CardText,{children:["File extension: ",s.extension?.toUpperCase()]})]})]})},Q=x.memo(z),J="media_gallery",X=({isLibrary:s})=>{const n=F.useSelector(i=>i.gallery.targetMedia),{t:a}=D.useTranslation();return e.jsxs("div",{className:"fadeIn animated",children:[!s&&e.jsx("h5",{className:"mb-2",children:a(J)}),e.jsxs(l.Row,{className:"mb-2",children:[e.jsx(l.Col,{md:8,children:e.jsx(W,{height:"100vh",isLibrary:s})}),e.jsx(l.Col,{md:4,children:e.jsx(Q,{targetMedia:n},n?.key)})]})]})};exports.default=X;
|