Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8b0b237

Browse files
committed
Add more items to mobile navbar when logged in
1 parent cfaef58 commit 8b0b237

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/components/AppNavBar.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,28 @@ export default function AppNavBar() {
2525
const [session, loading] = useSession()
2626
const router = useRouter()
2727
const [isDonateModalOpen, setIsDonateModalOpen] = useState(false)
28+
const mobileItems = [
29+
...navbarItems,
30+
...(session
31+
? [
32+
{
33+
title: 'Your Profile',
34+
value: 'your-profile',
35+
href: session && (session.user as User).username,
36+
},
37+
{
38+
title: 'Your Goal',
39+
value: 'your-goal',
40+
href: session && (session.user as User).username,
41+
},
42+
{
43+
title: 'Settings',
44+
value: 'settings',
45+
href: '/profile/settings',
46+
},
47+
]
48+
: []),
49+
]
2850

2951
return (
3052
<NavBar
@@ -118,7 +140,7 @@ export default function AppNavBar() {
118140
}
119141
mobileItems={
120142
<>
121-
{navbarItems.map((item) => (
143+
{mobileItems.map((item) => (
122144
<Link href={item.href} passHref={true} key={item.value}>
123145
<NavBar.Item.Mobile.Left isSelected={router.asPath === item.href}>
124146
{item.title}

0 commit comments

Comments
 (0)