Skip to content

Commit

Permalink
Updated sidebar to match the navbar (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivntsng authored Oct 28, 2024
1 parent 4f6a17f commit 9b583d8
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions frontend/src/components/nav/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
FaRegFileLines,
FaRobot,
FaSearchengin,
FaTerminal,
FaWpexplorer,
FaXTwitter,
} from "react-icons/fa6";
Expand Down Expand Up @@ -35,14 +36,30 @@ const SidebarItem = ({ icon, title, onClick }: SidebarItemProps) => (
</li>
);

type NavItem = {
name: string;
path: string;
isExternal: boolean;
icon?: JSX.Element;
};

const Sidebar = ({ show, onClose }: SidebarProps) => {
const navigate = useNavigate();
const { isAuthenticated } = useAuthentication();

const navItems = [
{ name: "Pro", path: "/pro", icon: <FaRobot /> },
{ name: "Mini", path: "/mini", icon: <FaRobot /> },
];
let navItems: NavItem[] = [];

if (isAuthenticated) {
navItems = [
{
name: "Terminal",
path: "/terminal",
isExternal: false,
icon: <FaTerminal />,
},
...navItems,
];
}

const technicalItems = [
{ name: "Browse", path: "/browse", icon: <FaSearchengin /> },
Expand Down Expand Up @@ -89,15 +106,19 @@ const Sidebar = ({ show, onClose }: SidebarProps) => {
<div className="border-t border-gray-1 my-2"></div>
<nav>
<ul className="space-y-1">
{navItems.map((item) => (
<SidebarItem
key={item.name}
title={item.name}
icon={item.icon}
onClick={() => handleItemClick(item.path)}
/>
))}
<div className="border-t border-gray-1 my-2"></div>
{isAuthenticated && (
<>
{navItems.map((item) => (
<SidebarItem
key={item.name}
title={item.name}
icon={item.icon}
onClick={() => handleItemClick(item.path)}
/>
))}
<div className="border-t border-gray-1 my-2"></div>
</>
)}
{technicalItems.map((item) => (
<SidebarItem
key={item.name}
Expand Down

0 comments on commit 9b583d8

Please sign in to comment.