@burdenoff/microfe-healthybowl 2026.612.2 → 2026.612.3
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/healthybowl/pages/marketplace/MarketplacePage.js +347 -346
- package/dist/healthybowl/pages/marketplace/MarketplacePage.js.map +1 -1
- package/dist/healthybowl/pages/network/NetworkOverviewPage.js +170 -169
- package/dist/healthybowl/pages/network/NetworkOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js +196 -195
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { cn as e, formatCurrency as t, formatNumber as n } from "../../utils/helpers.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { useBasePath as r } from "../../hooks/useBasePath.js";
|
|
3
|
+
import { PageLayout as i } from "../../components/PageLayout.js";
|
|
4
|
+
import { StatCard as a } from "../../components/StatCard.js";
|
|
5
|
+
import { StatusBadge as o } from "../../components/StatusBadge.js";
|
|
6
|
+
import { EmptyState as ee } from "../../components/EmptyState.js";
|
|
6
7
|
import { ErrorState as s } from "../../components/ErrorState.js";
|
|
7
|
-
import { ToastContainer as
|
|
8
|
-
import { Breadcrumbs as
|
|
9
|
-
import { Modal as
|
|
10
|
-
import { HBEntityTags as
|
|
8
|
+
import { ToastContainer as te } from "../../components/Toast.js";
|
|
9
|
+
import { Breadcrumbs as ne } from "../../components/Breadcrumbs.js";
|
|
10
|
+
import { Modal as c } from "../../components/Modal.js";
|
|
11
|
+
import { HBEntityTags as re } from "../../components/HBEntityTags.js";
|
|
11
12
|
import "../../components/index.js";
|
|
12
|
-
import { useHealthyBowlData as
|
|
13
|
-
import { useHealthyBowlStore as
|
|
14
|
-
import { useToast as
|
|
15
|
-
import { isNative as
|
|
16
|
-
import { useCallback as
|
|
17
|
-
import { useI18n as
|
|
18
|
-
import { ArrowUpDown as
|
|
19
|
-
import { useNavigate as
|
|
20
|
-
import { Fragment as
|
|
13
|
+
import { useHealthyBowlData as ie } from "../../hooks/useHealthyBowlData.js";
|
|
14
|
+
import { useHealthyBowlStore as ae } from "../../store/healthybowlStore.js";
|
|
15
|
+
import { useToast as oe } from "../../hooks/useToast.js";
|
|
16
|
+
import { isNative as l, nativeConfirm as se, nativeNotify as u, nativeToast as d } from "../../../utils/nativeBridge.js";
|
|
17
|
+
import { useCallback as ce, useEffect as le, useRef as ue, useState as f } from "react";
|
|
18
|
+
import { useI18n as de } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
19
|
+
import { ArrowUpDown as fe, Award as pe, Check as me, ChevronDown as he, Eye as ge, Heart as _e, Info as ve, Leaf as p, Minus as ye, Package as be, Pencil as xe, Plus as Se, Search as Ce, ShoppingCart as m, Star as h, Store as g, Tags as _, Trash2 as we, X as v } from "lucide-react";
|
|
20
|
+
import { useNavigate as Te } from "react-router-dom";
|
|
21
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
21
22
|
//#region src/healthybowl/pages/marketplace/MarketplacePage.tsx
|
|
22
|
-
var
|
|
23
|
+
var Ee = [
|
|
23
24
|
"Vegetables",
|
|
24
25
|
"Fruits",
|
|
25
26
|
"Herbs",
|
|
@@ -27,7 +28,7 @@ var De = [
|
|
|
27
28
|
"Seeds",
|
|
28
29
|
"Supplies",
|
|
29
30
|
"Pest Control"
|
|
30
|
-
],
|
|
31
|
+
], S = {
|
|
31
32
|
name: "",
|
|
32
33
|
category: "Vegetables",
|
|
33
34
|
price: "",
|
|
@@ -37,7 +38,7 @@ var De = [
|
|
|
37
38
|
location: "",
|
|
38
39
|
description: "",
|
|
39
40
|
organicCertified: !1
|
|
40
|
-
},
|
|
41
|
+
}, De = [
|
|
41
42
|
"All",
|
|
42
43
|
"Vegetables",
|
|
43
44
|
"Fruits",
|
|
@@ -46,28 +47,28 @@ var De = [
|
|
|
46
47
|
"Seeds",
|
|
47
48
|
"Supplies",
|
|
48
49
|
"Pest Control"
|
|
49
|
-
],
|
|
50
|
+
], Oe = {
|
|
50
51
|
"price-asc": "Price: Low → High",
|
|
51
52
|
"price-desc": "Price: High → Low",
|
|
52
53
|
rating: "Highest Rated",
|
|
53
54
|
reviews: "Most Reviewed"
|
|
54
55
|
};
|
|
55
|
-
function
|
|
56
|
-
return Array.from({ length: 5 }, (n, r) => /* @__PURE__ */
|
|
56
|
+
function ke(t) {
|
|
57
|
+
return Array.from({ length: 5 }, (n, r) => /* @__PURE__ */ b(h, { className: e("h-3 w-3", r < Math.round(t) ? "fill-warning text-warning" : "text-muted-foreground") }, r));
|
|
57
58
|
}
|
|
58
59
|
var C = () => {
|
|
59
|
-
let { marketplaceProducts: C, loading:
|
|
60
|
-
let n =
|
|
60
|
+
let { marketplaceProducts: C, loading: Ae, errors: je, createMarketplaceProduct: Me, updateMarketplaceProduct: Ne, deleteMarketplaceProduct: Pe } = ie(), { t: Fe } = de(), w = ce((e, t) => {
|
|
61
|
+
let n = Fe(e);
|
|
61
62
|
return n === e ? t : n;
|
|
62
|
-
}, [
|
|
63
|
-
|
|
63
|
+
}, [Fe]), [T, E] = f(""), [D, O] = f("All"), [k, A] = f(null), [j, Ie] = f("rating"), [M, N] = f(!1), [Le, P] = f(/* @__PURE__ */ new Set()), [Re, ze] = f({}), [F, I] = f(null), [Be, L] = f(!1), [R, z] = f(null), [B, V] = f(S), [H, U] = f(!1), W = (e, t) => {
|
|
64
|
+
V((n) => ({
|
|
64
65
|
...n,
|
|
65
66
|
[e]: t
|
|
66
67
|
}));
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
68
|
+
}, Ve = () => {
|
|
69
|
+
z(null), V(S), L(!0);
|
|
70
|
+
}, He = (e) => {
|
|
71
|
+
z(e), V({
|
|
71
72
|
name: e.name ?? "",
|
|
72
73
|
category: e.category ?? "Vegetables",
|
|
73
74
|
price: String(e.price ?? ""),
|
|
@@ -77,13 +78,13 @@ var C = () => {
|
|
|
77
78
|
location: e.location ?? "",
|
|
78
79
|
description: e.description ?? "",
|
|
79
80
|
organicCertified: !!e.organicCertified
|
|
80
|
-
}),
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
let e = Number(
|
|
85
|
-
if (!
|
|
86
|
-
|
|
81
|
+
}), L(!0);
|
|
82
|
+
}, G = () => {
|
|
83
|
+
L(!1), z(null), V(S);
|
|
84
|
+
}, Ue = async () => {
|
|
85
|
+
let e = Number(B.price), t = Number(B.stock);
|
|
86
|
+
if (!B.name.trim() || !B.seller.trim() || !B.price || !B.stock) {
|
|
87
|
+
X({
|
|
87
88
|
title: "Missing required fields",
|
|
88
89
|
description: "Product name, seller, price, and quantity available are required.",
|
|
89
90
|
variant: "warning"
|
|
@@ -91,129 +92,129 @@ var C = () => {
|
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
94
|
if (Number.isNaN(e) || e < 0 || Number.isNaN(t) || t < 0) {
|
|
94
|
-
|
|
95
|
+
X({
|
|
95
96
|
title: "Invalid values",
|
|
96
97
|
description: "Price and quantity must be positive numbers.",
|
|
97
98
|
variant: "warning"
|
|
98
99
|
});
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
+
U(!0);
|
|
102
103
|
try {
|
|
103
|
-
|
|
104
|
-
id:
|
|
105
|
-
name:
|
|
106
|
-
category:
|
|
104
|
+
R ? (await Ne({
|
|
105
|
+
id: R.id,
|
|
106
|
+
name: B.name.trim(),
|
|
107
|
+
category: B.category,
|
|
107
108
|
price: e,
|
|
108
|
-
unit:
|
|
109
|
+
unit: B.unit.trim() || "unit",
|
|
109
110
|
stock: t,
|
|
110
|
-
seller:
|
|
111
|
-
location:
|
|
112
|
-
description:
|
|
113
|
-
organicCertified:
|
|
114
|
-
}),
|
|
111
|
+
seller: B.seller.trim(),
|
|
112
|
+
location: B.location.trim() || void 0,
|
|
113
|
+
description: B.description.trim() || void 0,
|
|
114
|
+
organicCertified: B.organicCertified
|
|
115
|
+
}), X({
|
|
115
116
|
title: "Listing updated",
|
|
116
|
-
description: `${
|
|
117
|
+
description: `${B.name.trim()} has been updated.`,
|
|
117
118
|
variant: "success"
|
|
118
|
-
})) : (await
|
|
119
|
-
name:
|
|
120
|
-
category:
|
|
119
|
+
})) : (await Me({
|
|
120
|
+
name: B.name.trim(),
|
|
121
|
+
category: B.category,
|
|
121
122
|
price: e,
|
|
122
|
-
unit:
|
|
123
|
+
unit: B.unit.trim() || "unit",
|
|
123
124
|
stock: t,
|
|
124
|
-
seller:
|
|
125
|
-
location:
|
|
126
|
-
description:
|
|
127
|
-
organicCertified:
|
|
125
|
+
seller: B.seller.trim(),
|
|
126
|
+
location: B.location.trim() || void 0,
|
|
127
|
+
description: B.description.trim() || "",
|
|
128
|
+
organicCertified: B.organicCertified,
|
|
128
129
|
rating: 0,
|
|
129
130
|
reviews: 0,
|
|
130
131
|
sellerRating: 0
|
|
131
|
-
}),
|
|
132
|
+
}), X({
|
|
132
133
|
title: "Listing published",
|
|
133
|
-
description: `${
|
|
134
|
+
description: `${B.name.trim()} is now live in the marketplace.`,
|
|
134
135
|
variant: "success"
|
|
135
|
-
})),
|
|
136
|
+
})), G();
|
|
136
137
|
} catch (e) {
|
|
137
|
-
|
|
138
|
-
title:
|
|
138
|
+
X({
|
|
139
|
+
title: R ? "Update failed" : "Publish failed",
|
|
139
140
|
description: String(e),
|
|
140
141
|
variant: "error"
|
|
141
142
|
});
|
|
142
143
|
} finally {
|
|
143
|
-
|
|
144
|
+
U(!1);
|
|
144
145
|
}
|
|
145
|
-
},
|
|
146
|
-
if (await
|
|
146
|
+
}, We = async (e) => {
|
|
147
|
+
if (await se({
|
|
147
148
|
title: "Delete listing?",
|
|
148
149
|
message: `${e.name ?? "This listing"} will be permanently removed from the marketplace.`,
|
|
149
150
|
okButtonTitle: "Delete",
|
|
150
151
|
cancelButtonTitle: "Cancel"
|
|
151
152
|
}) !== !1) {
|
|
152
|
-
|
|
153
|
+
U(!0);
|
|
153
154
|
try {
|
|
154
|
-
await
|
|
155
|
+
await Pe(e.id), X({
|
|
155
156
|
title: "Listing deleted",
|
|
156
157
|
description: `${e.name ?? "Listing"} has been removed.`,
|
|
157
158
|
variant: "success"
|
|
158
|
-
}),
|
|
159
|
+
}), l() && (d("Listing deleted"), u("success"));
|
|
159
160
|
} catch (e) {
|
|
160
|
-
|
|
161
|
+
X({
|
|
161
162
|
title: "Delete failed",
|
|
162
163
|
description: String(e),
|
|
163
164
|
variant: "error"
|
|
164
|
-
}),
|
|
165
|
+
}), l() && (d("Delete failed"), u("error"));
|
|
165
166
|
} finally {
|
|
166
|
-
|
|
167
|
+
U(!1);
|
|
167
168
|
}
|
|
168
169
|
}
|
|
169
|
-
},
|
|
170
|
-
|
|
170
|
+
}, K = ue(null), q = Te(), { buildPath: J } = r(), { addToCart: Ge, cart: Ke, wishlist: Y, toggleWishlist: qe } = ae(), { toasts: Je, toast: X, dismiss: Ye } = oe(), Xe = Ke.reduce((e, t) => e + t.quantity, 0);
|
|
171
|
+
le(() => {
|
|
171
172
|
let e = (e) => {
|
|
172
|
-
|
|
173
|
+
K.current && !K.current.contains(e.target) && N(!1);
|
|
173
174
|
};
|
|
174
175
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
175
176
|
}, []);
|
|
176
|
-
let
|
|
177
|
+
let Ze = Array.from(C.flatMap((e) => e.entityTags ?? []).reduce((e, t) => e.has(t.key) ? e : e.set(t.key, t.label), /* @__PURE__ */ new Map()).entries()).map(([e, t]) => ({
|
|
177
178
|
key: e,
|
|
178
179
|
label: t
|
|
179
|
-
})),
|
|
180
|
-
let t = (e.name ?? "").toLowerCase().includes(
|
|
180
|
+
})), Z = C.filter((e) => {
|
|
181
|
+
let t = (e.name ?? "").toLowerCase().includes(T.toLowerCase()) || (e.seller ?? "").toLowerCase().includes(T.toLowerCase()) || (e.description ?? "").toLowerCase().includes(T.toLowerCase()), n = D === "All" || e.category === D, r = !k || (e.entityTags ?? []).some((e) => e.key === k);
|
|
181
182
|
return t && n && r;
|
|
182
183
|
}).sort((e, t) => {
|
|
183
|
-
switch (
|
|
184
|
+
switch (j) {
|
|
184
185
|
case "price-asc": return e.price - t.price;
|
|
185
186
|
case "price-desc": return t.price - e.price;
|
|
186
187
|
case "rating": return t.rating - e.rating;
|
|
187
188
|
case "reviews": return t.reviews - e.reviews;
|
|
188
189
|
default: return 0;
|
|
189
190
|
}
|
|
190
|
-
}),
|
|
191
|
-
|
|
191
|
+
}), Q = C.length, Qe = new Set(C.map((e) => e.category)).size, $e = Q > 0 ? C.reduce((e, t) => e + t.rating, 0) / Q : 0, et = C.filter((e) => e.organicCertified).length, tt = (e) => Re[e] ?? 1, nt = (e, t) => {
|
|
192
|
+
ze((n) => ({
|
|
192
193
|
...n,
|
|
193
194
|
[e]: Math.max(1, t)
|
|
194
195
|
}));
|
|
195
|
-
},
|
|
196
|
-
let t =
|
|
197
|
-
for (let n = 0; n < t; n++)
|
|
196
|
+
}, $ = (e) => {
|
|
197
|
+
let t = tt(e.id);
|
|
198
|
+
for (let n = 0; n < t; n++) Ge({
|
|
198
199
|
productId: e.id,
|
|
199
200
|
name: e.name,
|
|
200
201
|
price: e.price,
|
|
201
202
|
unit: e.unit,
|
|
202
203
|
seller: e.seller
|
|
203
204
|
});
|
|
204
|
-
|
|
205
|
+
P((t) => new Set(t).add(e.id)), X({
|
|
205
206
|
title: "Added to cart (this session)",
|
|
206
207
|
description: `${t}× ${e.name}. Cart isn't saved yet — it resets on refresh.`,
|
|
207
208
|
variant: "info"
|
|
208
209
|
}), setTimeout(() => {
|
|
209
|
-
|
|
210
|
+
P((t) => {
|
|
210
211
|
let n = new Set(t);
|
|
211
212
|
return n.delete(e.id), n;
|
|
212
213
|
});
|
|
213
214
|
}, 1500);
|
|
214
|
-
},
|
|
215
|
-
let t =
|
|
216
|
-
|
|
215
|
+
}, rt = (e) => {
|
|
216
|
+
let t = Y.has(e.id);
|
|
217
|
+
qe(e.id), X(t ? {
|
|
217
218
|
title: "Removed from wishlist",
|
|
218
219
|
description: e.name,
|
|
219
220
|
variant: "info"
|
|
@@ -223,220 +224,220 @@ var C = () => {
|
|
|
223
224
|
variant: "info"
|
|
224
225
|
});
|
|
225
226
|
};
|
|
226
|
-
return /* @__PURE__ */
|
|
227
|
-
title:
|
|
228
|
-
description:
|
|
229
|
-
actions: /* @__PURE__ */
|
|
227
|
+
return /* @__PURE__ */ x(i, {
|
|
228
|
+
title: w("healthybowl.marketplace.title", "Marketplace"),
|
|
229
|
+
description: w("healthybowl.marketplace.description", "Browse organic products from verified sellers"),
|
|
230
|
+
actions: /* @__PURE__ */ x("div", {
|
|
230
231
|
className: "flex items-center gap-2",
|
|
231
232
|
children: [
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
onClick:
|
|
233
|
+
/* @__PURE__ */ x("button", {
|
|
234
|
+
onClick: Ve,
|
|
234
235
|
className: "flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-foreground hover:bg-muted/50",
|
|
235
|
-
children: [/* @__PURE__ */
|
|
236
|
+
children: [/* @__PURE__ */ b(g, { className: "h-4 w-4" }), w("healthybowl.marketplace.actions.listProduct", "List a Product")]
|
|
236
237
|
}),
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
-
onClick: () =>
|
|
238
|
+
/* @__PURE__ */ x("button", {
|
|
239
|
+
onClick: () => q(J("marketplace/wishlist")),
|
|
239
240
|
className: "flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-foreground hover:bg-muted/50",
|
|
240
241
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
/* @__PURE__ */ b(_e, { className: "h-4 w-4" }),
|
|
243
|
+
w("healthybowl.marketplace.actions.wishlist", "Wishlist"),
|
|
244
|
+
Y.size > 0 && /* @__PURE__ */ b("span", {
|
|
244
245
|
className: "ml-0.5 rounded-full bg-muted px-1.5 text-xs font-bold text-foreground",
|
|
245
|
-
children:
|
|
246
|
+
children: Y.size
|
|
246
247
|
})
|
|
247
248
|
]
|
|
248
249
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
onClick: () =>
|
|
250
|
+
/* @__PURE__ */ x("button", {
|
|
251
|
+
onClick: () => q(J("marketplace/cart")),
|
|
251
252
|
className: "relative flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90",
|
|
252
253
|
children: [
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
/* @__PURE__ */ b(m, { className: "h-4 w-4" }),
|
|
255
|
+
w("healthybowl.marketplace.actions.cart", "Cart"),
|
|
256
|
+
Xe > 0 && /* @__PURE__ */ b("span", {
|
|
256
257
|
className: "absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-[10px] font-bold text-background",
|
|
257
|
-
children:
|
|
258
|
+
children: Xe
|
|
258
259
|
})
|
|
259
260
|
]
|
|
260
261
|
})
|
|
261
262
|
]
|
|
262
263
|
}),
|
|
263
264
|
children: [
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ b(ne, { items: [{ label: w("healthybowl.marketplace.breadcrumb", "Marketplace") }] }),
|
|
266
|
+
/* @__PURE__ */ x("div", {
|
|
266
267
|
className: "flex items-start gap-2 rounded-lg border border-border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
267
|
-
children: [/* @__PURE__ */
|
|
268
|
+
children: [/* @__PURE__ */ b(ve, { className: "mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" }), /* @__PURE__ */ b("p", { children: "Product listings are saved and shared across the marketplace, and checking out from the cart places a real order (payment is arranged separately). Cart and wishlist are kept only for this browser session (not saved yet) and reset on refresh." })]
|
|
268
269
|
}),
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ x("div", {
|
|
270
271
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
271
272
|
children: [
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
label:
|
|
274
|
-
value:
|
|
275
|
-
icon: /* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ b(a, {
|
|
274
|
+
label: w("healthybowl.marketplace.stats.totalProducts", "Total Products"),
|
|
275
|
+
value: Q,
|
|
276
|
+
icon: /* @__PURE__ */ b(be, { className: "h-5 w-5" })
|
|
276
277
|
}),
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
-
label:
|
|
279
|
-
value:
|
|
280
|
-
icon: /* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ b(a, {
|
|
279
|
+
label: w("healthybowl.marketplace.stats.categories", "Categories"),
|
|
280
|
+
value: Qe,
|
|
281
|
+
icon: /* @__PURE__ */ b(_, { className: "h-5 w-5" })
|
|
281
282
|
}),
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
label:
|
|
284
|
-
value:
|
|
285
|
-
icon: /* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ b(a, {
|
|
284
|
+
label: w("healthybowl.marketplace.stats.avgRating", "Avg Rating"),
|
|
285
|
+
value: $e.toFixed(1),
|
|
286
|
+
icon: /* @__PURE__ */ b(h, { className: "h-5 w-5" })
|
|
286
287
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
label:
|
|
289
|
-
value:
|
|
290
|
-
icon: /* @__PURE__ */
|
|
288
|
+
/* @__PURE__ */ b(a, {
|
|
289
|
+
label: w("healthybowl.marketplace.stats.organicCertified", "Organic Certified"),
|
|
290
|
+
value: et,
|
|
291
|
+
icon: /* @__PURE__ */ b(pe, { className: "h-5 w-5" })
|
|
291
292
|
})
|
|
292
293
|
]
|
|
293
294
|
}),
|
|
294
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ x("div", {
|
|
295
296
|
className: "flex flex-col gap-4 rounded-lg border border-border bg-card p-4 sm:flex-row sm:items-center sm:justify-between",
|
|
296
|
-
children: [/* @__PURE__ */
|
|
297
|
+
children: [/* @__PURE__ */ x("div", {
|
|
297
298
|
className: "flex flex-1 flex-wrap items-center gap-3",
|
|
298
|
-
children: [/* @__PURE__ */
|
|
299
|
+
children: [/* @__PURE__ */ x("div", {
|
|
299
300
|
className: "relative",
|
|
300
301
|
children: [
|
|
301
|
-
/* @__PURE__ */
|
|
302
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ b(Ce, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
303
|
+
/* @__PURE__ */ b("input", {
|
|
303
304
|
type: "text",
|
|
304
|
-
placeholder:
|
|
305
|
-
value:
|
|
306
|
-
onChange: (e) =>
|
|
305
|
+
placeholder: w("healthybowl.marketplace.search.placeholder", "Search products or sellers..."),
|
|
306
|
+
value: T,
|
|
307
|
+
onChange: (e) => E(e.target.value),
|
|
307
308
|
className: "w-64 rounded-md border border-border bg-background py-2 pl-10 pr-8 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
308
309
|
}),
|
|
309
|
-
|
|
310
|
-
onClick: () =>
|
|
310
|
+
T && /* @__PURE__ */ b("button", {
|
|
311
|
+
onClick: () => E(""),
|
|
311
312
|
className: "absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
312
|
-
children: /* @__PURE__ */ v
|
|
313
|
+
children: /* @__PURE__ */ b(v, { className: "h-3.5 w-3.5" })
|
|
313
314
|
})
|
|
314
315
|
]
|
|
315
|
-
}), /* @__PURE__ */
|
|
316
|
+
}), /* @__PURE__ */ x("div", {
|
|
316
317
|
className: "relative",
|
|
317
|
-
ref:
|
|
318
|
-
children: [/* @__PURE__ */
|
|
319
|
-
onClick: () =>
|
|
318
|
+
ref: K,
|
|
319
|
+
children: [/* @__PURE__ */ x("button", {
|
|
320
|
+
onClick: () => N(!M),
|
|
320
321
|
className: "flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground hover:bg-muted/50",
|
|
321
322
|
children: [
|
|
322
|
-
/* @__PURE__ */
|
|
323
|
-
|
|
324
|
-
/* @__PURE__ */
|
|
323
|
+
/* @__PURE__ */ b(fe, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
324
|
+
Oe[j],
|
|
325
|
+
/* @__PURE__ */ b(he, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
325
326
|
]
|
|
326
|
-
}),
|
|
327
|
+
}), M && /* @__PURE__ */ b("div", {
|
|
327
328
|
className: "absolute left-0 z-20 mt-1 w-48 rounded-md border border-border bg-card shadow-lg",
|
|
328
|
-
children: Object.entries(
|
|
329
|
+
children: Object.entries(Oe).map(([t, n]) => /* @__PURE__ */ b("button", {
|
|
329
330
|
onClick: () => {
|
|
330
|
-
|
|
331
|
+
Ie(t), N(!1);
|
|
331
332
|
},
|
|
332
|
-
className: e("flex w-full items-center px-3 py-2 text-sm hover:bg-muted/50",
|
|
333
|
+
className: e("flex w-full items-center px-3 py-2 text-sm hover:bg-muted/50", j === t ? "font-medium text-primary" : "text-foreground"),
|
|
333
334
|
children: n
|
|
334
335
|
}, t))
|
|
335
336
|
})]
|
|
336
337
|
})]
|
|
337
|
-
}), /* @__PURE__ */
|
|
338
|
+
}), /* @__PURE__ */ x("span", {
|
|
338
339
|
className: "text-xs text-muted-foreground",
|
|
339
340
|
children: [
|
|
340
341
|
"Showing ",
|
|
341
|
-
|
|
342
|
+
Z.length,
|
|
342
343
|
" of ",
|
|
343
|
-
|
|
344
|
+
Q,
|
|
344
345
|
" products"
|
|
345
346
|
]
|
|
346
347
|
})]
|
|
347
348
|
}),
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ b("div", {
|
|
349
350
|
className: "flex flex-wrap gap-1.5",
|
|
350
|
-
children:
|
|
351
|
-
onClick: () =>
|
|
352
|
-
className: e("rounded-full px-3 py-1 text-xs font-medium transition-colors",
|
|
351
|
+
children: De.map((t) => /* @__PURE__ */ b("button", {
|
|
352
|
+
onClick: () => O(t),
|
|
353
|
+
className: e("rounded-full px-3 py-1 text-xs font-medium transition-colors", D === t ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground hover:text-foreground hover:bg-muted/50"),
|
|
353
354
|
children: t
|
|
354
355
|
}, t))
|
|
355
356
|
}),
|
|
356
|
-
|
|
357
|
+
Ze.length > 0 && /* @__PURE__ */ x("div", {
|
|
357
358
|
className: "flex flex-wrap items-center gap-1.5",
|
|
358
359
|
children: [
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ x("span", {
|
|
360
361
|
className: "flex items-center gap-1 text-xs font-medium text-muted-foreground",
|
|
361
|
-
children: [/* @__PURE__ */
|
|
362
|
+
children: [/* @__PURE__ */ b(_, { className: "h-3.5 w-3.5" }), " Tags:"]
|
|
362
363
|
}),
|
|
363
|
-
|
|
364
|
-
onClick: () =>
|
|
365
|
-
className: e("rounded-full px-3 py-1 text-xs font-medium transition-colors",
|
|
364
|
+
Ze.map((t) => /* @__PURE__ */ b("button", {
|
|
365
|
+
onClick: () => A((e) => e === t.key ? null : t.key),
|
|
366
|
+
className: e("rounded-full px-3 py-1 text-xs font-medium transition-colors", k === t.key ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground hover:text-foreground hover:bg-muted/50"),
|
|
366
367
|
children: t.label
|
|
367
368
|
}, t.key)),
|
|
368
|
-
|
|
369
|
-
onClick: () =>
|
|
369
|
+
k && /* @__PURE__ */ x("button", {
|
|
370
|
+
onClick: () => A(null),
|
|
370
371
|
className: "flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground",
|
|
371
|
-
children: [/* @__PURE__ */ v
|
|
372
|
+
children: [/* @__PURE__ */ b(v, { className: "h-3 w-3" }), " Clear"]
|
|
372
373
|
})
|
|
373
374
|
]
|
|
374
375
|
}),
|
|
375
|
-
|
|
376
|
+
Z.length > 0 ? /* @__PURE__ */ b("div", {
|
|
376
377
|
className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
|
|
377
|
-
children:
|
|
378
|
-
let i =
|
|
379
|
-
return /* @__PURE__ */
|
|
378
|
+
children: Z.map((r) => {
|
|
379
|
+
let i = Le.has(r.id), a = Ke.some((e) => e.productId === r.id), ee = Y.has(r.id), s = tt(r.id);
|
|
380
|
+
return /* @__PURE__ */ x("div", {
|
|
380
381
|
className: "flex flex-col rounded-lg border border-border bg-card p-4 shadow-sm transition-shadow hover:shadow-md",
|
|
381
382
|
children: [
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
+
/* @__PURE__ */ x("div", {
|
|
383
384
|
className: "flex items-start justify-between",
|
|
384
|
-
children: [/* @__PURE__ */
|
|
385
|
-
onClick: () =>
|
|
385
|
+
children: [/* @__PURE__ */ b("button", {
|
|
386
|
+
onClick: () => I(r),
|
|
386
387
|
className: "text-left text-sm font-semibold text-foreground hover:underline",
|
|
387
388
|
children: r.name
|
|
388
|
-
}), /* @__PURE__ */
|
|
389
|
+
}), /* @__PURE__ */ x("div", {
|
|
389
390
|
className: "flex items-center gap-1.5",
|
|
390
|
-
children: [r.organicCertified && /* @__PURE__ */
|
|
391
|
+
children: [r.organicCertified && /* @__PURE__ */ x("span", {
|
|
391
392
|
className: "flex items-center gap-0.5 rounded-full bg-success-subtle px-1.5 py-0.5 text-[10px] font-medium text-success",
|
|
392
|
-
children: [/* @__PURE__ */
|
|
393
|
-
}), /* @__PURE__ */
|
|
394
|
-
onClick: () =>
|
|
393
|
+
children: [/* @__PURE__ */ b(p, { className: "h-2.5 w-2.5" }), " Organic"]
|
|
394
|
+
}), /* @__PURE__ */ b("button", {
|
|
395
|
+
onClick: () => rt(r),
|
|
395
396
|
className: "rounded-md p-1 text-muted-foreground hover:text-foreground",
|
|
396
|
-
children: /* @__PURE__ */
|
|
397
|
+
children: /* @__PURE__ */ b(_e, { className: e("h-4 w-4 transition-colors", ee && "fill-destructive text-destructive") })
|
|
397
398
|
})]
|
|
398
399
|
})]
|
|
399
400
|
}),
|
|
400
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ b("div", {
|
|
401
402
|
className: "mt-1.5",
|
|
402
|
-
children: /* @__PURE__ */
|
|
403
|
+
children: /* @__PURE__ */ b(o, {
|
|
403
404
|
label: r.category,
|
|
404
405
|
variant: "muted"
|
|
405
406
|
})
|
|
406
407
|
}),
|
|
407
|
-
/* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ b(re, {
|
|
408
409
|
readOnly: !0,
|
|
409
410
|
entityType: "MARKETPLACE_PRODUCT",
|
|
410
411
|
entityId: r.id,
|
|
411
412
|
tags: r.entityTags ?? [],
|
|
412
413
|
className: "mt-1.5"
|
|
413
414
|
}),
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ x("div", {
|
|
415
416
|
className: "mt-2 flex items-center justify-between",
|
|
416
|
-
children: [/* @__PURE__ */
|
|
417
|
+
children: [/* @__PURE__ */ b("p", {
|
|
417
418
|
className: "text-xs text-muted-foreground",
|
|
418
419
|
children: r.seller
|
|
419
|
-
}), /* @__PURE__ */
|
|
420
|
+
}), /* @__PURE__ */ b("div", {
|
|
420
421
|
className: "flex items-center gap-0.5",
|
|
421
|
-
children:
|
|
422
|
+
children: ke(r.sellerRating)
|
|
422
423
|
})]
|
|
423
424
|
}),
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ x("p", {
|
|
425
426
|
className: "mt-2 text-lg font-bold text-foreground",
|
|
426
|
-
children: [t(r.price), /* @__PURE__ */
|
|
427
|
+
children: [t(r.price), /* @__PURE__ */ x("span", {
|
|
427
428
|
className: "text-xs font-normal text-muted-foreground",
|
|
428
429
|
children: ["/", r.unit]
|
|
429
430
|
})]
|
|
430
431
|
}),
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
+
/* @__PURE__ */ x("div", {
|
|
432
433
|
className: "mt-1.5 flex items-center gap-2",
|
|
433
|
-
children: [/* @__PURE__ */
|
|
434
|
+
children: [/* @__PURE__ */ x("div", {
|
|
434
435
|
className: "flex items-center gap-1",
|
|
435
|
-
children: [/* @__PURE__ */
|
|
436
|
+
children: [/* @__PURE__ */ b(h, { className: "h-3 w-3 fill-warning text-warning" }), /* @__PURE__ */ b("span", {
|
|
436
437
|
className: "text-xs font-medium text-foreground",
|
|
437
438
|
children: r.rating
|
|
438
439
|
})]
|
|
439
|
-
}), /* @__PURE__ */
|
|
440
|
+
}), /* @__PURE__ */ x("span", {
|
|
440
441
|
className: "text-xs text-muted-foreground",
|
|
441
442
|
children: [
|
|
442
443
|
"(",
|
|
@@ -445,224 +446,224 @@ var C = () => {
|
|
|
445
446
|
]
|
|
446
447
|
})]
|
|
447
448
|
}),
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ b("div", {
|
|
449
450
|
className: "mt-2",
|
|
450
|
-
children: /* @__PURE__ */
|
|
451
|
+
children: /* @__PURE__ */ b(o, {
|
|
451
452
|
label: r.stock === 0 ? "Out of Stock" : r.stock < 50 ? `Low Stock (${r.stock})` : "In Stock",
|
|
452
453
|
variant: r.stock === 0 ? "error" : r.stock < 50 ? "warning" : "success",
|
|
453
454
|
dot: !0
|
|
454
455
|
})
|
|
455
456
|
}),
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ x("div", {
|
|
457
458
|
className: "mt-3 flex items-center gap-2",
|
|
458
|
-
children: [/* @__PURE__ */
|
|
459
|
+
children: [/* @__PURE__ */ b("span", {
|
|
459
460
|
className: "text-xs text-muted-foreground",
|
|
460
461
|
children: "Qty:"
|
|
461
|
-
}), /* @__PURE__ */
|
|
462
|
+
}), /* @__PURE__ */ x("div", {
|
|
462
463
|
className: "flex items-center rounded-md border border-border",
|
|
463
464
|
children: [
|
|
464
|
-
/* @__PURE__ */
|
|
465
|
-
onClick: () =>
|
|
466
|
-
disabled:
|
|
465
|
+
/* @__PURE__ */ b("button", {
|
|
466
|
+
onClick: () => nt(r.id, s - 1),
|
|
467
|
+
disabled: s <= 1,
|
|
467
468
|
className: "rounded-l-md px-2 py-1 text-muted-foreground hover:bg-muted/50 disabled:opacity-40",
|
|
468
|
-
children: /* @__PURE__ */
|
|
469
|
+
children: /* @__PURE__ */ b(ye, { className: "h-3 w-3" })
|
|
469
470
|
}),
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
+
/* @__PURE__ */ b("span", {
|
|
471
472
|
className: "min-w-[2rem] text-center text-xs font-medium text-foreground",
|
|
472
|
-
children:
|
|
473
|
+
children: s
|
|
473
474
|
}),
|
|
474
|
-
/* @__PURE__ */
|
|
475
|
-
onClick: () =>
|
|
476
|
-
disabled:
|
|
475
|
+
/* @__PURE__ */ b("button", {
|
|
476
|
+
onClick: () => nt(r.id, s + 1),
|
|
477
|
+
disabled: s >= r.stock,
|
|
477
478
|
className: "rounded-r-md px-2 py-1 text-muted-foreground hover:bg-muted/50 disabled:opacity-40",
|
|
478
|
-
children: /* @__PURE__ */
|
|
479
|
+
children: /* @__PURE__ */ b(Se, { className: "h-3 w-3" })
|
|
479
480
|
})
|
|
480
481
|
]
|
|
481
482
|
})]
|
|
482
483
|
}),
|
|
483
|
-
/* @__PURE__ */
|
|
484
|
+
/* @__PURE__ */ x("div", {
|
|
484
485
|
className: "mt-3 flex items-center gap-2",
|
|
485
|
-
children: [/* @__PURE__ */
|
|
486
|
-
onClick: () =>
|
|
486
|
+
children: [/* @__PURE__ */ b("button", {
|
|
487
|
+
onClick: () => $(r),
|
|
487
488
|
disabled: r.stock === 0,
|
|
488
|
-
className: e("flex flex-1 items-center justify-center gap-1 rounded-md px-3 py-1.5 text-xs font-medium transition-all", i ? "bg-success text-white" :
|
|
489
|
-
children: i ? /* @__PURE__ */ y
|
|
490
|
-
}), /* @__PURE__ */
|
|
491
|
-
onClick: () =>
|
|
489
|
+
className: e("flex flex-1 items-center justify-center gap-1 rounded-md px-3 py-1.5 text-xs font-medium transition-all", i ? "bg-success text-white" : a ? "border border-border bg-muted text-foreground hover:bg-muted/80" : "bg-primary text-primary-foreground hover:bg-primary/90", r.stock === 0 && "cursor-not-allowed opacity-50"),
|
|
490
|
+
children: i ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(me, { className: "h-3 w-3" }), " Added"] }) : a ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(m, { className: "h-3 w-3" }), " Add More"] }) : /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(m, { className: "h-3 w-3" }), " Add to Cart"] })
|
|
491
|
+
}), /* @__PURE__ */ b("button", {
|
|
492
|
+
onClick: () => I(r),
|
|
492
493
|
className: "rounded-md border border-border px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground",
|
|
493
494
|
"aria-label": "Quick view",
|
|
494
|
-
children: /* @__PURE__ */
|
|
495
|
+
children: /* @__PURE__ */ b(ge, { className: "h-3.5 w-3.5" })
|
|
495
496
|
})]
|
|
496
497
|
}),
|
|
497
|
-
/* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ x("div", {
|
|
498
499
|
className: "mt-2 flex items-center gap-2 border-t border-border pt-2",
|
|
499
|
-
children: [/* @__PURE__ */
|
|
500
|
-
onClick: () =>
|
|
501
|
-
disabled:
|
|
500
|
+
children: [/* @__PURE__ */ x("button", {
|
|
501
|
+
onClick: () => He(r),
|
|
502
|
+
disabled: H,
|
|
502
503
|
className: "flex flex-1 items-center justify-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground disabled:opacity-50",
|
|
503
|
-
children: [/* @__PURE__ */
|
|
504
|
-
}), /* @__PURE__ */
|
|
505
|
-
onClick: () =>
|
|
506
|
-
disabled:
|
|
504
|
+
children: [/* @__PURE__ */ b(xe, { className: "h-3 w-3" }), " Edit Listing"]
|
|
505
|
+
}), /* @__PURE__ */ b("button", {
|
|
506
|
+
onClick: () => We(r),
|
|
507
|
+
disabled: H,
|
|
507
508
|
className: "flex items-center justify-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:border-destructive hover:text-destructive disabled:opacity-50",
|
|
508
509
|
"aria-label": "Delete listing",
|
|
509
|
-
children: /* @__PURE__ */
|
|
510
|
+
children: /* @__PURE__ */ b(we, { className: "h-3 w-3" })
|
|
510
511
|
})]
|
|
511
512
|
})
|
|
512
513
|
]
|
|
513
514
|
}, r.id);
|
|
514
515
|
})
|
|
515
|
-
}) :
|
|
516
|
-
icon: /* @__PURE__ */
|
|
517
|
-
title:
|
|
518
|
-
description:
|
|
519
|
-
action:
|
|
516
|
+
}) : je.marketplace ? /* @__PURE__ */ b(s, {}) : /* @__PURE__ */ b(ee, {
|
|
517
|
+
icon: /* @__PURE__ */ b(be, { className: "h-12 w-12 text-muted-foreground" }),
|
|
518
|
+
title: T || D !== "All" ? "No products found" : "No listings yet",
|
|
519
|
+
description: T || D !== "All" ? "Try adjusting your search or category filters." : Ae ? "Loading marketplace products..." : "No products have been listed yet. Be the first to list your farm produce for buyers to discover.",
|
|
520
|
+
action: T || D !== "All" ? /* @__PURE__ */ b("button", {
|
|
520
521
|
onClick: () => {
|
|
521
|
-
|
|
522
|
+
E(""), O("All");
|
|
522
523
|
},
|
|
523
524
|
className: "rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90",
|
|
524
525
|
children: "Clear Filters"
|
|
525
|
-
}) :
|
|
526
|
-
onClick:
|
|
526
|
+
}) : Ae ? void 0 : /* @__PURE__ */ x("button", {
|
|
527
|
+
onClick: Ve,
|
|
527
528
|
className: "flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90",
|
|
528
|
-
children: [/* @__PURE__ */
|
|
529
|
+
children: [/* @__PURE__ */ b(g, { className: "h-4 w-4" }), " List a Product"]
|
|
529
530
|
})
|
|
530
531
|
}),
|
|
531
|
-
/* @__PURE__ */
|
|
532
|
-
open: !!
|
|
533
|
-
onClose: () =>
|
|
534
|
-
title:
|
|
535
|
-
description:
|
|
532
|
+
/* @__PURE__ */ b(c, {
|
|
533
|
+
open: !!F,
|
|
534
|
+
onClose: () => I(null),
|
|
535
|
+
title: F?.name ?? "",
|
|
536
|
+
description: F?.category,
|
|
536
537
|
size: "lg",
|
|
537
|
-
footer:
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
onClick: () =>
|
|
538
|
+
footer: F ? /* @__PURE__ */ x(y, { children: [
|
|
539
|
+
/* @__PURE__ */ b("button", {
|
|
540
|
+
onClick: () => I(null),
|
|
540
541
|
className: "rounded-md border border-border px-4 py-2 text-sm text-muted-foreground hover:text-foreground",
|
|
541
542
|
children: "Close"
|
|
542
543
|
}),
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
+
/* @__PURE__ */ b("button", {
|
|
544
545
|
onClick: () => {
|
|
545
|
-
|
|
546
|
+
q(J(`marketplace/${F.id}`)), I(null);
|
|
546
547
|
},
|
|
547
548
|
className: "rounded-md border border-border px-4 py-2 text-sm text-foreground hover:bg-muted/50",
|
|
548
549
|
children: "View Full Details"
|
|
549
550
|
}),
|
|
550
|
-
/* @__PURE__ */
|
|
551
|
+
/* @__PURE__ */ x("button", {
|
|
551
552
|
onClick: () => {
|
|
552
|
-
|
|
553
|
+
$(F), I(null);
|
|
553
554
|
},
|
|
554
|
-
disabled:
|
|
555
|
+
disabled: F.stock === 0,
|
|
555
556
|
className: "flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50",
|
|
556
|
-
children: [/* @__PURE__ */
|
|
557
|
+
children: [/* @__PURE__ */ b(m, { className: "h-4 w-4" }), " Add to Cart"]
|
|
557
558
|
})
|
|
558
559
|
] }) : void 0,
|
|
559
|
-
children:
|
|
560
|
+
children: F && /* @__PURE__ */ x("div", {
|
|
560
561
|
className: "space-y-4",
|
|
561
562
|
children: [
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ x("div", {
|
|
563
564
|
className: "flex flex-wrap items-center gap-2",
|
|
564
565
|
children: [
|
|
565
|
-
|
|
566
|
+
F.organicCertified && /* @__PURE__ */ x("span", {
|
|
566
567
|
className: "flex items-center gap-1 rounded-full bg-success-subtle px-2.5 py-0.5 text-xs font-medium text-success",
|
|
567
|
-
children: [/* @__PURE__ */
|
|
568
|
+
children: [/* @__PURE__ */ b(p, { className: "h-3 w-3" }), " Organic Certified"]
|
|
568
569
|
}),
|
|
569
|
-
/* @__PURE__ */
|
|
570
|
-
label:
|
|
570
|
+
/* @__PURE__ */ b(o, {
|
|
571
|
+
label: F.category,
|
|
571
572
|
variant: "muted"
|
|
572
573
|
}),
|
|
573
|
-
/* @__PURE__ */
|
|
574
|
-
label:
|
|
575
|
-
variant:
|
|
574
|
+
/* @__PURE__ */ b(o, {
|
|
575
|
+
label: F.stock > 0 ? `${F.stock} in stock` : "Out of Stock",
|
|
576
|
+
variant: F.stock > 0 ? "success" : "error",
|
|
576
577
|
dot: !0
|
|
577
578
|
})
|
|
578
579
|
]
|
|
579
580
|
}),
|
|
580
|
-
/* @__PURE__ */
|
|
581
|
+
/* @__PURE__ */ x("div", {
|
|
581
582
|
className: "flex items-baseline gap-3",
|
|
582
|
-
children: [/* @__PURE__ */
|
|
583
|
+
children: [/* @__PURE__ */ b("span", {
|
|
583
584
|
className: "text-2xl font-bold text-foreground",
|
|
584
|
-
children: t(
|
|
585
|
-
}), /* @__PURE__ */
|
|
585
|
+
children: t(F.price)
|
|
586
|
+
}), /* @__PURE__ */ x("span", {
|
|
586
587
|
className: "text-sm text-muted-foreground",
|
|
587
|
-
children: ["/ ",
|
|
588
|
+
children: ["/ ", F.unit]
|
|
588
589
|
})]
|
|
589
590
|
}),
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ x("div", {
|
|
591
592
|
className: "flex items-center gap-2",
|
|
592
593
|
children: [
|
|
593
|
-
/* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ b("div", {
|
|
594
595
|
className: "flex",
|
|
595
|
-
children:
|
|
596
|
+
children: ke(F.rating)
|
|
596
597
|
}),
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
+
/* @__PURE__ */ b("span", {
|
|
598
599
|
className: "text-sm font-medium text-foreground",
|
|
599
|
-
children:
|
|
600
|
+
children: F.rating
|
|
600
601
|
}),
|
|
601
|
-
/* @__PURE__ */
|
|
602
|
+
/* @__PURE__ */ x("span", {
|
|
602
603
|
className: "text-sm text-muted-foreground",
|
|
603
604
|
children: [
|
|
604
605
|
"(",
|
|
605
|
-
n(
|
|
606
|
+
n(F.reviews),
|
|
606
607
|
" reviews)"
|
|
607
608
|
]
|
|
608
609
|
})
|
|
609
610
|
]
|
|
610
611
|
}),
|
|
611
|
-
/* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("h4", {
|
|
612
613
|
className: "text-sm font-medium text-foreground",
|
|
613
614
|
children: "Description"
|
|
614
|
-
}), /* @__PURE__ */
|
|
615
|
+
}), /* @__PURE__ */ b("p", {
|
|
615
616
|
className: "mt-1 text-sm text-muted-foreground",
|
|
616
|
-
children:
|
|
617
|
+
children: F.description
|
|
617
618
|
})] }),
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("h4", {
|
|
619
620
|
className: "text-sm font-medium text-foreground",
|
|
620
621
|
children: "Tags"
|
|
621
|
-
}), /* @__PURE__ */
|
|
622
|
+
}), /* @__PURE__ */ b(re, {
|
|
622
623
|
entityType: "MARKETPLACE_PRODUCT",
|
|
623
|
-
entityId:
|
|
624
|
-
tags:
|
|
624
|
+
entityId: F.id,
|
|
625
|
+
tags: F.entityTags ?? [],
|
|
625
626
|
className: "mt-1.5"
|
|
626
627
|
})] }),
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
+
/* @__PURE__ */ x("div", {
|
|
628
629
|
className: "rounded-lg border border-border bg-muted/50 p-3",
|
|
629
|
-
children: [/* @__PURE__ */
|
|
630
|
+
children: [/* @__PURE__ */ b("h4", {
|
|
630
631
|
className: "text-sm font-medium text-foreground",
|
|
631
632
|
children: "Seller Information"
|
|
632
|
-
}), /* @__PURE__ */
|
|
633
|
+
}), /* @__PURE__ */ x("div", {
|
|
633
634
|
className: "mt-2 space-y-1 text-sm",
|
|
634
635
|
children: [
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
+
/* @__PURE__ */ x("div", {
|
|
636
637
|
className: "flex items-center justify-between",
|
|
637
|
-
children: [/* @__PURE__ */
|
|
638
|
+
children: [/* @__PURE__ */ b("span", {
|
|
638
639
|
className: "text-muted-foreground",
|
|
639
640
|
children: "Seller"
|
|
640
|
-
}), /* @__PURE__ */
|
|
641
|
+
}), /* @__PURE__ */ b("span", {
|
|
641
642
|
className: "font-medium text-foreground",
|
|
642
|
-
children:
|
|
643
|
+
children: F.seller
|
|
643
644
|
})]
|
|
644
645
|
}),
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ x("div", {
|
|
646
647
|
className: "flex items-center justify-between",
|
|
647
|
-
children: [/* @__PURE__ */
|
|
648
|
+
children: [/* @__PURE__ */ b("span", {
|
|
648
649
|
className: "text-muted-foreground",
|
|
649
650
|
children: "Seller Rating"
|
|
650
|
-
}), /* @__PURE__ */
|
|
651
|
+
}), /* @__PURE__ */ x("div", {
|
|
651
652
|
className: "flex items-center gap-1",
|
|
652
|
-
children: [/* @__PURE__ */
|
|
653
|
+
children: [/* @__PURE__ */ b(h, { className: "h-3 w-3 fill-warning text-warning" }), /* @__PURE__ */ b("span", {
|
|
653
654
|
className: "font-medium text-foreground",
|
|
654
|
-
children:
|
|
655
|
+
children: F.sellerRating
|
|
655
656
|
})]
|
|
656
657
|
})]
|
|
657
658
|
}),
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ x("div", {
|
|
659
660
|
className: "flex items-center justify-between",
|
|
660
|
-
children: [/* @__PURE__ */
|
|
661
|
+
children: [/* @__PURE__ */ b("span", {
|
|
661
662
|
className: "text-muted-foreground",
|
|
662
663
|
children: "Location"
|
|
663
|
-
}), /* @__PURE__ */
|
|
664
|
+
}), /* @__PURE__ */ b("span", {
|
|
664
665
|
className: "text-foreground",
|
|
665
|
-
children:
|
|
666
|
+
children: F.location
|
|
666
667
|
})]
|
|
667
668
|
})
|
|
668
669
|
]
|
|
@@ -671,120 +672,120 @@ var C = () => {
|
|
|
671
672
|
]
|
|
672
673
|
})
|
|
673
674
|
}),
|
|
674
|
-
/* @__PURE__ */
|
|
675
|
-
open:
|
|
676
|
-
onClose:
|
|
677
|
-
title:
|
|
678
|
-
description:
|
|
675
|
+
/* @__PURE__ */ b(c, {
|
|
676
|
+
open: Be,
|
|
677
|
+
onClose: G,
|
|
678
|
+
title: R ? `Edit ${R.name}` : "List a Product",
|
|
679
|
+
description: R ? "Update this marketplace listing. Changes are saved and persist after refresh." : "Publish your farm produce to the marketplace. Listings are saved and persist after refresh.",
|
|
679
680
|
size: "xl",
|
|
680
|
-
footer: /* @__PURE__ */ y
|
|
681
|
-
onClick:
|
|
681
|
+
footer: /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("button", {
|
|
682
|
+
onClick: G,
|
|
682
683
|
className: "rounded-md border border-border px-4 py-2 text-sm text-muted-foreground hover:text-foreground",
|
|
683
684
|
children: "Cancel"
|
|
684
|
-
}), /* @__PURE__ */
|
|
685
|
-
onClick:
|
|
686
|
-
disabled:
|
|
685
|
+
}), /* @__PURE__ */ b("button", {
|
|
686
|
+
onClick: Ue,
|
|
687
|
+
disabled: H,
|
|
687
688
|
className: "rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-60",
|
|
688
|
-
children:
|
|
689
|
+
children: H ? "Saving..." : R ? "Save Changes" : "Publish Listing"
|
|
689
690
|
})] }),
|
|
690
|
-
children: /* @__PURE__ */
|
|
691
|
+
children: /* @__PURE__ */ x("div", {
|
|
691
692
|
className: "grid gap-4 sm:grid-cols-2",
|
|
692
693
|
children: [
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
|
|
694
695
|
className: "text-sm font-medium text-foreground",
|
|
695
696
|
children: "Product Name *"
|
|
696
|
-
}), /* @__PURE__ */
|
|
697
|
+
}), /* @__PURE__ */ b("input", {
|
|
697
698
|
type: "text",
|
|
698
|
-
value:
|
|
699
|
-
onChange: (e) =>
|
|
699
|
+
value: B.name,
|
|
700
|
+
onChange: (e) => W("name", e.target.value),
|
|
700
701
|
placeholder: "e.g., Organic Tomato",
|
|
701
702
|
className: "mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
702
703
|
})] }),
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
|
|
704
705
|
className: "text-sm font-medium text-foreground",
|
|
705
706
|
children: "Category"
|
|
706
|
-
}), /* @__PURE__ */
|
|
707
|
-
value:
|
|
708
|
-
onChange: (e) =>
|
|
707
|
+
}), /* @__PURE__ */ b("select", {
|
|
708
|
+
value: B.category,
|
|
709
|
+
onChange: (e) => W("category", e.target.value),
|
|
709
710
|
className: "mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground",
|
|
710
|
-
children:
|
|
711
|
+
children: Ee.map((e) => /* @__PURE__ */ b("option", {
|
|
711
712
|
value: e,
|
|
712
713
|
children: e
|
|
713
714
|
}, e))
|
|
714
715
|
})] }),
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
|
|
716
717
|
className: "text-sm font-medium text-foreground",
|
|
717
718
|
children: "Price *"
|
|
718
|
-
}), /* @__PURE__ */
|
|
719
|
+
}), /* @__PURE__ */ b("input", {
|
|
719
720
|
type: "number",
|
|
720
721
|
min: 0,
|
|
721
722
|
step: "0.01",
|
|
722
|
-
value:
|
|
723
|
-
onChange: (e) =>
|
|
723
|
+
value: B.price,
|
|
724
|
+
onChange: (e) => W("price", e.target.value),
|
|
724
725
|
placeholder: "e.g., 75",
|
|
725
726
|
className: "mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
726
727
|
})] }),
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
|
|
728
729
|
className: "text-sm font-medium text-foreground",
|
|
729
730
|
children: "Unit"
|
|
730
|
-
}), /* @__PURE__ */
|
|
731
|
+
}), /* @__PURE__ */ b("input", {
|
|
731
732
|
type: "text",
|
|
732
|
-
value:
|
|
733
|
-
onChange: (e) =>
|
|
733
|
+
value: B.unit,
|
|
734
|
+
onChange: (e) => W("unit", e.target.value),
|
|
734
735
|
placeholder: "e.g., kg",
|
|
735
736
|
className: "mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
736
737
|
})] }),
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
|
|
738
739
|
className: "text-sm font-medium text-foreground",
|
|
739
740
|
children: "Quantity Available *"
|
|
740
|
-
}), /* @__PURE__ */
|
|
741
|
+
}), /* @__PURE__ */ b("input", {
|
|
741
742
|
type: "number",
|
|
742
743
|
min: 0,
|
|
743
|
-
value:
|
|
744
|
-
onChange: (e) =>
|
|
744
|
+
value: B.stock,
|
|
745
|
+
onChange: (e) => W("stock", e.target.value),
|
|
745
746
|
placeholder: "e.g., 1000",
|
|
746
747
|
className: "mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
747
748
|
})] }),
|
|
748
|
-
/* @__PURE__ */
|
|
749
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
|
|
749
750
|
className: "text-sm font-medium text-foreground",
|
|
750
751
|
children: "Seller / Farm *"
|
|
751
|
-
}), /* @__PURE__ */
|
|
752
|
+
}), /* @__PURE__ */ b("input", {
|
|
752
753
|
type: "text",
|
|
753
|
-
value:
|
|
754
|
-
onChange: (e) =>
|
|
754
|
+
value: B.seller,
|
|
755
|
+
onChange: (e) => W("seller", e.target.value),
|
|
755
756
|
placeholder: "e.g., Green Valley Farm",
|
|
756
757
|
className: "mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
757
758
|
})] }),
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
|
|
759
760
|
className: "text-sm font-medium text-foreground",
|
|
760
761
|
children: "Location"
|
|
761
|
-
}), /* @__PURE__ */
|
|
762
|
+
}), /* @__PURE__ */ b("input", {
|
|
762
763
|
type: "text",
|
|
763
|
-
value:
|
|
764
|
-
onChange: (e) =>
|
|
764
|
+
value: B.location,
|
|
765
|
+
onChange: (e) => W("location", e.target.value),
|
|
765
766
|
placeholder: "e.g., Pune, Maharashtra",
|
|
766
767
|
className: "mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
767
768
|
})] }),
|
|
768
|
-
/* @__PURE__ */
|
|
769
|
+
/* @__PURE__ */ b("div", {
|
|
769
770
|
className: "flex items-end",
|
|
770
|
-
children: /* @__PURE__ */
|
|
771
|
+
children: /* @__PURE__ */ x("label", {
|
|
771
772
|
className: "flex items-center gap-2 text-sm font-medium text-foreground",
|
|
772
|
-
children: [/* @__PURE__ */
|
|
773
|
+
children: [/* @__PURE__ */ b("input", {
|
|
773
774
|
type: "checkbox",
|
|
774
|
-
checked:
|
|
775
|
-
onChange: (e) =>
|
|
775
|
+
checked: B.organicCertified,
|
|
776
|
+
onChange: (e) => W("organicCertified", e.target.checked),
|
|
776
777
|
className: "h-4 w-4 rounded border-border text-primary focus:ring-ring"
|
|
777
778
|
}), "Organic certified"]
|
|
778
779
|
})
|
|
779
780
|
}),
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ x("div", {
|
|
781
782
|
className: "sm:col-span-2",
|
|
782
|
-
children: [/* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ b("label", {
|
|
783
784
|
className: "text-sm font-medium text-foreground",
|
|
784
785
|
children: "Description"
|
|
785
|
-
}), /* @__PURE__ */
|
|
786
|
-
value:
|
|
787
|
-
onChange: (e) =>
|
|
786
|
+
}), /* @__PURE__ */ b("textarea", {
|
|
787
|
+
value: B.description,
|
|
788
|
+
onChange: (e) => W("description", e.target.value),
|
|
788
789
|
placeholder: "Describe your produce, quality, and any certifications...",
|
|
789
790
|
rows: 3,
|
|
790
791
|
className: "mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
@@ -793,9 +794,9 @@ var C = () => {
|
|
|
793
794
|
]
|
|
794
795
|
})
|
|
795
796
|
}),
|
|
796
|
-
/* @__PURE__ */
|
|
797
|
-
toasts:
|
|
798
|
-
onDismiss:
|
|
797
|
+
/* @__PURE__ */ b(te, {
|
|
798
|
+
toasts: Je,
|
|
799
|
+
onDismiss: Ye
|
|
799
800
|
})
|
|
800
801
|
]
|
|
801
802
|
});
|