2024-10-27 21:11:45 +00:00
|
|
|
/* Copyright (C) 2024 Manuel Bustillo*/
|
|
|
|
|
2024-12-01 17:29:57 +01:00
|
|
|
'use client';
|
|
|
|
|
2024-08-11 12:03:11 +02:00
|
|
|
import Link from 'next/link';
|
|
|
|
import NavLinks from '@/app/ui/dashboard/nav-links';
|
|
|
|
import { PowerIcon } from '@heroicons/react/24/outline';
|
2024-08-11 12:34:16 +02:00
|
|
|
import { gloriaHallelujah } from '@/app/ui/fonts';
|
2024-12-01 17:29:57 +01:00
|
|
|
import { logout } from '@/app/api/authentication';
|
|
|
|
import { useRouter } from 'next/navigation';
|
2024-12-01 18:02:25 +01:00
|
|
|
import { getSlug } from '@/app/lib/utils';
|
2024-08-11 12:03:11 +02:00
|
|
|
|
|
|
|
export default function SideNav() {
|
2024-12-01 17:29:57 +01:00
|
|
|
const router = useRouter();
|
|
|
|
|
2024-08-11 12:03:11 +02:00
|
|
|
return (
|
|
|
|
<div className="flex h-full flex-col px-3 py-4 md:px-2">
|
|
|
|
<Link
|
2024-08-11 12:34:16 +02:00
|
|
|
className="mb-2 flex h-20 items-center justify-start rounded-md bg-blue-600 p-4 md:h-20"
|
2024-08-11 12:37:05 +02:00
|
|
|
href="/dashboard/guests"
|
2024-08-11 12:03:11 +02:00
|
|
|
>
|
2024-12-01 17:29:57 +01:00
|
|
|
<div className={`${gloriaHallelujah.className} "w-32 text-white md:w-40 antialiased`}>
|
2024-08-11 12:34:16 +02:00
|
|
|
<h1>Wedding Planner</h1>
|
2024-08-11 12:03:11 +02:00
|
|
|
</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>
|
2024-12-01 17:33:26 +01:00
|
|
|
<span>Logged in as {JSON.parse(localStorage.getItem('currentUser') || '{}').email}</span>
|
2024-12-01 17:29:57 +01:00
|
|
|
<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();
|
2024-12-01 18:02:25 +01:00
|
|
|
router.push(`/${getSlug()}`);
|
2024-12-01 17:29:57 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<PowerIcon className="w-6" />
|
|
|
|
<div className="hidden md:block">Sign Out</div>
|
|
|
|
</button>
|
2024-08-11 12:03:11 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|