diff --git a/components/header.tsx b/components/header.tsx
index d48a3c4..73f179b 100644
--- a/components/header.tsx
+++ b/components/header.tsx
@@ -1,19 +1,28 @@
-import React from 'react'
+import React, { useContext } from 'react'
import Link from 'next/link'
import Image from 'next/image'
+import UserContext from './user/context'
export default function Header({ label = 'Pfadi Bussle' }: { label?: string }) {
+ const { username, role } = useContext(UserContext)
return (
-
-
- {label}
-
-
-
+ <>
+
+
+ {label}
+
+
+
+ {username && (
+
+ FYI, you are logged in as {username}{' '}
+
+ )}
+ >
)
}
diff --git a/components/user/context.tsx b/components/user/context.tsx
new file mode 100644
index 0000000..35a72af
--- /dev/null
+++ b/components/user/context.tsx
@@ -0,0 +1,9 @@
+import React from 'react'
+import { UserData } from '../../lib/session'
+
+const UserContext = React.createContext({
+ username: undefined,
+ role: undefined,
+})
+
+export default UserContext
diff --git a/pages/_app.tsx b/pages/_app.tsx
index db46bed..159a597 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -1,10 +1,14 @@
-import React from 'react'
import '../styles/index.css'
+import UserContext from '../components/user/context'
export default function MyApp({ Component, pageProps }) {
+ const { username, role } = pageProps?.user || {}
+
return (
-
+
+
+
)
}