Manuel Bustillo
501bb3a81a
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m12s
Add copyright notice / copyright_notice (pull_request) Successful in 1m32s
Build Nginx-based docker image / build-static-assets (push) Successful in 6m2s
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
|
|
|
|
'use client';
|
|
|
|
import Link from 'next/link';
|
|
import NavLinks from '@/app/ui/dashboard/nav-links';
|
|
import { PowerIcon } from '@heroicons/react/24/outline';
|
|
import { gloriaHallelujah } from '@/app/ui/fonts';
|
|
import { logout } from '@/app/api/authentication';
|
|
import { useRouter } from 'next/navigation';
|
|
import { getSlug } from '@/app/lib/utils';
|
|
|
|
export default function SideNav() {
|
|
const router = useRouter();
|
|
|
|
return (
|
|
<div className="flex h-full flex-col px-3 py-4 md:px-2">
|
|
<Link
|
|
className="mb-2 flex h-20 items-center justify-start rounded-md bg-blue-600 p-4 md:h-20"
|
|
href={`/${getSlug()}/dashboard`}
|
|
>
|
|
<div className={`${gloriaHallelujah.className} "w-32 text-white md:w-40 antialiased`}>
|
|
<h1>Wedding Planner</h1>
|
|
</div>
|
|
</Link>
|
|
<div className="flex grow flex-row justify-between space-x-2 md:flex-col md:space-x-0 md:space-y-2">
|
|
<NavLinks />
|
|
<div className="hidden h-auto w-full grow rounded-md bg-gray-50 md:block"></div>
|
|
<span>Logged in as {JSON.parse(localStorage.getItem('currentUser') || '{}').email}</span>
|
|
<button
|
|
className="flex h-[48px] w-full grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3"
|
|
onClick={() => {
|
|
logout({
|
|
onLogout: () => {
|
|
localStorage.clear();
|
|
router.push(`/${getSlug()}`);
|
|
}
|
|
});
|
|
}}
|
|
>
|
|
<PowerIcon className="w-6" />
|
|
<div className="hidden md:block">Sign Out</div>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|