import { useContext } from 'react' import { useRouter } from 'next/router' import Link from 'next/link' import UserContext from './user/context' export default function Breadcrumbs() { const { username, role } = useContext(UserContext) const router = useRouter() const path = router.asPath if (path.length === 0 || path === '/') { return null } const breadcrumbs = path.replace(/^\//, '').split('/') // TODO: translate routes // TODO: make entries linkable return (
{role === 'admin' && (
{username}
)} <>

Home

{breadcrumbs.map((breadcrumb) => { return ( <> {'>'}

{breadcrumb}

) })}
) }