import { useState } from 'react' import { Dropdown, Image, Nav, Navbar, Offcanvas } from 'react-bootstrap' import { MEDIA_URL } from '@/lib/constants' import Link from 'next/link' import { useServiceWorker } from '@/components/serviceworker' import { signOut } from 'next-auth/react' import { LoginButtons, NavWalletSummary } from '../common' import AnonIcon from '@/svgs/spy-fill.svg' export default function OffCanvas ({ me, dropNavKey }) { const [show, setShow] = useState(false) const handleClose = () => setShow(false) const handleShow = () => setShow(true) const { registration: swRegistration, togglePushSubscription } = useServiceWorker() const MeImage = ({ onClick }) => me ? ( ) : return ( <>
{me ? ( <> profile {me && !me.bioId &&
{' '}
}
bookmarks wallet satistics referrals
settings
{ try { // order is important because we need to be logged in to delete push subscription on server const pushSubscription = await swRegistration?.pushManager.getSubscription() if (pushSubscription) { await togglePushSubscription() } } catch (err) { // don't prevent signout because of an unsubscription error console.error(err) } await signOut({ callbackUrl: '/' }) }} >logout ) : }
) }