mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Update next-connect, begin work on cloud img upload
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
/* eslint-disable jsx-a11y/label-has-associated-control */
|
||||
/* eslint-disable jsx-a11y/label-has-for */
|
||||
|
||||
import UserContext from '@/contexts/userContext';
|
||||
import Link from 'next/link';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
|
||||
interface Page {
|
||||
slug: string;
|
||||
@@ -14,19 +15,36 @@ const Navbar = () => {
|
||||
const router = useRouter();
|
||||
const [currentURL, setCurrentURL] = useState('/');
|
||||
|
||||
const { user } = useContext(UserContext);
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentURL(router.asPath);
|
||||
}, [router.asPath]);
|
||||
|
||||
const pages: Page[] = [
|
||||
const authenticatedPages: readonly Page[] = [
|
||||
{ slug: '/account', name: 'Account' },
|
||||
{ slug: '/logout', name: 'Logout' },
|
||||
];
|
||||
|
||||
const unauthenticatedPages: readonly Page[] = [
|
||||
{ slug: '/login', name: 'Login' },
|
||||
{ slug: '/register', name: 'Register' },
|
||||
];
|
||||
|
||||
const otherPages: readonly Page[] = [
|
||||
{ slug: '/beers', name: 'Beers' },
|
||||
{ slug: '/breweries', name: 'Breweries' },
|
||||
];
|
||||
|
||||
const pages: readonly Page[] = [
|
||||
...otherPages,
|
||||
...(user ? authenticatedPages : unauthenticatedPages),
|
||||
];
|
||||
|
||||
return (
|
||||
<nav className="navbar bg-primary">
|
||||
<div className="flex-1">
|
||||
<Link className="btn btn-ghost text-3xl normal-case" href="/">
|
||||
<Link className="btn-ghost btn text-3xl normal-case" href="/">
|
||||
<span className="cursor-pointer text-xl font-bold">The Biergarten App</span>
|
||||
</Link>
|
||||
</div>
|
||||
@@ -51,7 +69,7 @@ const Navbar = () => {
|
||||
</div>
|
||||
<div className="flex-none lg:hidden">
|
||||
<div className="dropdown-end dropdown">
|
||||
<label tabIndex={0} className="btn btn-ghost btn-circle">
|
||||
<label tabIndex={0} className="btn-ghost btn-circle btn">
|
||||
<span className="w-10 rounded-full">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
|
||||
Reference in New Issue
Block a user