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 } from 'next-auth/client' import { useLightning } from './lightning' import { useEffect, useState } from 'react' import { randInRange } from '../lib/rand' import { formatSats } from '../lib/format' import NoteIcon from '../svgs/notification-4-fill.svg' function WalletSummary ({ me }) { if (!me) return null return `${formatSats(me.sats)}` } export default function Header ({ sub }) { const router = useRouter() const path = router.asPath.split('?')[0] const [fired, setFired] = useState() const me = useMe() const prefix = sub ? `/~${sub}` : '' const Corner = () => { if (me) { return (
{me?.hasNewNotes && {' '} }
profile {me && !me.bio &&
{' '}
}
wallet satistics invites {me && !me.hasInvites &&
{' '}
}
settings
signOut({ callbackUrl: '/' })}>logout
{me && !me.bio && {' '} }
{me && }
) } else { if (!fired) { const strike = useLightning() useEffect(() => { setTimeout(strike, randInRange(3000, 10000)) setFired(true) }, [router.asPath]) } return path !== '/login' && !path.startsWith('/invites') && } } return ( <> ) }