Update next-connect, begin work on cloud img upload

This commit is contained in:
Aaron William Po
2023-02-09 23:58:03 -05:00
parent 0fb013e250
commit 45cc10a009
17 changed files with 1616 additions and 121 deletions

View File

@@ -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"