"use client"
import Link from "next/link"
import { cn } from "@lib/cn"
import { useSessionSWR } from "@lib/use-session-swr"
import { PropsWithChildren, useEffect, useState } from "react"
import { useSelectedLayoutSegments } from "next/navigation"
import Image from "next/image"
import FadeIn from "@components/fade-in"
import { useTheme } from "next-themes"
// }
// value="home"
// href="/home"
// />
// }
// value="new"
// href="/new"
// />
// }
// value="mine"
// href="/mine"
// />
// }
// value="settings"
// href="/settings"
// key="settings"
// />
//
// {isAdmin && (
//
// }
// value="admin"
// href="/admin"
// />
//
// )}
// {isAuthenticated === true && (
// }
// value="signout"
// onClick={() => {
// signOut({
// callbackUrl: `/signedout${userId ? "?userId=" + userId : ""}`
// })
// }}
// width={SIGN_IN_WIDTH}
// />
// )}
// {isAuthenticated === false && (
// }
// value="signin"
// href="/signin"
// width={SIGN_IN_WIDTH}
// />
// )}
// {isAuthenticated === undefined && (
// }
// value="signin"
// href="/signin"
// width={SIGN_IN_WIDTH}
// />
export default function Header() {
const { isAdmin, isAuthenticated } = useSessionSWR()
const { resolvedTheme, setTheme } = useTheme()
const toggleTheme = () => {
setTheme(resolvedTheme === "dark" ? "light" : "dark")
}
return (
Drift
)
}
type NavLinkProps = PropsWithChildren<{
href: string
disabled?: boolean
active?: boolean
}>
function NavLink({ href, disabled, children }: NavLinkProps) {
const baseClasses =
"text-sm text-muted-foreground font-medium transition-colors hover:text-primary"
const activeClasses = "text-primary border-primary"
const disabledClasses = "text-gray-400 hover:text-gray-400 cursor-default"
const segments = useSelectedLayoutSegments()
const activeSegment = segments[segments.length - 1]
const isActive =
activeSegment === href.slice(1) ||
// special case / because it's an alias of /home/page.tsx
(!activeSegment && href === "/home")
return (
{children}
)
}