File size: 1,662 Bytes
1d8be9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"use client";

import { ArrowUpRight, LogIn, LogOut, Sparkles } from "lucide-react";
import { useHfOAuth } from "@/components/HfOAuthProvider";

export function AppHeader() {
  const auth = useHfOAuth();

  return (
    <header className="site-header">
      <a className="brand-lockup" href="#top" aria-label="Sharpify AI home">
        <span className="brand-mark"><Sparkles size={16} strokeWidth={2.2} /></span>
        <span>sharpify<span className="brand-ai">.ai</span></span>
      </a>
      <nav className="main-nav" aria-label="Main navigation">
        <a href="#studio">Enhance</a>
        <a href="#how-it-works">How it works</a>
        <a href="#about">About</a>
      </nav>
      <div className="header-actions">
        {auth.required && (
          <div className="header-auth-wrap">
            <button
              className="header-cta header-auth-button"
              type="button"
              disabled={!auth.ready || auth.isSigningIn}
              onClick={() => {
                if (auth.accessToken) auth.signOut();
                else void auth.signIn();
              }}
            >
              {auth.accessToken ? <LogOut size={14} /> : <LogIn size={14} />}
              <span>{!auth.ready ? "Checking sign-in…" : auth.isSigningIn ? "Connecting…" : auth.accessToken ? `@${auth.username ?? "signed in"} · Sign out` : "Sign in with HF"}</span>
            </button>
            {auth.error && <span className="header-auth-error" role="status">{auth.error}</span>}
          </div>
        )}
        <a className="header-cta" href="#studio">Open studio <ArrowUpRight size={15} /></a>
      </div>
    </header>
  );
}