import Navbar from 'react-bootstrap/Navbar' import Nav from 'react-bootstrap/Nav' import Link from 'next/link' import styles from './header.module.css' import { useRouter } from 'next/router' import { Button, Container, NavDropdown } from 'react-bootstrap' import Price from './price' import { useMe } from './me' import Head from 'next/head' import { signOut, signIn, useSession } from 'next-auth/client' import { useLightning } from './lightning' import { useEffect } from 'react' import { randInRange } from '../lib/rand' function WalletSummary ({ me }) { return `${me.sats} \\ ${me.stacked}` } function RefreshableLink ({ href, children, ...props }) { const router = useRouter() const same = router.asPath === href return ( {children} ) } export default function Header () { const [session, loading] = useSession() const router = useRouter() const path = router.asPath.split('?')[0] const me = useMe() const Corner = () => { if (loading) { return null } if (session) { return (
profile notifications {me && me.hasNewNotes &&
{' '}
}
wallet
recent {session ? ( post ) : post} jobs
logout
{me && me.hasNewNotes && {' '} }
{me && }
) } else { const strike = useLightning() useEffect(() => { setTimeout(strike, randInRange(3000, 10000)) }, [router.asPath]) return path !== '/login' && } } return ( <> ) } export function HeaderPreview () { return ( <> ) }