@burdenoff/microfe-coolandlovely 2026.1102.5 → 2026.1102.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.
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useAssistantEntityName as o } from "../../hooks/useAssistantEntity.js";
|
|
1
|
+
import { cn as e } from "../../utils/cn.js";
|
|
2
|
+
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
|
+
import { useBrand as n, useTransitionBrand as r, useUpdateBrand as i } from "../../hooks/useCoolAndLovelyApi.js";
|
|
4
|
+
import { useAssistantEntityName as a } from "../../hooks/useAssistantEntity.js";
|
|
6
5
|
import "../../hooks/index.js";
|
|
7
|
-
import { StatusBadge as
|
|
8
|
-
import { ErrorView as
|
|
9
|
-
import { Thumbnail as
|
|
10
|
-
import { formatDate as
|
|
11
|
-
import { categoryIcon as
|
|
12
|
-
import { TagList as
|
|
13
|
-
import { Comments as
|
|
14
|
-
import { ActivityTrail as
|
|
15
|
-
import { BrandCover as
|
|
16
|
-
import { StepTracker as
|
|
6
|
+
import { StatusBadge as o } from "../../components/StatusBadge.js";
|
|
7
|
+
import { ErrorView as s, LoadingView as c } from "../../components/StateViews.js";
|
|
8
|
+
import { Thumbnail as l } from "../../components/Thumbnail.js";
|
|
9
|
+
import { formatDate as u, formatPrice as d, titleCase as f } from "../../utils/formatters.js";
|
|
10
|
+
import { categoryIcon as p } from "../../utils/icons.js";
|
|
11
|
+
import { TagList as m } from "../../components/TagList.js";
|
|
12
|
+
import { Comments as h } from "../../components/Comments.js";
|
|
13
|
+
import { ActivityTrail as g } from "../../components/ActivityTrail.js";
|
|
14
|
+
import { BrandCover as _ } from "../../components/BrandCover.js";
|
|
15
|
+
import { StepTracker as v } from "../../components/StepTracker.js";
|
|
16
|
+
import { useContextNavigation as y } from "../../hooks/useContextNavigation.js";
|
|
17
17
|
import { ArrowLeft as b, ExternalLink as x, Loader2 as S, Package as C, Pencil as w, Plus as T, Shapes as E, Shirt as D, Store as O } from "lucide-react";
|
|
18
18
|
import { useParams as k } from "react-router";
|
|
19
19
|
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
@@ -39,21 +39,21 @@ function I(e) {
|
|
|
39
39
|
return /forbidden|permission|not allowed|unauthori[sz]ed/i.test(t) ? "Your role does not permit this action." : t;
|
|
40
40
|
}
|
|
41
41
|
function L() {
|
|
42
|
-
let { brandId: L } = k(),
|
|
43
|
-
if (
|
|
42
|
+
let { brandId: L } = k(), R = y(), z = n(L), B = r(), V = i();
|
|
43
|
+
if (a(L, z.data?.name), z.isLoading) return /* @__PURE__ */ j(t, {
|
|
44
44
|
title: "Brand",
|
|
45
|
-
children: /* @__PURE__ */ j(
|
|
45
|
+
children: /* @__PURE__ */ j(c, { label: "Loading brand…" })
|
|
46
46
|
});
|
|
47
|
-
if (z.isError || !z.data) return /* @__PURE__ */ j(
|
|
47
|
+
if (z.isError || !z.data) return /* @__PURE__ */ j(t, {
|
|
48
48
|
title: "Brand",
|
|
49
|
-
children: /* @__PURE__ */ j(
|
|
49
|
+
children: /* @__PURE__ */ j(s, {
|
|
50
50
|
title: "Brand not found",
|
|
51
51
|
message: "This storefront could not be loaded or does not exist.",
|
|
52
52
|
onRetry: () => void z.refetch()
|
|
53
53
|
})
|
|
54
54
|
});
|
|
55
55
|
let H = z.data, U = H.collections ?? [], W = H.items ?? [], G = P[H.status], K = F.includes(H.status) ? F : [...F.slice(0, 1), H.status], q = H.websiteUrl && /^https?:\/\//i.test(H.websiteUrl) ? H.websiteUrl : void 0;
|
|
56
|
-
return /* @__PURE__ */ j(
|
|
56
|
+
return /* @__PURE__ */ j(t, {
|
|
57
57
|
title: H.name,
|
|
58
58
|
description: `@${H.handle}`,
|
|
59
59
|
children: /* @__PURE__ */ M("div", {
|
|
@@ -61,7 +61,7 @@ function L() {
|
|
|
61
61
|
children: [/* @__PURE__ */ M("div", {
|
|
62
62
|
className: "space-y-6 lg:col-span-2",
|
|
63
63
|
children: [
|
|
64
|
-
/* @__PURE__ */ j(
|
|
64
|
+
/* @__PURE__ */ j(_, {
|
|
65
65
|
coverFileId: H.cover?.id,
|
|
66
66
|
logoFileId: H.logo?.id,
|
|
67
67
|
name: H.name,
|
|
@@ -91,7 +91,7 @@ function L() {
|
|
|
91
91
|
]
|
|
92
92
|
}), /* @__PURE__ */ M("div", {
|
|
93
93
|
className: "absolute inset-x-0 bottom-0 flex items-end gap-3 p-4 sm:gap-4 sm:p-5",
|
|
94
|
-
children: [/* @__PURE__ */ j(
|
|
94
|
+
children: [/* @__PURE__ */ j(l, {
|
|
95
95
|
icon: /* @__PURE__ */ j(O, { className: "h-7 w-7" }),
|
|
96
96
|
seed: H.id,
|
|
97
97
|
fileId: H.logo?.id,
|
|
@@ -120,17 +120,17 @@ function L() {
|
|
|
120
120
|
children: [
|
|
121
121
|
/* @__PURE__ */ M("div", {
|
|
122
122
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
123
|
-
children: [H.aesthetics.length > 0 ? /* @__PURE__ */ j(
|
|
124
|
-
tags: H.aesthetics.map(
|
|
123
|
+
children: [H.aesthetics.length > 0 ? /* @__PURE__ */ j(m, {
|
|
124
|
+
tags: H.aesthetics.map(f),
|
|
125
125
|
tone: "accent",
|
|
126
126
|
max: 12
|
|
127
|
-
}) : /* @__PURE__ */ j("span", {}), /* @__PURE__ */ j(
|
|
127
|
+
}) : /* @__PURE__ */ j("span", {}), /* @__PURE__ */ j(o, { status: H.status })]
|
|
128
128
|
}),
|
|
129
129
|
H.bio && /* @__PURE__ */ j("p", {
|
|
130
130
|
className: "text-sm text-text-secondary",
|
|
131
131
|
children: H.bio
|
|
132
132
|
}),
|
|
133
|
-
H.tags.length > 0 && /* @__PURE__ */ j(
|
|
133
|
+
H.tags.length > 0 && /* @__PURE__ */ j(m, {
|
|
134
134
|
tags: H.tags,
|
|
135
135
|
max: 12
|
|
136
136
|
}),
|
|
@@ -181,7 +181,7 @@ function L() {
|
|
|
181
181
|
onClick: () => R(`/collections/${e.id}`),
|
|
182
182
|
className: "flex items-center gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 text-left transition-colors hover:bg-bg-sunken/50",
|
|
183
183
|
children: [
|
|
184
|
-
/* @__PURE__ */ j(
|
|
184
|
+
/* @__PURE__ */ j(l, {
|
|
185
185
|
icon: /* @__PURE__ */ j(E, { className: "h-5 w-5" }),
|
|
186
186
|
seed: e.id,
|
|
187
187
|
fileId: e.cover?.id,
|
|
@@ -195,10 +195,10 @@ function L() {
|
|
|
195
195
|
children: e.name
|
|
196
196
|
}), /* @__PURE__ */ j("p", {
|
|
197
197
|
className: "text-xs text-text-secondary",
|
|
198
|
-
children:
|
|
198
|
+
children: f(e.season)
|
|
199
199
|
})]
|
|
200
200
|
}),
|
|
201
|
-
/* @__PURE__ */ j(
|
|
201
|
+
/* @__PURE__ */ j(o, { status: e.status })
|
|
202
202
|
]
|
|
203
203
|
}, e.id))
|
|
204
204
|
})]
|
|
@@ -222,8 +222,8 @@ function L() {
|
|
|
222
222
|
type: "button",
|
|
223
223
|
onClick: () => R(`/items/${e.id}`),
|
|
224
224
|
className: "overflow-hidden rounded-lg border border-border-seam bg-bg-surface text-left transition-all hover:border-accent-foreground/20 hover:shadow-md",
|
|
225
|
-
children: [/* @__PURE__ */ j(
|
|
226
|
-
icon:
|
|
225
|
+
children: [/* @__PURE__ */ j(l, {
|
|
226
|
+
icon: p(e.category, 24),
|
|
227
227
|
seed: e.id,
|
|
228
228
|
fileId: e.image?.id,
|
|
229
229
|
alt: e.name,
|
|
@@ -235,7 +235,7 @@ function L() {
|
|
|
235
235
|
children: e.name
|
|
236
236
|
}), /* @__PURE__ */ j("p", {
|
|
237
237
|
className: "mt-0.5 text-xs text-text-secondary",
|
|
238
|
-
children:
|
|
238
|
+
children: d(e.price, e.currency)
|
|
239
239
|
})]
|
|
240
240
|
})]
|
|
241
241
|
}, e.id))
|
|
@@ -253,7 +253,7 @@ function L() {
|
|
|
253
253
|
className: "mb-3 text-sm font-semibold text-text-primary",
|
|
254
254
|
children: "Publish lifecycle"
|
|
255
255
|
}),
|
|
256
|
-
/* @__PURE__ */ j(
|
|
256
|
+
/* @__PURE__ */ j(v, {
|
|
257
257
|
steps: K,
|
|
258
258
|
current: H.status,
|
|
259
259
|
className: "mb-5"
|
|
@@ -263,27 +263,27 @@ function L() {
|
|
|
263
263
|
children: [/* @__PURE__ */ j("span", {
|
|
264
264
|
className: "text-sm text-text-secondary",
|
|
265
265
|
children: "Current:"
|
|
266
|
-
}), /* @__PURE__ */ j(
|
|
266
|
+
}), /* @__PURE__ */ j(o, { status: H.status })]
|
|
267
267
|
}),
|
|
268
268
|
G.length === 0 ? /* @__PURE__ */ j("p", {
|
|
269
269
|
className: "text-xs text-text-secondary",
|
|
270
270
|
children: "This brand is archived (terminal state)."
|
|
271
271
|
}) : /* @__PURE__ */ j("div", {
|
|
272
272
|
className: "flex flex-col gap-2",
|
|
273
|
-
children: G.map((
|
|
273
|
+
children: G.map((t) => /* @__PURE__ */ M("button", {
|
|
274
274
|
type: "button",
|
|
275
275
|
disabled: B.isPending,
|
|
276
276
|
onClick: () => B.mutate({
|
|
277
277
|
id: H.id,
|
|
278
|
-
status:
|
|
278
|
+
status: t
|
|
279
279
|
}),
|
|
280
|
-
className:
|
|
280
|
+
className: e("inline-flex items-center justify-center gap-2 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50"),
|
|
281
281
|
children: [
|
|
282
282
|
B.isPending && /* @__PURE__ */ j(S, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
283
283
|
"Move to ",
|
|
284
|
-
|
|
284
|
+
f(t)
|
|
285
285
|
]
|
|
286
|
-
},
|
|
286
|
+
}, t))
|
|
287
287
|
}),
|
|
288
288
|
B.isError && /* @__PURE__ */ j("p", {
|
|
289
289
|
className: "mt-2 text-xs text-status-error-text",
|
|
@@ -327,8 +327,8 @@ function L() {
|
|
|
327
327
|
id: H.id,
|
|
328
328
|
input: { isFeatured: !H.isFeatured }
|
|
329
329
|
}),
|
|
330
|
-
className:
|
|
331
|
-
children: /* @__PURE__ */ j("span", { className:
|
|
330
|
+
className: e("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:opacity-60", H.isFeatured ? "bg-action-primary-bg" : "bg-bg-sunken"),
|
|
331
|
+
children: /* @__PURE__ */ j("span", { className: e("inline-block h-4 w-4 rounded-full bg-bg-surface shadow transition-transform", H.isFeatured ? "translate-x-[1.125rem]" : "translate-x-0.5") })
|
|
332
332
|
}), V.isPending && /* @__PURE__ */ j(S, { className: "h-3.5 w-3.5 animate-spin text-text-secondary" })]
|
|
333
333
|
})]
|
|
334
334
|
}),
|
|
@@ -339,7 +339,7 @@ function L() {
|
|
|
339
339
|
children: "Created"
|
|
340
340
|
}), /* @__PURE__ */ j("dd", {
|
|
341
341
|
className: "text-text-primary",
|
|
342
|
-
children:
|
|
342
|
+
children: u(H.createdAt, {
|
|
343
343
|
hour: void 0,
|
|
344
344
|
minute: void 0
|
|
345
345
|
})
|
|
@@ -352,7 +352,7 @@ function L() {
|
|
|
352
352
|
children: "Updated"
|
|
353
353
|
}), /* @__PURE__ */ j("dd", {
|
|
354
354
|
className: "text-text-primary",
|
|
355
|
-
children:
|
|
355
|
+
children: u(H.updatedAt, {
|
|
356
356
|
hour: void 0,
|
|
357
357
|
minute: void 0
|
|
358
358
|
})
|
|
@@ -361,11 +361,11 @@ function L() {
|
|
|
361
361
|
]
|
|
362
362
|
})]
|
|
363
363
|
}),
|
|
364
|
-
/* @__PURE__ */ j(
|
|
364
|
+
/* @__PURE__ */ j(g, {
|
|
365
365
|
resourceType: "coolandlovely-brand",
|
|
366
366
|
resourceId: H.id
|
|
367
367
|
}),
|
|
368
|
-
/* @__PURE__ */ j(
|
|
368
|
+
/* @__PURE__ */ j(h, {
|
|
369
369
|
entityType: "CooBrand",
|
|
370
370
|
entityId: H.id,
|
|
371
371
|
className: "mt-0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrandDetailPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/brands/BrandDetailPage.tsx"],"sourcesContent":["/**\n * Brand Detail Page\n * @module coolandlovely/pages/brands\n *\n * Renders a single brand storefront (`cooBrand`) with its publish-lifecycle\n * transitions (`cooTransitionBrand`), collections and style items.\n */\n\nimport { useParams } from 'react-router';\nimport {\n Store,\n ExternalLink,\n Pencil,\n ArrowLeft,\n Shapes,\n Shirt,\n Loader2,\n Plus,\n Package,\n} from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { Thumbnail } from '../../components/Thumbnail';\nimport { BrandCover } from '../../components/BrandCover';\nimport { TagList } from '../../components/TagList';\nimport { Comments } from '../../components/Comments';\nimport { StepTracker } from '../../components/StepTracker';\nimport { ActivityTrail } from '../../components/ActivityTrail';\nimport { useCoolAndLovely } from '../../context/CoolAndLovelyContext';\nimport { useAssistantEntityName, useBrand, useTransitionBrand, useUpdateBrand } from '../../hooks';\nimport { categoryIcon } from '../../utils/icons';\nimport { formatPrice, formatDate, titleCase } from '../../utils/formatters';\nimport { cn } from '../../utils/cn';\nimport type { CooBrandStatus } from '../../types';\n\n/** Allowed next states per the svc brand state machine (UX guidance only;\n * the service is the authority and rejects illegal jumps). */\nconst NEXT_STATES: Record<CooBrandStatus, CooBrandStatus[]> = {\n DRAFT: ['PENDING_REVIEW', 'ARCHIVED'],\n PENDING_REVIEW: ['PUBLISHED', 'DRAFT', 'ARCHIVED'],\n PUBLISHED: ['SUSPENDED', 'ARCHIVED'],\n SUSPENDED: ['PUBLISHED', 'ARCHIVED'],\n ARCHIVED: [],\n};\n\n/** The publish path a storefront walks. SUSPENDED/ARCHIVED are exits from it,\n * not steps on it, so a brand sitting in one is tracked separately below. */\nconst LIFECYCLE_STEPS: CooBrandStatus[] = ['DRAFT', 'PENDING_REVIEW', 'PUBLISHED'];\n\n/**\n * Reframe the gateway's RBAC refusal in the operator's language. ONLY a\n * permission refusal is relabelled — every other failure keeps the service's\n * own message, so a validation error is never disguised as a role problem.\n */\nfunction transitionErrorMessage(error: unknown): string {\n const raw = error instanceof Error ? error.message : 'Transition failed';\n return /forbidden|permission|not allowed|unauthori[sz]ed/i.test(raw)\n ? 'Your role does not permit this action.'\n : raw;\n}\n\nexport function BrandDetailPage() {\n const { brandId } = useParams<{ brandId: string }>();\n const { navigateTo } = useCoolAndLovely();\n const query = useBrand(brandId);\n const transition = useTransitionBrand();\n const updateBrand = useUpdateBrand();\n // Tell the assistant WHICH storefront is on screen (see useAssistantEntity).\n useAssistantEntityName(brandId, query.data?.name);\n\n if (query.isLoading) {\n return (\n <PageLayout title=\"Brand\">\n <LoadingView label=\"Loading brand…\" />\n </PageLayout>\n );\n }\n\n if (query.isError || !query.data) {\n return (\n <PageLayout title=\"Brand\">\n <ErrorView\n title=\"Brand not found\"\n message=\"This storefront could not be loaded or does not exist.\"\n onRetry={() => void query.refetch()}\n />\n </PageLayout>\n );\n }\n\n const brand = query.data;\n const collections = brand.collections ?? [];\n const items = brand.items ?? [];\n const nextStates = NEXT_STATES[brand.status];\n const trackerSteps = LIFECYCLE_STEPS.includes(brand.status)\n ? LIFECYCLE_STEPS\n : ([...LIFECYCLE_STEPS.slice(0, 1), brand.status] as CooBrandStatus[]);\n // Only render a website link for safe http(s) URLs (block javascript:/data: sinks).\n const safeWebsiteUrl =\n brand.websiteUrl && /^https?:\\/\\//i.test(brand.websiteUrl) ? brand.websiteUrl : undefined;\n\n return (\n <PageLayout title={brand.name} description={`@${brand.handle}`}>\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Main column */}\n <div className=\"space-y-6 lg:col-span-2\">\n {/* Storefront hero — cover + logo + identity overlay, floating actions */}\n <BrandCover\n coverFileId={brand.cover?.id}\n logoFileId={brand.logo?.id}\n name={brand.name}\n seed={brand.id}\n className=\"overflow-hidden rounded-xl border border-border-seam shadow-sm\"\n overlay={\n <>\n <div className=\"absolute right-3 top-3 flex flex-wrap items-center justify-end gap-2\">\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-bg-surface/80 px-3 py-2 text-sm font-medium text-text-primary shadow-sm backdrop-blur transition-colors hover:bg-bg-surface\"\n >\n <ArrowLeft className=\"h-4 w-4\" /> Back\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/brand-orders?brand=${brand.id}`)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-bg-surface/80 px-3 py-2 text-sm font-medium text-text-primary shadow-sm backdrop-blur transition-colors hover:bg-bg-surface\"\n >\n <Package className=\"h-4 w-4\" /> Orders\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/brands/${brand.id}/edit`)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text shadow-sm transition-colors hover:bg-action-primary-bg/90\"\n >\n <Pencil className=\"h-4 w-4\" /> Edit\n </button>\n </div>\n <div className=\"absolute inset-x-0 bottom-0 flex items-end gap-3 p-4 sm:gap-4 sm:p-5\">\n <Thumbnail\n icon={<Store className=\"h-7 w-7\" />}\n seed={brand.id}\n fileId={brand.logo?.id}\n alt={`${brand.name} logo`}\n className=\"h-16 w-16 shrink-0 rounded-full shadow-md ring-2 ring-bg-surface\"\n />\n <div className=\"min-w-0 pb-1\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-0.5\">\n <h2 className=\"truncate text-xl font-semibold text-text-primary sm:text-2xl\">\n {brand.name}\n </h2>\n <span className=\"text-sm text-text-secondary\">@{brand.handle}</span>\n </div>\n {brand.tagline && (\n <p className=\"mt-1 line-clamp-2 text-sm text-text-primary\">{brand.tagline}</p>\n )}\n </div>\n </div>\n </>\n }\n />\n\n {/* Storefront meta — aesthetics, status, bio, tags, website */}\n <section className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n {brand.aesthetics.length > 0 ? (\n <TagList tags={brand.aesthetics.map(titleCase)} tone=\"accent\" max={12} />\n ) : (\n <span />\n )}\n <StatusBadge status={brand.status} />\n </div>\n {brand.bio && <p className=\"text-sm text-text-secondary\">{brand.bio}</p>}\n {brand.tags.length > 0 && <TagList tags={brand.tags} max={12} />}\n {safeWebsiteUrl ? (\n <a\n href={safeWebsiteUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex max-w-full items-center gap-1.5 text-sm font-medium text-action-primary-bg hover:underline\"\n >\n <ExternalLink className=\"h-4 w-4 shrink-0\" />{' '}\n <span className=\"break-all\">{safeWebsiteUrl}</span>\n </a>\n ) : brand.websiteUrl ? (\n <p className=\"break-all text-sm text-text-secondary\">{brand.websiteUrl}</p>\n ) : null}\n </section>\n\n {/* Collections */}\n <section className=\"mt-6\">\n <div className=\"mb-3 flex items-center justify-between gap-2\">\n <h3 className=\"flex items-center gap-2 text-lg font-semibold text-text-primary\">\n <Shapes className=\"h-5 w-5\" /> Collections ({collections.length})\n </h3>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/collections/new?brandId=${brand.id}`)}\n className=\"inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n <Plus className=\"h-4 w-4\" /> Add collection\n </button>\n </div>\n {collections.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n No collections yet.\n </p>\n ) : (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n {collections.map((c) => (\n <button\n key={c.id}\n type=\"button\"\n onClick={() => navigateTo(`/collections/${c.id}`)}\n className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 text-left transition-colors hover:bg-bg-sunken/50\"\n >\n <Thumbnail\n icon={<Shapes className=\"h-5 w-5\" />}\n seed={c.id}\n fileId={c.cover?.id}\n alt={c.name}\n className=\"h-11 w-11 shrink-0\"\n />\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{c.name}</p>\n <p className=\"text-xs text-text-secondary\">{titleCase(c.season)}</p>\n </div>\n <StatusBadge status={c.status} />\n </button>\n ))}\n </div>\n )}\n </section>\n\n {/* Items */}\n <section className=\"mt-6\">\n <h3 className=\"mb-3 flex items-center gap-2 text-lg font-semibold text-text-primary\">\n <Shirt className=\"h-5 w-5\" /> Style items ({items.length})\n </h3>\n {items.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n No items yet.\n </p>\n ) : (\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3\">\n {items.map((item) => (\n <button\n key={item.id}\n type=\"button\"\n onClick={() => navigateTo(`/items/${item.id}`)}\n className=\"overflow-hidden rounded-lg border border-border-seam bg-bg-surface text-left transition-all hover:border-accent-foreground/20 hover:shadow-md\"\n >\n <Thumbnail\n icon={categoryIcon(item.category, 24)}\n seed={item.id}\n fileId={item.image?.id}\n alt={item.name}\n className=\"h-24 w-full\"\n />\n <div className=\"p-3\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{item.name}</p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {formatPrice(item.price, item.currency)}\n </p>\n </div>\n </button>\n ))}\n </div>\n )}\n </section>\n </div>\n\n {/* Sidebar */}\n <div className=\"space-y-4\">\n <GlassCard treatment=\"insight\" className=\"p-5\">\n <h3 className=\"mb-3 text-sm font-semibold text-text-primary\">Publish lifecycle</h3>\n <StepTracker steps={trackerSteps} current={brand.status} className=\"mb-5\" />\n <div className=\"mb-3 flex items-center gap-2\">\n <span className=\"text-sm text-text-secondary\">Current:</span>\n <StatusBadge status={brand.status} />\n </div>\n {nextStates.length === 0 ? (\n <p className=\"text-xs text-text-secondary\">\n This brand is archived (terminal state).\n </p>\n ) : (\n <div className=\"flex flex-col gap-2\">\n {nextStates.map((next) => (\n <button\n key={next}\n type=\"button\"\n disabled={transition.isPending}\n onClick={() => transition.mutate({ id: brand.id, status: next })}\n className={cn(\n 'inline-flex items-center justify-center gap-2 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50'\n )}\n >\n {transition.isPending && <Loader2 className=\"h-3.5 w-3.5 animate-spin\" />}\n Move to {titleCase(next)}\n </button>\n ))}\n </div>\n )}\n {transition.isError && (\n <p className=\"mt-2 text-xs text-status-error-text\">\n {transitionErrorMessage(transition.error)}\n </p>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"plain\" className=\"p-5\">\n <h3 className=\"mb-3 text-sm font-semibold text-text-primary\">Details</h3>\n <dl className=\"space-y-2 text-sm\">\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Handle</dt>\n <dd className=\"text-text-primary\">@{brand.handle}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">Featured</dt>\n <dd className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={brand.isFeatured}\n aria-label={brand.isFeatured ? 'Unfeature this brand' : 'Feature this brand'}\n disabled={updateBrand.isPending}\n onClick={() =>\n updateBrand.mutate({\n id: brand.id,\n input: { isFeatured: !brand.isFeatured },\n })\n }\n className={cn(\n 'relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:opacity-60',\n brand.isFeatured ? 'bg-action-primary-bg' : 'bg-bg-sunken'\n )}\n >\n <span\n className={cn(\n 'inline-block h-4 w-4 rounded-full bg-bg-surface shadow transition-transform',\n brand.isFeatured ? 'translate-x-[1.125rem]' : 'translate-x-0.5'\n )}\n />\n </button>\n {updateBrand.isPending && (\n <Loader2 className=\"h-3.5 w-3.5 animate-spin text-text-secondary\" />\n )}\n </dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Created</dt>\n <dd className=\"text-text-primary\">\n {formatDate(brand.createdAt, { hour: undefined, minute: undefined })}\n </dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Updated</dt>\n <dd className=\"text-text-primary\">\n {formatDate(brand.updatedAt, { hour: undefined, minute: undefined })}\n </dd>\n </div>\n </dl>\n </GlassCard>\n\n {/* Audit trail — who moved this storefront through its lifecycle, from\n the platform ActivityLog rows the svc's audit plugin writes. */}\n <ActivityTrail resourceType=\"coolandlovely-brand\" resourceId={brand.id} />\n\n {/* Reviews & feedback — moved into the sidebar to match the storefront layout */}\n <Comments entityType=\"CooBrand\" entityId={brand.id} className=\"mt-0\" />\n </div>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,IAAwD;CAC5D,OAAO,CAAC,kBAAkB,UAAU;CACpC,gBAAgB;EAAC;EAAa;EAAS;CAAU;CACjD,WAAW,CAAC,aAAa,UAAU;CACnC,WAAW,CAAC,aAAa,UAAU;CACnC,UAAU,CAAC;AACb,GAIM,IAAoC;CAAC;CAAS;CAAkB;AAAW;AAOjF,SAAS,EAAuB,GAAwB;CACtD,IAAM,IAAM,aAAiB,QAAQ,EAAM,UAAU;CACrD,OAAO,oDAAoD,KAAK,CAAG,IAC/D,2CACA;AACN;AAEA,SAAgB,IAAkB;CAChC,IAAM,EAAE,eAAY,EAA+B,GAC7C,EAAE,kBAAe,EAAiB,GAClC,IAAQ,EAAS,CAAO,GACxB,IAAa,EAAmB,GAChC,IAAc,EAAe;CAInC,IAFA,EAAuB,GAAS,EAAM,MAAM,IAAI,GAE5C,EAAM,WACR,OACE,kBAAC,G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AW,CAAA,GAC/C,kBAAC,MAAD;UAAI,WAAU;oBACX,EAAW,EAAM,WAAW;WAAE,MAAM,KAAA;WAAW,QAAQ,KAAA;UAAU,CAAC;SACjE,CAAA,CACD;;OACH;QACK;;KAIX,kBAAC,GAAD;MAAe,cAAa;MAAsB,YAAY,EAAM;KAAK,CAAA;KAGzE,kBAAC,GAAD;MAAU,YAAW;MAAW,UAAU,EAAM;MAAI,WAAU;KAAQ,CAAA;IACnE;KACF;;CACK,CAAA;AAEhB"}
|
|
1
|
+
{"version":3,"file":"BrandDetailPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/brands/BrandDetailPage.tsx"],"sourcesContent":["/**\n * Brand Detail Page\n * @module coolandlovely/pages/brands\n *\n * Renders a single brand storefront (`cooBrand`) with its publish-lifecycle\n * transitions (`cooTransitionBrand`), collections and style items.\n */\n\nimport { useParams } from 'react-router';\nimport {\n Store,\n ExternalLink,\n Pencil,\n ArrowLeft,\n Shapes,\n Shirt,\n Loader2,\n Plus,\n Package,\n} from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { Thumbnail } from '../../components/Thumbnail';\nimport { BrandCover } from '../../components/BrandCover';\nimport { TagList } from '../../components/TagList';\nimport { Comments } from '../../components/Comments';\nimport { StepTracker } from '../../components/StepTracker';\nimport { ActivityTrail } from '../../components/ActivityTrail';\nimport { useContextNavigation } from '../../hooks/useContextNavigation';\nimport { useAssistantEntityName, useBrand, useTransitionBrand, useUpdateBrand } from '../../hooks';\nimport { categoryIcon } from '../../utils/icons';\nimport { formatPrice, formatDate, titleCase } from '../../utils/formatters';\nimport { cn } from '../../utils/cn';\nimport type { CooBrandStatus } from '../../types';\n\n/** Allowed next states per the svc brand state machine (UX guidance only;\n * the service is the authority and rejects illegal jumps). */\nconst NEXT_STATES: Record<CooBrandStatus, CooBrandStatus[]> = {\n DRAFT: ['PENDING_REVIEW', 'ARCHIVED'],\n PENDING_REVIEW: ['PUBLISHED', 'DRAFT', 'ARCHIVED'],\n PUBLISHED: ['SUSPENDED', 'ARCHIVED'],\n SUSPENDED: ['PUBLISHED', 'ARCHIVED'],\n ARCHIVED: [],\n};\n\n/** The publish path a storefront walks. SUSPENDED/ARCHIVED are exits from it,\n * not steps on it, so a brand sitting in one is tracked separately below. */\nconst LIFECYCLE_STEPS: CooBrandStatus[] = ['DRAFT', 'PENDING_REVIEW', 'PUBLISHED'];\n\n/**\n * Reframe the gateway's RBAC refusal in the operator's language. ONLY a\n * permission refusal is relabelled — every other failure keeps the service's\n * own message, so a validation error is never disguised as a role problem.\n */\nfunction transitionErrorMessage(error: unknown): string {\n const raw = error instanceof Error ? error.message : 'Transition failed';\n return /forbidden|permission|not allowed|unauthori[sz]ed/i.test(raw)\n ? 'Your role does not permit this action.'\n : raw;\n}\n\nexport function BrandDetailPage() {\n const { brandId } = useParams<{ brandId: string }>();\n const navigateTo = useContextNavigation();\n const query = useBrand(brandId);\n const transition = useTransitionBrand();\n const updateBrand = useUpdateBrand();\n // Tell the assistant WHICH storefront is on screen (see useAssistantEntity).\n useAssistantEntityName(brandId, query.data?.name);\n\n if (query.isLoading) {\n return (\n <PageLayout title=\"Brand\">\n <LoadingView label=\"Loading brand…\" />\n </PageLayout>\n );\n }\n\n if (query.isError || !query.data) {\n return (\n <PageLayout title=\"Brand\">\n <ErrorView\n title=\"Brand not found\"\n message=\"This storefront could not be loaded or does not exist.\"\n onRetry={() => void query.refetch()}\n />\n </PageLayout>\n );\n }\n\n const brand = query.data;\n const collections = brand.collections ?? [];\n const items = brand.items ?? [];\n const nextStates = NEXT_STATES[brand.status];\n const trackerSteps = LIFECYCLE_STEPS.includes(brand.status)\n ? LIFECYCLE_STEPS\n : ([...LIFECYCLE_STEPS.slice(0, 1), brand.status] as CooBrandStatus[]);\n // Only render a website link for safe http(s) URLs (block javascript:/data: sinks).\n const safeWebsiteUrl =\n brand.websiteUrl && /^https?:\\/\\//i.test(brand.websiteUrl) ? brand.websiteUrl : undefined;\n\n return (\n <PageLayout title={brand.name} description={`@${brand.handle}`}>\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Main column */}\n <div className=\"space-y-6 lg:col-span-2\">\n {/* Storefront hero — cover + logo + identity overlay, floating actions */}\n <BrandCover\n coverFileId={brand.cover?.id}\n logoFileId={brand.logo?.id}\n name={brand.name}\n seed={brand.id}\n className=\"overflow-hidden rounded-xl border border-border-seam shadow-sm\"\n overlay={\n <>\n <div className=\"absolute right-3 top-3 flex flex-wrap items-center justify-end gap-2\">\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-bg-surface/80 px-3 py-2 text-sm font-medium text-text-primary shadow-sm backdrop-blur transition-colors hover:bg-bg-surface\"\n >\n <ArrowLeft className=\"h-4 w-4\" /> Back\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/brand-orders?brand=${brand.id}`)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-bg-surface/80 px-3 py-2 text-sm font-medium text-text-primary shadow-sm backdrop-blur transition-colors hover:bg-bg-surface\"\n >\n <Package className=\"h-4 w-4\" /> Orders\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/brands/${brand.id}/edit`)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text shadow-sm transition-colors hover:bg-action-primary-bg/90\"\n >\n <Pencil className=\"h-4 w-4\" /> Edit\n </button>\n </div>\n <div className=\"absolute inset-x-0 bottom-0 flex items-end gap-3 p-4 sm:gap-4 sm:p-5\">\n <Thumbnail\n icon={<Store className=\"h-7 w-7\" />}\n seed={brand.id}\n fileId={brand.logo?.id}\n alt={`${brand.name} logo`}\n className=\"h-16 w-16 shrink-0 rounded-full shadow-md ring-2 ring-bg-surface\"\n />\n <div className=\"min-w-0 pb-1\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-0.5\">\n <h2 className=\"truncate text-xl font-semibold text-text-primary sm:text-2xl\">\n {brand.name}\n </h2>\n <span className=\"text-sm text-text-secondary\">@{brand.handle}</span>\n </div>\n {brand.tagline && (\n <p className=\"mt-1 line-clamp-2 text-sm text-text-primary\">{brand.tagline}</p>\n )}\n </div>\n </div>\n </>\n }\n />\n\n {/* Storefront meta — aesthetics, status, bio, tags, website */}\n <section className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n {brand.aesthetics.length > 0 ? (\n <TagList tags={brand.aesthetics.map(titleCase)} tone=\"accent\" max={12} />\n ) : (\n <span />\n )}\n <StatusBadge status={brand.status} />\n </div>\n {brand.bio && <p className=\"text-sm text-text-secondary\">{brand.bio}</p>}\n {brand.tags.length > 0 && <TagList tags={brand.tags} max={12} />}\n {safeWebsiteUrl ? (\n <a\n href={safeWebsiteUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex max-w-full items-center gap-1.5 text-sm font-medium text-action-primary-bg hover:underline\"\n >\n <ExternalLink className=\"h-4 w-4 shrink-0\" />{' '}\n <span className=\"break-all\">{safeWebsiteUrl}</span>\n </a>\n ) : brand.websiteUrl ? (\n <p className=\"break-all text-sm text-text-secondary\">{brand.websiteUrl}</p>\n ) : null}\n </section>\n\n {/* Collections */}\n <section className=\"mt-6\">\n <div className=\"mb-3 flex items-center justify-between gap-2\">\n <h3 className=\"flex items-center gap-2 text-lg font-semibold text-text-primary\">\n <Shapes className=\"h-5 w-5\" /> Collections ({collections.length})\n </h3>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/collections/new?brandId=${brand.id}`)}\n className=\"inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n <Plus className=\"h-4 w-4\" /> Add collection\n </button>\n </div>\n {collections.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n No collections yet.\n </p>\n ) : (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n {collections.map((c) => (\n <button\n key={c.id}\n type=\"button\"\n onClick={() => navigateTo(`/collections/${c.id}`)}\n className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 text-left transition-colors hover:bg-bg-sunken/50\"\n >\n <Thumbnail\n icon={<Shapes className=\"h-5 w-5\" />}\n seed={c.id}\n fileId={c.cover?.id}\n alt={c.name}\n className=\"h-11 w-11 shrink-0\"\n />\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{c.name}</p>\n <p className=\"text-xs text-text-secondary\">{titleCase(c.season)}</p>\n </div>\n <StatusBadge status={c.status} />\n </button>\n ))}\n </div>\n )}\n </section>\n\n {/* Items */}\n <section className=\"mt-6\">\n <h3 className=\"mb-3 flex items-center gap-2 text-lg font-semibold text-text-primary\">\n <Shirt className=\"h-5 w-5\" /> Style items ({items.length})\n </h3>\n {items.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n No items yet.\n </p>\n ) : (\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3\">\n {items.map((item) => (\n <button\n key={item.id}\n type=\"button\"\n onClick={() => navigateTo(`/items/${item.id}`)}\n className=\"overflow-hidden rounded-lg border border-border-seam bg-bg-surface text-left transition-all hover:border-accent-foreground/20 hover:shadow-md\"\n >\n <Thumbnail\n icon={categoryIcon(item.category, 24)}\n seed={item.id}\n fileId={item.image?.id}\n alt={item.name}\n className=\"h-24 w-full\"\n />\n <div className=\"p-3\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{item.name}</p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {formatPrice(item.price, item.currency)}\n </p>\n </div>\n </button>\n ))}\n </div>\n )}\n </section>\n </div>\n\n {/* Sidebar */}\n <div className=\"space-y-4\">\n <GlassCard treatment=\"insight\" className=\"p-5\">\n <h3 className=\"mb-3 text-sm font-semibold text-text-primary\">Publish lifecycle</h3>\n <StepTracker steps={trackerSteps} current={brand.status} className=\"mb-5\" />\n <div className=\"mb-3 flex items-center gap-2\">\n <span className=\"text-sm text-text-secondary\">Current:</span>\n <StatusBadge status={brand.status} />\n </div>\n {nextStates.length === 0 ? (\n <p className=\"text-xs text-text-secondary\">\n This brand is archived (terminal state).\n </p>\n ) : (\n <div className=\"flex flex-col gap-2\">\n {nextStates.map((next) => (\n <button\n key={next}\n type=\"button\"\n disabled={transition.isPending}\n onClick={() => transition.mutate({ id: brand.id, status: next })}\n className={cn(\n 'inline-flex items-center justify-center gap-2 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50'\n )}\n >\n {transition.isPending && <Loader2 className=\"h-3.5 w-3.5 animate-spin\" />}\n Move to {titleCase(next)}\n </button>\n ))}\n </div>\n )}\n {transition.isError && (\n <p className=\"mt-2 text-xs text-status-error-text\">\n {transitionErrorMessage(transition.error)}\n </p>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"plain\" className=\"p-5\">\n <h3 className=\"mb-3 text-sm font-semibold text-text-primary\">Details</h3>\n <dl className=\"space-y-2 text-sm\">\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Handle</dt>\n <dd className=\"text-text-primary\">@{brand.handle}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">Featured</dt>\n <dd className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={brand.isFeatured}\n aria-label={brand.isFeatured ? 'Unfeature this brand' : 'Feature this brand'}\n disabled={updateBrand.isPending}\n onClick={() =>\n updateBrand.mutate({\n id: brand.id,\n input: { isFeatured: !brand.isFeatured },\n })\n }\n className={cn(\n 'relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:opacity-60',\n brand.isFeatured ? 'bg-action-primary-bg' : 'bg-bg-sunken'\n )}\n >\n <span\n className={cn(\n 'inline-block h-4 w-4 rounded-full bg-bg-surface shadow transition-transform',\n brand.isFeatured ? 'translate-x-[1.125rem]' : 'translate-x-0.5'\n )}\n />\n </button>\n {updateBrand.isPending && (\n <Loader2 className=\"h-3.5 w-3.5 animate-spin text-text-secondary\" />\n )}\n </dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Created</dt>\n <dd className=\"text-text-primary\">\n {formatDate(brand.createdAt, { hour: undefined, minute: undefined })}\n </dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Updated</dt>\n <dd className=\"text-text-primary\">\n {formatDate(brand.updatedAt, { hour: undefined, minute: undefined })}\n </dd>\n </div>\n </dl>\n </GlassCard>\n\n {/* Audit trail — who moved this storefront through its lifecycle, from\n the platform ActivityLog rows the svc's audit plugin writes. */}\n <ActivityTrail resourceType=\"coolandlovely-brand\" resourceId={brand.id} />\n\n {/* Reviews & feedback — moved into the sidebar to match the storefront layout */}\n <Comments entityType=\"CooBrand\" entityId={brand.id} className=\"mt-0\" />\n </div>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,IAAwD;CAC5D,OAAO,CAAC,kBAAkB,UAAU;CACpC,gBAAgB;EAAC;EAAa;EAAS;CAAU;CACjD,WAAW,CAAC,aAAa,UAAU;CACnC,WAAW,CAAC,aAAa,UAAU;CACnC,UAAU,CAAC;AACb,GAIM,IAAoC;CAAC;CAAS;CAAkB;AAAW;AAOjF,SAAS,EAAuB,GAAwB;CACtD,IAAM,IAAM,aAAiB,QAAQ,EAAM,UAAU;CACrD,OAAO,oDAAoD,KAAK,CAAG,IAC/D,2CACA;AACN;AAEA,SAAgB,IAAkB;CAChC,IAAM,EAAE,eA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BACX,EAAW,EAAM,WAAW;WAAE,MAAM,KAAA;WAAW,QAAQ,KAAA;UAAU,CAAC;SACjE,CAAA,CACD;;QACL,kBAAC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,MAAD;UAAI,WAAU;oBAAsB;SAAW,CAAA,GAC/C,kBAAC,MAAD;UAAI,WAAU;oBACX,EAAW,EAAM,WAAW;WAAE,MAAM,KAAA;WAAW,QAAQ,KAAA;UAAU,CAAC;SACjE,CAAA,CACD;;OACH;QACK;;KAIX,kBAAC,GAAD;MAAe,cAAa;MAAsB,YAAY,EAAM;KAAK,CAAA;KAGzE,kBAAC,GAAD;MAAU,YAAW;MAAW,UAAU,EAAM;MAAI,WAAU;KAAQ,CAAA;IACnE;KACF;;CACK,CAAA;AAEhB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useTr as i } from "../../hooks/useTr.js";
|
|
1
|
+
import { cn as e } from "../../utils/cn.js";
|
|
2
|
+
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
|
+
import { useBrands as n } from "../../hooks/useCoolAndLovelyApi.js";
|
|
4
|
+
import { useTr as r } from "../../hooks/useTr.js";
|
|
6
5
|
import "../../hooks/index.js";
|
|
7
|
-
import { ErrorView as
|
|
8
|
-
import { EmptyState as
|
|
9
|
-
import { BrandCard as
|
|
6
|
+
import { ErrorView as i, LoadingView as a } from "../../components/StateViews.js";
|
|
7
|
+
import { EmptyState as o } from "../../components/EmptyState.js";
|
|
8
|
+
import { BrandCard as s } from "../../components/BrandCard.js";
|
|
9
|
+
import { useContextNavigation as c } from "../../hooks/useContextNavigation.js";
|
|
10
10
|
import { useMemo as l, useState as u } from "react";
|
|
11
11
|
import { ChevronLeft as d, ChevronRight as f, Download as p, Plus as m, Star as h, Store as g } from "lucide-react";
|
|
12
12
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
@@ -19,13 +19,13 @@ var b = 24, x = [
|
|
|
19
19
|
"ARCHIVED"
|
|
20
20
|
];
|
|
21
21
|
function S() {
|
|
22
|
-
let
|
|
22
|
+
let S = c(), C = r(), [w, T] = u("ALL"), [E, D] = u(!1), [O, k] = u(0), A = l(() => [{
|
|
23
23
|
value: "ALL",
|
|
24
24
|
label: C("coolandlovely.filters.all", "All")
|
|
25
25
|
}, ...x.map((e) => ({
|
|
26
26
|
value: e,
|
|
27
27
|
label: C(`coolandlovely.status.${e.toLowerCase()}`, e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()))
|
|
28
|
-
}))], [C]), j =
|
|
28
|
+
}))], [C]), j = n({
|
|
29
29
|
status: w === "ALL" ? void 0 : w,
|
|
30
30
|
featured: E ? !0 : void 0,
|
|
31
31
|
pagination: {
|
|
@@ -33,7 +33,7 @@ function S() {
|
|
|
33
33
|
offset: O
|
|
34
34
|
}
|
|
35
35
|
}), M = j.data?.items ?? [], N = j.data?.pageInfo.hasMore ?? !1;
|
|
36
|
-
return /* @__PURE__ */ y(
|
|
36
|
+
return /* @__PURE__ */ y(t, {
|
|
37
37
|
title: C("coolandlovely.page.brandsTitle", "Brands"),
|
|
38
38
|
description: C("coolandlovely.page.brandsSubtitle", "Storefronts on the platform with a real publish lifecycle"),
|
|
39
39
|
actions: /* @__PURE__ */ y("div", {
|
|
@@ -60,26 +60,26 @@ function S() {
|
|
|
60
60
|
}),
|
|
61
61
|
children: [/* @__PURE__ */ y("div", {
|
|
62
62
|
className: "mb-6 flex flex-wrap items-center gap-2",
|
|
63
|
-
children: [A.map((
|
|
63
|
+
children: [A.map((t) => /* @__PURE__ */ v("button", {
|
|
64
64
|
type: "button",
|
|
65
65
|
onClick: () => {
|
|
66
|
-
T(
|
|
66
|
+
T(t.value), k(0);
|
|
67
67
|
},
|
|
68
|
-
className:
|
|
69
|
-
children:
|
|
70
|
-
},
|
|
68
|
+
className: e("rounded-full px-3 py-1.5 text-sm font-medium transition-colors", w === t.value ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
|
|
69
|
+
children: t.label
|
|
70
|
+
}, t.value)), /* @__PURE__ */ y("button", {
|
|
71
71
|
type: "button",
|
|
72
72
|
onClick: () => {
|
|
73
73
|
D((e) => !e), k(0);
|
|
74
74
|
},
|
|
75
|
-
className:
|
|
75
|
+
className: e("ml-auto inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors", E ? "bg-status-warning-bg-subtle text-status-warning-text" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
|
|
76
76
|
children: [
|
|
77
|
-
/* @__PURE__ */ v(h, { className:
|
|
77
|
+
/* @__PURE__ */ v(h, { className: e("h-3.5 w-3.5", E && "fill-status-warning-text") }),
|
|
78
78
|
" ",
|
|
79
79
|
C("coolandlovely.filters.featured", "Featured")
|
|
80
80
|
]
|
|
81
81
|
})]
|
|
82
|
-
}), j.isLoading ? /* @__PURE__ */ v(
|
|
82
|
+
}), j.isLoading ? /* @__PURE__ */ v(a, { label: C("coolandlovely.loading.brands", "Loading brands…") }) : j.isError ? /* @__PURE__ */ v(i, { onRetry: () => void j.refetch() }) : M.length === 0 ? /* @__PURE__ */ v(o, {
|
|
83
83
|
illustration: "empty-data",
|
|
84
84
|
icon: /* @__PURE__ */ v(g, { className: "h-10 w-10" }),
|
|
85
85
|
title: C("coolandlovely.empty.brandsTitle", "No brands yet"),
|
|
@@ -96,7 +96,7 @@ function S() {
|
|
|
96
96
|
})
|
|
97
97
|
}) : /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", {
|
|
98
98
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
|
|
99
|
-
children: M.map((e) => /* @__PURE__ */ v(
|
|
99
|
+
children: M.map((e) => /* @__PURE__ */ v(s, {
|
|
100
100
|
brand: e,
|
|
101
101
|
onClick: () => S(`/brands/${e.id}`)
|
|
102
102
|
}, e.id))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrandsListPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/brands/BrandsListPage.tsx"],"sourcesContent":["/**\n * Brands List Page\n * @module coolandlovely/pages/brands\n *\n * Lists brand storefronts (cursor-paginated `cooListBrands`) with status &\n * featured filters. Each card links to the brand detail page.\n */\n\nimport { useMemo, useState } from 'react';\nimport { Store, Plus, ChevronLeft, ChevronRight, Star, Download } from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { EmptyState } from '../../components/EmptyState';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { useCoolAndLovely } from '../../context/CoolAndLovelyContext';\nimport { useBrands, useTr } from '../../hooks';\nimport { BrandCard } from '../../components/BrandCard';\nimport { cn } from '../../utils/cn';\nimport type { CooBrandStatus } from '../../types';\n\nconst PAGE_SIZE = 24;\n\nconst STATUS_ORDER: CooBrandStatus[] = [\n 'PUBLISHED',\n 'DRAFT',\n 'PENDING_REVIEW',\n 'SUSPENDED',\n 'ARCHIVED',\n];\n\nexport function BrandsListPage() {\n const { navigateTo } = useCoolAndLovely();\n const tr = useTr();\n const [status, setStatus] = useState<CooBrandStatus | 'ALL'>('ALL');\n const [featuredOnly, setFeaturedOnly] = useState(false);\n const [offset, setOffset] = useState(0);\n\n const statusOptions = useMemo(\n () => [\n { value: 'ALL' as const, label: tr('coolandlovely.filters.all', 'All') },\n ...STATUS_ORDER.map((value) => ({\n value,\n label: tr(\n `coolandlovely.status.${value.toLowerCase()}`,\n value.replace(/_/g, ' ').replace(/\\b\\w/g, (c) => c.toUpperCase())\n ),\n })),\n ],\n [tr]\n );\n\n const query = useBrands({\n status: status === 'ALL' ? undefined : status,\n featured: featuredOnly ? true : undefined,\n pagination: { limit: PAGE_SIZE, offset },\n });\n\n const brands = query.data?.items ?? [];\n const hasMore = query.data?.pageInfo.hasMore ?? false;\n\n return (\n <PageLayout\n title={tr('coolandlovely.page.brandsTitle', 'Brands')}\n description={tr(\n 'coolandlovely.page.brandsSubtitle',\n 'Storefronts on the platform with a real publish lifecycle'\n )}\n actions={\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands/import')}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n <Download className=\"h-4 w-4\" />{' '}\n {tr('coolandlovely.actions.importCatalog', 'Import catalog')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands/new')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" /> {tr('coolandlovely.actions.newBrand', 'New brand')}\n </button>\n </div>\n }\n >\n {/* Filters */}\n <div className=\"mb-6 flex flex-wrap items-center gap-2\">\n {statusOptions.map((opt) => (\n <button\n key={opt.value}\n type=\"button\"\n onClick={() => {\n setStatus(opt.value);\n setOffset(0);\n }}\n className={cn(\n 'rounded-full px-3 py-1.5 text-sm font-medium transition-colors',\n status === opt.value\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {opt.label}\n </button>\n ))}\n <button\n type=\"button\"\n onClick={() => {\n setFeaturedOnly((v) => !v);\n setOffset(0);\n }}\n className={cn(\n 'ml-auto inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors',\n featuredOnly\n ? 'bg-status-warning-bg-subtle text-status-warning-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n <Star className={cn('h-3.5 w-3.5', featuredOnly && 'fill-status-warning-text')} />{' '}\n {tr('coolandlovely.filters.featured', 'Featured')}\n </button>\n </div>\n\n {query.isLoading ? (\n <LoadingView label={tr('coolandlovely.loading.brands', 'Loading brands…')} />\n ) : query.isError ? (\n <ErrorView onRetry={() => void query.refetch()} />\n ) : brands.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<Store className=\"h-10 w-10\" />}\n title={tr('coolandlovely.empty.brandsTitle', 'No brands yet')}\n description={tr(\n 'coolandlovely.empty.brandsDescription',\n 'Launch the first storefront to start building the catalogue.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands/new')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n <Plus className=\"h-4 w-4\" /> {tr('coolandlovely.actions.newBrand', 'New brand')}\n </button>\n }\n />\n ) : (\n <>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {brands.map((brand) => (\n <BrandCard\n key={brand.id}\n brand={brand}\n onClick={() => navigateTo(`/brands/${brand.id}`)}\n />\n ))}\n </div>\n\n {/* Pagination */}\n {(offset > 0 || hasMore) && (\n <div className=\"mt-6 flex items-center justify-center gap-2\">\n <button\n type=\"button\"\n disabled={offset === 0}\n onClick={() => setOffset((o) => Math.max(0, o - PAGE_SIZE))}\n className=\"inline-flex items-center gap-1 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-40\"\n >\n <ChevronLeft className=\"h-4 w-4\" />{' '}\n {tr('coolandlovely.pagination.previous', 'Previous')}\n </button>\n <span className=\"text-sm text-text-secondary\">\n {tr('coolandlovely.pagination.page', 'Page {{page}}', {\n page: offset / PAGE_SIZE + 1,\n })}\n </span>\n <button\n type=\"button\"\n disabled={!hasMore}\n onClick={() => setOffset((o) => o + PAGE_SIZE)}\n className=\"inline-flex items-center gap-1 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-40\"\n >\n {tr('coolandlovely.pagination.next', 'Next')} <ChevronRight className=\"h-4 w-4\" />\n </button>\n </div>\n )}\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,UAAD;KACE,MAAK;KACL,UAAU,MAAW;KACrB,eAAe,GAAW,MAAM,KAAK,IAAI,GAAG,IAAI,CAAS,CAAC;KAC1D,WAAU;eAJZ;MAME,kBAAC,GAAD,EAAa,WAAU,UAAW,CAAA;MAAE;MACnC,EAAG,qCAAqC,UAAU;KAC7C;;IACR,kBAAC,QAAD;KAAM,WAAU;eACb,EAAG,iCAAiC,iBAAiB,EACpD,MAAM,IAAS,IAAY,EAC7B,CAAC;IACG,CAAA;IACN,kBAAC,UAAD;KACE,MAAK;KACL,UAAU,CAAC;KACX,eAAe,GAAW,MAAM,IAAI,CAAS;KAC7C,WAAU;eAJZ;MAMG,EAAG,iCAAiC,MAAM;MAAE;MAAC,kBAAC,GAAD,EAAc,WAAU,UAAW,CAAA;KAC3E;;GACL;IAEP,EAAA,CAAA,CAEM;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"BrandsListPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/brands/BrandsListPage.tsx"],"sourcesContent":["/**\n * Brands List Page\n * @module coolandlovely/pages/brands\n *\n * Lists brand storefronts (cursor-paginated `cooListBrands`) with status &\n * featured filters. Each card links to the brand detail page.\n */\n\nimport { useMemo, useState } from 'react';\nimport { Store, Plus, ChevronLeft, ChevronRight, Star, Download } from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { EmptyState } from '../../components/EmptyState';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { useContextNavigation } from '../../hooks/useContextNavigation';\nimport { useBrands, useTr } from '../../hooks';\nimport { BrandCard } from '../../components/BrandCard';\nimport { cn } from '../../utils/cn';\nimport type { CooBrandStatus } from '../../types';\n\nconst PAGE_SIZE = 24;\n\nconst STATUS_ORDER: CooBrandStatus[] = [\n 'PUBLISHED',\n 'DRAFT',\n 'PENDING_REVIEW',\n 'SUSPENDED',\n 'ARCHIVED',\n];\n\nexport function BrandsListPage() {\n const navigateTo = useContextNavigation();\n const tr = useTr();\n const [status, setStatus] = useState<CooBrandStatus | 'ALL'>('ALL');\n const [featuredOnly, setFeaturedOnly] = useState(false);\n const [offset, setOffset] = useState(0);\n\n const statusOptions = useMemo(\n () => [\n { value: 'ALL' as const, label: tr('coolandlovely.filters.all', 'All') },\n ...STATUS_ORDER.map((value) => ({\n value,\n label: tr(\n `coolandlovely.status.${value.toLowerCase()}`,\n value.replace(/_/g, ' ').replace(/\\b\\w/g, (c) => c.toUpperCase())\n ),\n })),\n ],\n [tr]\n );\n\n const query = useBrands({\n status: status === 'ALL' ? undefined : status,\n featured: featuredOnly ? true : undefined,\n pagination: { limit: PAGE_SIZE, offset },\n });\n\n const brands = query.data?.items ?? [];\n const hasMore = query.data?.pageInfo.hasMore ?? false;\n\n return (\n <PageLayout\n title={tr('coolandlovely.page.brandsTitle', 'Brands')}\n description={tr(\n 'coolandlovely.page.brandsSubtitle',\n 'Storefronts on the platform with a real publish lifecycle'\n )}\n actions={\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands/import')}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n <Download className=\"h-4 w-4\" />{' '}\n {tr('coolandlovely.actions.importCatalog', 'Import catalog')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands/new')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" /> {tr('coolandlovely.actions.newBrand', 'New brand')}\n </button>\n </div>\n }\n >\n {/* Filters */}\n <div className=\"mb-6 flex flex-wrap items-center gap-2\">\n {statusOptions.map((opt) => (\n <button\n key={opt.value}\n type=\"button\"\n onClick={() => {\n setStatus(opt.value);\n setOffset(0);\n }}\n className={cn(\n 'rounded-full px-3 py-1.5 text-sm font-medium transition-colors',\n status === opt.value\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {opt.label}\n </button>\n ))}\n <button\n type=\"button\"\n onClick={() => {\n setFeaturedOnly((v) => !v);\n setOffset(0);\n }}\n className={cn(\n 'ml-auto inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors',\n featuredOnly\n ? 'bg-status-warning-bg-subtle text-status-warning-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n <Star className={cn('h-3.5 w-3.5', featuredOnly && 'fill-status-warning-text')} />{' '}\n {tr('coolandlovely.filters.featured', 'Featured')}\n </button>\n </div>\n\n {query.isLoading ? (\n <LoadingView label={tr('coolandlovely.loading.brands', 'Loading brands…')} />\n ) : query.isError ? (\n <ErrorView onRetry={() => void query.refetch()} />\n ) : brands.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<Store className=\"h-10 w-10\" />}\n title={tr('coolandlovely.empty.brandsTitle', 'No brands yet')}\n description={tr(\n 'coolandlovely.empty.brandsDescription',\n 'Launch the first storefront to start building the catalogue.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands/new')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n <Plus className=\"h-4 w-4\" /> {tr('coolandlovely.actions.newBrand', 'New brand')}\n </button>\n }\n />\n ) : (\n <>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {brands.map((brand) => (\n <BrandCard\n key={brand.id}\n brand={brand}\n onClick={() => navigateTo(`/brands/${brand.id}`)}\n />\n ))}\n </div>\n\n {/* Pagination */}\n {(offset > 0 || hasMore) && (\n <div className=\"mt-6 flex items-center justify-center gap-2\">\n <button\n type=\"button\"\n disabled={offset === 0}\n onClick={() => setOffset((o) => Math.max(0, o - PAGE_SIZE))}\n className=\"inline-flex items-center gap-1 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-40\"\n >\n <ChevronLeft className=\"h-4 w-4\" />{' '}\n {tr('coolandlovely.pagination.previous', 'Previous')}\n </button>\n <span className=\"text-sm text-text-secondary\">\n {tr('coolandlovely.pagination.page', 'Page {{page}}', {\n page: offset / PAGE_SIZE + 1,\n })}\n </span>\n <button\n type=\"button\"\n disabled={!hasMore}\n onClick={() => setOffset((o) => o + PAGE_SIZE)}\n className=\"inline-flex items-center gap-1 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-40\"\n >\n {tr('coolandlovely.pagination.next', 'Next')} <ChevronRight className=\"h-4 w-4\" />\n </button>\n </div>\n )}\n </>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,IAAM,IAAY,IAEZ,IAAiC;CACrC;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgB,IAAiB;CAC/B,IAAM,IAAa,EAAqB,GAClC,IAAK,EAAM,GACX,CAAC,GAAQ,KAAa,EAAiC,KAAK,GAC5D,CAAC,GAAc,KAAmB,EAAS,EAAK,GAChD,CAAC,GAAQ,KAAa,EAAS,CAAC,GAEhC,IAAgB,QACd,CACJ;EAAE,OAAO;EAAgB,OAAO,EAAG,6BAA6B,KAAK;CAAE,GACvE,GAAG,EAAa,KAAK,OAAW;EAC9B;EACA,OAAO,EACL,wBAAwB,EAAM,YAAY,KAC1C,EAAM,QAAQ,MAAM,GAAG,CAAC,CAAC,QAAQ,UAAU,MAAM,EAAE,YAAY,CAAC,CAClE;CACF,EAAE,CACJ,GACA,CAAC,CAAE,CACL,GAEM,IAAQ,EAAU;EACtB,QAAQ,MAAW,QAAQ,KAAA,IAAY;EACvC,UAAU,IAAe,KAAO,KAAA;EAChC,YAAY;GAAE,OAAO;GAAW;EAAO;CACzC,CAAC,GAEK,IAAS,EAAM,M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