anky2002 commited on
Commit
d8272af
·
2 Parent(s): ae8063405a1a2d

fix: add useRouter import to login and signup pages for navigation handling

Browse files
web/app/auth/login/page.tsx CHANGED
@@ -4,7 +4,7 @@ import { useState, useEffect, Suspense } from "react";
4
  import { createClient } from "@/lib/supabase/client";
5
  import { getBaseUrl } from "@/lib/auth-url";
6
  import Link from "next/link";
7
- import { useSearchParams } from "next/navigation";
8
  import { ArrowLeft, Mail, Loader2 } from "lucide-react";
9
 
10
  function LoginForm() {
@@ -16,6 +16,7 @@ function LoginForm() {
16
  const [magicSent, setMagicSent] = useState(false);
17
  const supabase = createClient();
18
  const searchParams = useSearchParams();
 
19
  const next = searchParams.get("next") || "/dashboard-pages/dashboard";
20
 
21
  // Check if already logged in — redirect immediately
 
4
  import { createClient } from "@/lib/supabase/client";
5
  import { getBaseUrl } from "@/lib/auth-url";
6
  import Link from "next/link";
7
+ import { useSearchParams, useRouter } from "next/navigation";
8
  import { ArrowLeft, Mail, Loader2 } from "lucide-react";
9
 
10
  function LoginForm() {
 
16
  const [magicSent, setMagicSent] = useState(false);
17
  const supabase = createClient();
18
  const searchParams = useSearchParams();
19
+ const router = useRouter();
20
  const next = searchParams.get("next") || "/dashboard-pages/dashboard";
21
 
22
  // Check if already logged in — redirect immediately
web/app/auth/signup/page.tsx CHANGED
@@ -4,6 +4,7 @@ import { useState, useEffect } from "react";
4
  import { createClient } from "@/lib/supabase/client";
5
  import { getBaseUrl } from "@/lib/auth-url";
6
  import Link from "next/link";
 
7
  import { ArrowLeft, Loader2 } from "lucide-react";
8
 
9
  export default function SignupPage() {
@@ -14,6 +15,7 @@ export default function SignupPage() {
14
  const [checking, setChecking] = useState(true);
15
  const [done, setDone] = useState(false);
16
  const supabase = createClient();
 
17
 
18
  // Redirect if already logged in
19
  useEffect(() => {
 
4
  import { createClient } from "@/lib/supabase/client";
5
  import { getBaseUrl } from "@/lib/auth-url";
6
  import Link from "next/link";
7
+ import { useRouter } from "next/navigation";
8
  import { ArrowLeft, Loader2 } from "lucide-react";
9
 
10
  export default function SignupPage() {
 
15
  const [checking, setChecking] = useState(true);
16
  const [done, setDone] = useState(false);
17
  const supabase = createClient();
18
+ const router = useRouter();
19
 
20
  // Redirect if already logged in
21
  useEffect(() => {
web/components/nav.tsx CHANGED
@@ -5,7 +5,8 @@ import { usePathname } from "next/navigation";
5
  import type { LucideIcon } from "lucide-react";
6
  import {
7
  ShieldCheck, Menu, X, Crown, GitCompare, LayoutDashboard,
8
- ScanText, Settings, LogIn, Zap, Sparkles, CreditCard
 
9
  } from "lucide-react";
10
  import { useState, useEffect } from "react";
11
  import { createClient } from "@/lib/supabase/client";
@@ -20,10 +21,12 @@ export function Nav() {
20
  const [open, setOpen] = useState(false);
21
  const [userEmail, setUserEmail] = useState<string | null>(null);
22
  const [userRole, setUserRole] = useState<string | null>(null);
 
23
  const [loaded, setLoaded] = useState(false);
24
  const pathname = usePathname();
25
  const isLoggedIn = !!userEmail;
26
  const isAdmin = userRole === "admin";
 
27
 
28
  useEffect(() => {
29
  const supabase = createClient();
@@ -33,16 +36,26 @@ export function Nav() {
33
  if (user) {
34
  const { data: profile } = await supabase
35
  .from("profiles")
36
- .select("role")
37
  .eq("id", user.id)
38
  .single();
39
  setUserRole(profile?.role || "user");
 
40
  }
41
  setLoaded(true);
42
  });
43
  }, []);
44
 
45
- // All links — always visible
 
 
 
 
 
 
 
 
 
46
  const mainLinks: NavLink[] = [
47
  { href: "/#features", label: "Features", icon: Sparkles },
48
  { href: "/#pricing", label: "Pricing", icon: CreditCard },
@@ -50,11 +63,6 @@ export function Nav() {
50
  { href: "/dashboard-pages/compare", label: "Compare", icon: GitCompare },
51
  ];
52
 
53
- // Extra links only for logged-in users
54
- const authLinks: NavLink[] = [
55
- { href: "/dashboard-pages/dashboard", label: "Dashboard", icon: LayoutDashboard },
56
- ];
57
-
58
  return (
59
  <nav className="sticky top-0 z-50 bg-white/80 backdrop-blur-md border-b border-zinc-100">
60
  <div className="max-w-6xl mx-auto px-4 sm:px-5 h-14 flex items-center justify-between">
@@ -67,9 +75,8 @@ export function Nav() {
67
 
68
  {/* Desktop Nav */}
69
  <div className="hidden md:flex items-center gap-0.5">
70
- {/* Main links always visible */}
71
  {mainLinks.map((l) => {
72
- const Icon = l.icon ?? null;
73
  const isActive = pathname === l.href;
74
  return (
75
  <Link key={l.href} href={l.href}
@@ -81,69 +88,132 @@ export function Nav() {
81
  );
82
  })}
83
 
84
- {/* Dashboard only when logged in */}
85
- {isLoggedIn && authLinks.map((l) => {
86
- const Icon = l.icon ?? null;
87
- const isActive = pathname === l.href;
88
- return (
89
- <Link key={l.href} href={l.href}
 
 
 
 
 
 
 
 
 
 
90
  className={`flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] rounded-md transition-colors ${
91
- isActive ? "text-zinc-900 bg-zinc-100 font-medium" : "text-zinc-500 hover:text-zinc-900 hover:bg-zinc-50"
 
 
92
  }`}>
93
- {Icon && <Icon className="w-3.5 h-3.5" />}
94
- {l.label}
95
  </Link>
96
- );
97
- })}
98
 
99
- {/* Admin always visible for admins */}
100
- {isAdmin && (
101
- <Link href="/admin"
102
- className={`flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] rounded-md transition-colors ${
103
- pathname === "/admin"
104
- ? "text-amber-700 bg-amber-50 font-medium"
105
- : "text-amber-600 hover:text-amber-700 hover:bg-amber-50"
106
- }`}>
107
- <Crown className="w-3.5 h-3.5" /> Admin
108
- </Link>
109
- )}
 
110
 
111
- <div className="w-px h-4 bg-zinc-200 mx-1.5" />
 
 
 
 
 
 
 
 
 
 
 
112
 
113
- {/* Right side auth actions */}
114
- {isLoggedIn ? (
115
- <>
116
  <Link href="/dashboard-pages/settings"
117
  className={`flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] rounded-md transition-colors ${
118
- pathname?.includes("settings") ? "text-zinc-900 bg-zinc-100" : "text-zinc-500 hover:text-zinc-900 hover:bg-zinc-50"
 
 
119
  }`}>
120
- <Settings className="w-3.5 h-3.5" /> Settings
 
121
  </Link>
122
- <button onClick={async () => {
123
- const supabase = createClient();
124
- await supabase.auth.signOut();
125
- setUserEmail(null);
126
- setUserRole(null);
127
- window.location.href = "/";
128
- }} className="flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] text-zinc-500 hover:text-zinc-900 rounded-md hover:bg-zinc-50 transition-colors">
129
- Log out
130
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  <Link href="/dashboard-pages/analyze"
132
  className="ml-1 px-3 py-1.5 text-[13px] font-medium text-white bg-zinc-900 rounded-md hover:bg-zinc-800 transition-colors flex items-center gap-1.5">
133
  <Zap className="w-3.5 h-3.5" /> New scan
134
  </Link>
135
  </>
136
- ) : (
 
 
 
137
  <>
138
- {loaded && (
139
- <Link href="/auth/login"
140
- className="flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] text-zinc-500 hover:text-zinc-900 rounded-md hover:bg-zinc-50 transition-colors">
141
- <LogIn className="w-3.5 h-3.5" /> Log in
142
- </Link>
143
- )}
 
 
 
 
 
144
  <Link href="/auth/signup"
145
  className="ml-1 px-3 py-1.5 text-[13px] font-medium text-white bg-zinc-900 rounded-md hover:bg-zinc-800 transition-colors">
146
- Get started
147
  </Link>
148
  </>
149
  )}
@@ -158,72 +228,118 @@ export function Nav() {
158
  {/* Mobile Menu */}
159
  {open && (
160
  <div className="md:hidden border-t border-zinc-100 bg-white px-5 py-3 space-y-0.5">
161
- {/* Main links */}
162
  {mainLinks.map((l) => {
163
  const Icon = l.icon ?? null;
 
164
  return (
165
  <Link key={l.href} href={l.href} onClick={() => setOpen(false)}
166
- className="flex items-center gap-2.5 px-3 py-2.5 text-sm text-zinc-600 rounded-md hover:bg-zinc-50">
 
 
167
  {Icon && <Icon className="w-4 h-4 text-zinc-400" />}
168
  {l.label}
169
  </Link>
170
  );
171
  })}
172
 
173
- {/* Auth links */}
174
- {isLoggedIn && (
 
 
 
 
 
 
 
 
 
 
 
175
  <>
176
  <div className="h-px bg-zinc-100 my-1.5" />
 
 
 
 
 
 
 
177
  <Link href="/dashboard-pages/dashboard" onClick={() => setOpen(false)}
178
- className="flex items-center gap-2.5 px-3 py-2.5 text-sm text-zinc-600 rounded-md hover:bg-zinc-50">
 
 
 
 
179
  <LayoutDashboard className="w-4 h-4 text-zinc-400" /> Dashboard
180
  </Link>
 
181
  <Link href="/dashboard-pages/settings" onClick={() => setOpen(false)}
182
- className="flex items-center gap-2.5 px-3 py-2.5 text-sm text-zinc-600 rounded-md hover:bg-zinc-50">
 
 
 
 
183
  <Settings className="w-4 h-4 text-zinc-400" /> Settings
184
  </Link>
185
- </>
186
- )}
187
 
188
- {/* Admin */}
189
- {isAdmin && (
190
- <Link href="/admin" onClick={() => setOpen(false)}
191
- className="flex items-center gap-2.5 px-3 py-2.5 text-sm text-amber-600 rounded-md hover:bg-amber-50">
192
- <Crown className="w-4 h-4" /> Admin Panel
193
- </Link>
194
- )}
 
 
 
 
195
 
196
- <div className="h-px bg-zinc-100 my-1.5" />
 
 
 
 
 
 
 
 
 
 
197
 
198
- {/* Auth actions */}
199
- {isLoggedIn ? (
200
- <>
201
  <Link href="/dashboard-pages/analyze" onClick={() => setOpen(false)}
202
- className="block px-3 py-2.5 text-sm font-medium text-white bg-zinc-900 rounded-lg text-center hover:bg-zinc-800 mb-1">
203
- New Scan
204
  </Link>
205
- <button
206
- onClick={async () => {
207
- setOpen(false);
208
- const supabase = createClient();
209
- await supabase.auth.signOut();
210
- setUserEmail(null);
211
- setUserRole(null);
212
- window.location.href = "/";
213
- }}
214
- className="w-full text-left flex items-center gap-2.5 px-3 py-2.5 text-sm text-zinc-600 rounded-md hover:bg-zinc-50">
215
- Log out
216
  </button>
217
  </>
218
- ) : (
 
 
 
219
  <>
 
 
220
  <Link href="/auth/login" onClick={() => setOpen(false)}
221
- className="flex items-center gap-2.5 px-3 py-2.5 text-sm text-zinc-600 rounded-md hover:bg-zinc-50">
 
 
 
 
222
  <LogIn className="w-4 h-4 text-zinc-400" /> Log in
223
  </Link>
 
224
  <Link href="/auth/signup" onClick={() => setOpen(false)}
225
- className="block px-3 py-2.5 text-sm font-medium text-white bg-zinc-900 rounded-lg text-center hover:bg-zinc-800">
226
- Get started
227
  </Link>
228
  </>
229
  )}
 
5
  import type { LucideIcon } from "lucide-react";
6
  import {
7
  ShieldCheck, Menu, X, Crown, GitCompare, LayoutDashboard,
8
+ ScanText, Settings, LogIn, Zap, Sparkles, CreditCard, UserCircle,
9
+ LogOut, Users
10
  } from "lucide-react";
11
  import { useState, useEffect } from "react";
12
  import { createClient } from "@/lib/supabase/client";
 
21
  const [open, setOpen] = useState(false);
22
  const [userEmail, setUserEmail] = useState<string | null>(null);
23
  const [userRole, setUserRole] = useState<string | null>(null);
24
+ const [userTeam, setUserTeam] = useState<string | null>(null);
25
  const [loaded, setLoaded] = useState(false);
26
  const pathname = usePathname();
27
  const isLoggedIn = !!userEmail;
28
  const isAdmin = userRole === "admin";
29
+ const hasTeam = !!userTeam;
30
 
31
  useEffect(() => {
32
  const supabase = createClient();
 
36
  if (user) {
37
  const { data: profile } = await supabase
38
  .from("profiles")
39
+ .select("role, team_id")
40
  .eq("id", user.id)
41
  .single();
42
  setUserRole(profile?.role || "user");
43
+ setUserTeam(profile?.team_id || null);
44
  }
45
  setLoaded(true);
46
  });
47
  }, []);
48
 
49
+ async function handleSignOut() {
50
+ const supabase = createClient();
51
+ await supabase.auth.signOut();
52
+ setUserEmail(null);
53
+ setUserRole(null);
54
+ setUserTeam(null);
55
+ window.location.href = "/";
56
+ }
57
+
58
+ // Public links - always visible
59
  const mainLinks: NavLink[] = [
60
  { href: "/#features", label: "Features", icon: Sparkles },
61
  { href: "/#pricing", label: "Pricing", icon: CreditCard },
 
63
  { href: "/dashboard-pages/compare", label: "Compare", icon: GitCompare },
64
  ];
65
 
 
 
 
 
 
66
  return (
67
  <nav className="sticky top-0 z-50 bg-white/80 backdrop-blur-md border-b border-zinc-100">
68
  <div className="max-w-6xl mx-auto px-4 sm:px-5 h-14 flex items-center justify-between">
 
75
 
76
  {/* Desktop Nav */}
77
  <div className="hidden md:flex items-center gap-0.5">
78
+ {/* Public links - always visible */}
79
  {mainLinks.map((l) => {
 
80
  const isActive = pathname === l.href;
81
  return (
82
  <Link key={l.href} href={l.href}
 
88
  );
89
  })}
90
 
91
+ {/* Loading skeleton while auth state resolves */}
92
+ {!loaded && (
93
+ <>
94
+ <div className="w-px h-4 bg-zinc-200 mx-1.5" />
95
+ <div className="flex items-center gap-2">
96
+ <div className="w-14 h-7 bg-zinc-100 rounded-md animate-pulse" />
97
+ <div className="w-20 h-7 bg-zinc-900/10 rounded-md animate-pulse" />
98
+ </div>
99
+ </>
100
+ )}
101
+
102
+ {/* Logged-in links */}
103
+ {loaded && isLoggedIn && (
104
+ <>
105
+ {/* Dashboard */}
106
+ <Link href="/dashboard-pages/dashboard"
107
  className={`flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] rounded-md transition-colors ${
108
+ pathname === "/dashboard-pages/dashboard"
109
+ ? "text-zinc-900 bg-zinc-100 font-medium"
110
+ : "text-zinc-500 hover:text-zinc-900 hover:bg-zinc-50"
111
  }`}>
112
+ <LayoutDashboard className="w-3.5 h-3.5" />
113
+ Dashboard
114
  </Link>
 
 
115
 
116
+ {/* Team - only when user belongs to a team */}
117
+ {hasTeam && (
118
+ <Link href="/dashboard-pages/team"
119
+ className={`flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] rounded-md transition-colors ${
120
+ pathname === "/dashboard-pages/team"
121
+ ? "text-zinc-900 bg-zinc-100 font-medium"
122
+ : "text-zinc-500 hover:text-zinc-900 hover:bg-zinc-50"
123
+ }`}>
124
+ <Users className="w-3.5 h-3.5" />
125
+ Team
126
+ </Link>
127
+ )}
128
 
129
+ {/* Admin - only for admin role */}
130
+ {isAdmin && (
131
+ <Link href="/admin"
132
+ className={`flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] rounded-md transition-colors ${
133
+ pathname === "/admin"
134
+ ? "text-amber-700 bg-amber-50 font-medium"
135
+ : "text-amber-600 hover:text-amber-700 hover:bg-amber-50"
136
+ }`}>
137
+ <Crown className="w-3.5 h-3.5" />
138
+ Admin
139
+ </Link>
140
+ )}
141
 
142
+ <div className="w-px h-4 bg-zinc-200 mx-1.5" />
143
+
144
+ {/* Settings */}
145
  <Link href="/dashboard-pages/settings"
146
  className={`flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] rounded-md transition-colors ${
147
+ pathname?.includes("settings")
148
+ ? "text-zinc-900 bg-zinc-100 font-medium"
149
+ : "text-zinc-500 hover:text-zinc-900 hover:bg-zinc-50"
150
  }`}>
151
+ <Settings className="w-3.5 h-3.5" />
152
+ Settings
153
  </Link>
154
+ {/* User indicator with hover dropdown */}
155
+ <div className="relative group ml-1">
156
+ <button className="flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] text-zinc-500 hover:text-zinc-900 rounded-md hover:bg-zinc-50 transition-colors">
157
+ <UserCircle className="w-3.5 h-3.5" />
158
+ <span className="max-w-[100px] truncate">{userEmail?.split("@")[0]}</span>
159
+ </button>
160
+ {/* Dropdown on hover */}
161
+ <div className="absolute right-0 top-full mt-1 w-52 bg-white border border-zinc-200 rounded-xl shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-150 z-50">
162
+ <div className="px-3 py-2.5 border-b border-zinc-100">
163
+ <p className="text-xs text-zinc-400">Signed in as</p>
164
+ <p className="text-sm text-zinc-700 font-medium truncate">{userEmail}</p>
165
+ {isAdmin && (
166
+ <span className="inline-flex items-center gap-1 mt-1 text-[10px] bg-amber-50 text-amber-700 border border-amber-200 px-1.5 py-0.5 rounded">
167
+ <Crown className="w-2.5 h-2.5" /> Admin
168
+ </span>
169
+ )}
170
+ </div>
171
+ <div className="py-1">
172
+ <Link href="/dashboard-pages/settings"
173
+ className="flex items-center gap-2 px-3 py-2 text-sm text-zinc-600 hover:bg-zinc-50">
174
+ <Settings className="w-3.5 h-3.5 text-zinc-400" /> Settings
175
+ </Link>
176
+ {isAdmin && (
177
+ <Link href="/admin"
178
+ className="flex items-center gap-2 px-3 py-2 text-sm text-amber-600 hover:bg-amber-50">
179
+ <Crown className="w-3.5 h-3.5" /> Admin Panel
180
+ </Link>
181
+ )}
182
+ </div>
183
+ <div className="border-t border-zinc-100 py-1">
184
+ <button onClick={handleSignOut}
185
+ className="flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 w-full text-left">
186
+ <LogOut className="w-3.5 h-3.5" /> Sign out
187
+ </button>
188
+ </div>
189
+ </div>
190
+ </div>
191
+
192
+ {/* New scan CTA */}
193
  <Link href="/dashboard-pages/analyze"
194
  className="ml-1 px-3 py-1.5 text-[13px] font-medium text-white bg-zinc-900 rounded-md hover:bg-zinc-800 transition-colors flex items-center gap-1.5">
195
  <Zap className="w-3.5 h-3.5" /> New scan
196
  </Link>
197
  </>
198
+ )}
199
+
200
+ {/* Logged-out links */}
201
+ {loaded && !isLoggedIn && (
202
  <>
203
+ <div className="w-px h-4 bg-zinc-200 mx-1.5" />
204
+
205
+ <Link href="/auth/login"
206
+ className={`flex items-center gap-1.5 px-2.5 py-1.5 text-[13px] rounded-md transition-colors ${
207
+ pathname === "/auth/login"
208
+ ? "text-zinc-900 bg-zinc-100 font-medium"
209
+ : "text-zinc-500 hover:text-zinc-900 hover:bg-zinc-50"
210
+ }`}>
211
+ <LogIn className="w-3.5 h-3.5" /> Log in
212
+ </Link>
213
+
214
  <Link href="/auth/signup"
215
  className="ml-1 px-3 py-1.5 text-[13px] font-medium text-white bg-zinc-900 rounded-md hover:bg-zinc-800 transition-colors">
216
+ Sign up
217
  </Link>
218
  </>
219
  )}
 
228
  {/* Mobile Menu */}
229
  {open && (
230
  <div className="md:hidden border-t border-zinc-100 bg-white px-5 py-3 space-y-0.5">
231
+ {/* Public links */}
232
  {mainLinks.map((l) => {
233
  const Icon = l.icon ?? null;
234
+ const isActive = pathname === l.href;
235
  return (
236
  <Link key={l.href} href={l.href} onClick={() => setOpen(false)}
237
+ className={`flex items-center gap-2.5 px-3 py-2.5 text-sm rounded-md ${
238
+ isActive ? "text-zinc-900 bg-zinc-100 font-medium" : "text-zinc-600 hover:bg-zinc-50"
239
+ }`}>
240
  {Icon && <Icon className="w-4 h-4 text-zinc-400" />}
241
  {l.label}
242
  </Link>
243
  );
244
  })}
245
 
246
+ {/* Mobile loading skeleton */}
247
+ {!loaded && (
248
+ <>
249
+ <div className="h-px bg-zinc-100 my-1.5" />
250
+ <div className="flex flex-col gap-2 px-3">
251
+ <div className="w-full h-10 bg-zinc-100 rounded-lg animate-pulse" />
252
+ <div className="w-full h-10 bg-zinc-900/10 rounded-lg animate-pulse" />
253
+ </div>
254
+ </>
255
+ )}
256
+
257
+ {/* Mobile: Logged-in links */}
258
+ {loaded && isLoggedIn && (
259
  <>
260
  <div className="h-px bg-zinc-100 my-1.5" />
261
+
262
+ {/* User info banner */}
263
+ <div className="px-3 py-2">
264
+ <p className="text-xs text-zinc-400">Signed in as</p>
265
+ <p className="text-sm text-zinc-700 font-medium truncate">{userEmail}</p>
266
+ </div>
267
+
268
  <Link href="/dashboard-pages/dashboard" onClick={() => setOpen(false)}
269
+ className={`flex items-center gap-2.5 px-3 py-2.5 text-sm rounded-md ${
270
+ pathname === "/dashboard-pages/dashboard"
271
+ ? "text-zinc-900 bg-zinc-100 font-medium"
272
+ : "text-zinc-600 hover:bg-zinc-50"
273
+ }`}>
274
  <LayoutDashboard className="w-4 h-4 text-zinc-400" /> Dashboard
275
  </Link>
276
+
277
  <Link href="/dashboard-pages/settings" onClick={() => setOpen(false)}
278
+ className={`flex items-center gap-2.5 px-3 py-2.5 text-sm rounded-md ${
279
+ pathname?.includes("settings")
280
+ ? "text-zinc-900 bg-zinc-100 font-medium"
281
+ : "text-zinc-600 hover:bg-zinc-50"
282
+ }`}>
283
  <Settings className="w-4 h-4 text-zinc-400" /> Settings
284
  </Link>
 
 
285
 
286
+ {/* Team link */}
287
+ {hasTeam && (
288
+ <Link href="/dashboard-pages/team" onClick={() => setOpen(false)}
289
+ className={`flex items-center gap-2.5 px-3 py-2.5 text-sm rounded-md ${
290
+ pathname === "/dashboard-pages/team"
291
+ ? "text-zinc-900 bg-zinc-100 font-medium"
292
+ : "text-zinc-600 hover:bg-zinc-50"
293
+ }`}>
294
+ <Users className="w-4 h-4 text-zinc-400" /> Team
295
+ </Link>
296
+ )}
297
 
298
+ {/* Admin link */}
299
+ {isAdmin && (
300
+ <Link href="/admin" onClick={() => setOpen(false)}
301
+ className={`flex items-center gap-2.5 px-3 py-2.5 text-sm rounded-md ${
302
+ pathname === "/admin"
303
+ ? "text-amber-700 bg-amber-50 font-medium"
304
+ : "text-amber-600 hover:bg-amber-50"
305
+ }`}>
306
+ <Crown className="w-4 h-4" /> Admin Panel
307
+ </Link>
308
+ )}
309
 
310
+ <div className="h-px bg-zinc-100 my-1.5" />
311
+
312
+ {/* New Scan CTA */}
313
  <Link href="/dashboard-pages/analyze" onClick={() => setOpen(false)}
314
+ className="flex items-center justify-center gap-2 px-3 py-2.5 text-sm font-medium text-white bg-zinc-900 rounded-lg hover:bg-zinc-800">
315
+ <Zap className="w-4 h-4" /> New Scan
316
  </Link>
317
+
318
+ {/* Sign out */}
319
+ <button onClick={() => { handleSignOut(); setOpen(false); }}
320
+ className="flex items-center gap-2.5 px-3 py-2.5 text-sm text-red-600 rounded-md hover:bg-red-50 w-full">
321
+ <LogOut className="w-4 h-4" /> Sign out
 
 
 
 
 
 
322
  </button>
323
  </>
324
+ )}
325
+
326
+ {/* Mobile: Logged-out links */}
327
+ {loaded && !isLoggedIn && (
328
  <>
329
+ <div className="h-px bg-zinc-100 my-1.5" />
330
+
331
  <Link href="/auth/login" onClick={() => setOpen(false)}
332
+ className={`flex items-center gap-2.5 px-3 py-2.5 text-sm rounded-md ${
333
+ pathname === "/auth/login"
334
+ ? "text-zinc-900 bg-zinc-100 font-medium"
335
+ : "text-zinc-600 hover:bg-zinc-50"
336
+ }`}>
337
  <LogIn className="w-4 h-4 text-zinc-400" /> Log in
338
  </Link>
339
+
340
  <Link href="/auth/signup" onClick={() => setOpen(false)}
341
+ className="flex items-center justify-center gap-2 px-3 py-2.5 text-sm font-medium text-white bg-zinc-900 rounded-lg hover:bg-zinc-800">
342
+ Sign up
343
  </Link>
344
  </>
345
  )}