File size: 2,286 Bytes
60e766b
 
 
d438808
60e766b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d438808
 
 
60e766b
 
 
 
 
 
 
 
 
d438808
60e766b
 
 
 
 
 
d438808
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60e766b
 
 
 
 
 
 
 
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
import type { Metadata } from "next";
import Link from "next/link";
import { Fraunces, Space_Grotesk } from "next/font/google";
import { auth, signOut } from "@/auth";
import "./globals.css";

export const metadata: Metadata = {
  title: "Demand Solution Board",
  description: "Community demand to implementation board",
};

const sans = Space_Grotesk({
  subsets: ["latin"],
  variable: "--font-sans",
});

const display = Fraunces({
  subsets: ["latin"],
  variable: "--font-display",
});

export default async function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
  const session = await auth();

  return (
    <html lang="en">
      <body className={`${sans.variable} ${display.variable}`}>
        <div className="ambient-bg" />
        <header className="sticky top-0 z-20 border-b border-white/60 bg-white/70 backdrop-blur-xl">
          <div className="container-page flex items-center justify-between py-5">
            <Link href="/" className="brand-mark text-lg font-semibold tracking-tight">
              Demand Solution Board
            </Link>
            <div className="flex flex-wrap items-center gap-2">
              <Link href="/" className="btn">
                Browse
              </Link>
              <Link href="/submit" className="btn btn-primary">
                Submit Idea
              </Link>

              {session?.user ? (
                <>
                  <Link href="/me/profile" className="btn">
                    Profile
                  </Link>
                  <span className="pill">{session.user.name || session.user.email || "Signed in"}</span>
                  <form
                    action={async () => {
                      "use server";
                      await signOut({ redirectTo: "/" });
                    }}
                  >
                    <button type="submit" className="btn">
                      Sign out
                    </button>
                  </form>
                </>
              ) : (
                <Link href="/login" className="btn">
                  Login
                </Link>
              )}
            </div>
          </div>
        </header>
        <main className="container-page pb-12">{children}</main>
      </body>
    </html>
  );
}