'use client'; import { cc } from '@/utility/css'; import Link from 'next/link'; import { useSession, signOut } from 'next-auth/react'; import ThemeSwitcher from '@/site/ThemeSwitcher'; import SiteGrid from './SiteGrid'; import { usePathname } from 'next/navigation'; import { isRouteSignIn } from '@/site/routes'; const LINK_STYLE = cc( 'cursor-pointer', 'hover:text-gray-600', ); export default function AuthNav() { const { data: session, status } = useSession(); const hasState = status !== 'loading'; const path = usePathname(); return (
{hasState ? <> {session?.user === undefined && <>Loading ...} {session?.user.email && <>
{session.user.email}
signOut()} className={LINK_STYLE} > Sign Out
} : Sign In }
{!isRouteSignIn(path) && } } /> ); };