mirror of
https://github.com/dylanbenzi/yellowbird.git
synced 2026-11-27 01:07:01 +00:00
212 lines
4.5 KiB
TypeScript
212 lines
4.5 KiB
TypeScript
"use client";
|
|
|
|
import Image from "next/image";
|
|
import React, { useState } from "react";
|
|
import { Button } from "../ui/button";
|
|
import { cn } from "@/lib/utils";
|
|
import {
|
|
ArrowLeftRightIcon,
|
|
ArrowLeftToLineIcon,
|
|
ArrowRightToLine,
|
|
ArrowRightToLineIcon,
|
|
CalendarIcon,
|
|
CircleDollarSignIcon,
|
|
FileTextIcon,
|
|
LayoutGridIcon,
|
|
LineChartIcon,
|
|
LogOutIcon,
|
|
Mail,
|
|
PersonStanding,
|
|
PersonStandingIcon,
|
|
RocketIcon,
|
|
Settings,
|
|
SettingsIcon,
|
|
} from "lucide-react";
|
|
import {
|
|
Command,
|
|
CommandEmpty,
|
|
CommandGroup,
|
|
CommandInput,
|
|
CommandItem,
|
|
CommandList,
|
|
CommandSeparator,
|
|
CommandShortcut,
|
|
} from "../ui/command";
|
|
import { useRouter } from "next/navigation";
|
|
|
|
function Sidebar() {
|
|
const [isCollapsed, setIsCollapsed] = useState<boolean>(false);
|
|
|
|
const router = useRouter();
|
|
|
|
const handleClick = (redirectLink: any) => {
|
|
router.push(redirectLink);
|
|
};
|
|
|
|
const menuList = [
|
|
{
|
|
group: "Navigation",
|
|
items: [
|
|
{
|
|
link: "/",
|
|
icon: <LayoutGridIcon height={20} />,
|
|
text: "Dashboard",
|
|
},
|
|
{
|
|
link: "/calendar",
|
|
icon: <CalendarIcon height={20} />,
|
|
text: "Calendar",
|
|
},
|
|
{
|
|
link: "/porfolio",
|
|
icon: <LineChartIcon height={20} />,
|
|
text: "Portfolio",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
group: "Apple Inc",
|
|
items: [
|
|
{
|
|
link: "/",
|
|
icon: <CircleDollarSignIcon height={20} />,
|
|
text: "Earnings",
|
|
},
|
|
{
|
|
link: "/",
|
|
icon: <ArrowLeftRightIcon height={20} />,
|
|
text: "Insider Trades",
|
|
},
|
|
{
|
|
link: "/",
|
|
icon: <FileTextIcon height={20} />,
|
|
text: "Filings",
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
return (
|
|
<div
|
|
className={cn(
|
|
isCollapsed ? "w-[75px]" : "min-w-[275px]",
|
|
"border-r border-neutral-700 min-h-screen"
|
|
)}
|
|
>
|
|
<div
|
|
className={cn(
|
|
isCollapsed ? "items-center" : "",
|
|
"pb-4 px-2 flex flex-col min-h-screen"
|
|
)}
|
|
>
|
|
<div
|
|
className={cn(isCollapsed ? "" : "px-4", "h-16 flex items-center")}
|
|
>
|
|
{isCollapsed ? (
|
|
<Image
|
|
src={"/yellowbird-yellow-circle.svg"}
|
|
height={40}
|
|
width={40}
|
|
alt="yellowbird"
|
|
/>
|
|
) : (
|
|
<Image
|
|
src={"/yellowbird-yellow-badge.svg"}
|
|
height={40}
|
|
width={152.5}
|
|
alt="yellowbird"
|
|
/>
|
|
)}
|
|
</div>
|
|
|
|
<div className="flex-grow px-4">
|
|
<div className="max-h-full">
|
|
{menuList.map((menu: any, key: number) => (
|
|
<>
|
|
<div key={key} className="py-2">
|
|
<div className="text-muted-foreground text-sm pl-1 pb-1">
|
|
{!isCollapsed && menu.group}
|
|
</div>
|
|
{menu.items.map((option: any, optionKey: number) => (
|
|
<div
|
|
key={optionKey}
|
|
className="flex gap-2 cursor-pointer p-2 hover:bg-neutral-700 rounded-xl"
|
|
onClick={() => handleClick(option.link)}
|
|
>
|
|
<div
|
|
className={cn(
|
|
isCollapsed ? "justify-center" : "pl-1 gap-2",
|
|
"flex"
|
|
)}
|
|
>
|
|
<div className="text-muted-foreground flex items-center">
|
|
{option.icon}
|
|
</div>
|
|
{!isCollapsed && (
|
|
<span className="text-base">{option.text}</span>
|
|
)}
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
<hr className="border-neutral-600 last:hidden" />
|
|
</>
|
|
))}
|
|
</div>
|
|
</div>
|
|
<div className="flex flex-col gap-2">
|
|
<div className={cn(isCollapsed ? "flex flex-col" : "flex", "gap-2")}>
|
|
<Button
|
|
className="grow"
|
|
variant="secondary"
|
|
onClick={() => {
|
|
setIsCollapsed(!isCollapsed);
|
|
}}
|
|
>
|
|
{!isCollapsed ? (
|
|
<ArrowLeftToLineIcon height={20} />
|
|
) : (
|
|
<ArrowRightToLineIcon height={20} />
|
|
)}
|
|
</Button>
|
|
<Button
|
|
variant="secondary"
|
|
className="grow"
|
|
onClick={() => {
|
|
router.push("/settings");
|
|
}}
|
|
>
|
|
<SettingsIcon height={20} />
|
|
</Button>
|
|
</div>
|
|
<div
|
|
className={cn(
|
|
isCollapsed ? "justify-center" : "",
|
|
"p-2 bg-secondary rounded-lg flex items-center"
|
|
)}
|
|
>
|
|
<Button variant="default" className="w-8 h-8 rounded-full">
|
|
Me
|
|
</Button>
|
|
{!isCollapsed && (
|
|
<>
|
|
<div className="flex-grow pl-2">
|
|
<p className="text-sm">Dylan Benzi</p>
|
|
<p className="text-xs text-muted-foreground">
|
|
dylanbenzi@gmail.com
|
|
</p>
|
|
</div>
|
|
<Button variant="ghost" className="">
|
|
<LogOutIcon width={20} height={20} className="text-red-500" />
|
|
</Button>
|
|
</>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default Sidebar;
|