gaurv007 commited on
Commit
1995940
·
verified ·
1 Parent(s): 408d3b8

v3.0: Fix nav.tsx — upload actual content (was file path reference), v3.0 badge

Browse files
Files changed (1) hide show
  1. web/components/nav.tsx +96 -1
web/components/nav.tsx CHANGED
@@ -1 +1,96 @@
1
- /app/web/nav.tsx
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+
3
+ import Link from "next/link";
4
+ import { usePathname } from "next/navigation";
5
+ import { ShieldCheck, Menu, X, Crown, GitCompare } from "lucide-react";
6
+ import { useState, useEffect } from "react";
7
+ import { createClient } from "@/lib/supabase/client";
8
+
9
+ const links = [
10
+ { href: "/#features", label: "Features" },
11
+ { href: "/#pricing", label: "Pricing" },
12
+ { href: "/dashboard-pages/analyze", label: "Scanner" },
13
+ { href: "/dashboard-pages/compare", label: "Compare", icon: GitCompare },
14
+ ];
15
+
16
+ const ADMIN_EMAILS = ["ankygaur9972@gmail.com"];
17
+
18
+ export function Nav() {
19
+ const [open, setOpen] = useState(false);
20
+ const [userEmail, setUserEmail] = useState<string | null>(null);
21
+ const pathname = usePathname();
22
+ const isDashboard = pathname?.startsWith("/dashboard");
23
+ const isAdmin = userEmail && ADMIN_EMAILS.includes(userEmail);
24
+
25
+ useEffect(() => {
26
+ const supabase = createClient();
27
+ supabase.auth.getUser().then(({ data }) => {
28
+ setUserEmail(data.user?.email || null);
29
+ });
30
+ }, []);
31
+
32
+ return (
33
+ <nav className="sticky top-0 z-50 bg-white/80 backdrop-blur-md border-b border-zinc-100">
34
+ <div className="max-w-6xl mx-auto px-4 sm:px-5 h-14 flex items-center justify-between">
35
+ <Link href="/" className="flex items-center gap-2">
36
+ <ShieldCheck className="w-5 h-5 text-zinc-900" strokeWidth={2.2} />
37
+ <span className="font-semibold text-[15px] tracking-tight text-zinc-900">ClauseGuard</span>
38
+ <span className="hidden sm:inline text-[10px] font-medium text-zinc-400 ml-1 border border-zinc-200 px-1.5 py-0.5 rounded">v3.0</span>
39
+ </Link>
40
+
41
+ <div className="hidden md:flex items-center gap-1">
42
+ {links.map((l) => (
43
+ <a key={l.href} href={l.href}
44
+ className="px-3 py-1.5 text-[13px] text-zinc-500 hover:text-zinc-900 rounded-md hover:bg-zinc-50 transition-colors">
45
+ {l.label}
46
+ </a>
47
+ ))}
48
+
49
+ {isAdmin && (
50
+ <Link href="/admin"
51
+ className="px-3 py-1.5 text-[13px] text-amber-600 hover:text-amber-700 rounded-md hover:bg-amber-50 transition-colors flex items-center gap-1">
52
+ <Crown className="w-3.5 h-3.5" /> Admin
53
+ </Link>
54
+ )}
55
+
56
+ <div className="w-px h-4 bg-zinc-200 mx-2" />
57
+
58
+ {isDashboard || userEmail ? (
59
+ <Link href="/dashboard-pages/settings"
60
+ className="px-3 py-1.5 text-[13px] text-zinc-500 hover:text-zinc-900 rounded-md hover:bg-zinc-50">
61
+ Settings
62
+ </Link>
63
+ ) : (
64
+ <Link href="/auth/login"
65
+ className="px-3 py-1.5 text-[13px] text-zinc-500 hover:text-zinc-900 rounded-md hover:bg-zinc-50">
66
+ Log in
67
+ </Link>
68
+ )}
69
+ <Link href={isDashboard || userEmail ? "/dashboard-pages/analyze" : "/auth/signup"}
70
+ className="ml-1 px-3.5 py-1.5 text-[13px] font-medium text-white bg-zinc-900 rounded-md hover:bg-zinc-800 transition-colors">
71
+ {isDashboard || userEmail ? "New scan" : "Get started"}
72
+ </Link>
73
+ </div>
74
+
75
+ <button className="md:hidden p-1.5 rounded-md hover:bg-zinc-100" onClick={() => setOpen(!open)}>
76
+ {open ? <X className="w-5 h-5" /> : <Menu className="w-5 h-5" />}
77
+ </button>
78
+ </div>
79
+
80
+ {open && (
81
+ <div className="md:hidden border-t border-zinc-100 bg-white px-5 py-3 space-y-1">
82
+ {links.map((l) => (
83
+ <a key={l.href} href={l.href} onClick={() => setOpen(false)}
84
+ className="block px-3 py-2 text-sm text-zinc-600 rounded-md hover:bg-zinc-50">{l.label}</a>
85
+ ))}
86
+ {isAdmin && (
87
+ <Link href="/admin" onClick={() => setOpen(false)}
88
+ className="block px-3 py-2 text-sm text-amber-600 rounded-md hover:bg-amber-50">Admin</Link>
89
+ )}
90
+ <Link href="/auth/login" onClick={() => setOpen(false)}
91
+ className="block px-3 py-2 text-sm text-zinc-600 rounded-md hover:bg-zinc-50">Log in</Link>
92
+ </div>
93
+ )}
94
+ </nav>
95
+ );
96
+ }