fp/services/next/app/components/navbar.tsx

94 lines
4.0 KiB
TypeScript
Raw Normal View History

2024-01-20 16:16:14 +00:00
'use client'
2024-12-12 07:23:46 +00:00
import { useState } from 'react'
2024-01-20 16:16:14 +00:00
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons";
2024-12-12 07:23:46 +00:00
import { faUpload } from "@fortawesome/free-solid-svg-icons";
2024-01-20 16:16:14 +00:00
import Link from 'next/link'
2024-12-12 07:23:46 +00:00
import { LoginButton, ProfileButton } from './auth-buttons';
import { Spinner } from './spinner';
import ProtectedRoute from "../components/protected-route";
2024-01-20 16:16:14 +00:00
export default function Navbar() {
const [isExpanded, setExpanded] = useState(false);
2024-12-12 07:23:46 +00:00
2024-01-20 16:16:14 +00:00
const handleBurgerClick = () => {
setExpanded(!isExpanded);
};
return (
<>
<nav className="navbar" role="navigation" aria-label="main navigation">
<div className="navbar-brand">
<Link className="navbar-item" href="/">
<h1 className="title">🔞💦 Futureporn.net</h1>
</Link>
<button
className="navbar-burger"
onClick={handleBurgerClick}
>
<span></span>
<span></span>
<span></span>
</button>
</div>
<div className={`navbar-menu ${isExpanded ? 'is-active' : ''}`} id="navMenu">
<div className='navbar-start'>
<Link className="navbar-item is-expanded" href="/vt">Vtubers</Link>
2024-05-27 22:20:58 +00:00
<Link className="navbar-item is-expanded" href="/archive">Archive</Link>
2024-01-20 16:16:14 +00:00
<Link className="navbar-item is-expanded" href="/about">About</Link>
<Link className="navbar-item is-expanded" href="/faq">FAQ</Link>
<Link className="navbar-item is-expanded" href="/goals">Goals</Link>
<Link className="navbar-item is-expanded" href="/patrons">Patrons</Link>
<Link className="navbar-item is-expanded" href="/tags">Tags</Link>
<Link className="navbar-item is-expanded" href="/api">API</Link>
</div>
<div className='navbar-end'>
<div className="navbar-item is-expanded">
<Link target="_blank" href="https://status.futureporn.net">
<span>Status </span>
<FontAwesomeIcon
icon={faExternalLinkAlt}
className="fab fa-external-link-alt"
></FontAwesomeIcon>
</Link>
</div>
2024-07-06 08:49:51 +00:00
<div className="navbar-item">
2024-12-12 07:23:46 +00:00
<ProtectedRoute
requiredUserRole='patron'
accessDenied={<></>}
>
<Link className="button " href="/upload">
<span className="mr-1">Upload</span>
<FontAwesomeIcon
icon={faUpload}
className="fas fa-upload"
></FontAwesomeIcon>
</Link>
</ProtectedRoute>
2024-07-06 08:49:51 +00:00
</div>
2024-01-20 16:16:14 +00:00
2024-12-12 07:23:46 +00:00
<div className='navbar-item'>
<ProtectedRoute
requiredUserRole="default-roles-futureporn"
accessDenied={<LoginButton></LoginButton>}
loading={<button disabled className="button"><Spinner></Spinner></button>}
>
<ProfileButton></ProfileButton>
</ProtectedRoute>
2024-01-20 16:16:14 +00:00
</div>
2024-12-12 07:23:46 +00:00
2024-01-20 16:16:14 +00:00
</div>
</div>
</nav>
</>
)
}