medusa-plugin-content 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/medusa-config.js +3 -3
- package/.medusa/server/src/admin/index.js +148 -148
- package/.medusa/server/src/admin/index.mjs +151 -151
- package/.medusa/server/src/modules/content/models/content-collection.d.ts +74 -52
- package/.medusa/server/src/modules/content/models/content-creator-activity.d.ts +118 -22
- package/.medusa/server/src/modules/content/models/content-creator.d.ts +118 -22
- package/.medusa/server/src/modules/content/models/content-field.d.ts +74 -52
- package/.medusa/server/src/modules/content/models/content-item-activity.d.ts +120 -24
- package/.medusa/server/src/modules/content/models/content-item.d.ts +120 -24
- package/.medusa/server/src/modules/content/models/content-link.d.ts +189 -35
- package/.medusa/server/src/modules/content/models/content-relationship.d.ts +189 -35
- package/.medusa/server/src/modules/content/models/content-tag.d.ts +120 -24
- package/.medusa/server/src/modules/content/service.d.ts +2290 -184
- package/package.json +13 -13
|
@@ -10,8 +10,8 @@ module.exports = (0, utils_1.defineConfig)({
|
|
|
10
10
|
storeCors: process.env.STORE_CORS || 'http://localhost:5173',
|
|
11
11
|
adminCors: process.env.ADMIN_CORS || 'http://localhost:5173,http://localhost:9000',
|
|
12
12
|
authCors: process.env.AUTH_CORS || 'http://localhost:5173,http://localhost:9000',
|
|
13
|
-
jwtSecret: process.env.JWT_SECRET
|
|
14
|
-
cookieSecret: process.env.COOKIE_SECRET
|
|
13
|
+
jwtSecret: process.env.JWT_SECRET,
|
|
14
|
+
cookieSecret: process.env.COOKIE_SECRET
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
modules: [
|
|
@@ -20,4 +20,4 @@ module.exports = (0, utils_1.defineConfig)({
|
|
|
20
20
|
}
|
|
21
21
|
]
|
|
22
22
|
});
|
|
23
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVkdXNhLWNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL21lZHVzYS1jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxxREFBaUU7QUFFakUsSUFBQSxlQUFPLEVBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxRQUFRLElBQUksYUFBYSxFQUFFLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQyxDQUFBO0FBRTdELE1BQU0sQ0FBQyxPQUFPLEdBQUcsSUFBQSxvQkFBWSxFQUFDO0lBQzdCLGFBQWEsRUFBRTtRQUNkLFFBQVEsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVM7UUFDL0IsV0FBVyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWTtRQUNyQyxJQUFJLEVBQUU7WUFDTCxTQUFTLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLElBQUksdUJBQXVCO1lBQzVELFNBQVMsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLFVBQVUsSUFBSSw2Q0FBNkM7WUFDbEYsUUFBUSxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsU0FBUyxJQUFJLDZDQUE2QztZQUNoRixTQUFTLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVO1lBQ2pDLFlBQVksRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLGFBQWE7U0FDdkM7S0FDRDtJQUNELE9BQU8sRUFBRTtRQUNSO1lBQ0MsT0FBTyxFQUFFLHVCQUF1QjtTQUNoQztLQUNEO0NBQ0QsQ0FBQyxDQUFBIn0=
|
|
@@ -295,136 +295,6 @@ const ProductVariantImageLibraryWidget = ({
|
|
|
295
295
|
)
|
|
296
296
|
] });
|
|
297
297
|
};
|
|
298
|
-
const config$2 = adminSdk.defineRouteConfig({
|
|
299
|
-
label: "Image Gallery",
|
|
300
|
-
icon: icons.ImageSparkle,
|
|
301
|
-
rank: 7
|
|
302
|
-
});
|
|
303
|
-
const handle$4 = { breadcrumb: () => "Image Gallery" };
|
|
304
|
-
const STATUS_COLORS$2 = {
|
|
305
|
-
published: "green",
|
|
306
|
-
draft: "orange",
|
|
307
|
-
archived: "grey"
|
|
308
|
-
};
|
|
309
|
-
const PAGE_SIZE = 48;
|
|
310
|
-
const ImageGalleryPage = () => {
|
|
311
|
-
const navigate = reactRouterDom.useNavigate();
|
|
312
|
-
const [selectedCollectionId, setSelectedCollectionId] = React.useState();
|
|
313
|
-
const [search, setSearch] = React.useState("");
|
|
314
|
-
const [pageIndex, setPageIndex] = React.useState(0);
|
|
315
|
-
const { data: collectionsData } = useContentCollections({ limit: 100 });
|
|
316
|
-
const imgCollections = ((collectionsData == null ? void 0 : collectionsData.content_collections) ?? []).filter((t2) => t2.format === "img");
|
|
317
|
-
React.useEffect(() => {
|
|
318
|
-
if (imgCollections.length > 0 && !selectedCollectionId) {
|
|
319
|
-
setSelectedCollectionId(imgCollections[0].id);
|
|
320
|
-
}
|
|
321
|
-
}, [imgCollections.length]);
|
|
322
|
-
React.useEffect(() => {
|
|
323
|
-
setPageIndex(0);
|
|
324
|
-
}, [selectedCollectionId, search]);
|
|
325
|
-
const offset = React.useMemo(() => pageIndex * PAGE_SIZE, [pageIndex]);
|
|
326
|
-
const { data: itemsData, isLoading } = useContentItems(
|
|
327
|
-
selectedCollectionId,
|
|
328
|
-
selectedCollectionId ? { limit: PAGE_SIZE, offset, q: search || void 0 } : {}
|
|
329
|
-
);
|
|
330
|
-
const items = (itemsData == null ? void 0 : itemsData.content_items) ?? [];
|
|
331
|
-
const total = (itemsData == null ? void 0 : itemsData.count) ?? 0;
|
|
332
|
-
const pageCount = Math.ceil(total / PAGE_SIZE);
|
|
333
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0", children: [
|
|
334
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start justify-between gap-2 px-6 py-4 md:flex-row md:items-center", children: [
|
|
335
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Image Gallery" }),
|
|
336
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
337
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
338
|
-
ui.Input,
|
|
339
|
-
{
|
|
340
|
-
type: "search",
|
|
341
|
-
placeholder: "Search images...",
|
|
342
|
-
value: search,
|
|
343
|
-
onChange: (e2) => setSearch(e2.target.value),
|
|
344
|
-
className: "w-48 md:w-64"
|
|
345
|
-
}
|
|
346
|
-
),
|
|
347
|
-
imgCollections.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
348
|
-
ui.Select,
|
|
349
|
-
{
|
|
350
|
-
value: selectedCollectionId ?? "",
|
|
351
|
-
onValueChange: setSelectedCollectionId,
|
|
352
|
-
children: [
|
|
353
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { className: "w-48", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select library..." }) }),
|
|
354
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: imgCollections.map((t2) => /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: t2.id, children: t2.label }, t2.id)) })
|
|
355
|
-
]
|
|
356
|
-
}
|
|
357
|
-
)
|
|
358
|
-
] })
|
|
359
|
-
] }),
|
|
360
|
-
imgCollections.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "px-6 py-8 text-center text-ui-fg-muted", children: "No image content collections found." }) : isLoading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "px-6 py-4 text-ui-fg-muted", children: "Loading..." }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "px-6 py-8 text-center text-ui-fg-muted", children: search ? "No images match your search." : "No images in this library." }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-4 p-6", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
361
|
-
"div",
|
|
362
|
-
{
|
|
363
|
-
className: "group flex-none flex flex-col cursor-pointer overflow-hidden rounded-lg border border-ui-border-base bg-ui-bg-subtle",
|
|
364
|
-
onClick: () => navigate(`/content/${selectedCollectionId}/items/${item.id}`),
|
|
365
|
-
children: [
|
|
366
|
-
item.body ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
367
|
-
"img",
|
|
368
|
-
{
|
|
369
|
-
src: item.body,
|
|
370
|
-
alt: item.title,
|
|
371
|
-
className: "block h-40 w-auto object-contain bg-ui-bg-component transition-transform group-hover:scale-105"
|
|
372
|
-
}
|
|
373
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-40 w-32 items-center justify-center bg-ui-bg-component", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-ui-fg-muted", children: "No image" }) }),
|
|
374
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-0 min-w-full overflow-hidden p-2", children: [
|
|
375
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "truncate", children: item.title }),
|
|
376
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
377
|
-
ui.Badge,
|
|
378
|
-
{
|
|
379
|
-
size: "xsmall",
|
|
380
|
-
color: STATUS_COLORS$2[item.status] ?? "grey",
|
|
381
|
-
className: "mt-1",
|
|
382
|
-
children: item.status
|
|
383
|
-
}
|
|
384
|
-
)
|
|
385
|
-
] })
|
|
386
|
-
]
|
|
387
|
-
},
|
|
388
|
-
item.id
|
|
389
|
-
)) }),
|
|
390
|
-
pageCount > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-6 py-3", children: [
|
|
391
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-muted", children: [
|
|
392
|
-
offset + 1,
|
|
393
|
-
"–",
|
|
394
|
-
Math.min(offset + PAGE_SIZE, total),
|
|
395
|
-
" of ",
|
|
396
|
-
total
|
|
397
|
-
] }),
|
|
398
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
399
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
400
|
-
ui.Button,
|
|
401
|
-
{
|
|
402
|
-
size: "small",
|
|
403
|
-
variant: "transparent",
|
|
404
|
-
disabled: pageIndex === 0,
|
|
405
|
-
onClick: () => setPageIndex((p) => p - 1),
|
|
406
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronLeft, {})
|
|
407
|
-
}
|
|
408
|
-
),
|
|
409
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "min-w-[4rem] text-center text-ui-fg-subtle", children: [
|
|
410
|
-
pageIndex + 1,
|
|
411
|
-
" / ",
|
|
412
|
-
pageCount
|
|
413
|
-
] }),
|
|
414
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
415
|
-
ui.Button,
|
|
416
|
-
{
|
|
417
|
-
size: "small",
|
|
418
|
-
variant: "transparent",
|
|
419
|
-
disabled: pageIndex >= pageCount - 1,
|
|
420
|
-
onClick: () => setPageIndex((p) => p + 1),
|
|
421
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRight, {})
|
|
422
|
-
}
|
|
423
|
-
)
|
|
424
|
-
] })
|
|
425
|
-
] })
|
|
426
|
-
] });
|
|
427
|
-
};
|
|
428
298
|
function $constructor(name, initializer2, params) {
|
|
429
299
|
function init(inst, def) {
|
|
430
300
|
if (!inst._zod) {
|
|
@@ -489,7 +359,7 @@ class $ZodEncodeError extends Error {
|
|
|
489
359
|
}
|
|
490
360
|
}
|
|
491
361
|
const globalConfig = {};
|
|
492
|
-
function config$
|
|
362
|
+
function config$2(newConfig) {
|
|
493
363
|
return globalConfig;
|
|
494
364
|
}
|
|
495
365
|
function getEnumValues(entries) {
|
|
@@ -934,7 +804,7 @@ const _parse = (_Err) => (schema2, value, _ctx, _params) => {
|
|
|
934
804
|
throw new $ZodAsyncError();
|
|
935
805
|
}
|
|
936
806
|
if (result.issues.length) {
|
|
937
|
-
const e2 = new ((_params == null ? void 0 : _params.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config$
|
|
807
|
+
const e2 = new ((_params == null ? void 0 : _params.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config$2())));
|
|
938
808
|
captureStackTrace(e2, _params == null ? void 0 : _params.callee);
|
|
939
809
|
throw e2;
|
|
940
810
|
}
|
|
@@ -946,7 +816,7 @@ const _parseAsync = (_Err) => async (schema2, value, _ctx, params) => {
|
|
|
946
816
|
if (result instanceof Promise)
|
|
947
817
|
result = await result;
|
|
948
818
|
if (result.issues.length) {
|
|
949
|
-
const e2 = new ((params == null ? void 0 : params.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config$
|
|
819
|
+
const e2 = new ((params == null ? void 0 : params.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config$2())));
|
|
950
820
|
captureStackTrace(e2, params == null ? void 0 : params.callee);
|
|
951
821
|
throw e2;
|
|
952
822
|
}
|
|
@@ -960,7 +830,7 @@ const _safeParse = (_Err) => (schema2, value, _ctx) => {
|
|
|
960
830
|
}
|
|
961
831
|
return result.issues.length ? {
|
|
962
832
|
success: false,
|
|
963
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config$
|
|
833
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config$2())))
|
|
964
834
|
} : { success: true, data: result.value };
|
|
965
835
|
};
|
|
966
836
|
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
@@ -971,7 +841,7 @@ const _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
|
971
841
|
result = await result;
|
|
972
842
|
return result.issues.length ? {
|
|
973
843
|
success: false,
|
|
974
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config$
|
|
844
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config$2())))
|
|
975
845
|
} : { success: true, data: result.value };
|
|
976
846
|
};
|
|
977
847
|
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
@@ -2025,7 +1895,7 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
2025
1895
|
code: "invalid_union",
|
|
2026
1896
|
input: final.value,
|
|
2027
1897
|
inst,
|
|
2028
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config$
|
|
1898
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config$2())))
|
|
2029
1899
|
});
|
|
2030
1900
|
return final;
|
|
2031
1901
|
}
|
|
@@ -2350,7 +2220,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
2350
2220
|
payload.value = def.catchValue({
|
|
2351
2221
|
...payload,
|
|
2352
2222
|
error: {
|
|
2353
|
-
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config$
|
|
2223
|
+
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config$2()))
|
|
2354
2224
|
},
|
|
2355
2225
|
input: payload.value
|
|
2356
2226
|
});
|
|
@@ -2364,7 +2234,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
2364
2234
|
payload.value = def.catchValue({
|
|
2365
2235
|
...payload,
|
|
2366
2236
|
error: {
|
|
2367
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config$
|
|
2237
|
+
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config$2()))
|
|
2368
2238
|
},
|
|
2369
2239
|
input: payload.value
|
|
2370
2240
|
});
|
|
@@ -6061,12 +5931,12 @@ const CreateContentCollectionModal = ({ open, onOpenChange }) => {
|
|
|
6061
5931
|
] }) })
|
|
6062
5932
|
] }) }) });
|
|
6063
5933
|
};
|
|
6064
|
-
const config = adminSdk.defineRouteConfig({
|
|
5934
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
6065
5935
|
label: "Content",
|
|
6066
5936
|
icon: icons.PencilSquare,
|
|
6067
5937
|
rank: 6
|
|
6068
5938
|
});
|
|
6069
|
-
const handle$
|
|
5939
|
+
const handle$4 = { breadcrumb: () => "Content" };
|
|
6070
5940
|
const FORMAT_LABELS$1 = {
|
|
6071
5941
|
html: "HTML",
|
|
6072
5942
|
img: "Image",
|
|
@@ -6170,6 +6040,136 @@ const ContentCollectionsPage = () => {
|
|
|
6170
6040
|
/* @__PURE__ */ jsxRuntime.jsx(CreateContentCollectionModal, { open: createOpen, onOpenChange: setCreateOpen })
|
|
6171
6041
|
] });
|
|
6172
6042
|
};
|
|
6043
|
+
const config = adminSdk.defineRouteConfig({
|
|
6044
|
+
label: "Image Gallery",
|
|
6045
|
+
icon: icons.ImageSparkle,
|
|
6046
|
+
rank: 7
|
|
6047
|
+
});
|
|
6048
|
+
const handle$3 = { breadcrumb: () => "Image Gallery" };
|
|
6049
|
+
const STATUS_COLORS$2 = {
|
|
6050
|
+
published: "green",
|
|
6051
|
+
draft: "orange",
|
|
6052
|
+
archived: "grey"
|
|
6053
|
+
};
|
|
6054
|
+
const PAGE_SIZE = 48;
|
|
6055
|
+
const ImageGalleryPage = () => {
|
|
6056
|
+
const navigate = reactRouterDom.useNavigate();
|
|
6057
|
+
const [selectedCollectionId, setSelectedCollectionId] = React.useState();
|
|
6058
|
+
const [search, setSearch] = React.useState("");
|
|
6059
|
+
const [pageIndex, setPageIndex] = React.useState(0);
|
|
6060
|
+
const { data: collectionsData } = useContentCollections({ limit: 100 });
|
|
6061
|
+
const imgCollections = ((collectionsData == null ? void 0 : collectionsData.content_collections) ?? []).filter((t2) => t2.format === "img");
|
|
6062
|
+
React.useEffect(() => {
|
|
6063
|
+
if (imgCollections.length > 0 && !selectedCollectionId) {
|
|
6064
|
+
setSelectedCollectionId(imgCollections[0].id);
|
|
6065
|
+
}
|
|
6066
|
+
}, [imgCollections.length]);
|
|
6067
|
+
React.useEffect(() => {
|
|
6068
|
+
setPageIndex(0);
|
|
6069
|
+
}, [selectedCollectionId, search]);
|
|
6070
|
+
const offset = React.useMemo(() => pageIndex * PAGE_SIZE, [pageIndex]);
|
|
6071
|
+
const { data: itemsData, isLoading } = useContentItems(
|
|
6072
|
+
selectedCollectionId,
|
|
6073
|
+
selectedCollectionId ? { limit: PAGE_SIZE, offset, q: search || void 0 } : {}
|
|
6074
|
+
);
|
|
6075
|
+
const items = (itemsData == null ? void 0 : itemsData.content_items) ?? [];
|
|
6076
|
+
const total = (itemsData == null ? void 0 : itemsData.count) ?? 0;
|
|
6077
|
+
const pageCount = Math.ceil(total / PAGE_SIZE);
|
|
6078
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0", children: [
|
|
6079
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start justify-between gap-2 px-6 py-4 md:flex-row md:items-center", children: [
|
|
6080
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Image Gallery" }),
|
|
6081
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6082
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6083
|
+
ui.Input,
|
|
6084
|
+
{
|
|
6085
|
+
type: "search",
|
|
6086
|
+
placeholder: "Search images...",
|
|
6087
|
+
value: search,
|
|
6088
|
+
onChange: (e2) => setSearch(e2.target.value),
|
|
6089
|
+
className: "w-48 md:w-64"
|
|
6090
|
+
}
|
|
6091
|
+
),
|
|
6092
|
+
imgCollections.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6093
|
+
ui.Select,
|
|
6094
|
+
{
|
|
6095
|
+
value: selectedCollectionId ?? "",
|
|
6096
|
+
onValueChange: setSelectedCollectionId,
|
|
6097
|
+
children: [
|
|
6098
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { className: "w-48", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select library..." }) }),
|
|
6099
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: imgCollections.map((t2) => /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: t2.id, children: t2.label }, t2.id)) })
|
|
6100
|
+
]
|
|
6101
|
+
}
|
|
6102
|
+
)
|
|
6103
|
+
] })
|
|
6104
|
+
] }),
|
|
6105
|
+
imgCollections.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "px-6 py-8 text-center text-ui-fg-muted", children: "No image content collections found." }) : isLoading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "px-6 py-4 text-ui-fg-muted", children: "Loading..." }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "px-6 py-8 text-center text-ui-fg-muted", children: search ? "No images match your search." : "No images in this library." }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-4 p-6", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6106
|
+
"div",
|
|
6107
|
+
{
|
|
6108
|
+
className: "group flex-none flex flex-col cursor-pointer overflow-hidden rounded-lg border border-ui-border-base bg-ui-bg-subtle",
|
|
6109
|
+
onClick: () => navigate(`/content/${selectedCollectionId}/items/${item.id}`),
|
|
6110
|
+
children: [
|
|
6111
|
+
item.body ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6112
|
+
"img",
|
|
6113
|
+
{
|
|
6114
|
+
src: item.body,
|
|
6115
|
+
alt: item.title,
|
|
6116
|
+
className: "block h-40 w-auto object-contain bg-ui-bg-component transition-transform group-hover:scale-105"
|
|
6117
|
+
}
|
|
6118
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-40 w-32 items-center justify-center bg-ui-bg-component", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-ui-fg-muted", children: "No image" }) }),
|
|
6119
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-0 min-w-full overflow-hidden p-2", children: [
|
|
6120
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "truncate", children: item.title }),
|
|
6121
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6122
|
+
ui.Badge,
|
|
6123
|
+
{
|
|
6124
|
+
size: "xsmall",
|
|
6125
|
+
color: STATUS_COLORS$2[item.status] ?? "grey",
|
|
6126
|
+
className: "mt-1",
|
|
6127
|
+
children: item.status
|
|
6128
|
+
}
|
|
6129
|
+
)
|
|
6130
|
+
] })
|
|
6131
|
+
]
|
|
6132
|
+
},
|
|
6133
|
+
item.id
|
|
6134
|
+
)) }),
|
|
6135
|
+
pageCount > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-6 py-3", children: [
|
|
6136
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-muted", children: [
|
|
6137
|
+
offset + 1,
|
|
6138
|
+
"–",
|
|
6139
|
+
Math.min(offset + PAGE_SIZE, total),
|
|
6140
|
+
" of ",
|
|
6141
|
+
total
|
|
6142
|
+
] }),
|
|
6143
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
6144
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6145
|
+
ui.Button,
|
|
6146
|
+
{
|
|
6147
|
+
size: "small",
|
|
6148
|
+
variant: "transparent",
|
|
6149
|
+
disabled: pageIndex === 0,
|
|
6150
|
+
onClick: () => setPageIndex((p) => p - 1),
|
|
6151
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronLeft, {})
|
|
6152
|
+
}
|
|
6153
|
+
),
|
|
6154
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "min-w-[4rem] text-center text-ui-fg-subtle", children: [
|
|
6155
|
+
pageIndex + 1,
|
|
6156
|
+
" / ",
|
|
6157
|
+
pageCount
|
|
6158
|
+
] }),
|
|
6159
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6160
|
+
ui.Button,
|
|
6161
|
+
{
|
|
6162
|
+
size: "small",
|
|
6163
|
+
variant: "transparent",
|
|
6164
|
+
disabled: pageIndex >= pageCount - 1,
|
|
6165
|
+
onClick: () => setPageIndex((p) => p + 1),
|
|
6166
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRight, {})
|
|
6167
|
+
}
|
|
6168
|
+
)
|
|
6169
|
+
] })
|
|
6170
|
+
] })
|
|
6171
|
+
] });
|
|
6172
|
+
};
|
|
6173
6173
|
const ActionMenu = ({ groups }) => {
|
|
6174
6174
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
|
|
6175
6175
|
/* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", variant: "transparent", children: /* @__PURE__ */ jsxRuntime.jsx(icons.EllipsisHorizontal, {}) }) }),
|
|
@@ -7564,13 +7564,13 @@ const widgetModule = { widgets: [
|
|
|
7564
7564
|
const routeModule = {
|
|
7565
7565
|
routes: [
|
|
7566
7566
|
{
|
|
7567
|
-
Component:
|
|
7568
|
-
path: "/
|
|
7567
|
+
Component: ContentCollectionsPage,
|
|
7568
|
+
path: "/content",
|
|
7569
7569
|
handle: handle$4
|
|
7570
7570
|
},
|
|
7571
7571
|
{
|
|
7572
|
-
Component:
|
|
7573
|
-
path: "/
|
|
7572
|
+
Component: ImageGalleryPage,
|
|
7573
|
+
path: "/images",
|
|
7574
7574
|
handle: handle$3
|
|
7575
7575
|
},
|
|
7576
7576
|
{
|
|
@@ -7595,16 +7595,16 @@ const routeModule = {
|
|
|
7595
7595
|
const menuItemModule = {
|
|
7596
7596
|
menuItems: [
|
|
7597
7597
|
{
|
|
7598
|
-
label: config.label,
|
|
7599
|
-
icon: config.icon,
|
|
7598
|
+
label: config$1.label,
|
|
7599
|
+
icon: config$1.icon,
|
|
7600
7600
|
path: "/content",
|
|
7601
7601
|
nested: void 0,
|
|
7602
7602
|
rank: 6,
|
|
7603
7603
|
translationNs: void 0
|
|
7604
7604
|
},
|
|
7605
7605
|
{
|
|
7606
|
-
label: config
|
|
7607
|
-
icon: config
|
|
7606
|
+
label: config.label,
|
|
7607
|
+
icon: config.icon,
|
|
7608
7608
|
path: "/images",
|
|
7609
7609
|
nested: void 0,
|
|
7610
7610
|
rank: 7,
|