@lastbrain/module-auth 2.0.16 → 2.0.27
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/auth.build.config.d.ts.map +1 -1
- package/dist/auth.build.config.js +42 -51
- package/dist/components/AccountButton.d.ts.map +1 -1
- package/dist/components/AccountButton.js +9 -5
- package/dist/components/auth/dashboard.d.ts +2 -0
- package/dist/components/auth/dashboard.d.ts.map +1 -0
- package/dist/components/auth/dashboard.js +47 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/web/admin/signup-stats.d.ts.map +1 -1
- package/dist/web/admin/signup-stats.js +4 -2
- package/dist/web/admin/user-detail.d.ts.map +1 -1
- package/dist/web/admin/user-detail.js +42 -17
- package/dist/web/admin/users-by-signup-source.d.ts.map +1 -1
- package/dist/web/admin/users-by-signup-source.js +18 -7
- package/dist/web/admin/users.d.ts.map +1 -1
- package/dist/web/admin/users.js +11 -6
- package/dist/web/auth/dashboard.d.ts.map +1 -1
- package/dist/web/auth/dashboard.js +7 -3
- package/dist/web/auth/folder.d.ts.map +1 -1
- package/dist/web/auth/folder.js +5 -3
- package/dist/web/auth/profile.d.ts.map +1 -1
- package/dist/web/auth/profile.js +13 -6
- package/dist/web/auth/reglage.d.ts.map +1 -1
- package/dist/web/auth/reglage.js +11 -6
- package/dist/web/public/SignInPage.d.ts.map +1 -1
- package/dist/web/public/SignInPage.js +14 -56
- package/dist/web/public/SignUpPage.d.ts.map +1 -1
- package/dist/web/public/SignUpPage.js +18 -11
- package/package.json +4 -3
- package/src/auth.build.config.ts +43 -52
- package/src/components/AccountButton.tsx +17 -10
- package/src/{web → components}/auth/dashboard.tsx +33 -14
- package/src/i18n/en.json +265 -0
- package/src/i18n/fr.json +262 -0
- package/src/index.ts +1 -1
- package/src/web/admin/signup-stats.tsx +10 -3
- package/src/web/admin/user-detail.tsx +135 -56
- package/src/web/admin/users-by-signup-source.tsx +60 -21
- package/src/web/admin/users.tsx +41 -18
- package/src/web/auth/folder.tsx +11 -3
- package/src/web/auth/profile.tsx +63 -29
- package/src/web/auth/reglage.tsx +43 -19
- package/src/web/public/SignInPage.tsx +32 -70
- package/src/web/public/SignUpPage.tsx +48 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.build.config.d.ts","sourceRoot":"","sources":["../src/auth.build.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,QAAA,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"auth.build.config.d.ts","sourceRoot":"","sources":["../src/auth.build.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,QAAA,MAAM,eAAe,EAAE,iBAuVtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -16,11 +16,6 @@ const authBuildConfig = {
|
|
|
16
16
|
path: "/reset-password",
|
|
17
17
|
componentExport: "ResetPassword",
|
|
18
18
|
},
|
|
19
|
-
{
|
|
20
|
-
section: "auth",
|
|
21
|
-
path: "/dashboard",
|
|
22
|
-
componentExport: "DashboardPage",
|
|
23
|
-
},
|
|
24
19
|
{
|
|
25
20
|
section: "auth",
|
|
26
21
|
path: "/folder",
|
|
@@ -139,8 +134,8 @@ const authBuildConfig = {
|
|
|
139
134
|
menu: {
|
|
140
135
|
public: [
|
|
141
136
|
{
|
|
142
|
-
title: "
|
|
143
|
-
description: "
|
|
137
|
+
title: "module-auth.menu.notifications",
|
|
138
|
+
description: "module-auth.menu.notifications_desc",
|
|
144
139
|
icon: "Bell",
|
|
145
140
|
path: "#",
|
|
146
141
|
order: 998,
|
|
@@ -149,8 +144,8 @@ const authBuildConfig = {
|
|
|
149
144
|
componentExport: "NotificationButton",
|
|
150
145
|
},
|
|
151
146
|
{
|
|
152
|
-
title: "
|
|
153
|
-
description: "
|
|
147
|
+
title: "module-auth.menu.account",
|
|
148
|
+
description: "module-auth.menu.account_desc",
|
|
154
149
|
icon: "User",
|
|
155
150
|
path: "#",
|
|
156
151
|
order: 999,
|
|
@@ -159,8 +154,8 @@ const authBuildConfig = {
|
|
|
159
154
|
componentExport: "AccountButton",
|
|
160
155
|
},
|
|
161
156
|
{
|
|
162
|
-
title: "
|
|
163
|
-
description: "
|
|
157
|
+
title: "module-auth.menu.theme",
|
|
158
|
+
description: "module-auth.menu.theme_desc",
|
|
164
159
|
icon: "Palette",
|
|
165
160
|
path: "#",
|
|
166
161
|
order: 9999,
|
|
@@ -171,8 +166,8 @@ const authBuildConfig = {
|
|
|
171
166
|
],
|
|
172
167
|
admin: [
|
|
173
168
|
{
|
|
174
|
-
title: "
|
|
175
|
-
description: "
|
|
169
|
+
title: "module-auth.menu.users_management",
|
|
170
|
+
description: "module-auth.menu.users_management_desc",
|
|
176
171
|
icon: "Users2",
|
|
177
172
|
path: "/admin/auth/users",
|
|
178
173
|
order: 1,
|
|
@@ -180,15 +175,15 @@ const authBuildConfig = {
|
|
|
180
175
|
shortcutDisplay: "⌘⇧U",
|
|
181
176
|
},
|
|
182
177
|
{
|
|
183
|
-
title: "
|
|
184
|
-
description: "
|
|
178
|
+
title: "module-auth.menu.signup_stats",
|
|
179
|
+
description: "module-auth.menu.signup_stats_desc",
|
|
185
180
|
icon: "UserStar",
|
|
186
181
|
path: "/admin/auth/signup-stats",
|
|
187
182
|
order: 2,
|
|
188
183
|
},
|
|
189
184
|
{
|
|
190
|
-
title: "
|
|
191
|
-
description: "
|
|
185
|
+
title: "module-auth.menu.notifications",
|
|
186
|
+
description: "module-auth.menu.notifications_desc",
|
|
192
187
|
icon: "Bell",
|
|
193
188
|
path: "#",
|
|
194
189
|
order: 998,
|
|
@@ -197,8 +192,8 @@ const authBuildConfig = {
|
|
|
197
192
|
componentExport: "NotificationButton",
|
|
198
193
|
},
|
|
199
194
|
{
|
|
200
|
-
title: "
|
|
201
|
-
description: "
|
|
195
|
+
title: "module-auth.menu.account",
|
|
196
|
+
description: "module-auth.menu.account_desc",
|
|
202
197
|
icon: "User",
|
|
203
198
|
path: "#",
|
|
204
199
|
order: 999,
|
|
@@ -207,8 +202,8 @@ const authBuildConfig = {
|
|
|
207
202
|
componentExport: "AccountButton",
|
|
208
203
|
},
|
|
209
204
|
{
|
|
210
|
-
title: "
|
|
211
|
-
description: "
|
|
205
|
+
title: "module-auth.menu.theme",
|
|
206
|
+
description: "module-auth.menu.theme_desc",
|
|
212
207
|
icon: "Palette",
|
|
213
208
|
path: "#",
|
|
214
209
|
order: 9999,
|
|
@@ -219,8 +214,8 @@ const authBuildConfig = {
|
|
|
219
214
|
],
|
|
220
215
|
auth: [
|
|
221
216
|
{
|
|
222
|
-
title: "
|
|
223
|
-
description: "
|
|
217
|
+
title: "module-auth.menu.dashboard",
|
|
218
|
+
description: "module-auth.menu.dashboard_desc",
|
|
224
219
|
icon: "LayoutDashboard",
|
|
225
220
|
path: "/auth/dashboard",
|
|
226
221
|
order: 1,
|
|
@@ -228,8 +223,8 @@ const authBuildConfig = {
|
|
|
228
223
|
shortcutDisplay: "⌘⇧D",
|
|
229
224
|
},
|
|
230
225
|
{
|
|
231
|
-
title: "
|
|
232
|
-
description: "
|
|
226
|
+
title: "module-auth.menu.folder",
|
|
227
|
+
description: "module-auth.menu.folder_desc",
|
|
233
228
|
icon: "FolderOpen",
|
|
234
229
|
path: "/auth/folder",
|
|
235
230
|
order: 99,
|
|
@@ -237,8 +232,8 @@ const authBuildConfig = {
|
|
|
237
232
|
shortcutDisplay: "⌘⇧F",
|
|
238
233
|
},
|
|
239
234
|
{
|
|
240
|
-
title: "
|
|
241
|
-
description: "
|
|
235
|
+
title: "module-auth.menu.notifications",
|
|
236
|
+
description: "module-auth.menu.notifications_desc",
|
|
242
237
|
icon: "Bell",
|
|
243
238
|
path: "#",
|
|
244
239
|
order: 998,
|
|
@@ -247,8 +242,8 @@ const authBuildConfig = {
|
|
|
247
242
|
componentExport: "NotificationButton",
|
|
248
243
|
},
|
|
249
244
|
{
|
|
250
|
-
title: "
|
|
251
|
-
description: "
|
|
245
|
+
title: "module-auth.menu.account",
|
|
246
|
+
description: "module-auth.menu.account_desc",
|
|
252
247
|
icon: "User",
|
|
253
248
|
path: "#",
|
|
254
249
|
order: 999,
|
|
@@ -257,8 +252,8 @@ const authBuildConfig = {
|
|
|
257
252
|
componentExport: "AccountButton",
|
|
258
253
|
},
|
|
259
254
|
{
|
|
260
|
-
title: "
|
|
261
|
-
description: "
|
|
255
|
+
title: "module-auth.menu.theme",
|
|
256
|
+
description: "module-auth.menu.theme_desc",
|
|
262
257
|
icon: "Palette",
|
|
263
258
|
path: "#",
|
|
264
259
|
order: 9999,
|
|
@@ -269,8 +264,8 @@ const authBuildConfig = {
|
|
|
269
264
|
],
|
|
270
265
|
account: [
|
|
271
266
|
{
|
|
272
|
-
title: "
|
|
273
|
-
description: "
|
|
267
|
+
title: "module-auth.menu.profile",
|
|
268
|
+
description: "module-auth.menu.profile_desc",
|
|
274
269
|
icon: "User2",
|
|
275
270
|
path: "/auth/profile",
|
|
276
271
|
order: 1,
|
|
@@ -278,8 +273,8 @@ const authBuildConfig = {
|
|
|
278
273
|
shortcutDisplay: "⌘⇧P",
|
|
279
274
|
},
|
|
280
275
|
{
|
|
281
|
-
title: "
|
|
282
|
-
description: "
|
|
276
|
+
title: "module-auth.menu.settings",
|
|
277
|
+
description: "module-auth.menu.settings_desc",
|
|
283
278
|
icon: "Settings",
|
|
284
279
|
path: "/auth/reglage",
|
|
285
280
|
order: 2,
|
|
@@ -287,8 +282,8 @@ const authBuildConfig = {
|
|
|
287
282
|
shortcutDisplay: "⌘⇧S",
|
|
288
283
|
},
|
|
289
284
|
{
|
|
290
|
-
title: "
|
|
291
|
-
description: "
|
|
285
|
+
title: "module-auth.menu.signout",
|
|
286
|
+
description: "module-auth.menu.signout",
|
|
292
287
|
icon: "LogOut",
|
|
293
288
|
path: "/signout",
|
|
294
289
|
order: 99,
|
|
@@ -305,22 +300,18 @@ const authBuildConfig = {
|
|
|
305
300
|
filter: "owner_id=eq.${USER_ID}",
|
|
306
301
|
broadcast: "user_notifications_updated",
|
|
307
302
|
},
|
|
308
|
-
{
|
|
309
|
-
schema: "public",
|
|
310
|
-
table: "user_profil",
|
|
311
|
-
event: "*",
|
|
312
|
-
filter: "owner_id=eq.${USER_ID}",
|
|
313
|
-
broadcast: "user_profil_updated",
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
schema: "public",
|
|
317
|
-
table: "user_addresses",
|
|
318
|
-
event: "*",
|
|
319
|
-
filter: "owner_id=eq.${USER_ID}",
|
|
320
|
-
broadcast: "user_address_updated",
|
|
321
|
-
},
|
|
322
303
|
],
|
|
323
304
|
},
|
|
305
|
+
authDashboard: [
|
|
306
|
+
{
|
|
307
|
+
key: "user",
|
|
308
|
+
title: "auth",
|
|
309
|
+
icon: "Dashboard",
|
|
310
|
+
componentExport: "DashboardPage",
|
|
311
|
+
entryPoint: "components/auth/dashboard",
|
|
312
|
+
order: 1,
|
|
313
|
+
},
|
|
314
|
+
],
|
|
324
315
|
storage: {
|
|
325
316
|
buckets: [
|
|
326
317
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountButton.d.ts","sourceRoot":"","sources":["../../src/components/AccountButton.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountButton.d.ts","sourceRoot":"","sources":["../../src/components/AccountButton.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAIlD,UAAU,kBAAkB;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AASD,eAAO,MAAM,aAAa,GAAI,kCAI3B,kBAAkB,4CAmIpB,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { AppLink, Button } from "@lastbrain/ui";
|
|
4
4
|
import { Avatar } from "@lastbrain/ui";
|
|
5
5
|
import { Dropdown, DropdownItem, DropdownMenu, DropdownTrigger, } from "@lastbrain/ui";
|
|
6
6
|
import * as LucideIcons from "lucide-react";
|
|
7
|
+
import { useModuleTranslation, langHref } from "@lastbrain/app";
|
|
8
|
+
import { useLanguage } from "@lastbrain/app";
|
|
7
9
|
// Fonction pour récupérer l'icône Lucide
|
|
8
10
|
const getIcon = (iconName) => {
|
|
9
11
|
if (!iconName)
|
|
@@ -12,8 +14,10 @@ const getIcon = (iconName) => {
|
|
|
12
14
|
return Icon ? Icon : null;
|
|
13
15
|
};
|
|
14
16
|
export const AccountButton = ({ user, accountMenu = [], onLogout, }) => {
|
|
17
|
+
const { lang } = useLanguage();
|
|
18
|
+
const t = useModuleTranslation("auth");
|
|
15
19
|
if (!user)
|
|
16
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "block md:hidden", children: [_jsx(Button, { as:
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "block md:hidden", children: [_jsx(Button, { as: AppLink, href: "/signin", radius: "full", isIconOnly: true, variant: "light", color: "primary", children: _jsx(LucideIcons.LogIn, { size: 16 }) }), _jsx(Button, { as: AppLink, href: "/signup", radius: "full", isIconOnly: true, variant: "flat", className: "ml-2", color: "secondary", children: _jsx(LucideIcons.UserPlus2, { size: 16 }) })] }), _jsxs("div", { className: "hidden md:block", children: [_jsx(Button, { as: AppLink, href: "/signin", startContent: _jsx(LucideIcons.LogIn, { size: 16 }), variant: "light", color: "primary", children: t("signin") }), _jsx(Button, { as: AppLink, href: "/signup", variant: "flat", className: "ml-2", color: "secondary", startContent: _jsx(LucideIcons.UserPlus2, { size: 16 }), children: t("signup") })] })] }));
|
|
17
21
|
return (_jsxs(Dropdown, { children: [_jsx(DropdownTrigger, { children: user?.user_metadata.avatar ? (_jsx(Avatar, { size: "sm", src: user?.user_metadata.avatar
|
|
18
22
|
? `/api/storage/${user?.user_metadata.avatar}`
|
|
19
23
|
: undefined, title: user.email, fallback: _jsx(LucideIcons.User2, { size: 18 }), classNames: {
|
|
@@ -22,7 +26,7 @@ export const AccountButton = ({ user, accountMenu = [], onLogout, }) => {
|
|
|
22
26
|
} })) : (_jsx(Button, { size: "sm", variant: "flat", radius: "full", isIconOnly: true, children: _jsx(LucideIcons.User2, { size: 16 }) })) }), _jsx(DropdownMenu, { items: [
|
|
23
27
|
{
|
|
24
28
|
key: "hello",
|
|
25
|
-
label:
|
|
29
|
+
label: `${t("hello")} ${user?.user_metadata?.full_name || user.email}`,
|
|
26
30
|
isReadOnly: true,
|
|
27
31
|
},
|
|
28
32
|
...accountMenu.map((item) => ({
|
|
@@ -33,10 +37,10 @@ export const AccountButton = ({ user, accountMenu = [], onLogout, }) => {
|
|
|
33
37
|
isLogout: item.path.includes("signout") || item.path.includes("logout"),
|
|
34
38
|
href: item.path.includes("signout") || item.path.includes("logout")
|
|
35
39
|
? undefined
|
|
36
|
-
: item.path,
|
|
40
|
+
: langHref(item.path, lang),
|
|
37
41
|
})),
|
|
38
42
|
], children: (item) => {
|
|
39
43
|
const Icon = item.icon ? getIcon(item.icon) : null;
|
|
40
|
-
return (_jsx(DropdownItem, { href: item.href, onPress: item.isLogout ? () => onLogout?.() : undefined, color: item.isLogout ? "danger" : "default", description: item.description, startContent: Icon && _jsx(Icon, { size: 16 }), isDisabled: item.isReadOnly, isReadOnly: item.isReadOnly, children: item.label }, item.key));
|
|
44
|
+
return (_jsx(DropdownItem, { href: item.href, onPress: item.isLogout ? () => onLogout?.() : undefined, color: item.isLogout ? "danger" : "default", description: !item.isLogout && item.description, startContent: Icon && _jsx(Icon, { size: 16 }), isDisabled: item.isReadOnly, isReadOnly: item.isReadOnly, children: item.label }, item.key));
|
|
41
45
|
} })] }));
|
|
42
46
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../../src/components/auth/dashboard.tsx"],"names":[],"mappings":"AA8BA,wBAAgB,aAAa,mDAsM5B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { Card, CardBody, CardHeader, Spinner, Chip, Divider, Avatar, } from "@lastbrain/ui";
|
|
5
|
+
import { User, Mail, Calendar, Shield, LayoutDashboard } from "lucide-react";
|
|
6
|
+
import { useModuleTranslation } from "@lastbrain/core";
|
|
7
|
+
export function DashboardPage() {
|
|
8
|
+
const t = useModuleTranslation("auth");
|
|
9
|
+
const [userData, setUserData] = useState(null);
|
|
10
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
11
|
+
const [error, setError] = useState(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
fetchUserData();
|
|
14
|
+
}, []);
|
|
15
|
+
const fetchUserData = async () => {
|
|
16
|
+
try {
|
|
17
|
+
setIsLoading(true);
|
|
18
|
+
const response = await fetch("/api/auth/me");
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
throw new Error("Failed to fetch user data");
|
|
21
|
+
}
|
|
22
|
+
const result = await response.json();
|
|
23
|
+
setUserData(result.data);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
setError(err instanceof Error ? err.message : "An error occurred");
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
setIsLoading(false);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
if (isLoading) {
|
|
33
|
+
return (_jsx("div", { className: "flex justify-center items-center min-h-[400px]", children: _jsxs(Spinner, { color: "primary", size: "lg", children: [" ", _jsx("span", { className: "text-xs text-default-700", children: t("dashboard.loading") || "Loading dashboard..." })] }) }));
|
|
34
|
+
}
|
|
35
|
+
if (error) {
|
|
36
|
+
return (_jsx("div", { className: "pt-12", children: _jsx(Card, { className: "max-w-2xl mx-auto", children: _jsx(CardBody, { children: _jsxs("p", { className: "text-danger", children: [t("dashboard.error") || "Error", ": ", error] }) }) }) }));
|
|
37
|
+
}
|
|
38
|
+
if (!userData) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const fullName = userData.profile?.first_name && userData.profile?.last_name
|
|
42
|
+
? `${userData.profile.first_name} ${userData.profile.last_name}`
|
|
43
|
+
: "User";
|
|
44
|
+
return (_jsxs("div", { className: "md:pt-8 max-w-6xl mx-auto", children: [_jsxs("div", { className: "flex flex-inline items-center gap-2 mb-4", children: [_jsx(LayoutDashboard, { size: 24 }), _jsx("h1", { className: "text-3xl font-bold ", children: t("dashboard.title") || "Dashboard" })] }), _jsxs("div", { className: "mx-0 px-0 grid gap-6 md:grid-cols-2", children: [_jsxs(Card, { className: "col-span-full md:col-span-1", children: [_jsxs(CardHeader, { className: "flex gap-3", children: [_jsx(Avatar, { src: userData.profile?.avatar_url, icon: _jsx(User, {}), size: "lg", className: "shrink-0" }), _jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "text-xl font-semibold", children: fullName }), _jsx("p", { className: "text-small text-default-500", children: userData.email })] })] }), _jsx(Divider, {}), _jsx(CardBody, { children: _jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Mail, { className: "w-4 h-4 text-default-400" }), _jsx("span", { className: "text-small", children: userData.email })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "w-4 h-4 text-default-400" }), _jsxs("span", { className: "text-small", children: [t("dashboard.member_since") || "Member since", " ", new Date(userData.created_at).toLocaleDateString()] })] }), userData.profile?.company && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Shield, { className: "w-4 h-4 text-default-400" }), _jsx("span", { className: "text-small", children: userData.profile.company })] }))] }) })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx("h3", { className: "text-lg font-semibold", children: t("dashboard.account_status") || "Account Status" }) }), _jsx(Divider, {}), _jsx(CardBody, { children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsx("span", { className: "text-small", children: t("dashboard.status") || "Status" }), _jsx(Chip, { color: "success", size: "sm", variant: "flat", children: t("dashboard.active") || "Active" })] }), _jsxs("div", { className: "flex justify-between items-center", children: [_jsx("span", { className: "text-small", children: t("dashboard.profile") || "Profile" }), _jsx(Chip, { color: userData.profile ? "success" : "warning", size: "sm", variant: "flat", children: userData.profile
|
|
45
|
+
? t("dashboard.complete") || "Complete"
|
|
46
|
+
: t("dashboard.incomplete") || "Incomplete" })] })] }) })] }), userData.profile?.bio && (_jsxs(Card, { className: "col-span-full", children: [_jsx(CardHeader, { children: _jsx("h3", { className: "text-lg font-semibold", children: "Bio" }) }), _jsx(Divider, {}), _jsx(CardBody, { children: _jsx("p", { className: "text-small text-default-600", children: userData.profile.bio }) })] }))] })] }));
|
|
47
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { SignInPage } from "./web/public/SignInPage";
|
|
2
2
|
export { SignUpPage } from "./web/public/SignUpPage";
|
|
3
3
|
export { ResetPassword } from "./web/public/ResetPassword";
|
|
4
|
-
export { DashboardPage } from "./
|
|
4
|
+
export { DashboardPage } from "./components/auth/dashboard";
|
|
5
5
|
export { FolderPage } from "./web/auth/folder";
|
|
6
6
|
export { ProfilePage } from "./web/auth/profile";
|
|
7
7
|
export { ReglagePage } from "./web/auth/reglage";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,GAAG,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export { SignInPage } from "./web/public/SignInPage";
|
|
3
3
|
export { SignUpPage } from "./web/public/SignUpPage";
|
|
4
4
|
export { ResetPassword } from "./web/public/ResetPassword";
|
|
5
|
-
export { DashboardPage } from "./
|
|
5
|
+
export { DashboardPage } from "./components/auth/dashboard";
|
|
6
6
|
export { FolderPage } from "./web/auth/folder";
|
|
7
7
|
export { ProfilePage } from "./web/auth/profile";
|
|
8
8
|
export { ReglagePage } from "./web/auth/reglage";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signup-stats.d.ts","sourceRoot":"","sources":["../../../src/web/admin/signup-stats.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signup-stats.d.ts","sourceRoot":"","sources":["../../../src/web/admin/signup-stats.tsx"],"names":[],"mappings":"AAmCA,wBAAgB,eAAe,4CAmR9B"}
|
|
@@ -3,7 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { Card, CardBody, CardHeader, Chip, Spinner, Tab, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, Tabs, } from "@lastbrain/ui";
|
|
5
5
|
import { BarChart3, TrendingUp } from "lucide-react";
|
|
6
|
+
import { useModuleTranslation } from "@lastbrain/core";
|
|
6
7
|
export function SignupStatsPage() {
|
|
8
|
+
const t = useModuleTranslation("auth");
|
|
7
9
|
const [stats, setStats] = useState(null);
|
|
8
10
|
const [loading, setLoading] = useState(true);
|
|
9
11
|
const [error, setError] = useState(null);
|
|
@@ -28,7 +30,7 @@ export function SignupStatsPage() {
|
|
|
28
30
|
}
|
|
29
31
|
};
|
|
30
32
|
if (loading) {
|
|
31
|
-
return (_jsx("div", { className: "flex justify-center items-center min-h-screen", children: _jsx(Spinner, { size: "lg", label: "Chargement des statistiques..." }) }));
|
|
33
|
+
return (_jsx("div", { className: "flex justify-center items-center min-h-screen", children: _jsx(Spinner, { size: "lg", label: t("signup_stats.loading") || "Chargement des statistiques..." }) }));
|
|
32
34
|
}
|
|
33
35
|
if (error || !stats) {
|
|
34
36
|
return (_jsx("div", { className: "p-6", children: _jsx(Card, { className: "border border-danger-200 bg-danger-50/50", children: _jsx(CardBody, { children: _jsx("p", { className: "text-danger-600", children: error || "Erreur de chargement" }) }) }) }));
|
|
@@ -37,7 +39,7 @@ export function SignupStatsPage() {
|
|
|
37
39
|
100).toFixed(1);
|
|
38
40
|
const recipePercentage = ((stats.bySource.recipe / stats.total) *
|
|
39
41
|
100).toFixed(1);
|
|
40
|
-
return (_jsxs("div", { className: "space-y-6 px-2 md:p-6", children: [_jsxs("div", { className: "flex items-center gap-2 mb-8", children: [_jsx(BarChart3, { size: 28, className: "text-primary-600" }), _jsx("h1", { className: "text-3xl font-bold", children: "Statistiques d'inscriptions" })] }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-12", children: [_jsx(Card, { className: " ", children: _jsxs(CardBody, { className: "gap-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm font-medium text-primary-600 dark:text-primary-400", children: "Total d'inscriptions" }), _jsx(TrendingUp, { size: 20, className: "text-primary-600" })] }), _jsx("p", { className: "text-4xl font-bold text-primary-700 dark:text-primary-300", children: stats.total })] }) }), _jsx(Card, { className: " ", children: _jsxs(CardBody, { className: "gap-4", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("span", { className: "text-sm font-medium text-secondary-600 dark:text-secondary-400", children: "Inscriptions LastBrain" }) }), _jsxs("div", { className: "flex items-end justify-between gap-2", children: [_jsx("p", { className: "text-4xl font-bold text-secondary-700 dark:text-secondary-300", children: stats.bySource.lastbrain }), _jsxs(Chip, { size: "sm", color: "secondary", variant: "flat", children: [lastbrainPercentage, "%"] })] })] }) }), _jsx(Card, { className: " ", children: _jsxs(CardBody, { className: "gap-4", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("span", { className: "text-sm font-medium text-success-600 dark:text-success-400", children: "Inscriptions Recipe" }) }), _jsxs("div", { className: "flex items-end justify-between gap-2", children: [_jsx("p", { className: "text-4xl font-bold text-success-700 dark:text-success-300", children: stats.bySource.recipe }), _jsxs(Chip, { size: "sm", color: "success", variant: "flat", children: [recipePercentage, "%"] })] })] }) })] }), _jsxs(Tabs, { "aria-label": "Vues des statistiques", color: "primary", variant: "bordered", children: [_jsx(Tab, { title: "Par Source", children: _jsxs(Card, { className: "mt-6", children: [_jsx(CardHeader, { children: _jsx("h3", { className: "text-lg font-semibold", children: "R\u00E9sum\u00E9 par source" }) }), _jsx(CardBody, { children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "p-4 rounded-lg border border-secondary-800 dark:border-secondary-800", children: [_jsxs("div", { className: "flex items-center justify-between mb-2", children: [_jsx("span", { className: "font-medium text-secondary-700 dark:text-secondary-300", children: "LastBrain" }), _jsxs(Chip, { size: "sm", color: "secondary", variant: "flat", children: [stats.bySource.lastbrain, " inscriptions"] })] }), _jsx("div", { className: "w-full bg-default-200 rounded-full h-2 dark:bg-default-700", children: _jsx("div", { className: "bg-secondary-500 h-2 rounded-full", style: {
|
|
42
|
+
return (_jsxs("div", { className: "space-y-6 px-2 md:p-6", children: [_jsxs("div", { className: "flex items-center gap-2 mb-8", children: [_jsx(BarChart3, { size: 28, className: "text-primary-600" }), _jsx("h1", { className: "text-3xl font-bold", children: t("signup_stats.title") || "Statistiques d'inscriptions" })] }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-12", children: [_jsx(Card, { className: " ", children: _jsxs(CardBody, { className: "gap-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm font-medium text-primary-600 dark:text-primary-400", children: t("signup_stats.total") || "Total d'inscriptions" }), _jsx(TrendingUp, { size: 20, className: "text-primary-600" })] }), _jsx("p", { className: "text-4xl font-bold text-primary-700 dark:text-primary-300", children: stats.total })] }) }), _jsx(Card, { className: " ", children: _jsxs(CardBody, { className: "gap-4", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("span", { className: "text-sm font-medium text-secondary-600 dark:text-secondary-400", children: "Inscriptions LastBrain" }) }), _jsxs("div", { className: "flex items-end justify-between gap-2", children: [_jsx("p", { className: "text-4xl font-bold text-secondary-700 dark:text-secondary-300", children: stats.bySource.lastbrain }), _jsxs(Chip, { size: "sm", color: "secondary", variant: "flat", children: [lastbrainPercentage, "%"] })] })] }) }), _jsx(Card, { className: " ", children: _jsxs(CardBody, { className: "gap-4", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("span", { className: "text-sm font-medium text-success-600 dark:text-success-400", children: "Inscriptions Recipe" }) }), _jsxs("div", { className: "flex items-end justify-between gap-2", children: [_jsx("p", { className: "text-4xl font-bold text-success-700 dark:text-success-300", children: stats.bySource.recipe }), _jsxs(Chip, { size: "sm", color: "success", variant: "flat", children: [recipePercentage, "%"] })] })] }) })] }), _jsxs(Tabs, { "aria-label": "Vues des statistiques", color: "primary", variant: "bordered", children: [_jsx(Tab, { title: "Par Source", children: _jsxs(Card, { className: "mt-6", children: [_jsx(CardHeader, { children: _jsx("h3", { className: "text-lg font-semibold", children: "R\u00E9sum\u00E9 par source" }) }), _jsx(CardBody, { children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "p-4 rounded-lg border border-secondary-800 dark:border-secondary-800", children: [_jsxs("div", { className: "flex items-center justify-between mb-2", children: [_jsx("span", { className: "font-medium text-secondary-700 dark:text-secondary-300", children: "LastBrain" }), _jsxs(Chip, { size: "sm", color: "secondary", variant: "flat", children: [stats.bySource.lastbrain, " inscriptions"] })] }), _jsx("div", { className: "w-full bg-default-200 rounded-full h-2 dark:bg-default-700", children: _jsx("div", { className: "bg-secondary-500 h-2 rounded-full", style: {
|
|
41
43
|
width: `${(stats.bySource.lastbrain / stats.total) * 100}%`,
|
|
42
44
|
} }) }), _jsxs("p", { className: "text-xs text-default-500 mt-2", children: [lastbrainPercentage, "% du total"] })] }), _jsxs("div", { className: "p-4 rounded-lg border border-success-200 dark:border-success-800", children: [_jsxs("div", { className: "flex items-center justify-between mb-2", children: [_jsx("span", { className: "font-medium text-success-700 dark:text-success-300", children: "Recipe" }), _jsxs(Chip, { size: "sm", color: "success", variant: "flat", children: [stats.bySource.recipe, " inscriptions"] })] }), _jsx("div", { className: "w-full bg-default-200 rounded-full h-2 dark:bg-default-700", children: _jsx("div", { className: "bg-success-500 h-2 rounded-full", style: {
|
|
43
45
|
width: `${(stats.bySource.recipe / stats.total) * 100}%`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-detail.d.ts","sourceRoot":"","sources":["../../../src/web/admin/user-detail.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-detail.d.ts","sourceRoot":"","sources":["../../../src/web/admin/user-detail.tsx"],"names":[],"mappings":"AAyBA,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAkCD,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,cAAmB,GACpB,EAAE,mBAAmB,2CAulBrB"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect, useCallback } from "react";
|
|
4
|
+
import { useModuleTranslation, useLanguage } from "@lastbrain/core";
|
|
4
5
|
import { Card, CardHeader, CardBody, Tabs, Tab, Avatar, Chip, Button, Input, Textarea, Select, SelectItem, Spinner, addToast, Snippet, } from "@lastbrain/ui";
|
|
5
6
|
import { User, Bell, Settings } from "lucide-react";
|
|
6
7
|
import { useAuth } from "@lastbrain/core";
|
|
7
8
|
import * as LucideIcons from "lucide-react";
|
|
8
9
|
export function UserDetailPage({ userId, moduleUserTabs = [], }) {
|
|
10
|
+
const t = useModuleTranslation("auth");
|
|
11
|
+
const { t: tGlobal } = useLanguage(); // Pour les traductions des autres modules
|
|
9
12
|
const { user: _currentUser } = useAuth();
|
|
10
13
|
const [userProfile, setUserProfile] = useState(null);
|
|
11
14
|
const [loading, setLoading] = useState(true);
|
|
@@ -33,7 +36,8 @@ export function UserDetailPage({ userId, moduleUserTabs = [], }) {
|
|
|
33
36
|
setUserProfile(userDetails);
|
|
34
37
|
}
|
|
35
38
|
catch (error) {
|
|
36
|
-
console.error("
|
|
39
|
+
console.error(t("user_detail.profile_loading_error") ||
|
|
40
|
+
"Erreur lors du chargement du profil:", error);
|
|
37
41
|
setUserProfile(null);
|
|
38
42
|
}
|
|
39
43
|
finally {
|
|
@@ -48,7 +52,8 @@ export function UserDetailPage({ userId, moduleUserTabs = [], }) {
|
|
|
48
52
|
if (!notificationTitle.trim() || !notificationMessage.trim()) {
|
|
49
53
|
addToast({
|
|
50
54
|
color: "danger",
|
|
51
|
-
title: "
|
|
55
|
+
title: t("user_detail.fill_title_message") ||
|
|
56
|
+
"Veuillez remplir le titre et le message",
|
|
52
57
|
});
|
|
53
58
|
return;
|
|
54
59
|
}
|
|
@@ -76,13 +81,15 @@ export function UserDetailPage({ userId, moduleUserTabs = [], }) {
|
|
|
76
81
|
setNotificationType("info");
|
|
77
82
|
addToast({
|
|
78
83
|
color: "success",
|
|
79
|
-
title: "
|
|
84
|
+
title: t("user_detail.notification_sent_success") ||
|
|
85
|
+
"Notification envoyée avec succès",
|
|
80
86
|
});
|
|
81
87
|
}
|
|
82
88
|
catch {
|
|
83
89
|
addToast({
|
|
84
90
|
color: "danger",
|
|
85
|
-
title: "
|
|
91
|
+
title: t("user_detail.notification_send_error") ||
|
|
92
|
+
"Erreur lors de l'envoi de la notification",
|
|
86
93
|
});
|
|
87
94
|
}
|
|
88
95
|
finally {
|
|
@@ -93,32 +100,40 @@ export function UserDetailPage({ userId, moduleUserTabs = [], }) {
|
|
|
93
100
|
return (_jsx("div", { className: "flex justify-center items-center min-h-64", children: _jsx(Spinner, { size: "lg" }) }));
|
|
94
101
|
}
|
|
95
102
|
if (!userProfile) {
|
|
96
|
-
return (_jsx(Card, { children: _jsx(CardBody, { children: _jsx("p", { className: "text-center text-gray-500", children: "Utilisateur non
|
|
103
|
+
return (_jsx(Card, { children: _jsx(CardBody, { children: _jsx("p", { className: "text-center text-gray-500", children: t("user_detail.user_not_found") || "Utilisateur non trouvé" }) }) }));
|
|
97
104
|
}
|
|
98
105
|
const isAdmin = Array.isArray(userProfile.raw_app_meta_data?.roles) &&
|
|
99
106
|
userProfile.raw_app_meta_data.roles.includes("admin");
|
|
100
107
|
return (_jsxs("div", { className: "max-w-[calc(100vw-8rem)] mx-auto mt-4 space-y-6", children: [_jsx(Card, { children: _jsxs(CardHeader, { className: "flex flex-col md:flex-row gap-4", children: [_jsx(Avatar, { isBordered: true, src: userProfile.avatar_sizes?.large || userProfile.avatar_url
|
|
101
108
|
? `/api/storage/${userProfile.avatar_sizes?.large || userProfile.avatar_url}`
|
|
102
|
-
: undefined, name: userProfile.full_name || userProfile.email, size: "lg" }), _jsxs("div", { className: "w-full flex flex-col gap-1", children: [_jsxs("div", { className: "w-full flex flex-col md:flex-row justify-between", children: [_jsx("h1", { className: "text-xl font-bold", children: userProfile.full_name || userProfile.email }), _jsxs("p", { className: "text-sm text-default-500 ", children: [_jsx("span", { className: "", children: "
|
|
109
|
+
: undefined, name: userProfile.full_name || userProfile.email, size: "lg" }), _jsxs("div", { className: "w-full flex flex-col gap-1", children: [_jsxs("div", { className: "w-full flex flex-col md:flex-row justify-between", children: [_jsx("h1", { className: "text-xl font-bold", children: userProfile.full_name || userProfile.email }), _jsxs("p", { className: "text-sm text-default-500 ", children: [_jsx("span", { className: "", children: t("user_detail.last_login") || "Dernière connexion:" }), " ", userProfile.last_sign_in_at
|
|
103
110
|
? new Date(userProfile.last_sign_in_at).toLocaleDateString()
|
|
104
|
-
: "N/A", " ", "
|
|
111
|
+
: t("user_detail.not_available") || "N/A", " ", t("user_detail.at") || "à", " ", userProfile.last_sign_in_at
|
|
105
112
|
? new Date(userProfile.last_sign_in_at).toLocaleTimeString()
|
|
106
|
-
: "N/A"] })] }), _jsx("p", { className: "text-gray-500", children: userProfile.email }), _jsxs("div", { className: "flex flex-col md:flex-row md:items-center gap-2", children: [_jsx(Chip, { variant: "flat", color: isAdmin ? "danger" : "primary", size: "sm", children: isAdmin
|
|
113
|
+
: t("user_detail.not_available") || "N/A"] })] }), _jsx("p", { className: "text-gray-500", children: userProfile.email }), _jsxs("div", { className: "flex flex-col md:flex-row md:items-center gap-2", children: [_jsx(Chip, { variant: "flat", color: isAdmin ? "danger" : "primary", size: "sm", children: isAdmin
|
|
114
|
+
? t("user_detail.administrator") || "Administrateur"
|
|
115
|
+
: t("user_detail.user") || "Utilisateur" }), userProfile.profile?.signup_source && (_jsx(Chip, { variant: "flat", color: userProfile.profile.signup_source.toLowerCase() === "recipe"
|
|
107
116
|
? "success"
|
|
108
117
|
: "secondary", size: "sm", children: userProfile.profile.signup_source.toLowerCase() === "recipe"
|
|
109
|
-
? "Recipe"
|
|
110
|
-
: "LastBrain" })), _jsx(Snippet, { color: "default", size: "sm", symbol: "#", children: userId })] })] })] }) }), _jsx(Card, { children: _jsx(CardBody, { children: _jsxs(Tabs, { "aria-label": "Options utilisateur", color: "primary", variant: "underlined", children: [_jsx(Tab, { title: _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(User, { size: 16 }), _jsx("span", { children: "Profil" })] }), children: _jsxs("div", { className: "space-y-6 mt-4", children: [_jsx(Card, { children: _jsxs(CardBody, { children: [_jsxs("h3", { className: "font-semibold text-lg mb-4 flex items-center gap-2", children: [_jsx(User, { size: 18 }), "
|
|
118
|
+
? t("user_detail.source_recipe") || "Recipe"
|
|
119
|
+
: t("user_detail.source_lastbrain") || "LastBrain" })), _jsx(Snippet, { color: "default", size: "sm", symbol: "#", children: userId })] })] })] }) }), _jsx(Card, { children: _jsx(CardBody, { children: _jsxs(Tabs, { "aria-label": t("user_detail.user_options") || "Options utilisateur", color: "primary", variant: "underlined", children: [_jsx(Tab, { title: _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(User, { size: 16 }), _jsx("span", { children: t("user_detail.tab_profile") || "Profil" })] }), children: _jsxs("div", { className: "space-y-6 mt-4", children: [_jsx(Card, { children: _jsxs(CardBody, { children: [_jsxs("h3", { className: "font-semibold text-lg mb-4 flex items-center gap-2", children: [_jsx(User, { size: 18 }), t("user_detail.identity_section") || "Identité"] }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 text-sm", children: [_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.full_name") || "Nom complet" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.full_name ||
|
|
120
|
+
t("user_detail.not_provided") ||
|
|
121
|
+
"Non renseigné" })] }), userProfile.profile?.first_name && (_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.first_name") || "Prénom" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.profile.first_name })] })), userProfile.profile?.last_name && (_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.last_name") || "Nom" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.profile.last_name })] })), _jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.email") || "Email" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.email })] }), userProfile.profile?.phone && (_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.phone") || "Téléphone" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.profile.phone })] }))] }), userProfile.profile?.bio && (_jsxs("div", { className: "mt-4", children: [_jsx("span", { className: "text-default-500 text-sm", children: t("user_detail.bio") || "Bio" }), _jsx("p", { className: "font-medium mt-1 text-sm", children: userProfile.profile.bio })] }))] }) }), (userProfile.profile?.company ||
|
|
111
122
|
userProfile.profile?.website ||
|
|
112
|
-
userProfile.profile?.location) && (_jsx(Card, { children: _jsxs(CardBody, { children: [_jsx("h3", { className: "font-semibold text-lg mb-4", children:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
123
|
+
userProfile.profile?.location) && (_jsx(Card, { children: _jsxs(CardBody, { children: [_jsx("h3", { className: "font-semibold text-lg mb-4", children: t("user_detail.professional_info") ||
|
|
124
|
+
"Informations professionnelles" }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 text-sm", children: [userProfile.profile?.company && (_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.company") || "Entreprise" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.profile.company })] })), userProfile.profile?.website && (_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.website") || "Site web" }), _jsx("p", { className: "font-medium mt-1", children: _jsx("a", { href: userProfile.profile.website, target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline", children: userProfile.profile.website }) })] })), userProfile.profile?.location && (_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.location") || "Localisation" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.profile.location })] }))] })] }) })), (userProfile.profile?.language ||
|
|
125
|
+
userProfile.profile?.timezone) && (_jsx(Card, { children: _jsxs(CardBody, { children: [_jsx("h3", { className: "font-semibold text-lg mb-4", children: t("user_detail.preferences") || "Préférences" }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 text-sm", children: [userProfile.profile?.language && (_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.language") || "Langue" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.profile.language.toUpperCase() })] })), userProfile.profile?.timezone && (_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.timezone") || "Fuseau horaire" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.profile.timezone })] }))] })] }) })), _jsx(Card, { children: _jsxs(CardBody, { children: [_jsx("h3", { className: "font-semibold text-lg mb-4", children: t("user_detail.account_info") ||
|
|
126
|
+
"Informations du compte" }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 text-sm", children: [_jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.role") || "Rôle" }), _jsx("div", { className: "mt-2", children: _jsx(Chip, { variant: "flat", color: isAdmin ? "danger" : "default", size: "sm", children: isAdmin
|
|
127
|
+
? t("user_detail.administrator") ||
|
|
128
|
+
"Administrateur"
|
|
129
|
+
: t("user_detail.standard_user") ||
|
|
130
|
+
"Utilisateur standard" }) })] }), _jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.creation_date") || "Date de création" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.created_at
|
|
116
131
|
? new Date(userProfile.created_at).toLocaleDateString("fr-FR", {
|
|
117
132
|
year: "numeric",
|
|
118
133
|
month: "long",
|
|
119
134
|
day: "numeric",
|
|
120
135
|
})
|
|
121
|
-
: "N/A" })] }), _jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: "
|
|
136
|
+
: t("user_detail.not_available") || "N/A" })] }), _jsxs("div", { children: [_jsx("span", { className: "text-default-500", children: t("user_detail.last_login") || "Dernière connexion" }), _jsx("p", { className: "font-medium mt-1", children: userProfile.last_sign_in_at
|
|
122
137
|
? new Date(userProfile.last_sign_in_at).toLocaleDateString("fr-FR", {
|
|
123
138
|
year: "numeric",
|
|
124
139
|
month: "long",
|
|
@@ -126,7 +141,17 @@ export function UserDetailPage({ userId, moduleUserTabs = [], }) {
|
|
|
126
141
|
hour: "2-digit",
|
|
127
142
|
minute: "2-digit",
|
|
128
143
|
})
|
|
129
|
-
: "Jamais" })] })] })] }) })] }) }, "profile"), _jsx(Tab, { title: _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Bell, { size: 16 }), _jsx("span", { children:
|
|
144
|
+
: t("user_detail.never") || "Jamais" })] })] })] }) })] }) }, "profile"), _jsx(Tab, { title: _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Bell, { size: 16 }), _jsx("span", { children: t("user_detail.tab_notifications") || "Notifications" })] }), children: _jsxs("div", { className: "space-y-4 mt-4", children: [_jsx("h3", { className: "font-semibold", children: t("user_detail.send_notification") ||
|
|
145
|
+
"Envoyer une notification" }), _jsxs("div", { className: "space-y-4", children: [_jsx(Input, { label: t("user_detail.notification_title") ||
|
|
146
|
+
"Titre de la notification", placeholder: t("user_detail.notification_title_placeholder") ||
|
|
147
|
+
"Ex: Nouveau message important", value: notificationTitle, onChange: (e) => setNotificationTitle(e.target.value), maxLength: 100 }), _jsx(Textarea, { label: t("user_detail.notification_message") || "Message", placeholder: t("user_detail.notification_message_placeholder") ||
|
|
148
|
+
"Contenu de la notification...", value: notificationMessage, onChange: (e) => setNotificationMessage(e.target.value), maxLength: 500, minRows: 3 }), _jsxs(Select, { label: t("user_detail.notification_type") ||
|
|
149
|
+
"Type de notification", selectedKeys: [notificationType], onSelectionChange: (keys) => setNotificationType(Array.from(keys)[0]), children: [_jsx(SelectItem, { children: t("user_detail.notification_type_info") || "Information" }, "info"), _jsx(SelectItem, { children: t("user_detail.notification_type_warning") ||
|
|
150
|
+
"Avertissement" }, "warning"), _jsx(SelectItem, { children: t("user_detail.notification_type_danger") || "Danger" }, "danger"), _jsx(SelectItem, { children: t("user_detail.notification_type_success") || "Succès" }, "success")] }), _jsx(Button, { color: "primary", onPress: handleSendNotification, isLoading: sendingNotification, startContent: _jsx(Bell, { size: 16 }), isDisabled: !notificationTitle.trim() || !notificationMessage.trim(), children: t("user_detail.send_button") || "Envoyer la notification" })] })] }) }, "notifications"), _jsx(Tab, { title: _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Settings, { size: 16 }), _jsx("span", { children: t("user_detail.tab_settings") || "Paramètres" })] }), children: _jsxs("div", { className: "space-y-4 mt-4", children: [_jsx("h3", { className: "font-semibold", children: t("user_detail.admin_actions") || "Actions administrateur" }), _jsxs("div", { className: "space-y-3 space-x-5", children: [_jsx(Button, { color: "warning", variant: "bordered", size: "sm", children: t("user_detail.reset_password_btn") ||
|
|
151
|
+
"Réinitialiser le mot de passe" }), _jsx(Button, { color: "danger", variant: "bordered", size: "sm", children: t("user_detail.suspend_account_btn") ||
|
|
152
|
+
"Suspendre le compte" }), _jsx(Button, { color: "secondary", variant: "bordered", size: "sm", children: t("user_detail.promote_admin_btn") ||
|
|
153
|
+
"Promouvoir en administrateur" })] }), _jsxs("div", { className: "mt-6 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg", children: [_jsx("h4", { className: "font-medium mb-2", children: t("user_detail.technical_metadata") ||
|
|
154
|
+
"Métadonnées techniques" }), _jsx("pre", { className: "text-xs text-gray-600 dark:text-gray-400 overflow-auto", children: JSON.stringify({
|
|
130
155
|
app_metadata: userProfile.raw_app_meta_data,
|
|
131
156
|
user_metadata: userProfile.raw_user_meta_data,
|
|
132
157
|
}, null, 2) })] })] }) }, "settings"), moduleUserTabs.map((tab) => {
|
|
@@ -134,6 +159,6 @@ export function UserDetailPage({ userId, moduleUserTabs = [], }) {
|
|
|
134
159
|
const IconComponent = tab.icon
|
|
135
160
|
? LucideIcons[tab.icon]
|
|
136
161
|
: null;
|
|
137
|
-
return (_jsx(Tab, { title: _jsxs("div", { className: "flex items-center space-x-2", children: [IconComponent && _jsx(IconComponent, { size: 16 }), _jsx("span", { children: tab.title })] }), children: _jsx(TabComponent, { userId: userId }) }, tab.key));
|
|
162
|
+
return (_jsx(Tab, { title: _jsxs("div", { className: "flex items-center space-x-2", children: [IconComponent && _jsx(IconComponent, { size: 16 }), _jsx("span", { children: tGlobal(tab.title) })] }), children: _jsx(TabComponent, { userId: userId }) }, tab.key));
|
|
138
163
|
})] }) }) })] }));
|
|
139
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users-by-signup-source.d.ts","sourceRoot":"","sources":["../../../src/web/admin/users-by-signup-source.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"users-by-signup-source.d.ts","sourceRoot":"","sources":["../../../src/web/admin/users-by-signup-source.tsx"],"names":[],"mappings":"AAuCA,wBAAgB,uBAAuB,4CAqQtC"}
|