2023-10-16 19:40:56 -04:00
|
|
|
"use client";
|
|
|
|
|
2023-10-13 19:02:59 -04:00
|
|
|
import Link from "next/link";
|
|
|
|
import {
|
|
|
|
RiHome6Fill,
|
|
|
|
RiCompassLine,
|
|
|
|
RiCompass3Fill,
|
|
|
|
RiQuestionAnswerLine,
|
|
|
|
RiAddFill,
|
|
|
|
RiSettings4Fill,
|
|
|
|
RiSettings4Line,
|
|
|
|
} from "react-icons/ri";
|
|
|
|
import { HiOutlineLightningBolt } from "react-icons/hi";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
import { Button } from "@/components/ui/button";
|
2023-10-14 23:35:08 -04:00
|
|
|
import {
|
|
|
|
Tooltip,
|
|
|
|
TooltipContent,
|
|
|
|
TooltipProvider,
|
|
|
|
TooltipTrigger,
|
|
|
|
} from "@/components/ui/tooltip";
|
2023-10-16 19:40:56 -04:00
|
|
|
import ZapPicker from "@/components/Modals/ZapPicker";
|
|
|
|
import { useModal } from "@/app/_providers/modal/provider";
|
|
|
|
import { IconType } from "react-icons";
|
|
|
|
|
|
|
|
type NavigationLink = {
|
|
|
|
type: "link";
|
|
|
|
href: string;
|
|
|
|
};
|
|
|
|
type NavigationButton = {
|
|
|
|
type: "button";
|
|
|
|
onClick: () => void;
|
|
|
|
};
|
|
|
|
type NavigationElement = {
|
|
|
|
name: string;
|
|
|
|
label: string;
|
|
|
|
icon: IconType;
|
|
|
|
current: boolean;
|
|
|
|
active: boolean;
|
|
|
|
} & (NavigationLink | NavigationButton);
|
2023-10-13 19:02:59 -04:00
|
|
|
|
|
|
|
export default function Sidebar() {
|
2023-10-16 19:40:56 -04:00
|
|
|
const modal = useModal();
|
|
|
|
|
|
|
|
const navigation: NavigationElement[] = [
|
2023-10-13 19:02:59 -04:00
|
|
|
{
|
|
|
|
href: "",
|
|
|
|
name: "home",
|
|
|
|
label: "Home",
|
|
|
|
icon: RiHome6Fill,
|
2023-10-16 19:40:56 -04:00
|
|
|
type: "link",
|
2023-10-13 19:02:59 -04:00
|
|
|
current: true,
|
2023-10-14 23:35:08 -04:00
|
|
|
active: true,
|
2023-10-13 19:02:59 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
href: "",
|
|
|
|
name: "explore",
|
|
|
|
label: "Explore",
|
|
|
|
icon: RiCompassLine,
|
2023-10-16 19:40:56 -04:00
|
|
|
type: "link",
|
2023-10-13 19:02:59 -04:00
|
|
|
current: false,
|
2023-10-14 23:35:08 -04:00
|
|
|
active: false,
|
2023-10-13 19:02:59 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
href: "",
|
|
|
|
name: "messages",
|
|
|
|
label: "Messages",
|
|
|
|
icon: RiQuestionAnswerLine,
|
2023-10-16 19:40:56 -04:00
|
|
|
type: "link",
|
2023-10-13 19:02:59 -04:00
|
|
|
current: false,
|
2023-10-14 23:35:08 -04:00
|
|
|
active: false,
|
2023-10-13 19:02:59 -04:00
|
|
|
},
|
|
|
|
{
|
2023-10-16 19:40:56 -04:00
|
|
|
onClick: () => modal?.show(<ZapPicker />),
|
2023-10-13 19:02:59 -04:00
|
|
|
name: "zap",
|
|
|
|
label: "Zap Flockstr",
|
|
|
|
icon: HiOutlineLightningBolt,
|
2023-10-16 19:40:56 -04:00
|
|
|
type: "button",
|
2023-10-13 19:02:59 -04:00
|
|
|
current: false,
|
2023-10-14 23:35:08 -04:00
|
|
|
active: true,
|
2023-10-13 19:02:59 -04:00
|
|
|
},
|
|
|
|
];
|
|
|
|
return (
|
|
|
|
<nav className="z-header- hidden h-[calc(100svh_-_var(--header-height))] w-[var(--sidebar-closed-width)] flex-col sm:flex">
|
|
|
|
<div className="fixed bottom-0 flex h-[calc(100svh_-_var(--header-height))] w-[var(--sidebar-closed-width)] flex-col border-r xl:w-[var(--sidebar-open-width)]">
|
|
|
|
<div className="flex flex-1 flex-col">
|
|
|
|
<div className="flex flex-col items-stretch gap-y-2 p-4">
|
2023-10-14 23:35:08 -04:00
|
|
|
{navigation.map((item) => {
|
2023-10-16 19:40:56 -04:00
|
|
|
if (item.type === "link") {
|
|
|
|
if (item.active) {
|
|
|
|
return (
|
|
|
|
<Link
|
|
|
|
key={item.name}
|
|
|
|
href={item.href}
|
|
|
|
className={cn(
|
|
|
|
"center group relative min-h-[48px] min-w-[48px] rounded-lg hover:bg-muted xl:justify-start xl:gap-x-4 xl:p-2.5",
|
|
|
|
item.current
|
|
|
|
? "text-foreground"
|
|
|
|
: "text-muted-foreground hover:text-foreground",
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<item.icon
|
|
|
|
className={cn("h-6 w-6 shrink-0")}
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
<span className="hidden text-base xl:flex">
|
|
|
|
{item.label}
|
|
|
|
</span>
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<TooltipProvider key={item.name}>
|
|
|
|
<Tooltip delayDuration={100}>
|
|
|
|
<TooltipTrigger>
|
|
|
|
<div
|
|
|
|
className={cn(
|
|
|
|
"center group relative min-h-[48px] min-w-[48px] rounded-lg hover:bg-muted xl:justify-start xl:gap-x-4 xl:p-2.5",
|
|
|
|
item.current
|
|
|
|
? "text-foreground"
|
|
|
|
: "text-muted-foreground hover:text-foreground",
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<item.icon
|
|
|
|
className={cn("h-6 w-6 shrink-0")}
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
<span className="hidden text-base xl:flex">
|
|
|
|
{item.label}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</TooltipTrigger>
|
|
|
|
<TooltipContent align="start">
|
|
|
|
<p>Coming Soon</p>
|
|
|
|
</TooltipContent>
|
|
|
|
</Tooltip>
|
|
|
|
</TooltipProvider>
|
|
|
|
);
|
|
|
|
}
|
2023-10-14 23:35:08 -04:00
|
|
|
} else {
|
2023-10-16 19:40:56 -04:00
|
|
|
if (item.active) {
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
key={item.name}
|
|
|
|
onClick={item.onClick}
|
|
|
|
className={cn(
|
|
|
|
"center group relative min-h-[48px] min-w-[48px] rounded-lg hover:bg-muted xl:justify-start xl:gap-x-4 xl:p-2.5",
|
|
|
|
item.current
|
|
|
|
? "text-foreground"
|
|
|
|
: "text-muted-foreground hover:text-foreground",
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<item.icon
|
|
|
|
className={cn("h-6 w-6 shrink-0")}
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
<span className="hidden text-base xl:flex">
|
|
|
|
{item.label}
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<TooltipProvider key={item.name}>
|
|
|
|
<Tooltip delayDuration={100}>
|
|
|
|
<TooltipTrigger>
|
|
|
|
<div
|
|
|
|
className={cn(
|
|
|
|
"center group relative min-h-[48px] min-w-[48px] rounded-lg hover:bg-muted xl:justify-start xl:gap-x-4 xl:p-2.5",
|
|
|
|
item.current
|
|
|
|
? "text-foreground"
|
|
|
|
: "text-muted-foreground hover:text-foreground",
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<item.icon
|
|
|
|
className={cn("h-6 w-6 shrink-0")}
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
<span className="hidden text-base xl:flex">
|
|
|
|
{item.label}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</TooltipTrigger>
|
|
|
|
<TooltipContent align="start">
|
|
|
|
<p>Coming Soon</p>
|
|
|
|
</TooltipContent>
|
|
|
|
</Tooltip>
|
|
|
|
</TooltipProvider>
|
|
|
|
);
|
|
|
|
}
|
2023-10-14 23:35:08 -04:00
|
|
|
}
|
|
|
|
})}
|
2023-10-13 19:02:59 -04:00
|
|
|
<div className="center py-2 xl:justify-start">
|
2023-10-16 19:40:56 -04:00
|
|
|
<Button
|
|
|
|
onClick={() => modal?.show(<ZapPicker />)}
|
|
|
|
size={"icon"}
|
|
|
|
className="xl:hidden"
|
|
|
|
>
|
2023-10-13 19:02:59 -04:00
|
|
|
<RiAddFill className="h-6 w-6" />
|
|
|
|
</Button>
|
2023-10-16 19:40:56 -04:00
|
|
|
<Button
|
|
|
|
onClick={() => modal?.show(<ZapPicker />)}
|
|
|
|
size={"lg"}
|
|
|
|
className="hidden xl:flex"
|
|
|
|
>
|
2023-10-13 19:02:59 -04:00
|
|
|
<div className="center gap-x-1.5">
|
|
|
|
<RiAddFill className="h-6 w-6" />
|
|
|
|
<span>Add Note</span>
|
|
|
|
</div>
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="flex flex-1 flex-col justify-end p-4">
|
|
|
|
<button
|
|
|
|
className={cn(
|
|
|
|
"center relative min-h-[48px] min-w-[48px] rounded-lg hover:bg-muted xl:justify-start xl:gap-x-4 xl:p-2.5",
|
|
|
|
|
|
|
|
"text-muted-foreground group-hover:text-foreground",
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<RiSettings4Line
|
|
|
|
className={cn("h-6 w-6 shrink-0")}
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
<span className="hidden text-base xl:flex">Settings</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
);
|
|
|
|
}
|