diff --git a/components/breadcrumbs.tsx b/components/breadcrumbs.tsx
index 11ace5e..8a7fa75 100644
--- a/components/breadcrumbs.tsx
+++ b/components/breadcrumbs.tsx
@@ -1,14 +1,20 @@
import { useContext } from 'react'
+import { useRouter } from 'next/router'
import Link from 'next/link'
import UserContext from './user/context'
-export default function Breadcrumbs({ label }: { label: string }) {
+export default function Breadcrumbs() {
const { username, role } = useContext(UserContext)
+ const router = useRouter()
- if (!label) {
+ const breadcrumbs = router.asPath.replace(/^\//, '').split('/')
+
+ if (!breadcrumbs.length) {
return null
}
+ // TODO: translate routes
+ // TODO: make entries linkable
return (
{role === 'admin' && (
@@ -22,10 +28,16 @@ export default function Breadcrumbs({ label }: { label: string }) {
Home
- {'>'}
-
- {label}
-
+ {breadcrumbs.map((breadcrumb) => {
+ return (
+ <>
+ {'>'}
+
+ {breadcrumb}
+
+ >
+ )
+ })}
>
)
diff --git a/components/header.tsx b/components/header.tsx
index 0c0aa16..01468bc 100644
--- a/components/header.tsx
+++ b/components/header.tsx
@@ -3,7 +3,7 @@ import Link from 'next/link'
import Logo from './logo'
import Breadcrumbs from './breadcrumbs'
-export default function Header({ label }: { label?: string }) {
+export default function Header() {
return (
<>
@@ -20,7 +20,7 @@ export default function Header({ label }: { label?: string }) {
-
+
>
)
diff --git a/pages/admin/booking/[uuid]/bill.tsx b/pages/admin/booking/[uuid]/bill.tsx
index 590c64e..4da40a9 100644
--- a/pages/admin/booking/[uuid]/bill.tsx
+++ b/pages/admin/booking/[uuid]/bill.tsx
@@ -174,7 +174,7 @@ export default function BookingBillPage({
return (
<>
-
+
{booking && (