@burdenoff/microfe-coolandlovely 2026.1109.4 → 2026.1109.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coolandlovely/CoolAndLovelyRoot.d.ts.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoot.js +8 -0
- package/dist/coolandlovely/CoolAndLovelyRoot.js.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoutes.d.ts.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoutes.js +32 -16
- package/dist/coolandlovely/CoolAndLovelyRoutes.js.map +1 -1
- package/dist/coolandlovely/api/resaleTransport.d.ts +13 -0
- package/dist/coolandlovely/api/resaleTransport.d.ts.map +1 -0
- package/dist/coolandlovely/api/resaleTransport.js +38 -0
- package/dist/coolandlovely/api/resaleTransport.js.map +1 -0
- package/dist/coolandlovely/hooks/useResale.d.ts +12 -0
- package/dist/coolandlovely/hooks/useResale.d.ts.map +1 -0
- package/dist/coolandlovely/hooks/useResale.js +132 -0
- package/dist/coolandlovely/hooks/useResale.js.map +1 -0
- package/dist/coolandlovely/pages/resale/ResaleBrowsePage.d.ts +2 -0
- package/dist/coolandlovely/pages/resale/ResaleBrowsePage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/resale/ResaleBrowsePage.js +164 -0
- package/dist/coolandlovely/pages/resale/ResaleBrowsePage.js.map +1 -0
- package/dist/coolandlovely/pages/resale/ResaleListingPage.d.ts +2 -0
- package/dist/coolandlovely/pages/resale/ResaleListingPage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/resale/ResaleListingPage.js +161 -0
- package/dist/coolandlovely/pages/resale/ResaleListingPage.js.map +1 -0
- package/dist/coolandlovely/pages/resale/ResaleReportsPage.d.ts +2 -0
- package/dist/coolandlovely/pages/resale/ResaleReportsPage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/resale/ResaleReportsPage.js +80 -0
- package/dist/coolandlovely/pages/resale/ResaleReportsPage.js.map +1 -0
- package/dist/coolandlovely/pages/resale/ResaleSellerPage.d.ts +2 -0
- package/dist/coolandlovely/pages/resale/ResaleSellerPage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/resale/ResaleSellerPage.js +235 -0
- package/dist/coolandlovely/pages/resale/ResaleSellerPage.js.map +1 -0
- package/dist/coolandlovely/utils/resalePresentation.d.ts +5 -0
- package/dist/coolandlovely/utils/resalePresentation.d.ts.map +1 -0
- package/dist/coolandlovely/utils/resalePresentation.js +33 -0
- package/dist/coolandlovely/utils/resalePresentation.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +974 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +252 -18
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +66230 -9890
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { PageLayout as e } from "../../components/PageLayout.js";
|
|
2
|
+
import { useTr as t } from "../../hooks/useTr.js";
|
|
3
|
+
import { ErrorView as n, LoadingView as r } from "../../components/StateViews.js";
|
|
4
|
+
import { titleCase as i } from "../../utils/formatters.js";
|
|
5
|
+
import { useContextNavigation as a } from "../../hooks/useContextNavigation.js";
|
|
6
|
+
import { refreshResaleRead as o, useResaleBrowse as s } from "../../hooks/useResale.js";
|
|
7
|
+
import { RESALE_CATEGORIES as c, RESALE_CONDITIONS as l, formatResalePrice as u } from "../../utils/resalePresentation.js";
|
|
8
|
+
import { useState as d } from "react";
|
|
9
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
|
+
import { Button as m, GlassCard as h, Pagination as g } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
//#region src/coolandlovely/pages/resale/ResaleBrowsePage.tsx
|
|
12
|
+
var _ = "w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-text-primary";
|
|
13
|
+
function v() {
|
|
14
|
+
let v = t(), y = a(), [b, x] = d(""), [S, C] = d(""), [w, T] = d(""), [E, D] = d({
|
|
15
|
+
search: "",
|
|
16
|
+
category: "",
|
|
17
|
+
condition: ""
|
|
18
|
+
}), [O, k] = d(0), A = s({
|
|
19
|
+
search: E.search || void 0,
|
|
20
|
+
category: E.category || void 0,
|
|
21
|
+
condition: E.condition || void 0,
|
|
22
|
+
pagination: {
|
|
23
|
+
limit: 20,
|
|
24
|
+
offset: O * 20
|
|
25
|
+
}
|
|
26
|
+
}), j = (e) => {
|
|
27
|
+
e.preventDefault(), D({
|
|
28
|
+
search: b.trim(),
|
|
29
|
+
category: S,
|
|
30
|
+
condition: w
|
|
31
|
+
}), k(0);
|
|
32
|
+
}, M = A.data?.cooResaleListings.items ?? [];
|
|
33
|
+
return /* @__PURE__ */ f(e, {
|
|
34
|
+
title: v("coolandlovely.resale.title", "Pre-loved marketplace"),
|
|
35
|
+
description: v("coolandlovely.resale.description", "Browse reviewed listings from approved seller shops."),
|
|
36
|
+
actions: /* @__PURE__ */ f(m, {
|
|
37
|
+
variant: "outline",
|
|
38
|
+
onClick: () => y("resale/seller"),
|
|
39
|
+
children: v("coolandlovely.resale.myShop", "My resale shop")
|
|
40
|
+
}),
|
|
41
|
+
children: /* @__PURE__ */ p("div", {
|
|
42
|
+
className: "space-y-6",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ p("form", {
|
|
45
|
+
onSubmit: j,
|
|
46
|
+
className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
47
|
+
"aria-label": "Filter resale listings",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ p("label", {
|
|
50
|
+
className: "grid gap-1 text-sm text-text-secondary",
|
|
51
|
+
children: [v("coolandlovely.resale.search", "Search listings"), /* @__PURE__ */ f("input", {
|
|
52
|
+
value: b,
|
|
53
|
+
onChange: (e) => x(e.target.value),
|
|
54
|
+
maxLength: 160,
|
|
55
|
+
className: _
|
|
56
|
+
})]
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ p("label", {
|
|
59
|
+
className: "grid gap-1 text-sm text-text-secondary",
|
|
60
|
+
children: [v("coolandlovely.resale.category", "Category"), /* @__PURE__ */ p("select", {
|
|
61
|
+
value: S,
|
|
62
|
+
onChange: (e) => C(e.target.value),
|
|
63
|
+
className: _,
|
|
64
|
+
children: [/* @__PURE__ */ f("option", {
|
|
65
|
+
value: "",
|
|
66
|
+
children: v("coolandlovely.resale.allCategories", "All categories")
|
|
67
|
+
}), c.map((e) => /* @__PURE__ */ f("option", {
|
|
68
|
+
value: e,
|
|
69
|
+
children: i(e)
|
|
70
|
+
}, e))]
|
|
71
|
+
})]
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ p("label", {
|
|
74
|
+
className: "grid gap-1 text-sm text-text-secondary",
|
|
75
|
+
children: [v("coolandlovely.resale.condition", "Condition"), /* @__PURE__ */ p("select", {
|
|
76
|
+
value: w,
|
|
77
|
+
onChange: (e) => T(e.target.value),
|
|
78
|
+
className: _,
|
|
79
|
+
children: [/* @__PURE__ */ f("option", {
|
|
80
|
+
value: "",
|
|
81
|
+
children: v("coolandlovely.resale.allConditions", "All conditions")
|
|
82
|
+
}), l.map((e) => /* @__PURE__ */ f("option", {
|
|
83
|
+
value: e,
|
|
84
|
+
children: i(e)
|
|
85
|
+
}, e))]
|
|
86
|
+
})]
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ f("div", {
|
|
89
|
+
className: "flex items-end",
|
|
90
|
+
children: /* @__PURE__ */ f(m, {
|
|
91
|
+
type: "submit",
|
|
92
|
+
children: v("coolandlovely.resale.applyFilters", "Apply filters")
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
}),
|
|
97
|
+
A.isPending ? /* @__PURE__ */ f(r, {}) : A.isError ? /* @__PURE__ */ f(n, {
|
|
98
|
+
message: v("coolandlovely.resale.loadError", "Listings could not be loaded. Your filters are preserved."),
|
|
99
|
+
onRetry: () => o(A.refetch)
|
|
100
|
+
}) : M.length === 0 ? /* @__PURE__ */ f("p", {
|
|
101
|
+
role: "status",
|
|
102
|
+
className: "rounded-xl border border-border-seam p-6 text-text-secondary",
|
|
103
|
+
children: v("coolandlovely.resale.empty", "No reviewed listings match these filters.")
|
|
104
|
+
}) : /* @__PURE__ */ f("ul", {
|
|
105
|
+
className: "grid gap-4 sm:grid-cols-2 xl:grid-cols-3",
|
|
106
|
+
"aria-label": "Resale listings",
|
|
107
|
+
children: M.map((e) => /* @__PURE__ */ f("li", {
|
|
108
|
+
className: "min-w-0",
|
|
109
|
+
children: /* @__PURE__ */ f(h, {
|
|
110
|
+
className: "h-full overflow-hidden p-0",
|
|
111
|
+
children: /* @__PURE__ */ p("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
className: "flex h-full w-full flex-col text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",
|
|
114
|
+
onClick: () => y(`resale/listings/${e.id}`),
|
|
115
|
+
children: [e.photoUrls[0] && /* @__PURE__ */ f("img", {
|
|
116
|
+
src: e.photoUrls[0],
|
|
117
|
+
alt: e.title,
|
|
118
|
+
loading: "lazy",
|
|
119
|
+
className: "aspect-square w-full object-cover"
|
|
120
|
+
}), /* @__PURE__ */ p("div", {
|
|
121
|
+
className: "grid w-full gap-2 p-4",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ f("h2", {
|
|
124
|
+
className: "break-words text-lg font-semibold text-text-primary",
|
|
125
|
+
children: e.title
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ f("p", {
|
|
128
|
+
className: "font-semibold text-text-primary",
|
|
129
|
+
children: u(e.priceMinor, e.currency)
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ p("p", {
|
|
132
|
+
className: "text-sm text-text-secondary",
|
|
133
|
+
children: [
|
|
134
|
+
i(e.condition),
|
|
135
|
+
" · ",
|
|
136
|
+
e.size
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ f("p", {
|
|
140
|
+
className: "break-words text-sm text-text-secondary",
|
|
141
|
+
children: e.shop.name
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
})]
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
}, e.id))
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ f(g, {
|
|
150
|
+
page: O + 1,
|
|
151
|
+
pageSize: 20,
|
|
152
|
+
hasNextPage: A.data?.cooResaleListings.pageInfo.hasMore ?? !1,
|
|
153
|
+
hasPreviousPage: O > 0,
|
|
154
|
+
loading: A.isFetching,
|
|
155
|
+
onPageChange: (e) => k(e - 1)
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
export { v as ResaleBrowsePage };
|
|
163
|
+
|
|
164
|
+
//# sourceMappingURL=ResaleBrowsePage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResaleBrowsePage.js","names":[],"sources":["../../../../src/coolandlovely/pages/resale/ResaleBrowsePage.tsx"],"sourcesContent":["import { useState, type FormEvent } from 'react';\nimport { Button, GlassCard, Pagination } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { ErrorView, LoadingView } from '../../components/StateViews';\nimport { useContextNavigation } from '../../hooks/useContextNavigation';\nimport { RESALE_PAGE_SIZE, refreshResaleRead, useResaleBrowse } from '../../hooks/useResale';\nimport { useTr } from '../../hooks/useTr';\nimport {\n formatResalePrice,\n RESALE_CATEGORIES,\n RESALE_CONDITIONS,\n} from '../../utils/resalePresentation';\nimport { titleCase } from '../../utils/formatters';\n\nconst control =\n 'w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-text-primary';\n\nexport function ResaleBrowsePage() {\n const tr = useTr();\n const navigate = useContextNavigation();\n const [search, setSearch] = useState('');\n const [category, setCategory] = useState('');\n const [condition, setCondition] = useState('');\n const [applied, setApplied] = useState({ search: '', category: '', condition: '' });\n const [page, setPage] = useState(0);\n const listings = useResaleBrowse({\n search: applied.search || undefined,\n category: applied.category || undefined,\n condition: applied.condition || undefined,\n pagination: { limit: RESALE_PAGE_SIZE, offset: page * RESALE_PAGE_SIZE },\n });\n const submit = (event: FormEvent) => {\n event.preventDefault();\n setApplied({ search: search.trim(), category, condition });\n setPage(0);\n };\n const items = listings.data?.cooResaleListings.items ?? [];\n return (\n <PageLayout\n title={tr('coolandlovely.resale.title', 'Pre-loved marketplace')}\n description={tr(\n 'coolandlovely.resale.description',\n 'Browse reviewed listings from approved seller shops.'\n )}\n actions={\n <Button variant=\"outline\" onClick={() => navigate('resale/seller')}>\n {tr('coolandlovely.resale.myShop', 'My resale shop')}\n </Button>\n }\n >\n <div className=\"space-y-6\">\n <form\n onSubmit={submit}\n className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-4\"\n aria-label=\"Filter resale listings\"\n >\n <label className=\"grid gap-1 text-sm text-text-secondary\">\n {tr('coolandlovely.resale.search', 'Search listings')}\n <input\n value={search}\n onChange={(event) => setSearch(event.target.value)}\n maxLength={160}\n className={control}\n />\n </label>\n <label className=\"grid gap-1 text-sm text-text-secondary\">\n {tr('coolandlovely.resale.category', 'Category')}\n <select\n value={category}\n onChange={(event) => setCategory(event.target.value)}\n className={control}\n >\n <option value=\"\">{tr('coolandlovely.resale.allCategories', 'All categories')}</option>\n {RESALE_CATEGORIES.map((value) => (\n <option key={value} value={value}>\n {titleCase(value)}\n </option>\n ))}\n </select>\n </label>\n <label className=\"grid gap-1 text-sm text-text-secondary\">\n {tr('coolandlovely.resale.condition', 'Condition')}\n <select\n value={condition}\n onChange={(event) => setCondition(event.target.value)}\n className={control}\n >\n <option value=\"\">{tr('coolandlovely.resale.allConditions', 'All conditions')}</option>\n {RESALE_CONDITIONS.map((value) => (\n <option key={value} value={value}>\n {titleCase(value)}\n </option>\n ))}\n </select>\n </label>\n <div className=\"flex items-end\">\n <Button type=\"submit\">\n {tr('coolandlovely.resale.applyFilters', 'Apply filters')}\n </Button>\n </div>\n </form>\n {listings.isPending ? (\n <LoadingView />\n ) : listings.isError ? (\n <ErrorView\n message={tr(\n 'coolandlovely.resale.loadError',\n 'Listings could not be loaded. Your filters are preserved.'\n )}\n onRetry={() => refreshResaleRead(listings.refetch)}\n />\n ) : items.length === 0 ? (\n <p role=\"status\" className=\"rounded-xl border border-border-seam p-6 text-text-secondary\">\n {tr('coolandlovely.resale.empty', 'No reviewed listings match these filters.')}\n </p>\n ) : (\n <ul className=\"grid gap-4 sm:grid-cols-2 xl:grid-cols-3\" aria-label=\"Resale listings\">\n {items.map((item) => (\n <li key={item.id} className=\"min-w-0\">\n <GlassCard className=\"h-full overflow-hidden p-0\">\n <button\n type=\"button\"\n className=\"flex h-full w-full flex-col text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary\"\n onClick={() => navigate(`resale/listings/${item.id}`)}\n >\n {item.photoUrls[0] && (\n <img\n src={item.photoUrls[0]}\n alt={item.title}\n loading=\"lazy\"\n className=\"aspect-square w-full object-cover\"\n />\n )}\n <div className=\"grid w-full gap-2 p-4\">\n <h2 className=\"break-words text-lg font-semibold text-text-primary\">\n {item.title}\n </h2>\n <p className=\"font-semibold text-text-primary\">\n {formatResalePrice(item.priceMinor, item.currency)}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {titleCase(item.condition)} · {item.size}\n </p>\n <p className=\"break-words text-sm text-text-secondary\">{item.shop.name}</p>\n </div>\n </button>\n </GlassCard>\n </li>\n ))}\n </ul>\n )}\n <Pagination\n page={page + 1}\n pageSize={RESALE_PAGE_SIZE}\n hasNextPage={listings.data?.cooResaleListings.pageInfo.hasMore ?? false}\n hasPreviousPage={page > 0}\n loading={listings.isFetching}\n onPageChange={(next) => setPage(next - 1)}\n />\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;AAcA,IAAM,IACJ;AAEF,S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SAAK,WAAU;mBAAf;UACE,kBAAC,MAAD;WAAI,WAAU;qBACX,EAAK;UACJ,CAAA;UACJ,kBAAC,KAAD;WAAG,WAAU;qBACV,EAAkB,EAAK,YAAY,EAAK,QAAQ;UAChD,CAAA;UACH,kBAAC,KAAD;WAAG,WAAU;qBAAb;YACG,EAAU,EAAK,SAAS;YAAE;YAAI,EAAK;WACnC;;UACH,kBAAC,KAAD;WAAG,WAAU;qBAA2C,EAAK,KAAK;UAAQ,CAAA;SACvE;UACC;;MACC,CAAA;KACT,GA7BK,EAAK,EA6BV,CACL;IACC,CAAA;IAEN,kBAAC,GAAD;KACE,MAAM,IAAO;KACb,UAAA;KACA,aAAa,EAAS,MAAM,kBAAkB,SAAS,WAAW;KAClE,iBAAiB,IAAO;KACxB,SAAS,EAAS;KAClB,eAAe,MAAS,EAAQ,IAAO,CAAC;IACzC,CAAA;GACE;;CACK,CAAA;AAEhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResaleListingPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/resale/ResaleListingPage.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,iBAAiB,gCAGhC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { PageLayout as e } from "../../components/PageLayout.js";
|
|
2
|
+
import { useTr as t } from "../../hooks/useTr.js";
|
|
3
|
+
import { ErrorView as n, LoadingView as r } from "../../components/StateViews.js";
|
|
4
|
+
import { titleCase as i } from "../../utils/formatters.js";
|
|
5
|
+
import { useContextNavigation as a } from "../../hooks/useContextNavigation.js";
|
|
6
|
+
import { CooResaleReportListingDocument as o } from "../../../generated/wspace-operations.js";
|
|
7
|
+
import { refreshResaleRead as s, useResaleMutation as c, useResalePublicListing as l } from "../../hooks/useResale.js";
|
|
8
|
+
import { formatResalePrice as u } from "../../utils/resalePresentation.js";
|
|
9
|
+
import { useState as d } from "react";
|
|
10
|
+
import { useParams as f } from "react-router";
|
|
11
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
import { Button as h, GlassCard as g } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
//#region src/coolandlovely/pages/resale/ResaleListingPage.tsx
|
|
14
|
+
function _() {
|
|
15
|
+
let { listingId: e } = f();
|
|
16
|
+
return /* @__PURE__ */ p(v, { listingId: e }, e);
|
|
17
|
+
}
|
|
18
|
+
function v({ listingId: f }) {
|
|
19
|
+
let _ = l(f), v = c(o), y = a(), b = t(), [x, S] = d("OTHER"), [C, w] = d(""), [T, E] = d(""), D = (e) => {
|
|
20
|
+
if (e.preventDefault(), !(!f || v.isPending || v.isSuccess)) {
|
|
21
|
+
if (!C.trim()) {
|
|
22
|
+
E(b("coolandlovely.resale.reportDetailsRequired", "Describe the issue before sending your report."));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
E(""), v.mutate({
|
|
26
|
+
id: f,
|
|
27
|
+
reason: x.trim(),
|
|
28
|
+
details: C.trim()
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, O = _.data?.cooResaleListing;
|
|
32
|
+
return /* @__PURE__ */ p(e, {
|
|
33
|
+
title: O?.title ?? b("coolandlovely.resale.listingTitle", "Resale listing"),
|
|
34
|
+
actions: /* @__PURE__ */ p(h, {
|
|
35
|
+
variant: "outline",
|
|
36
|
+
onClick: () => y("resale"),
|
|
37
|
+
children: b("coolandlovely.resale.back", "Back to marketplace")
|
|
38
|
+
}),
|
|
39
|
+
children: _.isPending ? /* @__PURE__ */ p(r, {}) : _.isError ? /* @__PURE__ */ p(n, {
|
|
40
|
+
message: b("coolandlovely.resale.detailError", "This listing could not be loaded. It may no longer be available."),
|
|
41
|
+
onRetry: () => s(_.refetch)
|
|
42
|
+
}) : O ? /* @__PURE__ */ m("div", {
|
|
43
|
+
className: "grid min-w-0 gap-6 lg:grid-cols-2",
|
|
44
|
+
children: [/* @__PURE__ */ p("div", {
|
|
45
|
+
className: "grid content-start gap-3",
|
|
46
|
+
children: O.photoUrls.map((e, t) => /* @__PURE__ */ p("img", {
|
|
47
|
+
src: e,
|
|
48
|
+
alt: `${O.title}, ${t + 1}`,
|
|
49
|
+
loading: "lazy",
|
|
50
|
+
className: "w-full rounded-xl object-contain"
|
|
51
|
+
}, `${e}:${t}`))
|
|
52
|
+
}), /* @__PURE__ */ m("div", {
|
|
53
|
+
className: "min-w-0 space-y-5",
|
|
54
|
+
children: [/* @__PURE__ */ m(g, {
|
|
55
|
+
className: "space-y-3 p-5",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ p("p", {
|
|
58
|
+
className: "text-2xl font-semibold text-text-primary",
|
|
59
|
+
children: u(O.priceMinor, O.currency)
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ m("p", {
|
|
62
|
+
className: "text-sm text-text-secondary",
|
|
63
|
+
children: [
|
|
64
|
+
i(O.category),
|
|
65
|
+
" · ",
|
|
66
|
+
i(O.condition),
|
|
67
|
+
" · ",
|
|
68
|
+
O.size
|
|
69
|
+
]
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ p("p", {
|
|
72
|
+
className: "whitespace-pre-wrap break-words text-text-primary",
|
|
73
|
+
children: O.description
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ p("h2", {
|
|
76
|
+
className: "text-lg font-semibold text-text-primary",
|
|
77
|
+
children: O.shop.name
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ p("p", {
|
|
80
|
+
className: "whitespace-pre-wrap break-words text-sm text-text-secondary",
|
|
81
|
+
children: O.shop.description
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
}), /* @__PURE__ */ m(g, {
|
|
85
|
+
className: "p-5",
|
|
86
|
+
children: [/* @__PURE__ */ p("h2", {
|
|
87
|
+
className: "mb-3 text-lg font-semibold text-text-primary",
|
|
88
|
+
children: b("coolandlovely.resale.report", "Report this listing")
|
|
89
|
+
}), v.isSuccess ? /* @__PURE__ */ p("p", {
|
|
90
|
+
role: "status",
|
|
91
|
+
className: "text-text-secondary",
|
|
92
|
+
children: b("coolandlovely.resale.reportReceived", "Your report was received for review.")
|
|
93
|
+
}) : /* @__PURE__ */ m("form", {
|
|
94
|
+
onSubmit: D,
|
|
95
|
+
className: "space-y-3",
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ m("label", {
|
|
98
|
+
className: "grid gap-1 text-sm text-text-secondary",
|
|
99
|
+
children: [b("coolandlovely.resale.reportReason", "Reason"), /* @__PURE__ */ p("select", {
|
|
100
|
+
required: !0,
|
|
101
|
+
value: x,
|
|
102
|
+
onChange: (e) => S(e.target.value),
|
|
103
|
+
disabled: v.isPending,
|
|
104
|
+
className: "rounded-lg border border-border-seam bg-bg-surface p-2 text-text-primary",
|
|
105
|
+
children: [
|
|
106
|
+
"COUNTERFEIT",
|
|
107
|
+
"PROHIBITED",
|
|
108
|
+
"MISLEADING",
|
|
109
|
+
"OTHER"
|
|
110
|
+
].map((e) => /* @__PURE__ */ p("option", {
|
|
111
|
+
value: e,
|
|
112
|
+
children: i(e)
|
|
113
|
+
}, e))
|
|
114
|
+
})]
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ m("label", {
|
|
117
|
+
className: "grid gap-1 text-sm text-text-secondary",
|
|
118
|
+
children: [b("coolandlovely.resale.reportDetails", "Details"), /* @__PURE__ */ p("textarea", {
|
|
119
|
+
required: !0,
|
|
120
|
+
maxLength: 2e3,
|
|
121
|
+
value: C,
|
|
122
|
+
onChange: (e) => w(e.target.value),
|
|
123
|
+
disabled: v.isPending,
|
|
124
|
+
className: "min-h-28 rounded-lg border border-border-seam bg-bg-surface p-2 text-text-primary"
|
|
125
|
+
})]
|
|
126
|
+
}),
|
|
127
|
+
T && /* @__PURE__ */ p("p", {
|
|
128
|
+
role: "alert",
|
|
129
|
+
className: "text-status-error-text",
|
|
130
|
+
children: T
|
|
131
|
+
}),
|
|
132
|
+
v.isError && /* @__PURE__ */ p("p", {
|
|
133
|
+
role: "alert",
|
|
134
|
+
className: "text-status-error-text",
|
|
135
|
+
children: b("coolandlovely.resale.reportUnconfirmed", "The report was not confirmed. Check My reports before submitting again.")
|
|
136
|
+
}),
|
|
137
|
+
v.isError && /* @__PURE__ */ p(h, {
|
|
138
|
+
variant: "outline",
|
|
139
|
+
type: "button",
|
|
140
|
+
onClick: () => y("resale/reports"),
|
|
141
|
+
children: b("coolandlovely.resale.myReports", "My reports")
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ p(h, {
|
|
144
|
+
type: "submit",
|
|
145
|
+
disabled: v.isPending || v.isError,
|
|
146
|
+
children: b("coolandlovely.resale.sendReport", "Send report")
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
})]
|
|
150
|
+
})]
|
|
151
|
+
})]
|
|
152
|
+
}) : /* @__PURE__ */ p("p", {
|
|
153
|
+
className: "text-text-secondary",
|
|
154
|
+
children: b("coolandlovely.resale.unavailable", "This listing is no longer available.")
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
export { _ as ResaleListingPage };
|
|
160
|
+
|
|
161
|
+
//# sourceMappingURL=ResaleListingPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResaleListingPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/resale/ResaleListingPage.tsx"],"sourcesContent":["import { useState, type FormEvent } from 'react';\nimport { useParams } from 'react-router';\nimport { Button, GlassCard } from '@burdenoff/fe-libs/ui';\nimport {\n CooResaleReportListingDocument,\n type CooResaleReportListingMutation,\n type CooResaleReportListingMutationVariables,\n} from '../../../generated/wspace-operations';\nimport { PageLayout } from '../../components/PageLayout';\nimport { ErrorView, LoadingView } from '../../components/StateViews';\nimport {\n refreshResaleRead,\n useResaleMutation,\n useResalePublicListing,\n} from '../../hooks/useResale';\nimport { useContextNavigation } from '../../hooks/useContextNavigation';\nimport { useTr } from '../../hooks/useTr';\nimport { formatResalePrice } from '../../utils/resalePresentation';\nimport { titleCase } from '../../utils/formatters';\n\nexport function ResaleListingPage() {\n const { listingId } = useParams();\n return <ResaleListingDetail key={listingId} listingId={listingId} />;\n}\n\nfunction ResaleListingDetail({ listingId }: { listingId: string | undefined }) {\n const listing = useResalePublicListing(listingId);\n const report = useResaleMutation<\n CooResaleReportListingMutation,\n CooResaleReportListingMutationVariables\n >(CooResaleReportListingDocument);\n const navigate = useContextNavigation();\n const tr = useTr();\n const [reason, setReason] = useState('OTHER');\n const [details, setDetails] = useState('');\n const [validation, setValidation] = useState('');\n const submitReport = (event: FormEvent) => {\n event.preventDefault();\n if (!listingId || report.isPending || report.isSuccess) return;\n if (!details.trim()) {\n setValidation(\n tr(\n 'coolandlovely.resale.reportDetailsRequired',\n 'Describe the issue before sending your report.'\n )\n );\n return;\n }\n setValidation('');\n report.mutate({ id: listingId, reason: reason.trim(), details: details.trim() });\n };\n const item = listing.data?.cooResaleListing;\n return (\n <PageLayout\n title={item?.title ?? tr('coolandlovely.resale.listingTitle', 'Resale listing')}\n actions={\n <Button variant=\"outline\" onClick={() => navigate('resale')}>\n {tr('coolandlovely.resale.back', 'Back to marketplace')}\n </Button>\n }\n >\n {listing.isPending ? (\n <LoadingView />\n ) : listing.isError ? (\n <ErrorView\n message={tr(\n 'coolandlovely.resale.detailError',\n 'This listing could not be loaded. It may no longer be available.'\n )}\n onRetry={() => refreshResaleRead(listing.refetch)}\n />\n ) : !item ? (\n <p className=\"text-text-secondary\">\n {tr('coolandlovely.resale.unavailable', 'This listing is no longer available.')}\n </p>\n ) : (\n <div className=\"grid min-w-0 gap-6 lg:grid-cols-2\">\n <div className=\"grid content-start gap-3\">\n {item.photoUrls.map((url, index) => (\n <img\n key={`${url}:${index}`}\n src={url}\n alt={`${item.title}, ${index + 1}`}\n loading=\"lazy\"\n className=\"w-full rounded-xl object-contain\"\n />\n ))}\n </div>\n <div className=\"min-w-0 space-y-5\">\n <GlassCard className=\"space-y-3 p-5\">\n <p className=\"text-2xl font-semibold text-text-primary\">\n {formatResalePrice(item.priceMinor, item.currency)}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {titleCase(item.category)} · {titleCase(item.condition)} · {item.size}\n </p>\n <p className=\"whitespace-pre-wrap break-words text-text-primary\">\n {item.description}\n </p>\n <h2 className=\"text-lg font-semibold text-text-primary\">{item.shop.name}</h2>\n <p className=\"whitespace-pre-wrap break-words text-sm text-text-secondary\">\n {item.shop.description}\n </p>\n </GlassCard>\n <GlassCard className=\"p-5\">\n <h2 className=\"mb-3 text-lg font-semibold text-text-primary\">\n {tr('coolandlovely.resale.report', 'Report this listing')}\n </h2>\n {report.isSuccess ? (\n <p role=\"status\" className=\"text-text-secondary\">\n {tr(\n 'coolandlovely.resale.reportReceived',\n 'Your report was received for review.'\n )}\n </p>\n ) : (\n <form onSubmit={submitReport} className=\"space-y-3\">\n <label className=\"grid gap-1 text-sm text-text-secondary\">\n {tr('coolandlovely.resale.reportReason', 'Reason')}\n <select\n required\n value={reason}\n onChange={(event) => setReason(event.target.value)}\n disabled={report.isPending}\n className=\"rounded-lg border border-border-seam bg-bg-surface p-2 text-text-primary\"\n >\n {['COUNTERFEIT', 'PROHIBITED', 'MISLEADING', 'OTHER'].map((value) => (\n <option key={value} value={value}>\n {titleCase(value)}\n </option>\n ))}\n </select>\n </label>\n <label className=\"grid gap-1 text-sm text-text-secondary\">\n {tr('coolandlovely.resale.reportDetails', 'Details')}\n <textarea\n required\n maxLength={2000}\n value={details}\n onChange={(event) => setDetails(event.target.value)}\n disabled={report.isPending}\n className=\"min-h-28 rounded-lg border border-border-seam bg-bg-surface p-2 text-text-primary\"\n />\n </label>\n {validation && (\n <p role=\"alert\" className=\"text-status-error-text\">\n {validation}\n </p>\n )}\n {report.isError && (\n <p role=\"alert\" className=\"text-status-error-text\">\n {tr(\n 'coolandlovely.resale.reportUnconfirmed',\n 'The report was not confirmed. Check My reports before submitting again.'\n )}\n </p>\n )}\n {report.isError && (\n <Button\n variant=\"outline\"\n type=\"button\"\n onClick={() => navigate('resale/reports')}\n >\n {tr('coolandlovely.resale.myReports', 'My reports')}\n </Button>\n )}\n <Button type=\"submit\" disabled={report.isPending || report.isError}>\n {tr('coolandlovely.resale.sendReport', 'Send report')}\n </Button>\n </form>\n )}\n </GlassCard>\n </div>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,SAAgB,IAAoB;CAClC,IAAM,EAAE,iBAAc,EAAU;CAChC,OAAO,kBAAC,GAAD,EAAgD,aAAY,GAAlC,CAAkC;AACrE;AAEA,SAAS,EAAoB,EAAE,gBAAgD;CAC7E,IAAM,IAAU,EAAuB,CAAS,GAC1C,IAAS,EAGb,CAA8B,GAC1B,IAAW,EAAqB,GAChC,IAAK,EAAM,GACX,CAAC,GAAQ,KAAa,EAAS,OAAO,GACtC,CAAC,GAAS,KAAc,EAAS,EAAE,GACnC,CAAC,GAAY,KAAiB,EAAS,EAAE,GACzC,KAAgB,MAAqB;EACzC,MAAM,eAAe,GACjB,GAAC,KAAa,EAAO,aAAa,EAAO,YAC7C;OAAI,CAAC,EAAQ,KAAK,GAAG;IACnB,EACE,EACE,8CACA,gDACF,CACF;IACA;GACF;GAEA,AADA,EAAc,EAAE,GAChB,EAAO,OAAO;IAAE,IAAI;IAAW,QAAQ,EAAO,KAAK;IAAG,SAAS,EAAQ,KAAK;GAAE,CAAC;EAF/E;CAGF,GACM,IAAO,EAAQ,MAAM;CAC3B,OACE,kBAAC,GAAD;EACE,OAAO,GAAM,SAAS,EAAG,qCAAqC,gBAAgB;EAC9E,SACE,kBAAC,GAAD;GAAQ,SAAQ;GAAU,eAAe,EAAS,QAAQ;aACvD,EAAG,6BAA6B,qBAAqB;EAChD,CAAA;YAGT,EAAQ,YACP,kBAAC,GAAD,CAAc,CAAA,IACZ,EAAQ,UACV,kBAAC,GAAD;GACE,SAAS,EACP,oCACA,kEACF;GACA,eAAe,EAAkB,EAAQ,OAAO;EACjD,CAAA,IACE,IAKH,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CACT;QACK,CAAA,CACH;;OACP,kBAAC,SAAD;QAAO,WAAU;kBAAjB,CACG,EAAG,sCAAsC,SAAS,GACnD,kBAAC,YAAD;SACE,UAAA;SACA,WAAW;SACX,OAAO;SACP,WAAW,MAAU,EAAW,EAAM,OAAO,KAAK;SAClD,UAAU,EAAO;SACjB,WAAU;QACX,CAAA,CACI;;OACN,KACC,kBAAC,KAAD;QAAG,MAAK;QAAQ,WAAU;kBACvB;OACA,CAAA;OAEJ,EAAO,WACN,kBAAC,KAAD;QAAG,MAAK;QAAQ,WAAU;kBACvB,EACC,0CACA,yEACF;OACC,CAAA;OAEJ,EAAO,WACN,kBAAC,GAAD;QACE,SAAQ;QACR,MAAK;QACL,eAAe,EAAS,gBAAgB;kBAEvC,EAAG,kCAAkC,YAAY;OAC5C,CAAA;OAEV,kBAAC,GAAD;QAAQ,MAAK;QAAS,UAAU,EAAO,aAAa,EAAO;kBACxD,EAAG,mCAAmC,aAAa;OAC9C,CAAA;MACJ;OAEC;MACR;KACF;OArGL,kBAAC,KAAD;GAAG,WAAU;aACV,EAAG,oCAAoC,sCAAsC;EAC7E,CAAA;CAqGK,CAAA;AAEhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResaleReportsPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/resale/ResaleReportsPage.tsx"],"names":[],"mappings":"AAUA,wBAAgB,iBAAiB,gCA+EhC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { PageLayout as e } from "../../components/PageLayout.js";
|
|
2
|
+
import { useTr as t } from "../../hooks/useTr.js";
|
|
3
|
+
import { StatusBadge as n } from "../../components/StatusBadge.js";
|
|
4
|
+
import { ErrorView as r, LoadingView as i } from "../../components/StateViews.js";
|
|
5
|
+
import { titleCase as a } from "../../utils/formatters.js";
|
|
6
|
+
import { useContextNavigation as o } from "../../hooks/useContextNavigation.js";
|
|
7
|
+
import { refreshResaleRead as s, useResaleReports as c } from "../../hooks/useResale.js";
|
|
8
|
+
import { useState as l } from "react";
|
|
9
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
10
|
+
import { Button as f, GlassCard as p, Pagination as m } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
//#region src/coolandlovely/pages/resale/ResaleReportsPage.tsx
|
|
12
|
+
function h() {
|
|
13
|
+
let [h, g] = l(0), _ = c(h), v = t(), y = o(), b = _.data?.cooMyResaleReports.items ?? [];
|
|
14
|
+
return /* @__PURE__ */ u(e, {
|
|
15
|
+
title: v("coolandlovely.resale.myReports", "My reports"),
|
|
16
|
+
description: v("coolandlovely.resale.myReportsDescription", "Review the status of reports submitted from your current account and workspace."),
|
|
17
|
+
actions: /* @__PURE__ */ u(f, {
|
|
18
|
+
variant: "outline",
|
|
19
|
+
onClick: () => y("resale"),
|
|
20
|
+
children: v("coolandlovely.resale.back", "Back to marketplace")
|
|
21
|
+
}),
|
|
22
|
+
children: /* @__PURE__ */ d("div", {
|
|
23
|
+
className: "space-y-4",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ u(f, {
|
|
26
|
+
variant: "outline",
|
|
27
|
+
onClick: () => s(_.refetch),
|
|
28
|
+
disabled: _.isFetching,
|
|
29
|
+
children: v("coolandlovely.resale.refreshReports", "Refresh report status")
|
|
30
|
+
}),
|
|
31
|
+
_.isPending ? /* @__PURE__ */ u(i, {}) : _.isError ? /* @__PURE__ */ u(r, { onRetry: () => s(_.refetch) }) : b.length === 0 ? /* @__PURE__ */ u("p", {
|
|
32
|
+
role: "status",
|
|
33
|
+
className: "text-text-secondary",
|
|
34
|
+
children: v("coolandlovely.resale.noReports", "No reports were found in this account and workspace.")
|
|
35
|
+
}) : /* @__PURE__ */ u("ul", {
|
|
36
|
+
className: "space-y-3",
|
|
37
|
+
"aria-label": "My resale reports",
|
|
38
|
+
children: b.map((e) => /* @__PURE__ */ u("li", { children: /* @__PURE__ */ d(p, {
|
|
39
|
+
className: "min-w-0 space-y-2 p-4",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ d("div", {
|
|
42
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
43
|
+
children: [/* @__PURE__ */ u("h2", {
|
|
44
|
+
className: "text-lg font-semibold text-text-primary",
|
|
45
|
+
children: a(e.reason)
|
|
46
|
+
}), /* @__PURE__ */ u(n, { status: e.status })]
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ u("p", {
|
|
49
|
+
className: "whitespace-pre-wrap break-words text-text-secondary",
|
|
50
|
+
children: e.details
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ u("time", {
|
|
53
|
+
dateTime: e.createdAt,
|
|
54
|
+
className: "text-sm text-text-secondary",
|
|
55
|
+
children: new Date(e.createdAt).toLocaleString()
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ u("div", { children: /* @__PURE__ */ u(f, {
|
|
58
|
+
variant: "outline",
|
|
59
|
+
onClick: () => y(`resale/listings/${e.listingId}`),
|
|
60
|
+
children: v("coolandlovely.resale.openListing", "Open listing")
|
|
61
|
+
}) })
|
|
62
|
+
]
|
|
63
|
+
}) }, e.id))
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ u(m, {
|
|
66
|
+
page: h + 1,
|
|
67
|
+
pageSize: 20,
|
|
68
|
+
hasNextPage: _.data?.cooMyResaleReports.pageInfo.hasMore ?? !1,
|
|
69
|
+
hasPreviousPage: h > 0,
|
|
70
|
+
loading: _.isFetching,
|
|
71
|
+
onPageChange: (e) => g(e - 1)
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { h as ResaleReportsPage };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=ResaleReportsPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResaleReportsPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/resale/ResaleReportsPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Button, GlassCard, Pagination } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { ErrorView, LoadingView } from '../../components/StateViews';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { RESALE_PAGE_SIZE, refreshResaleRead, useResaleReports } from '../../hooks/useResale';\nimport { useContextNavigation } from '../../hooks/useContextNavigation';\nimport { useTr } from '../../hooks/useTr';\nimport { titleCase } from '../../utils/formatters';\n\nexport function ResaleReportsPage() {\n const [page, setPage] = useState(0);\n const reports = useResaleReports(page);\n const tr = useTr();\n const navigate = useContextNavigation();\n const items = reports.data?.cooMyResaleReports.items ?? [];\n return (\n <PageLayout\n title={tr('coolandlovely.resale.myReports', 'My reports')}\n description={tr(\n 'coolandlovely.resale.myReportsDescription',\n 'Review the status of reports submitted from your current account and workspace.'\n )}\n actions={\n <Button variant=\"outline\" onClick={() => navigate('resale')}>\n {tr('coolandlovely.resale.back', 'Back to marketplace')}\n </Button>\n }\n >\n <div className=\"space-y-4\">\n <Button\n variant=\"outline\"\n onClick={() => refreshResaleRead(reports.refetch)}\n disabled={reports.isFetching}\n >\n {tr('coolandlovely.resale.refreshReports', 'Refresh report status')}\n </Button>\n {reports.isPending ? (\n <LoadingView />\n ) : reports.isError ? (\n <ErrorView onRetry={() => refreshResaleRead(reports.refetch)} />\n ) : items.length === 0 ? (\n <p role=\"status\" className=\"text-text-secondary\">\n {tr(\n 'coolandlovely.resale.noReports',\n 'No reports were found in this account and workspace.'\n )}\n </p>\n ) : (\n <ul className=\"space-y-3\" aria-label=\"My resale reports\">\n {items.map((report) => (\n <li key={report.id}>\n <GlassCard className=\"min-w-0 space-y-2 p-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {titleCase(report.reason)}\n </h2>\n <StatusBadge status={report.status} />\n </div>\n <p className=\"whitespace-pre-wrap break-words text-text-secondary\">\n {report.details}\n </p>\n <time dateTime={report.createdAt} className=\"text-sm text-text-secondary\">\n {new Date(report.createdAt).toLocaleString()}\n </time>\n <div>\n <Button\n variant=\"outline\"\n onClick={() => navigate(`resale/listings/${report.listingId}`)}\n >\n {tr('coolandlovely.resale.openListing', 'Open listing')}\n </Button>\n </div>\n </GlassCard>\n </li>\n ))}\n </ul>\n )}\n <Pagination\n page={page + 1}\n pageSize={RESALE_PAGE_SIZE}\n hasNextPage={reports.data?.cooMyResaleReports.pageInfo.hasMore ?? false}\n hasPreviousPage={page > 0}\n loading={reports.isFetching}\n onPageChange={(next) => setPage(next - 1)}\n />\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,IAAoB;CAClC,IAAM,CAAC,GAAM,KAAW,EAAS,CAAC,GAC5B,IAAU,EAAiB,CAAI,GAC/B,IAAK,EAAM,GACX,IAAW,EAAqB,GAChC,IAAQ,EAAQ,MAAM,mBAAmB,SAAS,CAAC;CACzD,OACE,kBAAC,GAAD;EACE,OAAO,EAAG,kCAAkC,YAAY;EACxD,aAAa,EACX,6CACA,iFACF;EACA,SACE,kBAAC,GAAD;GAAQ,SAAQ;GAAU,eAAe,EAAS,QAAQ;aACvD,EAAG,6BAA6B,qBAAqB;EAChD,CAAA;YAGV,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,GAAD;KACE,SAAQ;KACR,eAAe,EAAkB,EAAQ,OAAO;KAChD,UAAU,EAAQ;eAEjB,EAAG,uCAAuC,uBAAuB;IAC5D,CAAA;IACP,EAAQ,YACP,kBAAC,GAAD,CAAc,CAAA,IACZ,EAAQ,UACV,kBAAC,GAAD,EAAW,eAAe,EAAkB,EAAQ,OAAO,EAAI,CAAA,IAC7D,EAAM,WAAW,IACnB,kBAAC,KAAD;KAAG,MAAK;KAAS,WAAU;eACxB,EACC,kCACA,sDACF;IACC,CAAA,IAEH,kBAAC,MAAD;KAAI,WAAU;KAAY,cAAW;eAClC,EAAM,KAAK,MACV,kBAAC,MAAD,EAAA,UACE,kBAAC,GAAD;MAAW,WAAU;gBAArB;OACE,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,MAAD;SAAI,WAAU;mBACX,EAAU,EAAO,MAAM;QACtB,CAAA,GACJ,kBAAC,GAAD,EAAa,QAAQ,EAAO,OAAS,CAAA,CAClC;;OACL,kBAAC,KAAD;QAAG,WAAU;kBACV,EAAO;OACP,CAAA;OACH,kBAAC,QAAD;QAAM,UAAU,EAAO;QAAW,WAAU;kBACzC,IAAI,KAAK,EAAO,SAAS,CAAC,CAAC,eAAe;OACvC,CAAA;OACN,kBAAC,OAAD,EAAA,UACE,kBAAC,GAAD;QACE,SAAQ;QACR,eAAe,EAAS,mBAAmB,EAAO,WAAW;kBAE5D,EAAG,oCAAoC,cAAc;OAChD,CAAA,EACL,CAAA;MACI;QACT,GAvBK,EAAO,EAuBZ,CACL;IACC,CAAA;IAEN,kBAAC,GAAD;KACE,MAAM,IAAO;KACb,UAAA;KACA,aAAa,EAAQ,MAAM,mBAAmB,SAAS,WAAW;KAClE,iBAAiB,IAAO;KACxB,SAAS,EAAQ;KACjB,eAAe,MAAS,EAAQ,IAAO,CAAC;IACzC,CAAA;GACE;;CACK,CAAA;AAEhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResaleSellerPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/resale/ResaleSellerPage.tsx"],"names":[],"mappings":"AA0MA,wBAAgB,gBAAgB,gCAkF/B"}
|