@chaibuilder/pages 0.4.8 → 0.4.9
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/{B4MFY5CR-BZLbrbU9.js → B4MFY5CR-C-y1qMcz.js} +1 -1
- package/dist/{B4MFY5CR-CrFfLRY2.cjs → B4MFY5CR-CZIhZc_v.cjs} +1 -1
- package/dist/{HO4MOOFI-DgTndXY6.js → HO4MOOFI-D1WZ0Hg3.js} +2 -2
- package/dist/{HO4MOOFI-CpUW02ii.cjs → HO4MOOFI-iH74XHta.cjs} +1 -1
- package/dist/{HUY7CZI3-COZlEkVr.cjs → HUY7CZI3-Bf9J-1mq.cjs} +1 -1
- package/dist/{HUY7CZI3-B-83eNUU.js → HUY7CZI3-DABOTt0o.js} +2 -2
- package/dist/{asset-metadata-editor-r5vYHUfm.js → asset-metadata-editor-CyTBhS-V.js} +9 -9
- package/dist/{asset-metadata-editor-zw9u1BB9.cjs → asset-metadata-editor-IRTgc3or.cjs} +1 -1
- package/dist/digital-asset-manager-CI-fxUjE.cjs +1 -0
- package/dist/{digital-asset-manager-cGBJUg2A.js → digital-asset-manager-ty2MhSyj.js} +188 -176
- package/dist/{image-editor-CwVua57o.js → image-editor-By8RDHso.js} +20 -20
- package/dist/{image-editor-D8wu5UNM.cjs → image-editor-DHmv5L8S.cjs} +1 -1
- package/dist/{index-CCLkatX6.js → index-B9yYtFHS.js} +3 -3
- package/dist/{index-B3cE059x.cjs → index-D6MzyrPC.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +6 -4
- package/dist/server.js +108 -90
- package/package.json +3 -3
- package/dist/digital-asset-manager-DZTV3jDX.cjs +0 -1
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { mergeClasses as
|
|
4
|
-
import { Tabs as
|
|
5
|
-
import { debounce as
|
|
6
|
-
import { Search as
|
|
7
|
-
import { useDropzone as
|
|
8
|
-
import { useQueryClient as
|
|
1
|
+
import { jsxs as t, Fragment as Q, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import J, { useState as S, useCallback as w, useMemo as de, useRef as ue, Suspense as $ } from "react";
|
|
3
|
+
import { mergeClasses as H } from "@chaibuilder/sdk";
|
|
4
|
+
import { Tabs as me, TabsList as he, TabsTrigger as V, Button as f, TabsContent as W, Input as ge, Card as pe, CardContent as fe, Dialog as ye, DialogContent as ve, DialogHeader as xe, DialogTitle as Ne, DialogDescription as we, DialogFooter as Ae } from "@chaibuilder/sdk/ui";
|
|
5
|
+
import { debounce as Se, find as be, pick as R, first as X, merge as Ce } from "lodash-es";
|
|
6
|
+
import { Search as Ee, Film as Te, ImageIcon as De, Edit as Pe, Trash2 as Ue, Loader2 as Z, Upload as Fe } from "lucide-react";
|
|
7
|
+
import { useDropzone as ze } from "react-dropzone";
|
|
8
|
+
import { useQueryClient as K, useMutation as G, useQuery as ke } from "@tanstack/react-query";
|
|
9
9
|
import { toast as b } from "sonner";
|
|
10
|
-
import { W as
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
return
|
|
10
|
+
import { W as F, X as z, Y as y, Z as k } from "./index-B9yYtFHS.js";
|
|
11
|
+
const Me = () => {
|
|
12
|
+
const a = F(), r = K(), o = z();
|
|
13
|
+
return G({
|
|
14
14
|
mutationFn: async ({
|
|
15
15
|
file: i,
|
|
16
|
-
folderId:
|
|
17
|
-
name:
|
|
18
|
-
}) => o(
|
|
16
|
+
folderId: u,
|
|
17
|
+
name: m
|
|
18
|
+
}) => o(a, {
|
|
19
19
|
action: y.UPLOAD_ASSET,
|
|
20
|
-
data: { file: i, folderId:
|
|
20
|
+
data: { file: i, folderId: u, name: m }
|
|
21
21
|
}),
|
|
22
22
|
onSuccess: () => {
|
|
23
23
|
r.invalidateQueries({
|
|
24
|
-
queryKey: [
|
|
24
|
+
queryKey: [k, y.GET_ASSETS]
|
|
25
25
|
}), b.success("Asset uploaded successfully");
|
|
26
26
|
},
|
|
27
27
|
onError: () => {
|
|
28
28
|
b.error("Failed to upload asset");
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
},
|
|
32
|
-
const
|
|
33
|
-
return
|
|
34
|
-
mutationFn: async (i) => o(
|
|
31
|
+
}, Ie = () => {
|
|
32
|
+
const a = F(), r = K(), o = z();
|
|
33
|
+
return G({
|
|
34
|
+
mutationFn: async (i) => o(a, {
|
|
35
35
|
action: y.DELETE_ASSET,
|
|
36
36
|
data: { id: i }
|
|
37
37
|
}),
|
|
38
38
|
onSuccess: () => {
|
|
39
39
|
r.invalidateQueries({
|
|
40
|
-
queryKey: [
|
|
40
|
+
queryKey: [k, y.GET_ASSETS]
|
|
41
41
|
}), b.success("Asset deleted successfully");
|
|
42
42
|
},
|
|
43
43
|
onError: () => {
|
|
44
44
|
b.error("Failed to delete asset");
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
},
|
|
48
|
-
const
|
|
49
|
-
return
|
|
50
|
-
mutationFn: async (i) => o(
|
|
47
|
+
}, qe = () => {
|
|
48
|
+
const a = F(), r = K(), o = z();
|
|
49
|
+
return G({
|
|
50
|
+
mutationFn: async (i) => o(a, {
|
|
51
51
|
action: y.UPDATE_ASSET,
|
|
52
52
|
data: i
|
|
53
53
|
}),
|
|
54
54
|
onSuccess: () => {
|
|
55
55
|
r.invalidateQueries({
|
|
56
|
-
queryKey: [
|
|
56
|
+
queryKey: [k, y.GET_ASSETS]
|
|
57
57
|
}), b.success("Asset updated successfully");
|
|
58
58
|
},
|
|
59
59
|
onError: () => {
|
|
60
60
|
b.error("Failed to update asset");
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
|
-
},
|
|
64
|
-
const r =
|
|
65
|
-
return
|
|
66
|
-
queryKey: [
|
|
67
|
-
queryFn: async () =>
|
|
63
|
+
}, je = (a = {}) => {
|
|
64
|
+
const r = F(), o = z(), { search: i, page: u = 1, limit: m = 10 } = a;
|
|
65
|
+
return ke({
|
|
66
|
+
queryKey: [k, y.GET_ASSETS, i, u, m],
|
|
67
|
+
queryFn: async () => await o(r, {
|
|
68
68
|
action: y.GET_ASSETS,
|
|
69
69
|
data: {
|
|
70
70
|
search: i,
|
|
71
|
-
page:
|
|
72
|
-
limit:
|
|
71
|
+
page: u,
|
|
72
|
+
limit: m
|
|
73
73
|
}
|
|
74
|
-
})
|
|
74
|
+
}),
|
|
75
75
|
retry: 1
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
|
-
function
|
|
79
|
-
const [r, o] = S([]), [i,
|
|
78
|
+
function _e() {
|
|
79
|
+
const [r, o] = S([]), [i, u] = S({
|
|
80
80
|
query: "",
|
|
81
81
|
page: 1,
|
|
82
82
|
pageSize: 10
|
|
83
|
-
}),
|
|
84
|
-
search: (
|
|
83
|
+
}), m = Se(() => i.query, 300)(), { data: n, isLoading: C } = je({
|
|
84
|
+
search: (m == null ? void 0 : m.toLowerCase().trim()) || "",
|
|
85
85
|
page: i.page,
|
|
86
86
|
limit: i.pageSize
|
|
87
|
-
}), v = n ? Math.ceil(n.total / n.pageSize) : 0, c = (n == null ? void 0 : n.page) || 1,
|
|
88
|
-
(
|
|
89
|
-
|
|
87
|
+
}), v = n ? Math.ceil(n.total / n.pageSize) : 0, c = (n == null ? void 0 : n.page) || 1, p = c < v, h = c > 1, { mutate: E, isPending: M } = qe(), { mutate: A, isPending: d } = Me(), { mutate: T, isPending: D } = Ie(), x = w(
|
|
88
|
+
(g) => {
|
|
89
|
+
g >= 1 && g <= v && u((N) => ({
|
|
90
90
|
...N,
|
|
91
|
-
page:
|
|
91
|
+
page: g
|
|
92
92
|
}));
|
|
93
93
|
},
|
|
94
94
|
[v]
|
|
95
|
-
),
|
|
96
|
-
|
|
97
|
-
}, [c,
|
|
98
|
-
|
|
99
|
-
}, [c,
|
|
100
|
-
|
|
95
|
+
), I = w(() => {
|
|
96
|
+
p && x(c + 1);
|
|
97
|
+
}, [c, p, x]), q = w(() => {
|
|
98
|
+
h && x(c - 1);
|
|
99
|
+
}, [c, h, x]), j = w((g) => {
|
|
100
|
+
u((N) => ({
|
|
101
101
|
...N,
|
|
102
|
-
query:
|
|
102
|
+
query: g,
|
|
103
103
|
page: 1
|
|
104
104
|
// Reset to first page on new search
|
|
105
105
|
}));
|
|
106
|
-
}, []), P =
|
|
107
|
-
(
|
|
108
|
-
o((N) =>
|
|
106
|
+
}, []), P = w(
|
|
107
|
+
(g) => {
|
|
108
|
+
o((N) => be(N, { id: g.id }) ? [] : [g]);
|
|
109
109
|
},
|
|
110
110
|
[!1]
|
|
111
|
-
), _ =
|
|
111
|
+
), _ = w(() => {
|
|
112
112
|
o([]);
|
|
113
113
|
}, []);
|
|
114
114
|
return {
|
|
@@ -118,111 +118,123 @@ function qe() {
|
|
|
118
118
|
assets: (n == null ? void 0 : n.assets) || [],
|
|
119
119
|
currentPage: c,
|
|
120
120
|
totalPages: v,
|
|
121
|
-
hasNextPage:
|
|
122
|
-
hasPreviousPage:
|
|
121
|
+
hasNextPage: p,
|
|
122
|
+
hasPreviousPage: h,
|
|
123
123
|
// Mutations
|
|
124
|
-
uploadAsset:
|
|
124
|
+
uploadAsset: A,
|
|
125
125
|
updateAsset: E,
|
|
126
126
|
deleteAsset: T,
|
|
127
127
|
goToPage: x,
|
|
128
|
-
nextPage:
|
|
128
|
+
nextPage: I,
|
|
129
129
|
previousPage: q,
|
|
130
130
|
updateSearchQuery: j,
|
|
131
131
|
clearSelectedAssets: _,
|
|
132
132
|
updateSelectedAssets: P,
|
|
133
133
|
// Loading
|
|
134
134
|
isLoadingAssets: C,
|
|
135
|
-
isUploadingAsset:
|
|
136
|
-
isUpdatingAsset:
|
|
135
|
+
isUploadingAsset: d,
|
|
136
|
+
isUpdatingAsset: M,
|
|
137
137
|
isDeletingAsset: D
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
const
|
|
141
|
-
function
|
|
142
|
-
close:
|
|
140
|
+
const Le = J.lazy(() => import("./asset-metadata-editor-CyTBhS-V.js")), Be = J.lazy(() => import("./image-editor-By8RDHso.js"));
|
|
141
|
+
function Je({
|
|
142
|
+
close: a,
|
|
143
143
|
onSelect: r,
|
|
144
144
|
mode: o = "image"
|
|
145
145
|
}) {
|
|
146
|
-
const
|
|
146
|
+
const u = de(() => [o], [o]), [m, n] = S("browse"), [C, v] = S(null), [c, p] = S(null), [h, E] = S({ show: !1, file: "" }), {
|
|
147
147
|
// Data
|
|
148
|
-
query:
|
|
149
|
-
assets:
|
|
150
|
-
selectedAssets:
|
|
148
|
+
query: M,
|
|
149
|
+
assets: A,
|
|
150
|
+
selectedAssets: d,
|
|
151
151
|
// Mutations
|
|
152
152
|
uploadAsset: T,
|
|
153
153
|
updateAsset: D,
|
|
154
154
|
deleteAsset: x,
|
|
155
|
-
updateSearchQuery:
|
|
155
|
+
updateSearchQuery: I,
|
|
156
156
|
clearSelectedAssets: q,
|
|
157
157
|
updateSelectedAssets: j,
|
|
158
158
|
// Loading
|
|
159
159
|
isLoadingAssets: P,
|
|
160
160
|
isUploadingAsset: _,
|
|
161
|
-
isUpdatingAsset:
|
|
161
|
+
isUpdatingAsset: g
|
|
162
162
|
// isDeletingAsset,
|
|
163
|
-
} =
|
|
163
|
+
} = _e(), N = ue(null), O = w(
|
|
164
164
|
async (s) => new Promise((l, L) => {
|
|
165
|
-
const
|
|
166
|
-
U.readAsDataURL(
|
|
167
|
-
const B = await T(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
const Y = s[0], U = new FileReader();
|
|
166
|
+
U.readAsDataURL(Y), U.onload = async () => {
|
|
167
|
+
const B = await T(
|
|
168
|
+
{
|
|
169
|
+
file: U.result,
|
|
170
|
+
folderId: null,
|
|
171
|
+
name: Y.name
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
onSuccess: () => {
|
|
175
|
+
n("browse");
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
l(B);
|
|
173
180
|
}, U.onerror = (B) => L(B);
|
|
174
181
|
}),
|
|
175
182
|
[T]
|
|
176
|
-
), { getRootProps:
|
|
177
|
-
onDrop:
|
|
183
|
+
), { getRootProps: ee, getInputProps: se, isDragActive: te } = ze({
|
|
184
|
+
onDrop: O,
|
|
178
185
|
accept: {
|
|
179
|
-
"image/*":
|
|
180
|
-
"video/*": d.includes("video") ? [] : []
|
|
186
|
+
"image/*": u.includes("image") ? [] : []
|
|
181
187
|
},
|
|
182
188
|
maxSize: 10 * 1024 * 1024
|
|
183
|
-
}),
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
|
|
189
|
+
}), ae = () => {
|
|
190
|
+
console.log(
|
|
191
|
+
"selectedAssets",
|
|
192
|
+
d,
|
|
193
|
+
R(X(d), ["url", "width", "height", "description"])
|
|
194
|
+
), d.length !== 0 && (r(
|
|
195
|
+
R(X(d), ["url", "width", "height", "description"])
|
|
196
|
+
), a());
|
|
197
|
+
}, le = async (s) => {
|
|
198
|
+
p(s);
|
|
199
|
+
}, ie = async () => {
|
|
200
|
+
c && (await x(c.id), p(null));
|
|
193
201
|
}, ne = (s) => {
|
|
194
|
-
|
|
202
|
+
v(s);
|
|
195
203
|
}, re = async (s, l) => {
|
|
204
|
+
await D(Ce(s, R(l, ["id", "description"]))), a();
|
|
205
|
+
}, oe = (s) => {
|
|
206
|
+
I(s.target.value);
|
|
207
|
+
}, ce = async (s, l) => {
|
|
196
208
|
try {
|
|
197
209
|
l ? await T({
|
|
198
210
|
file: s,
|
|
199
211
|
folderId: null,
|
|
200
|
-
name:
|
|
212
|
+
name: h.name || ""
|
|
201
213
|
}) : await D({
|
|
202
|
-
id:
|
|
214
|
+
id: h.id || "",
|
|
203
215
|
file: s
|
|
204
216
|
}), E({ show: !1, file: "" }), n("browse");
|
|
205
217
|
} catch (L) {
|
|
206
218
|
console.error("Error saving edited image:", L);
|
|
207
219
|
}
|
|
208
220
|
};
|
|
209
|
-
return /* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
221
|
+
return /* @__PURE__ */ t(Q, { children: [
|
|
222
|
+
/* @__PURE__ */ t("div", { className: "min-w-[700px] min-h-[600px] w-[900px] max-w-[900px]", children: [
|
|
211
223
|
/* @__PURE__ */ e("h1", { className: "text-lg font-medium pb-4", children: "Digital Asset Manager" }),
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
|
|
224
|
+
/* @__PURE__ */ t(
|
|
225
|
+
me,
|
|
214
226
|
{
|
|
215
|
-
value:
|
|
227
|
+
value: m,
|
|
216
228
|
onValueChange: (s) => n(s),
|
|
217
229
|
className: "flex-1 flex flex-col h-full",
|
|
218
230
|
children: [
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
-
/* @__PURE__ */ e(
|
|
222
|
-
/* @__PURE__ */ e(
|
|
231
|
+
/* @__PURE__ */ t("div", { className: "flex justify-between items-center mb-2", children: [
|
|
232
|
+
/* @__PURE__ */ t(he, { children: [
|
|
233
|
+
/* @__PURE__ */ e(V, { value: "browse", children: "Browse Assets" }),
|
|
234
|
+
/* @__PURE__ */ e(V, { value: "upload", children: "Upload" })
|
|
223
235
|
] }),
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
|
|
236
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
237
|
+
d.length > 0 && /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(
|
|
226
238
|
f,
|
|
227
239
|
{
|
|
228
240
|
variant: "outline",
|
|
@@ -236,27 +248,27 @@ function Xe({
|
|
|
236
248
|
f,
|
|
237
249
|
{
|
|
238
250
|
size: "sm",
|
|
239
|
-
onClick:
|
|
240
|
-
disabled:
|
|
251
|
+
onClick: ae,
|
|
252
|
+
disabled: d.length === 0,
|
|
241
253
|
children: "Select Asset"
|
|
242
254
|
}
|
|
243
255
|
)
|
|
244
256
|
] })
|
|
245
257
|
] }),
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */
|
|
248
|
-
/* @__PURE__ */ e(
|
|
258
|
+
/* @__PURE__ */ t(W, { value: "browse", className: "flex-1 flex flex-col", children: [
|
|
259
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ t("div", { className: "relative w-full", children: [
|
|
260
|
+
/* @__PURE__ */ e(Ee, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
249
261
|
/* @__PURE__ */ e(
|
|
250
|
-
|
|
262
|
+
ge,
|
|
251
263
|
{
|
|
252
264
|
placeholder: "Search assets...",
|
|
253
|
-
value:
|
|
254
|
-
onChange:
|
|
265
|
+
value: M,
|
|
266
|
+
onChange: oe,
|
|
255
267
|
className: "pl-8"
|
|
256
268
|
}
|
|
257
269
|
)
|
|
258
270
|
] }) }),
|
|
259
|
-
P &&
|
|
271
|
+
P && A.length === 0 ? /* @__PURE__ */ t("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1", children: [
|
|
260
272
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
261
273
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
262
274
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
@@ -267,37 +279,37 @@ function Xe({
|
|
|
267
279
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
268
280
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
269
281
|
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" })
|
|
270
|
-
] }) :
|
|
271
|
-
/* @__PURE__ */
|
|
282
|
+
] }) : A.length === 0 ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center text-center p-12 h-[380px]", children: [
|
|
283
|
+
/* @__PURE__ */ t("div", { className: "text-muted-foreground mb-2", children: [
|
|
272
284
|
/* @__PURE__ */ e("h3", { className: "text-gray-800 font-medium", children: "No assets to display" }),
|
|
273
285
|
/* @__PURE__ */ e("p", { className: "text-sm", children: "You haven't uploaded any assets yet. Start by uploading your first asset." })
|
|
274
286
|
] }),
|
|
275
287
|
/* @__PURE__ */ e("div", { className: "flex gap-2 pt-4", children: /* @__PURE__ */ e(f, { size: "lg", onClick: () => n("upload"), children: "Upload Assets" }) })
|
|
276
|
-
] }) : /* @__PURE__ */
|
|
288
|
+
] }) : /* @__PURE__ */ t(
|
|
277
289
|
"div",
|
|
278
290
|
{
|
|
279
291
|
ref: N,
|
|
280
292
|
className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",
|
|
281
293
|
children: [
|
|
282
|
-
|
|
283
|
-
|
|
294
|
+
A.map((s) => /* @__PURE__ */ e(
|
|
295
|
+
pe,
|
|
284
296
|
{
|
|
285
|
-
className:
|
|
297
|
+
className: H(
|
|
286
298
|
"cursor-pointer overflow-hidden transition-all",
|
|
287
|
-
|
|
299
|
+
d.some((l) => l.id === s.id) ? "ring-2 ring-primary" : "hover:ring-2 hover:ring-primary/20"
|
|
288
300
|
),
|
|
289
301
|
onClick: () => j(s),
|
|
290
|
-
children: /* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
302
|
+
children: /* @__PURE__ */ t(fe, { className: "p-0 relative group", children: [
|
|
303
|
+
/* @__PURE__ */ t("div", { className: "aspect-square relative overflow-hidden bg-muted", children: [
|
|
292
304
|
s.type === "image" ? /* @__PURE__ */ e(
|
|
293
305
|
"img",
|
|
294
306
|
{
|
|
295
307
|
src: s.thumbnailUrl || "/placeholder.svg",
|
|
296
308
|
alt: s.name,
|
|
297
|
-
className: "object-cover w-full h-full"
|
|
309
|
+
className: "object-cover w-full h-full min-h-[100px]"
|
|
298
310
|
}
|
|
299
|
-
) : /* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */ e(
|
|
311
|
+
) : /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-full", children: [
|
|
312
|
+
/* @__PURE__ */ e(Te, { className: "h-12 w-12 text-muted-foreground" }),
|
|
301
313
|
s.thumbnailUrl && /* @__PURE__ */ e(
|
|
302
314
|
"img",
|
|
303
315
|
{
|
|
@@ -307,7 +319,7 @@ function Xe({
|
|
|
307
319
|
}
|
|
308
320
|
)
|
|
309
321
|
] }),
|
|
310
|
-
/* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ t("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
|
|
311
323
|
/* @__PURE__ */ e(
|
|
312
324
|
f,
|
|
313
325
|
{
|
|
@@ -315,9 +327,9 @@ function Xe({
|
|
|
315
327
|
size: "icon",
|
|
316
328
|
className: "h-8 w-8",
|
|
317
329
|
onClick: (l) => {
|
|
318
|
-
l.stopPropagation(),
|
|
330
|
+
l.stopPropagation(), ne(s);
|
|
319
331
|
},
|
|
320
|
-
children: /* @__PURE__ */ e(
|
|
332
|
+
children: /* @__PURE__ */ e(De, { className: "h-4 w-4" })
|
|
321
333
|
}
|
|
322
334
|
),
|
|
323
335
|
/* @__PURE__ */ e(
|
|
@@ -334,7 +346,7 @@ function Xe({
|
|
|
334
346
|
name: s.name
|
|
335
347
|
});
|
|
336
348
|
},
|
|
337
|
-
children: /* @__PURE__ */ e(
|
|
349
|
+
children: /* @__PURE__ */ e(Pe, { className: "h-4 w-4" })
|
|
338
350
|
}
|
|
339
351
|
),
|
|
340
352
|
/* @__PURE__ */ e(
|
|
@@ -344,17 +356,17 @@ function Xe({
|
|
|
344
356
|
size: "icon",
|
|
345
357
|
className: "h-8 w-8",
|
|
346
358
|
onClick: (l) => {
|
|
347
|
-
l.stopPropagation(),
|
|
359
|
+
l.stopPropagation(), le(s);
|
|
348
360
|
},
|
|
349
|
-
children: /* @__PURE__ */ e(
|
|
361
|
+
children: /* @__PURE__ */ e(Ue, { className: "h-4 w-4" })
|
|
350
362
|
}
|
|
351
363
|
)
|
|
352
364
|
] }),
|
|
353
|
-
|
|
365
|
+
d.some((l) => l.id === s.id) && /* @__PURE__ */ e("div", { className: "absolute top-2 left-2", children: /* @__PURE__ */ e(
|
|
354
366
|
"input",
|
|
355
367
|
{
|
|
356
368
|
type: "checkbox",
|
|
357
|
-
checked:
|
|
369
|
+
checked: d.some(
|
|
358
370
|
(l) => l.id === s.id
|
|
359
371
|
),
|
|
360
372
|
readOnly: !0,
|
|
@@ -362,7 +374,7 @@ function Xe({
|
|
|
362
374
|
}
|
|
363
375
|
) })
|
|
364
376
|
] }),
|
|
365
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ t("div", { className: "p-2", children: [
|
|
366
378
|
/* @__PURE__ */ e(
|
|
367
379
|
"div",
|
|
368
380
|
{
|
|
@@ -371,44 +383,44 @@ function Xe({
|
|
|
371
383
|
children: s.name
|
|
372
384
|
}
|
|
373
385
|
),
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */ e("span", { children:
|
|
376
|
-
/* @__PURE__ */ e("span", { children:
|
|
386
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground flex items-center justify-between", children: [
|
|
387
|
+
/* @__PURE__ */ e("span", { children: Qe((s == null ? void 0 : s.size) || 0) }),
|
|
388
|
+
/* @__PURE__ */ e("span", { children: Re(s.createdAt) })
|
|
377
389
|
] })
|
|
378
390
|
] })
|
|
379
391
|
] })
|
|
380
392
|
},
|
|
381
393
|
s.id
|
|
382
394
|
)),
|
|
383
|
-
P &&
|
|
395
|
+
P && A.length > 0 && /* @__PURE__ */ e("div", { className: "col-span-full flex justify-center py-4", children: /* @__PURE__ */ e(Z, { className: "h-6 w-6 animate-spin text-muted-foreground" }) })
|
|
384
396
|
]
|
|
385
397
|
}
|
|
386
398
|
)
|
|
387
399
|
] }),
|
|
388
|
-
/* @__PURE__ */ e(
|
|
400
|
+
/* @__PURE__ */ e(W, { value: "upload", className: "flex-1 ", children: /* @__PURE__ */ t(
|
|
389
401
|
"div",
|
|
390
402
|
{
|
|
391
|
-
...
|
|
392
|
-
className:
|
|
403
|
+
...ee(),
|
|
404
|
+
className: H(
|
|
393
405
|
"border-2 border-dashed rounded-lg h-[380px] flex flex-col items-center justify-center text-center cursor-pointer hover:bg-gray-50",
|
|
394
|
-
|
|
406
|
+
te ? "border-primary bg-primary/5" : "border-muted-foreground/20"
|
|
395
407
|
),
|
|
396
408
|
children: [
|
|
397
|
-
/* @__PURE__ */ e("input", { ...
|
|
398
|
-
|
|
399
|
-
/* @__PURE__ */ e(
|
|
409
|
+
/* @__PURE__ */ e("input", { ...se() }),
|
|
410
|
+
g || _ ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center", children: [
|
|
411
|
+
/* @__PURE__ */ e(Z, { className: "h-12 w-12 text-primary animate-spin mb-4" }),
|
|
400
412
|
/* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Uploading files..." }),
|
|
401
413
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Please wait while your files are being processed." })
|
|
402
|
-
] }) : /* @__PURE__ */
|
|
403
|
-
/* @__PURE__ */ e(
|
|
414
|
+
] }) : /* @__PURE__ */ t(Q, { children: [
|
|
415
|
+
/* @__PURE__ */ e(Fe, { className: "h-12 w-12 text-muted-foreground mb-4" }),
|
|
404
416
|
/* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Drag & drop files here" }),
|
|
405
417
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mb-4", children: "or click to browse your files" }),
|
|
406
|
-
/* @__PURE__ */
|
|
407
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: [
|
|
419
|
+
/* @__PURE__ */ t("p", { children: [
|
|
408
420
|
"Accepted file types: ",
|
|
409
|
-
|
|
421
|
+
u.join(", ")
|
|
410
422
|
] }),
|
|
411
|
-
/* @__PURE__ */
|
|
423
|
+
/* @__PURE__ */ t("p", { children: [
|
|
412
424
|
"Maximum file size: ",
|
|
413
425
|
10,
|
|
414
426
|
"MB"
|
|
@@ -422,54 +434,54 @@ function Xe({
|
|
|
422
434
|
}
|
|
423
435
|
)
|
|
424
436
|
] }),
|
|
425
|
-
C && /* @__PURE__ */ e(
|
|
426
|
-
|
|
437
|
+
C && /* @__PURE__ */ e($, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
|
|
438
|
+
Le,
|
|
427
439
|
{
|
|
428
440
|
asset: C,
|
|
429
|
-
onSave: (s) =>
|
|
441
|
+
onSave: (s) => re(C, s),
|
|
430
442
|
onCancel: () => {
|
|
431
443
|
v(null);
|
|
432
444
|
}
|
|
433
445
|
}
|
|
434
446
|
) }),
|
|
435
|
-
|
|
436
|
-
|
|
447
|
+
h.show && /* @__PURE__ */ e($, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
|
|
448
|
+
Be,
|
|
437
449
|
{
|
|
438
|
-
imageUrl:
|
|
439
|
-
onSave:
|
|
450
|
+
imageUrl: h.file,
|
|
451
|
+
onSave: ce,
|
|
440
452
|
onClose: () => E({ show: !1, file: "" }),
|
|
441
|
-
defaultSavedImageName:
|
|
442
|
-
isEditing: !!
|
|
453
|
+
defaultSavedImageName: h.name,
|
|
454
|
+
isEditing: !!h.id
|
|
443
455
|
}
|
|
444
456
|
) }),
|
|
445
457
|
c && /* @__PURE__ */ e(
|
|
446
|
-
|
|
458
|
+
ye,
|
|
447
459
|
{
|
|
448
460
|
open: !!c,
|
|
449
|
-
onOpenChange: () =>
|
|
450
|
-
children: /* @__PURE__ */
|
|
451
|
-
/* @__PURE__ */
|
|
452
|
-
/* @__PURE__ */ e(
|
|
453
|
-
/* @__PURE__ */
|
|
461
|
+
onOpenChange: () => p(null),
|
|
462
|
+
children: /* @__PURE__ */ t(ve, { children: [
|
|
463
|
+
/* @__PURE__ */ t(xe, { children: [
|
|
464
|
+
/* @__PURE__ */ e(Ne, { children: "Delete Asset" }),
|
|
465
|
+
/* @__PURE__ */ t(we, { children: [
|
|
454
466
|
'Are you sure you want to delete "',
|
|
455
467
|
c.name,
|
|
456
468
|
'"? This action cannot be undone.'
|
|
457
469
|
] })
|
|
458
470
|
] }),
|
|
459
|
-
/* @__PURE__ */
|
|
460
|
-
/* @__PURE__ */ e(f, { variant: "outline", onClick: () =>
|
|
461
|
-
/* @__PURE__ */ e(f, { variant: "destructive", onClick:
|
|
471
|
+
/* @__PURE__ */ t(Ae, { className: "gap-2 sm:gap-0", children: [
|
|
472
|
+
/* @__PURE__ */ e(f, { variant: "outline", onClick: () => p(null), children: "Cancel" }),
|
|
473
|
+
/* @__PURE__ */ e(f, { variant: "destructive", onClick: ie, children: "Delete" })
|
|
462
474
|
] })
|
|
463
475
|
] })
|
|
464
476
|
}
|
|
465
477
|
)
|
|
466
478
|
] });
|
|
467
479
|
}
|
|
468
|
-
function
|
|
469
|
-
return
|
|
480
|
+
function Qe(a) {
|
|
481
|
+
return a < 1024 ? `${a.toFixed(2)} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(2)} KB` : `${(a / (1024 * 1024)).toFixed(2)} MB`;
|
|
470
482
|
}
|
|
471
|
-
function
|
|
472
|
-
const r = new Date(
|
|
483
|
+
function Re(a) {
|
|
484
|
+
const r = new Date(a);
|
|
473
485
|
return new Intl.DateTimeFormat("en-US", {
|
|
474
486
|
month: "short",
|
|
475
487
|
day: "numeric",
|
|
@@ -477,5 +489,5 @@ function Be(t) {
|
|
|
477
489
|
}).format(r);
|
|
478
490
|
}
|
|
479
491
|
export {
|
|
480
|
-
|
|
492
|
+
Je as default
|
|
481
493
|
};
|