@lastbrain/module-auth 2.0.19 → 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.
@@ -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,iBAkVtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
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",
@@ -307,6 +302,16 @@ const authBuildConfig = {
307
302
  },
308
303
  ],
309
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
+ ],
310
315
  storage: {
311
316
  buckets: [
312
317
  {
@@ -0,0 +1,2 @@
1
+ export declare function DashboardPage(): import("react/jsx-runtime").JSX.Element | null;
2
+ //# sourceMappingURL=dashboard.d.ts.map
@@ -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 "./web/auth/dashboard";
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";
@@ -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,sBAAsB,CAAC;AACrD,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"}
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 "./web/auth/dashboard";
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lastbrain/module-auth",
3
- "version": "2.0.19",
3
+ "version": "2.0.27",
4
4
  "description": "Module d'authentification complet pour LastBrain avec Supabase",
5
5
  "private": false,
6
6
  "type": "module",
@@ -32,9 +32,9 @@
32
32
  "supabase"
33
33
  ],
34
34
  "dependencies": {
35
- "@lastbrain/app": "^2.0.21",
36
- "@lastbrain/core": "^2.0.19",
37
- "@lastbrain/ui": "^2.0.19",
35
+ "@lastbrain/app": "^2.0.31",
36
+ "@lastbrain/core": "^2.0.27",
37
+ "@lastbrain/ui": "^2.0.27",
38
38
  "@supabase/supabase-js": "^2.86.0",
39
39
  "lucide-react": "^0.554.0",
40
40
  "react": "^19.2.1",
@@ -18,11 +18,6 @@ const authBuildConfig: ModuleBuildConfig = {
18
18
  path: "/reset-password",
19
19
  componentExport: "ResetPassword",
20
20
  },
21
- {
22
- section: "auth",
23
- path: "/dashboard",
24
- componentExport: "DashboardPage",
25
- },
26
21
  {
27
22
  section: "auth",
28
23
  path: "/folder",
@@ -310,6 +305,16 @@ const authBuildConfig: ModuleBuildConfig = {
310
305
  },
311
306
  ],
312
307
  },
308
+ authDashboard: [
309
+ {
310
+ key: "user",
311
+ title: "auth",
312
+ icon: "Dashboard",
313
+ componentExport: "DashboardPage",
314
+ entryPoint: "components/auth/dashboard",
315
+ order: 1,
316
+ },
317
+ ],
313
318
  storage: {
314
319
  buckets: [
315
320
  {
@@ -11,7 +11,7 @@ import {
11
11
  Avatar,
12
12
  } from "@lastbrain/ui";
13
13
 
14
- import { User, Mail, Calendar, Shield } from "lucide-react";
14
+ import { User, Mail, Calendar, Shield, LayoutDashboard } from "lucide-react";
15
15
  import { useModuleTranslation } from "@lastbrain/core";
16
16
 
17
17
  interface UserData {
@@ -93,12 +93,15 @@ export function DashboardPage() {
93
93
  : "User";
94
94
 
95
95
  return (
96
- <div className="pt-12 pb-12 max-w-6xl mx-auto px-4">
97
- <h1 className="text-3xl font-bold mb-8">
98
- {t("dashboard.title") || "Dashboard"}
99
- </h1>
96
+ <div className="md:pt-8 max-w-6xl mx-auto">
97
+ <div className="flex flex-inline items-center gap-2 mb-4">
98
+ <LayoutDashboard size={24} />
99
+ <h1 className="text-3xl font-bold ">
100
+ {t("dashboard.title") || "Dashboard"}
101
+ </h1>
102
+ </div>
100
103
 
101
- <div className="grid gap-6 md:grid-cols-2">
104
+ <div className="mx-0 px-0 grid gap-6 md:grid-cols-2">
102
105
  {/* Profile Summary Card */}
103
106
  <Card className="col-span-full md:col-span-1">
104
107
  <CardHeader className="flex gap-3">
@@ -188,7 +191,7 @@ export function DashboardPage() {
188
191
  </Card>
189
192
  )}
190
193
 
191
- {/* Quick Stats */}
194
+ {/* Quick Stats
192
195
  <Card className="col-span-full">
193
196
  <CardHeader>
194
197
  <h3 className="text-lg font-semibold">Quick Stats</h3>
@@ -219,7 +222,7 @@ export function DashboardPage() {
219
222
  </div>
220
223
  </div>
221
224
  </CardBody>
222
- </Card>
225
+ </Card> */}
223
226
  </div>
224
227
  </div>
225
228
  );
package/src/i18n/en.json CHANGED
@@ -108,6 +108,8 @@
108
108
  "profile.professional_info": "Professional Information",
109
109
  "profile.company_placeholder": "Enter your company name",
110
110
  "profile.website_placeholder": "https://example.com",
111
+ "module-auth.dashboard.complete": "Complete",
112
+
111
113
  "profile.location_placeholder": "City, Country",
112
114
  "profile.preferences": "Preferences",
113
115
  "profile.language": "Language",
package/src/i18n/fr.json CHANGED
@@ -115,6 +115,7 @@
115
115
  "profile.website_placeholder": "https://example.com",
116
116
  "profile.location_placeholder": "Ville, Pays",
117
117
  "profile.preferences": "Préférences",
118
+ "module-auth.dashboard.complete": "Complet",
118
119
  "profile.language": "Langue",
119
120
  "profile.language_placeholder": "en, fr, es...",
120
121
  "profile.timezone": "Fuseau horaire",
package/src/index.ts 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 "./web/auth/dashboard";
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";