File size: 3,011 Bytes
009c95b
052672d
3ba9c0c
5ec491a
c69ef3e
052672d
bfbf1a7
38448fc
bfbf1a7
1b0e328
 
009c95b
 
 
92f037b
 
 
 
 
 
3ba9c0c
60612a5
f80b091
009c95b
39c238d
 
 
 
 
cfb938a
39c238d
 
 
 
009c95b
f80b091
1b0e328
009c95b
 
 
 
1b0e328
009c95b
 
 
 
 
 
1b0e328
96ac62a
cfb938a
96ac62a
92f037b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c2515f
92f037b
 
 
 
 
 
f80b091
1b0e328
38448fc
f80b091
 
 
3ba9c0c
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { Suspense } from 'react';
import Link from 'next/link';

import { auth, sessionUser } from '@/auth';
import { Button } from '@/components/ui/Button';
import { UserMenu } from '@/components/UserMenu';
import { IconPlus, IconSeparator } from '@/components/ui/Icons';
import { LoginMenu } from './LoginMenu';
import { redirect } from 'next/navigation';
import Image from 'next/image';
import LandingLogo from '@/assets/svg/LandingAI_white.svg';
import ChatSelectServer from './ChatSelectServer';
import Loading from './ui/Loading';
import { Skeleton } from './ui/Skeleton';
import {
  Tooltip,
  TooltipContent,
  TooltipTrigger,
} from '@/components/ui/Tooltip';
import { IconDiscord, IconGitHub } from '@/components/ui/Icons';

export async function Header() {
  const session = await auth();
  // const { isAdmin } = await sessionUser();

  if (process.env.NEXT_PUBLIC_IS_HUGGING_FACE) {
    return (
      <header className="sticky top-0 z-50 flex items-center justify-end w-full h-16 px-8 border-b shrink-0 bg-gradient-to-b from-background/10 via-background/50 to-background/80 backdrop-blur-xl">
        <Button variant="link" asChild className="mr-2">
          <Link href="/">New conversation</Link>
        </Button>
      </header>
    );
  }

  return (
    <header className="sticky top-0 z-50 flex items-center justify-start w-full h-16 px-4 border-b shrink-0 bg-gradient-to-b from-background/10 via-background/50 to-background/80 backdrop-blur-xl">
      <Link
        className="overflow-hidden w-[150px] h-[45px] shrink-0 grow-0 relative mr-4 cursor-pointer"
        href="/"
      >
        <Image src={LandingLogo} alt="Landing AI" fill />
      </Link>
      {session?.user && (
        <Suspense fallback={<Skeleton className="w-[240px] h-[24px]" />}>
          <ChatSelectServer />
        </Suspense>
      )}
      <div className="grow" />
      <Button variant="link" asChild className="mr-2">
        <Link href="/">New conversation</Link>
      </Button>
      <Tooltip>
        <TooltipTrigger asChild>
          <Button variant="link" size="icon" asChild className="mr-2">
            <Link
              href="https://github.com/landing-ai/vision-agent"
              target="_blank"
            >
              <IconGitHub className="size-5" />
            </Link>
          </Button>
        </TooltipTrigger>
        <TooltipContent>Github</TooltipContent>
      </Tooltip>
      <Tooltip>
        <TooltipTrigger asChild>
          <Button variant="link" size="icon" asChild className="mr-2">
            <Link href="https://discord.gg/RVcW3j9RgR" target="_blank">
              <IconDiscord className="size-5" />
            </Link>
          </Button>
        </TooltipTrigger>
        <TooltipContent>Discord</TooltipContent>
      </Tooltip>
      <IconSeparator className="size-6 text-muted-foreground/50" />
      <div className="flex items-center grow-0">
        {session?.user ? <UserMenu user={session!.user} /> : <LoginMenu />}
      </div>
    </header>
  );
}