Files changed (2) hide show
  1. Navigation.tsx +158 -0
  2. auth-button.tsx +36 -0
Navigation.tsx ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use client';
2
+
3
+ import { useSession } from "next-auth/react";
4
+ import { useState, useEffect } from "react";
5
+ import Image from "next/image";
6
+ import { SignOutButton } from "./auth-button";
7
+
8
+ export default function Navigation() {
9
+ const { data: session } = useSession();
10
+ const [showProfileMenu, setShowProfileMenu] = useState(false);
11
+
12
+ // Handle click outside to close profile menu
13
+ useEffect(() => {
14
+ const handleClickOutside = (event: MouseEvent) => {
15
+ if (showProfileMenu) {
16
+ setShowProfileMenu(false);
17
+ }
18
+ };
19
+
20
+ if (showProfileMenu) {
21
+ document.addEventListener('click', handleClickOutside);
22
+ }
23
+
24
+ return () => document.removeEventListener('click', handleClickOutside);
25
+ }, [showProfileMenu]);
26
+
27
+ return (
28
+ <header className="h-14 border-b border-black/10 dark:border-white/15 px-4 flex items-center justify-between bg-white dark:bg-black/20">
29
+ <div className="flex items-center gap-3">
30
+ <a href="/" className="flex items-center gap-2">
31
+ <h1 className="text-2xl font-semibold">Garbin AI</h1>
32
+ </a>
33
+ {/* Search Bar */}
34
+ <div className="hidden md:flex items-center relative">
35
+ {/* <div className="relative">
36
+ <input
37
+ type="text"
38
+ placeholder="Search models..."
39
+ className="w-64 pl-10 pr-4 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-900 dark:focus:ring-white focus:border-transparent"
40
+ />
41
+ <svg className="absolute left-3 top-2.5 w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
42
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
43
+ </svg>
44
+ </div> */}
45
+ </div>
46
+
47
+ </div>
48
+ <nav className="hidden sm:flex items-center gap-8 text-sm text-gray-700 dark:text-gray-300">
49
+ <a className="flex items-center gap-2 hover:underline" href="#">
50
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
51
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
52
+ </svg>
53
+ Models
54
+ </a>
55
+ <a className="flex items-center gap-2 hover:underline" href="#">
56
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
57
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4" />
58
+ </svg>
59
+ Datasets
60
+ </a>
61
+ <a className="flex items-center gap-2 hover:underline" href="#">
62
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
63
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" />
64
+ </svg>
65
+ Spaces
66
+ </a>
67
+ <a className="flex items-center gap-2 hover:underline" href="#">
68
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
69
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
70
+ </svg>
71
+ Community
72
+ </a>
73
+ <a className="flex items-center gap-2 hover:underline" href="#">
74
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
75
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
76
+ </svg>
77
+ Docs
78
+ </a>
79
+
80
+ <a className="flex items-center gap-2 hover:underline" href="#">
81
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
82
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
83
+ </svg>
84
+ Pricing
85
+ </a>
86
+ </nav>
87
+ {/* Mobile Search Button */}
88
+ <button className="md:hidden p-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white">
89
+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
90
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
91
+ </svg>
92
+ </button>
93
+
94
+ {/* User Profile Dropdown */}
95
+ {session && (
96
+ <div className="relative">
97
+ <button
98
+ onClick={() => setShowProfileMenu(!showProfileMenu)}
99
+ className="flex items-center gap-2 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
100
+ >
101
+ {session.user?.image && (
102
+ <Image
103
+ src={session.user.image}
104
+ alt="Profile"
105
+ width={32}
106
+ height={32}
107
+ className="rounded-full"
108
+ />
109
+ )}
110
+ <svg className="w-4 h-4 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
111
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
112
+ </svg>
113
+ </button>
114
+
115
+ {showProfileMenu && (
116
+ <div className="absolute right-0 top-full mt-2 w-48 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50">
117
+ <div className="p-3 border-b border-gray-200 dark:border-gray-700">
118
+ <p className="font-medium text-sm">{session.user?.name}</p>
119
+ <p className="text-xs text-gray-500">{session.user?.email}</p>
120
+ </div>
121
+ <div className="py-1">
122
+ <a href="#" className="flex items-center gap-2 px-3 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-800">
123
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
124
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
125
+ </svg>
126
+ Profile
127
+ </a>
128
+ <a href="#" className="flex items-center gap-2 px-3 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-800">
129
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
130
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
131
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
132
+ </svg>
133
+ Settings
134
+ </a>
135
+ <a href="#" className="flex items-center gap-2 px-3 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-800">
136
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
137
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192L5.636 18.364M12 2.25a9.75 9.75 0 100 19.5 9.75 9.75 0 000-19.5z" />
138
+ </svg>
139
+ API Keys
140
+ </a>
141
+ <a href="#" className="flex items-center gap-2 px-3 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-800">
142
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
143
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
144
+ </svg>
145
+ Help & Support
146
+ </a>
147
+ <hr className="my-1 border-gray-200 dark:border-gray-700" />
148
+ <div className="px-3 py-2">
149
+ <SignOutButton />
150
+ </div>
151
+ </div>
152
+ </div>
153
+ )}
154
+ </div>
155
+ )}
156
+ </header>
157
+ );
158
+ }
auth-button.tsx ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+
3
+ import { signIn, signOut } from "next-auth/react";
4
+
5
+ export function SignInButton() {
6
+ return (
7
+ <button
8
+ onClick={() => signIn("huggingface", { callbackUrl: "/" })}
9
+ className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] font-poppins font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
10
+ >
11
+ <svg
12
+ className="w-5 h-5"
13
+ viewBox="0 0 95 88"
14
+ fill="currentColor"
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ >
17
+ <path d="M47.21 73.5583C42.6788 73.5583 39 69.8795 39 65.3483V41.5583C39 37.0271 42.6788 33.3483 47.21 33.3483C51.7412 33.3483 55.42 37.0271 55.42 41.5583V65.3483C55.42 69.8795 51.7412 73.5583 47.21 73.5583Z" />
18
+ <path d="M73.42 73.5583C68.8888 73.5583 65.21 69.8795 65.21 65.3483V22.3483C65.21 17.8171 68.8888 14.1383 73.42 14.1383C77.9512 14.1383 81.63 17.8171 81.63 22.3483V65.3483C81.63 69.8795 77.9512 73.5583 73.42 73.5583Z" />
19
+ <path d="M21 73.5583C16.4688 73.5583 12.79 69.8795 12.79 65.3483V22.3483C12.79 17.8171 16.4688 14.1383 21 14.1383C25.5312 14.1383 29.21 17.8171 29.21 22.3483V65.3483C29.21 69.8795 25.5312 73.5583 21 73.5583Z" />
20
+ </svg>
21
+ Sign in with Hugging Face
22
+ </button>
23
+ );
24
+ }
25
+
26
+ export function SignOutButton() {
27
+ return (
28
+ <button
29
+ onClick={() => signOut({ callbackUrl: "/" })}
30
+ className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent font-poppins font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
31
+ >
32
+ Sign out
33
+ </button>
34
+ );
35
+ }
36
+