@burdenoff/microfe-product 2026.514.3 → 2026.514.4
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsListPage.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/products/pages/ProductsListPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProductsListPage.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/products/pages/ProductsListPage.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,gBAAgB,4CAkX/B"}
|
|
@@ -8,110 +8,124 @@ import { SearchInput as s } from "../../../shared/components/input/SearchInput.j
|
|
|
8
8
|
import { exportToCsv as c } from "../../../shared/utils/exportUtils.js";
|
|
9
9
|
import { nativeConfirm as l, nativeImpact as u, nativeNotify as d } from "../../../../utils/nativeBridge.js";
|
|
10
10
|
import { useState as f } from "react";
|
|
11
|
-
import {
|
|
12
|
-
import { useI18n as
|
|
13
|
-
import { jsx as
|
|
14
|
-
import { PermissionGate as
|
|
11
|
+
import { ChevronLeft as p, ChevronRight as m, Download as h, Eye as g, Plus as _, RefreshCw as v, SquarePen as y, Trash2 as b } from "lucide-react";
|
|
12
|
+
import { useI18n as x } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
13
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
14
|
+
import { PermissionGate as w } from "@burdenoff/fe-libs/shared/components";
|
|
15
15
|
//#region src/product-management/modules/products/pages/ProductsListPage.tsx
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
var T = 20;
|
|
17
|
+
function E() {
|
|
18
|
+
let { navigate: E, basePath: D = "/products" } = e(), { t: O } = x(), k = (e, t) => {
|
|
19
|
+
let n = O(e);
|
|
19
20
|
return n === e ? t : n;
|
|
20
|
-
}, [
|
|
21
|
-
...
|
|
22
|
-
search:
|
|
23
|
-
}, {
|
|
21
|
+
}, [A, j] = f(""), [M, N] = f({}), [P, F] = f(0), { products: I, total: L, hasMore: R, loading: z, error: B, refetch: V } = i({
|
|
22
|
+
...M,
|
|
23
|
+
search: A || void 0
|
|
24
|
+
}, {
|
|
25
|
+
limit: T,
|
|
26
|
+
offset: P * T
|
|
27
|
+
}), { deleteProduct: H, loading: U } = r(), W = (e) => {
|
|
28
|
+
j(e), F(0);
|
|
29
|
+
}, G = (e) => {
|
|
30
|
+
N(e), F(0);
|
|
31
|
+
}, K = async (e) => {
|
|
24
32
|
u("medium");
|
|
25
|
-
let t =
|
|
33
|
+
let t = k("products.confirmDeleteProduct", "Are you sure you want to delete this product?"), n = await l({
|
|
26
34
|
title: "Delete product",
|
|
27
35
|
message: t,
|
|
28
36
|
okButtonTitle: "Delete",
|
|
29
37
|
cancelButtonTitle: "Cancel"
|
|
30
38
|
});
|
|
31
39
|
if (n === null ? window.confirm(t) : n) try {
|
|
32
|
-
await
|
|
40
|
+
await H(e), d("success"), V();
|
|
33
41
|
} catch (e) {
|
|
34
42
|
d("error"), console.error("Failed to delete product:", e);
|
|
35
43
|
}
|
|
36
44
|
};
|
|
37
|
-
|
|
45
|
+
if (z && I.length === 0 && !A && !M.status) return /* @__PURE__ */ S("div", {
|
|
38
46
|
className: "min-h-full bg-[var(--color-bg-canvas)] p-6",
|
|
39
|
-
children: /* @__PURE__ */
|
|
40
|
-
})
|
|
47
|
+
children: /* @__PURE__ */ S(t, { message: k("products.loadingProducts", "Loading products...") })
|
|
48
|
+
});
|
|
49
|
+
if (B && I.length === 0) return /* @__PURE__ */ S("div", {
|
|
41
50
|
className: "min-h-full bg-[var(--color-bg-canvas)] p-6",
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
message:
|
|
51
|
+
children: /* @__PURE__ */ S(n, {
|
|
52
|
+
message: B.message,
|
|
44
53
|
action: {
|
|
45
|
-
label:
|
|
46
|
-
onClick: () =>
|
|
54
|
+
label: k("productCommon.retry", "Retry"),
|
|
55
|
+
onClick: () => V()
|
|
47
56
|
}
|
|
48
57
|
})
|
|
49
|
-
})
|
|
58
|
+
});
|
|
59
|
+
let q = Math.max(1, Math.ceil(L / T)), J = I.length > 0 ? P * T + 1 : 0, Y = Math.min((P + 1) * T, L);
|
|
60
|
+
return /* @__PURE__ */ C("div", {
|
|
50
61
|
className: "min-h-full bg-[var(--color-bg-canvas)] p-6 animate-in fade-in duration-300",
|
|
51
|
-
children: [/* @__PURE__ */
|
|
62
|
+
children: [/* @__PURE__ */ C("div", {
|
|
52
63
|
className: "mb-6",
|
|
53
|
-
children: [/* @__PURE__ */
|
|
64
|
+
children: [/* @__PURE__ */ C("div", {
|
|
54
65
|
className: "flex items-center justify-between mb-4",
|
|
55
|
-
children: [/* @__PURE__ */
|
|
66
|
+
children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("h1", {
|
|
56
67
|
className: "text-3xl font-bold text-text-primary mb-2",
|
|
57
|
-
children:
|
|
58
|
-
}), /* @__PURE__ */
|
|
68
|
+
children: k("products.title", "Products")
|
|
69
|
+
}), /* @__PURE__ */ S("p", {
|
|
59
70
|
className: "text-text-secondary",
|
|
60
|
-
children:
|
|
61
|
-
})] }), /* @__PURE__ */
|
|
71
|
+
children: k("products.subtitle", "Manage platform products and features")
|
|
72
|
+
})] }), /* @__PURE__ */ S(w, {
|
|
62
73
|
role: "super_admin",
|
|
63
|
-
children: /* @__PURE__ */
|
|
64
|
-
onClick: () =>
|
|
74
|
+
children: /* @__PURE__ */ C("button", {
|
|
75
|
+
onClick: () => E(`${D}/new`),
|
|
65
76
|
className: "\n inline-flex items-center gap-2 px-4 py-2\n bg-[var(--color-action-primary-bg)]\n text-[var(--color-action-primary-text)]\n rounded-lg\n hover:opacity-90 hover:scale-[1.02]\n transition-all duration-200\n font-medium\n ",
|
|
66
|
-
children: [/* @__PURE__ */
|
|
77
|
+
children: [/* @__PURE__ */ S(_, { size: 20 }), k("products.createProduct", "Create Product")]
|
|
67
78
|
})
|
|
68
79
|
})]
|
|
69
|
-
}), /* @__PURE__ */
|
|
80
|
+
}), /* @__PURE__ */ C("div", {
|
|
70
81
|
className: "flex gap-4",
|
|
71
82
|
children: [
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
value:
|
|
74
|
-
onChange:
|
|
75
|
-
placeholder:
|
|
83
|
+
/* @__PURE__ */ S(s, {
|
|
84
|
+
value: A,
|
|
85
|
+
onChange: W,
|
|
86
|
+
placeholder: k("products.searchPlaceholder", "Search products..."),
|
|
76
87
|
className: "flex-1"
|
|
77
88
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
value:
|
|
80
|
-
onChange: (e) =>
|
|
81
|
-
...
|
|
89
|
+
/* @__PURE__ */ C("select", {
|
|
90
|
+
value: M.status || "",
|
|
91
|
+
onChange: (e) => G({
|
|
92
|
+
...M,
|
|
82
93
|
status: e.target.value ? e.target.value : void 0
|
|
83
94
|
}),
|
|
84
95
|
className: "\n px-4 py-2\n bg-surface\n border border-default\n rounded-lg\n text-text-primary\n focus:outline-none focus:ring-2 focus:ring-[var(--color-border-focus)]\n transition-all duration-200\n ",
|
|
85
96
|
children: [
|
|
86
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ S("option", {
|
|
87
98
|
value: "",
|
|
88
|
-
children:
|
|
99
|
+
children: k("products.allStatuses", "All Statuses")
|
|
89
100
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ S("option", {
|
|
91
102
|
value: a.ACTIVE,
|
|
92
|
-
children:
|
|
103
|
+
children: k("products.statusActive", "Active")
|
|
93
104
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ S("option", {
|
|
95
106
|
value: a.DRAFT,
|
|
96
|
-
children:
|
|
107
|
+
children: k("products.statusDraft", "Draft")
|
|
97
108
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ S("option", {
|
|
99
110
|
value: a.WAITLIST,
|
|
100
|
-
children:
|
|
111
|
+
children: k("products.statusWaitlist", "Waitlist")
|
|
101
112
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ S("option", {
|
|
103
114
|
value: a.COMING_SOON,
|
|
104
|
-
children:
|
|
115
|
+
children: k("products.statusComingSoon", "Coming Soon")
|
|
105
116
|
})
|
|
106
117
|
]
|
|
107
118
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
onClick: () =>
|
|
119
|
+
/* @__PURE__ */ S("button", {
|
|
120
|
+
onClick: () => V(),
|
|
110
121
|
className: "\n inline-flex items-center gap-2 px-4 py-2\n bg-surface\n text-text-primary\n border border-default\n rounded-lg\n hover:bg-muted\n transition-all duration-200\n ",
|
|
111
|
-
children: /* @__PURE__ */
|
|
122
|
+
children: /* @__PURE__ */ S(v, {
|
|
123
|
+
size: 18,
|
|
124
|
+
className: z ? "animate-spin" : ""
|
|
125
|
+
})
|
|
112
126
|
}),
|
|
113
|
-
|
|
114
|
-
onClick: () => c("products",
|
|
127
|
+
I.length > 0 && /* @__PURE__ */ S("button", {
|
|
128
|
+
onClick: () => c("products", I.map((e) => ({
|
|
115
129
|
id: e.id,
|
|
116
130
|
name: e.name,
|
|
117
131
|
slug: e.slug,
|
|
@@ -124,117 +138,117 @@ function C() {
|
|
|
124
138
|
updatedAt: e.updatedAt
|
|
125
139
|
}))),
|
|
126
140
|
className: "\n inline-flex items-center gap-2 px-4 py-2\n bg-surface\n text-text-primary\n border border-default\n rounded-lg\n hover:bg-muted\n transition-all duration-200\n ",
|
|
127
|
-
title:
|
|
128
|
-
children: /* @__PURE__ */
|
|
141
|
+
title: k("products.exportCsv", "Export as CSV"),
|
|
142
|
+
children: /* @__PURE__ */ S(h, { size: 18 })
|
|
129
143
|
})
|
|
130
144
|
]
|
|
131
145
|
})]
|
|
132
|
-
}),
|
|
146
|
+
}), I.length === 0 && !z ? /* @__PURE__ */ C("div", {
|
|
133
147
|
className: "bg-surface border border-default rounded-lg p-12 text-center animate-in fade-in duration-300",
|
|
134
|
-
children: [/* @__PURE__ */
|
|
148
|
+
children: [/* @__PURE__ */ S("p", {
|
|
135
149
|
className: "text-text-secondary mb-4",
|
|
136
|
-
children:
|
|
137
|
-
}), /* @__PURE__ */
|
|
138
|
-
onClick: () =>
|
|
139
|
-
className: "\n
|
|
140
|
-
children: [/* @__PURE__ */
|
|
150
|
+
children: A || M.status ? k("products.noMatchingProducts", "No products match your search") : k("products.noProductsFound", "No products found")
|
|
151
|
+
}), !A && !M.status && /* @__PURE__ */ C("button", {
|
|
152
|
+
onClick: () => E(`${D}/new`),
|
|
153
|
+
className: "\n inline-flex items-center gap-2 px-4 py-2\n bg-[var(--color-action-primary-bg)]\n text-[var(--color-action-primary-text)]\n rounded-lg\n hover:opacity-90 hover:scale-[1.02]\n transition-all duration-200\n font-medium\n ",
|
|
154
|
+
children: [/* @__PURE__ */ S(_, { size: 20 }), k("products.createProduct", "Create Product")]
|
|
141
155
|
})]
|
|
142
|
-
}) : /* @__PURE__ */
|
|
156
|
+
}) : /* @__PURE__ */ C("div", {
|
|
143
157
|
className: "bg-surface border border-default rounded-lg shadow-[var(--shadow-elevation-1)] overflow-hidden",
|
|
144
|
-
children: /* @__PURE__ */
|
|
158
|
+
children: [/* @__PURE__ */ C("table", {
|
|
145
159
|
className: "w-full",
|
|
146
|
-
children: [/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ S("thead", {
|
|
147
161
|
className: "bg-muted border-b border-default",
|
|
148
|
-
children: /* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ C("tr", { children: [
|
|
163
|
+
/* @__PURE__ */ S("th", {
|
|
150
164
|
className: "text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase",
|
|
151
|
-
children:
|
|
165
|
+
children: k("products.columnProduct", "Product")
|
|
152
166
|
}),
|
|
153
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ S("th", {
|
|
154
168
|
className: "text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase",
|
|
155
|
-
children:
|
|
169
|
+
children: k("products.columnStatus", "Status")
|
|
156
170
|
}),
|
|
157
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ S("th", {
|
|
158
172
|
className: "text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase",
|
|
159
|
-
children:
|
|
173
|
+
children: k("products.columnCategory", "Category")
|
|
160
174
|
}),
|
|
161
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ S("th", {
|
|
162
176
|
className: "text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase",
|
|
163
|
-
children:
|
|
177
|
+
children: k("products.columnVersion", "Version")
|
|
164
178
|
}),
|
|
165
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ S("th", {
|
|
166
180
|
className: "text-right px-6 py-3 text-xs font-semibold text-text-secondary uppercase",
|
|
167
|
-
children:
|
|
181
|
+
children: k("products.columnActions", "Actions")
|
|
168
182
|
})
|
|
169
183
|
] })
|
|
170
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ S("tbody", {
|
|
171
185
|
className: "divide-y divide-[var(--color-border-default)]",
|
|
172
|
-
children:
|
|
186
|
+
children: I.map((e) => /* @__PURE__ */ C("tr", {
|
|
173
187
|
className: "hover:bg-muted transition-all duration-200",
|
|
174
188
|
children: [
|
|
175
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ S("td", {
|
|
176
190
|
className: "px-6 py-4",
|
|
177
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ C("div", {
|
|
178
192
|
className: "flex items-center gap-3",
|
|
179
|
-
children: [e.logoUrl ? /* @__PURE__ */
|
|
193
|
+
children: [e.logoUrl ? /* @__PURE__ */ S("img", {
|
|
180
194
|
src: e.logoUrl,
|
|
181
195
|
alt: e.name,
|
|
182
196
|
className: "w-10 h-10 rounded-lg object-cover"
|
|
183
|
-
}) : /* @__PURE__ */
|
|
197
|
+
}) : /* @__PURE__ */ S("div", {
|
|
184
198
|
className: "w-10 h-10 rounded-lg bg-[var(--color-status-warning-subtle)] flex items-center justify-center",
|
|
185
|
-
children: /* @__PURE__ */
|
|
199
|
+
children: /* @__PURE__ */ S("span", {
|
|
186
200
|
className: "text-[var(--color-status-warning)] font-semibold",
|
|
187
201
|
children: e.name[0]
|
|
188
202
|
})
|
|
189
|
-
}), /* @__PURE__ */
|
|
203
|
+
}), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
|
|
190
204
|
className: "font-medium text-text-primary",
|
|
191
205
|
children: e.name
|
|
192
|
-
}), /* @__PURE__ */
|
|
206
|
+
}), /* @__PURE__ */ C("p", {
|
|
193
207
|
className: "text-sm text-text-tertiary font-mono",
|
|
194
208
|
children: ["/", e.slug]
|
|
195
209
|
})] })]
|
|
196
210
|
})
|
|
197
211
|
}),
|
|
198
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ S("td", {
|
|
199
213
|
className: "px-6 py-4",
|
|
200
|
-
children: /* @__PURE__ */
|
|
214
|
+
children: /* @__PURE__ */ S(o, { status: e.status })
|
|
201
215
|
}),
|
|
202
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ S("td", {
|
|
203
217
|
className: "px-6 py-4",
|
|
204
|
-
children: /* @__PURE__ */
|
|
218
|
+
children: /* @__PURE__ */ S("span", {
|
|
205
219
|
className: "text-sm text-text-primary",
|
|
206
220
|
children: "—"
|
|
207
221
|
})
|
|
208
222
|
}),
|
|
209
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ S("td", {
|
|
210
224
|
className: "px-6 py-4",
|
|
211
|
-
children: /* @__PURE__ */
|
|
225
|
+
children: /* @__PURE__ */ S("span", {
|
|
212
226
|
className: "text-sm text-text-primary font-mono",
|
|
213
227
|
children: "—"
|
|
214
228
|
})
|
|
215
229
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ S("td", {
|
|
217
231
|
className: "px-6 py-4",
|
|
218
|
-
children: /* @__PURE__ */
|
|
232
|
+
children: /* @__PURE__ */ C("div", {
|
|
219
233
|
className: "flex items-center justify-end gap-2",
|
|
220
|
-
children: [/* @__PURE__ */
|
|
221
|
-
onClick: () =>
|
|
234
|
+
children: [/* @__PURE__ */ S("button", {
|
|
235
|
+
onClick: () => E(`${D}/${e.id}`),
|
|
222
236
|
className: "p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200",
|
|
223
|
-
title:
|
|
224
|
-
children: /* @__PURE__ */
|
|
225
|
-
}), /* @__PURE__ */
|
|
237
|
+
title: k("products.viewDetails", "View details"),
|
|
238
|
+
children: /* @__PURE__ */ S(g, { size: 18 })
|
|
239
|
+
}), /* @__PURE__ */ C(w, {
|
|
226
240
|
role: "super_admin",
|
|
227
|
-
children: [/* @__PURE__ */
|
|
228
|
-
onClick: () =>
|
|
241
|
+
children: [/* @__PURE__ */ S("button", {
|
|
242
|
+
onClick: () => E(`${D}/${e.id}/edit`),
|
|
229
243
|
className: "p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200",
|
|
230
|
-
title:
|
|
231
|
-
children: /* @__PURE__ */
|
|
232
|
-
}), /* @__PURE__ */
|
|
233
|
-
onClick: () =>
|
|
234
|
-
disabled:
|
|
244
|
+
title: k("products.edit", "Edit"),
|
|
245
|
+
children: /* @__PURE__ */ S(y, { size: 18 })
|
|
246
|
+
}), /* @__PURE__ */ S("button", {
|
|
247
|
+
onClick: () => K(e.id),
|
|
248
|
+
disabled: U,
|
|
235
249
|
className: "p-2 rounded-lg text-[var(--color-status-error)] hover:bg-[var(--color-status-error-subtle)] transition-all duration-200 disabled:opacity-50",
|
|
236
|
-
title:
|
|
237
|
-
children: /* @__PURE__ */ b
|
|
250
|
+
title: k("products.delete", "Delete"),
|
|
251
|
+
children: /* @__PURE__ */ S(b, { size: 18 })
|
|
238
252
|
})]
|
|
239
253
|
})]
|
|
240
254
|
})
|
|
@@ -242,11 +256,53 @@ function C() {
|
|
|
242
256
|
]
|
|
243
257
|
}, e.id))
|
|
244
258
|
})]
|
|
245
|
-
})
|
|
259
|
+
}), L > 0 && /* @__PURE__ */ C("div", {
|
|
260
|
+
className: "flex items-center justify-between px-6 py-3 border-t border-default bg-muted/50",
|
|
261
|
+
children: [/* @__PURE__ */ C("p", {
|
|
262
|
+
className: "text-sm text-text-secondary",
|
|
263
|
+
children: [
|
|
264
|
+
k("products.showing", "Showing"),
|
|
265
|
+
" ",
|
|
266
|
+
J,
|
|
267
|
+
"–",
|
|
268
|
+
Y,
|
|
269
|
+
" ",
|
|
270
|
+
k("products.of", "of"),
|
|
271
|
+
" ",
|
|
272
|
+
L,
|
|
273
|
+
" ",
|
|
274
|
+
k("products.products", "products")
|
|
275
|
+
]
|
|
276
|
+
}), /* @__PURE__ */ C("div", {
|
|
277
|
+
className: "flex items-center gap-2",
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ C("button", {
|
|
280
|
+
onClick: () => F((e) => Math.max(0, e - 1)),
|
|
281
|
+
disabled: P === 0,
|
|
282
|
+
className: "\n inline-flex items-center gap-1 px-3 py-1.5 text-sm\n bg-surface border border-default rounded-lg\n text-text-primary\n hover:bg-muted transition-all duration-200\n disabled:opacity-40 disabled:cursor-not-allowed\n ",
|
|
283
|
+
children: [/* @__PURE__ */ S(p, { size: 16 }), k("products.prev", "Prev")]
|
|
284
|
+
}),
|
|
285
|
+
/* @__PURE__ */ C("span", {
|
|
286
|
+
className: "text-sm text-text-secondary px-2",
|
|
287
|
+
children: [
|
|
288
|
+
P + 1,
|
|
289
|
+
" / ",
|
|
290
|
+
q
|
|
291
|
+
]
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ C("button", {
|
|
294
|
+
onClick: () => F((e) => e + 1),
|
|
295
|
+
disabled: !R && P + 1 >= q,
|
|
296
|
+
className: "\n inline-flex items-center gap-1 px-3 py-1.5 text-sm\n bg-surface border border-default rounded-lg\n text-text-primary\n hover:bg-muted transition-all duration-200\n disabled:opacity-40 disabled:cursor-not-allowed\n ",
|
|
297
|
+
children: [k("products.next", "Next"), /* @__PURE__ */ S(m, { size: 16 })]
|
|
298
|
+
})
|
|
299
|
+
]
|
|
300
|
+
})]
|
|
301
|
+
})]
|
|
246
302
|
})]
|
|
247
303
|
});
|
|
248
304
|
}
|
|
249
305
|
//#endregion
|
|
250
|
-
export {
|
|
306
|
+
export { E as ProductsListPage };
|
|
251
307
|
|
|
252
308
|
//# sourceMappingURL=ProductsListPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsListPage.js","names":[],"sources":["../../../../../src/product-management/modules/products/pages/ProductsListPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Download, Plus, RefreshCw, Eye, SquarePen, Trash2 } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PermissionGate } from '@burdenoff/fe-libs/shared/components';\nimport { useProductConsole } from '../../../providers/ProductConsoleProvider';\nimport { useProducts, useDeleteProduct } from '../hooks/useProducts';\nimport { ProductStatusBadge } from '../components/ProductStatusBadge';\nimport { SearchInput } from '../../../shared/components/input/SearchInput';\nimport { LoadingState } from '../../../shared/components/feedback/LoadingState';\nimport { ErrorState } from '../../../shared/components/feedback/ErrorState';\nimport { exportToCsv } from '../../../shared/utils/exportUtils';\nimport type { ProductFilterInput } from '../types';\nimport { ProductStatus } from '../types';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../../../../utils/nativeBridge';\n\nexport function ProductsListPage() {\n const { navigate, basePath = '/products' } = useProductConsole();\n const { t } = useI18n();\n const tr = (key: string, fallback: string) => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const [searchQuery, setSearchQuery] = useState('');\n const [filter, setFilter] = useState<ProductFilterInput>({});\n\n const { products, loading, error, refetch } = useProducts(\n { ...filter, search: searchQuery || undefined },\n { limit: 20 }\n );\n\n const { deleteProduct, loading: deleteLoading } = useDeleteProduct();\n\n const handleDelete = async (id: string) => {\n void nativeImpact('medium');\n const message = tr(\n 'products.confirmDeleteProduct',\n 'Are you sure you want to delete this product?'\n );\n const native = await nativeConfirm({\n title: 'Delete product',\n message,\n okButtonTitle: 'Delete',\n cancelButtonTitle: 'Cancel',\n });\n const ok = native === null ? window.confirm(message) : native;\n if (!ok) return;\n\n try {\n await deleteProduct(id);\n void nativeNotify('success');\n refetch();\n } catch (error) {\n void nativeNotify('error');\n console.error('Failed to delete product:', error);\n }\n };\n\n if (loading) {\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6\">\n <LoadingState message={tr('products.loadingProducts', 'Loading products...')} />\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6\">\n <ErrorState\n message={error.message}\n action={{\n label: tr('productCommon.retry', 'Retry'),\n onClick: () => refetch(),\n }}\n />\n </div>\n );\n }\n\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6 animate-in fade-in duration-300\">\n {/* Page Header */}\n <div className=\"mb-6\">\n <div className=\"flex items-center justify-between mb-4\">\n <div>\n <h1 className=\"text-3xl font-bold text-text-primary mb-2\">\n {tr('products.title', 'Products')}\n </h1>\n <p className=\"text-text-secondary\">\n {tr('products.subtitle', 'Manage platform products and features')}\n </p>\n </div>\n\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${basePath}/new`)}\n className=\"\n inline-flex items-center gap-2 px-4 py-2\n bg-[var(--color-action-primary-bg)]\n text-[var(--color-action-primary-text)]\n rounded-lg\n hover:opacity-90 hover:scale-[1.02]\n transition-all duration-200\n font-medium\n \"\n >\n <Plus size={20} />\n {tr('products.createProduct', 'Create Product')}\n </button>\n </PermissionGate>\n </div>\n\n {/* Search and Filters */}\n <div className=\"flex gap-4\">\n {/* Search */}\n <SearchInput\n value={searchQuery}\n onChange={setSearchQuery}\n placeholder={tr('products.searchPlaceholder', 'Search products...')}\n className=\"flex-1\"\n />\n\n {/* Status Filter */}\n <select\n value={filter.status || ''}\n onChange={(e) =>\n setFilter({\n ...filter,\n status: e.target.value\n ? (e.target.value as (typeof ProductStatus)[keyof typeof ProductStatus])\n : undefined,\n })\n }\n className=\"\n px-4 py-2\n bg-surface\n border border-default\n rounded-lg\n text-text-primary\n focus:outline-none focus:ring-2 focus:ring-[var(--color-border-focus)]\n transition-all duration-200\n \"\n >\n <option value=\"\">{tr('products.allStatuses', 'All Statuses')}</option>\n <option value={ProductStatus.ACTIVE}>{tr('products.statusActive', 'Active')}</option>\n <option value={ProductStatus.DRAFT}>{tr('products.statusDraft', 'Draft')}</option>\n <option value={ProductStatus.WAITLIST}>\n {tr('products.statusWaitlist', 'Waitlist')}\n </option>\n <option value={ProductStatus.COMING_SOON}>\n {tr('products.statusComingSoon', 'Coming Soon')}\n </option>\n </select>\n\n {/* Refresh */}\n <button\n onClick={() => refetch()}\n className=\"\n inline-flex items-center gap-2 px-4 py-2\n bg-surface\n text-text-primary\n border border-default\n rounded-lg\n hover:bg-muted\n transition-all duration-200\n \"\n >\n <RefreshCw size={18} />\n </button>\n\n {/* Export */}\n {products.length > 0 && (\n <button\n onClick={() =>\n exportToCsv(\n 'products',\n products.map((p) => ({\n id: p.id,\n name: p.name,\n slug: p.slug,\n status: p.status,\n description: p.description ?? '',\n tags: (p.tags ?? []).join(', '),\n website: p.website ?? '',\n appUrl: p.appUrl ?? '',\n createdAt: p.createdAt,\n updatedAt: p.updatedAt,\n }))\n )\n }\n className=\"\n inline-flex items-center gap-2 px-4 py-2\n bg-surface\n text-text-primary\n border border-default\n rounded-lg\n hover:bg-muted\n transition-all duration-200\n \"\n title={tr('products.exportCsv', 'Export as CSV')}\n >\n <Download size={18} />\n </button>\n )}\n </div>\n </div>\n\n {/* Products Table */}\n {products.length === 0 ? (\n <div className=\"bg-surface border border-default rounded-lg p-12 text-center animate-in fade-in duration-300\">\n <p className=\"text-text-secondary mb-4\">\n {tr('products.noProductsFound', 'No products found')}\n </p>\n <button\n onClick={() => navigate(`${basePath}/new`)}\n className=\"\n inline-flex items-center gap-2 px-4 py-2\n bg-[var(--color-action-primary-bg)]\n text-[var(--color-action-primary-text)]\n rounded-lg\n hover:opacity-90 hover:scale-[1.02]\n transition-all duration-200\n font-medium\n \"\n >\n <Plus size={20} />\n {tr('products.createProduct', 'Create Product')}\n </button>\n </div>\n ) : (\n <div className=\"bg-surface border border-default rounded-lg shadow-[var(--shadow-elevation-1)] overflow-hidden\">\n <table className=\"w-full\">\n <thead className=\"bg-muted border-b border-default\">\n <tr>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnProduct', 'Product')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnStatus', 'Status')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnCategory', 'Category')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnVersion', 'Version')}\n </th>\n <th className=\"text-right px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnActions', 'Actions')}\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-[var(--color-border-default)]\">\n {products.map((product) => (\n <tr key={product.id} className=\"hover:bg-muted transition-all duration-200\">\n <td className=\"px-6 py-4\">\n <div className=\"flex items-center gap-3\">\n {product.logoUrl ? (\n <img\n src={product.logoUrl}\n alt={product.name}\n className=\"w-10 h-10 rounded-lg object-cover\"\n />\n ) : (\n <div className=\"w-10 h-10 rounded-lg bg-[var(--color-status-warning-subtle)] flex items-center justify-center\">\n <span className=\"text-[var(--color-status-warning)] font-semibold\">\n {product.name[0]}\n </span>\n </div>\n )}\n <div>\n <p className=\"font-medium text-text-primary\">{product.name}</p>\n <p className=\"text-sm text-text-tertiary font-mono\">/{product.slug}</p>\n </div>\n </div>\n </td>\n <td className=\"px-6 py-4\">\n <ProductStatusBadge status={product.status} />\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-primary\">—</span>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-primary font-mono\">—</span>\n </td>\n <td className=\"px-6 py-4\">\n <div className=\"flex items-center justify-end gap-2\">\n <button\n onClick={() => navigate(`${basePath}/${product.id}`)}\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('products.viewDetails', 'View details')}\n >\n <Eye size={18} />\n </button>\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${basePath}/${product.id}/edit`)}\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('products.edit', 'Edit')}\n >\n <SquarePen size={18} />\n </button>\n <button\n onClick={() => handleDelete(product.id)}\n disabled={deleteLoading}\n className=\"p-2 rounded-lg text-[var(--color-status-error)] hover:bg-[var(--color-status-error-subtle)] transition-all duration-200 disabled:opacity-50\"\n title={tr('products.delete', 'Delete')}\n >\n <Trash2 size={18} />\n </button>\n </PermissionGate>\n </div>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAgB,IAAmB;CACjC,IAAM,EAAE,aAAU,cAAW,gBAAgB,GAAmB,EAC1D,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAAqB;EAC5C,IAAM,IAAa,EAAE,EAAI;AACzB,SAAO,MAAe,IAAM,IAAW;IAEnC,CAAC,GAAa,KAAkB,EAAS,GAAG,EAC5C,CAAC,GAAQ,KAAa,EAA6B,EAAE,CAAC,EAEtD,EAAE,aAAU,YAAS,UAAO,eAAY,EAC5C;EAAE,GAAG;EAAQ,QAAQ,KAAe,KAAA;EAAW,EAC/C,EAAE,OAAO,IAAI,CACd,EAEK,EAAE,kBAAe,SAAS,MAAkB,GAAkB,EAE9D,IAAe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AU;kBACZ,kBAAC,GAAD,EAAoB,QAAQ,EAAQ,QAAU,CAAA;QAC3C,CAAA;OACL,kBAAC,MAAD;QAAI,WAAU;kBACZ,kBAAC,QAAD;SAAM,WAAU;mBAA4B;SAAQ,CAAA;QACjD,CAAA;OACL,kBAAC,MAAD;QAAI,WAAU;kBACZ,kBAAC,QAAD;SAAM,WAAU;mBAAsC;SAAQ,CAAA;QAC3D,CAAA;OACL,kBAAC,MAAD;QAAI,WAAU;kBACZ,kBAAC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,UAAD;UACE,eAAe,EAAS,GAAG,EAAS,GAAG,EAAQ,KAAK;UACpD,WAAU;UACV,OAAO,EAAG,wBAAwB,eAAe;oBAEjD,kBAAC,GAAD,EAAK,MAAM,IAAM,CAAA;UACV,CAAA,EACT,kBAAC,GAAD;UAAgB,MAAK;oBAArB,CACE,kBAAC,UAAD;WACE,eAAe,EAAS,GAAG,EAAS,GAAG,EAAQ,GAAG,OAAO;WACzD,WAAU;WACV,OAAO,EAAG,iBAAiB,OAAO;qBAElC,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;WAChB,CAAA,EACT,kBAAC,UAAD;WACE,eAAe,EAAa,EAAQ,GAAG;WACvC,UAAU;WACV,WAAU;WACV,OAAO,EAAG,mBAAmB,SAAS;qBAEtC,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;WACb,CAAA,CACM;YACb;;QACH,CAAA;OACF;QA3DI,EAAQ,GA2DZ,CACL;KACI,CAAA,CACF;;GACJ,CAAA,CAEJ"}
|
|
1
|
+
{"version":3,"file":"ProductsListPage.js","names":[],"sources":["../../../../../src/product-management/modules/products/pages/ProductsListPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { ChevronLeft, ChevronRight, Download, Plus, RefreshCw, Eye, SquarePen, Trash2 } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PermissionGate } from '@burdenoff/fe-libs/shared/components';\nimport { useProductConsole } from '../../../providers/ProductConsoleProvider';\nimport { useProducts, useDeleteProduct } from '../hooks/useProducts';\nimport { ProductStatusBadge } from '../components/ProductStatusBadge';\nimport { SearchInput } from '../../../shared/components/input/SearchInput';\nimport { LoadingState } from '../../../shared/components/feedback/LoadingState';\nimport { ErrorState } from '../../../shared/components/feedback/ErrorState';\nimport { exportToCsv } from '../../../shared/utils/exportUtils';\nimport type { ProductFilterInput } from '../types';\nimport { ProductStatus } from '../types';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../../../../utils/nativeBridge';\n\nconst PAGE_SIZE = 20;\n\nexport function ProductsListPage() {\n const { navigate, basePath = '/products' } = useProductConsole();\n const { t } = useI18n();\n const tr = (key: string, fallback: string) => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const [searchQuery, setSearchQuery] = useState('');\n const [filter, setFilter] = useState<ProductFilterInput>({});\n const [page, setPage] = useState(0);\n\n const { products, total, hasMore, loading, error, refetch } = useProducts(\n { ...filter, search: searchQuery || undefined },\n { limit: PAGE_SIZE, offset: page * PAGE_SIZE }\n );\n\n const { deleteProduct, loading: deleteLoading } = useDeleteProduct();\n\n // Reset to first page when search/filter changes\n const handleSearch = (value: string) => {\n setSearchQuery(value);\n setPage(0);\n };\n\n const handleFilterChange = (newFilter: ProductFilterInput) => {\n setFilter(newFilter);\n setPage(0);\n };\n\n const handleDelete = async (id: string) => {\n void nativeImpact('medium');\n const message = tr(\n 'products.confirmDeleteProduct',\n 'Are you sure you want to delete this product?'\n );\n const native = await nativeConfirm({\n title: 'Delete product',\n message,\n okButtonTitle: 'Delete',\n cancelButtonTitle: 'Cancel',\n });\n const ok = native === null ? window.confirm(message) : native;\n if (!ok) return;\n\n try {\n await deleteProduct(id);\n void nativeNotify('success');\n refetch();\n } catch (error) {\n void nativeNotify('error');\n console.error('Failed to delete product:', error);\n }\n };\n\n // Only show full-page loading on initial load (no products yet and loading)\n if (loading && products.length === 0 && !searchQuery && !filter.status) {\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6\">\n <LoadingState message={tr('products.loadingProducts', 'Loading products...')} />\n </div>\n );\n }\n\n if (error && products.length === 0) {\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6\">\n <ErrorState\n message={error.message}\n action={{\n label: tr('productCommon.retry', 'Retry'),\n onClick: () => refetch(),\n }}\n />\n </div>\n );\n }\n\n const totalPages = Math.max(1, Math.ceil(total / PAGE_SIZE));\n const showingFrom = products.length > 0 ? page * PAGE_SIZE + 1 : 0;\n const showingTo = Math.min((page + 1) * PAGE_SIZE, total);\n\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6 animate-in fade-in duration-300\">\n {/* Page Header */}\n <div className=\"mb-6\">\n <div className=\"flex items-center justify-between mb-4\">\n <div>\n <h1 className=\"text-3xl font-bold text-text-primary mb-2\">\n {tr('products.title', 'Products')}\n </h1>\n <p className=\"text-text-secondary\">\n {tr('products.subtitle', 'Manage platform products and features')}\n </p>\n </div>\n\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${basePath}/new`)}\n className=\"\n inline-flex items-center gap-2 px-4 py-2\n bg-[var(--color-action-primary-bg)]\n text-[var(--color-action-primary-text)]\n rounded-lg\n hover:opacity-90 hover:scale-[1.02]\n transition-all duration-200\n font-medium\n \"\n >\n <Plus size={20} />\n {tr('products.createProduct', 'Create Product')}\n </button>\n </PermissionGate>\n </div>\n\n {/* Search and Filters */}\n <div className=\"flex gap-4\">\n {/* Search */}\n <SearchInput\n value={searchQuery}\n onChange={handleSearch}\n placeholder={tr('products.searchPlaceholder', 'Search products...')}\n className=\"flex-1\"\n />\n\n {/* Status Filter */}\n <select\n value={filter.status || ''}\n onChange={(e) =>\n handleFilterChange({\n ...filter,\n status: e.target.value\n ? (e.target.value as (typeof ProductStatus)[keyof typeof ProductStatus])\n : undefined,\n })\n }\n className=\"\n px-4 py-2\n bg-surface\n border border-default\n rounded-lg\n text-text-primary\n focus:outline-none focus:ring-2 focus:ring-[var(--color-border-focus)]\n transition-all duration-200\n \"\n >\n <option value=\"\">{tr('products.allStatuses', 'All Statuses')}</option>\n <option value={ProductStatus.ACTIVE}>{tr('products.statusActive', 'Active')}</option>\n <option value={ProductStatus.DRAFT}>{tr('products.statusDraft', 'Draft')}</option>\n <option value={ProductStatus.WAITLIST}>\n {tr('products.statusWaitlist', 'Waitlist')}\n </option>\n <option value={ProductStatus.COMING_SOON}>\n {tr('products.statusComingSoon', 'Coming Soon')}\n </option>\n </select>\n\n {/* Refresh */}\n <button\n onClick={() => refetch()}\n className=\"\n inline-flex items-center gap-2 px-4 py-2\n bg-surface\n text-text-primary\n border border-default\n rounded-lg\n hover:bg-muted\n transition-all duration-200\n \"\n >\n <RefreshCw size={18} className={loading ? 'animate-spin' : ''} />\n </button>\n\n {/* Export */}\n {products.length > 0 && (\n <button\n onClick={() =>\n exportToCsv(\n 'products',\n products.map((p) => ({\n id: p.id,\n name: p.name,\n slug: p.slug,\n status: p.status,\n description: p.description ?? '',\n tags: (p.tags ?? []).join(', '),\n website: p.website ?? '',\n appUrl: p.appUrl ?? '',\n createdAt: p.createdAt,\n updatedAt: p.updatedAt,\n }))\n )\n }\n className=\"\n inline-flex items-center gap-2 px-4 py-2\n bg-surface\n text-text-primary\n border border-default\n rounded-lg\n hover:bg-muted\n transition-all duration-200\n \"\n title={tr('products.exportCsv', 'Export as CSV')}\n >\n <Download size={18} />\n </button>\n )}\n </div>\n </div>\n\n {/* Products Table */}\n {products.length === 0 && !loading ? (\n <div className=\"bg-surface border border-default rounded-lg p-12 text-center animate-in fade-in duration-300\">\n <p className=\"text-text-secondary mb-4\">\n {searchQuery || filter.status\n ? tr('products.noMatchingProducts', 'No products match your search')\n : tr('products.noProductsFound', 'No products found')}\n </p>\n {!searchQuery && !filter.status && (\n <button\n onClick={() => navigate(`${basePath}/new`)}\n className=\"\n inline-flex items-center gap-2 px-4 py-2\n bg-[var(--color-action-primary-bg)]\n text-[var(--color-action-primary-text)]\n rounded-lg\n hover:opacity-90 hover:scale-[1.02]\n transition-all duration-200\n font-medium\n \"\n >\n <Plus size={20} />\n {tr('products.createProduct', 'Create Product')}\n </button>\n )}\n </div>\n ) : (\n <div className=\"bg-surface border border-default rounded-lg shadow-[var(--shadow-elevation-1)] overflow-hidden\">\n <table className=\"w-full\">\n <thead className=\"bg-muted border-b border-default\">\n <tr>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnProduct', 'Product')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnStatus', 'Status')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnCategory', 'Category')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnVersion', 'Version')}\n </th>\n <th className=\"text-right px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('products.columnActions', 'Actions')}\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-[var(--color-border-default)]\">\n {products.map((product) => (\n <tr key={product.id} className=\"hover:bg-muted transition-all duration-200\">\n <td className=\"px-6 py-4\">\n <div className=\"flex items-center gap-3\">\n {product.logoUrl ? (\n <img\n src={product.logoUrl}\n alt={product.name}\n className=\"w-10 h-10 rounded-lg object-cover\"\n />\n ) : (\n <div className=\"w-10 h-10 rounded-lg bg-[var(--color-status-warning-subtle)] flex items-center justify-center\">\n <span className=\"text-[var(--color-status-warning)] font-semibold\">\n {product.name[0]}\n </span>\n </div>\n )}\n <div>\n <p className=\"font-medium text-text-primary\">{product.name}</p>\n <p className=\"text-sm text-text-tertiary font-mono\">/{product.slug}</p>\n </div>\n </div>\n </td>\n <td className=\"px-6 py-4\">\n <ProductStatusBadge status={product.status} />\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-primary\">—</span>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-primary font-mono\">—</span>\n </td>\n <td className=\"px-6 py-4\">\n <div className=\"flex items-center justify-end gap-2\">\n <button\n onClick={() => navigate(`${basePath}/${product.id}`)}\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('products.viewDetails', 'View details')}\n >\n <Eye size={18} />\n </button>\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${basePath}/${product.id}/edit`)}\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('products.edit', 'Edit')}\n >\n <SquarePen size={18} />\n </button>\n <button\n onClick={() => handleDelete(product.id)}\n disabled={deleteLoading}\n className=\"p-2 rounded-lg text-[var(--color-status-error)] hover:bg-[var(--color-status-error-subtle)] transition-all duration-200 disabled:opacity-50\"\n title={tr('products.delete', 'Delete')}\n >\n <Trash2 size={18} />\n </button>\n </PermissionGate>\n </div>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n\n {/* Pagination */}\n {total > 0 && (\n <div className=\"flex items-center justify-between px-6 py-3 border-t border-default bg-muted/50\">\n <p className=\"text-sm text-text-secondary\">\n {tr('products.showing', 'Showing')} {showingFrom}–{showingTo}{' '}\n {tr('products.of', 'of')} {total}{' '}\n {tr('products.products', 'products')}\n </p>\n <div className=\"flex items-center gap-2\">\n <button\n onClick={() => setPage((p) => Math.max(0, p - 1))}\n disabled={page === 0}\n className=\"\n inline-flex items-center gap-1 px-3 py-1.5 text-sm\n bg-surface border border-default rounded-lg\n text-text-primary\n hover:bg-muted transition-all duration-200\n disabled:opacity-40 disabled:cursor-not-allowed\n \"\n >\n <ChevronLeft size={16} />\n {tr('products.prev', 'Prev')}\n </button>\n <span className=\"text-sm text-text-secondary px-2\">\n {page + 1} / {totalPages}\n </span>\n <button\n onClick={() => setPage((p) => p + 1)}\n disabled={!hasMore && page + 1 >= totalPages}\n className=\"\n inline-flex items-center gap-1 px-3 py-1.5 text-sm\n bg-surface border border-default rounded-lg\n text-text-primary\n hover:bg-muted transition-all duration-200\n disabled:opacity-40 disabled:cursor-not-allowed\n \"\n >\n {tr('products.next', 'Next')}\n <ChevronRight size={16} />\n </button>\n </div>\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,IAAM,IAAY;AAElB,SAAgB,IAAmB;CACjC,IAAM,EAAE,aAAU,cAAW,gBAAgB,GAAmB,EAC1D,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAAqB;EAC5C,IAAM,IAAa,EAAE,EAAI;AACzB,SAAO,MAAe,IAAM,IAAW;IAEnC,CAAC,GAAa,KAAkB,EAAS,GAAG,EAC5C,CAAC,GAAQ,KAAa,EAA6B,EAAE,CAAC,EACtD,CAAC,GAAM,KAAW,EAAS,EAAE,EAE7B,EAAE,aAAU,UAAO,YAAS,YAAS,UAAO,eAAY,EAC5D;EAAE,GAAG;EAAQ,QAAQ,KAAe,KAAA;EAAW,EAC/C;EAAE,OAAO;EAAW,QAAQ,IAAO;EAAW,CAC/C,EAEK,EAAE,kBAAe,SAAS,MAAkB,GAAkB,EAG9D,KAAgB,MAAkB;AAEtC,EADA,EAAe,EAAM,EACrB,EAAQ,EAAE;IAGN,KAAsB,MAAkC;AAE5D,EADA,EAAU,EAAU,EACpB,EAAQ,EAAE;IAGN,IAAe,OAAO,MAAe;AACpC,IAAa,SAAS;EAC3B,IAAM,IAAU,EACd,iCACA,gDACD,EACK,IAAS,MAAM,EAAc;GACjC,OAAO;GACP;GACA,eAAe;GACf,mBAAmB;GACpB,CAAC;AACS,YAAW,OAAO,OAAO,QAAQ,EAAQ,GAAG,EAGvD,KAAI;AAGF,GAFA,MAAM,EAAc,EAAG,EAClB,EAAa,UAAU,EAC5B,GAAS;WACF,GAAO;AAEd,GADK,EAAa,QAAQ,EAC1B,QAAQ,MAAM,6BAA6B,EAAM;;;AAKrD,KAAI,KAAW,EAAS,WAAW,KAAK,CAAC,KAAe,CAAC,EAAO,OAC9D,QACE,kBAA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