import { useRef, useState } from "react"; import Link from "next/link"; import { Transition } from "@headlessui/react"; // hooks import useTheme from "hooks/use-theme"; import useOutsideClickDetector from "hooks/use-outside-click-detector"; // components import ProjectsList from "components/sidebar/projects-list"; import WorkspaceOptions from "components/sidebar/workspace-options"; // icons import { Cog6ToothIcon, RectangleStackIcon, ArrowLongLeftIcon, RectangleGroupIcon, } from "@heroicons/react/24/outline"; import { CyclesIcon, QuestionMarkCircleIcon, BoltIcon, DocumentIcon, DiscordIcon, GithubIcon, CommentIcon, } from "components/icons"; type Props = { toggleSidebar: boolean; setToggleSidebar: React.Dispatch>; }; const helpOptions = [ { name: "Documentation", href: "https://docs.plane.so/", Icon: DocumentIcon, }, { name: "Join our Discord", href: "https://discord.com/invite/A92xrEGCge", Icon: DiscordIcon, }, { name: "Report a bug", href: "https://github.com/makeplane/plane/issues/new/choose", Icon: GithubIcon, }, { name: "Chat with us", href: "mailto:hello@plane.so", Icon: CommentIcon, }, ]; const navigation = (workspaceSlug: string, projectId: string) => [ { name: "Issues", href: `/${workspaceSlug}/projects/${projectId}/issues`, icon: RectangleStackIcon, }, { name: "Cycles", href: `/${workspaceSlug}/projects/${projectId}/cycles`, icon: CyclesIcon, }, { name: "Modules", href: `/${workspaceSlug}/projects/${projectId}/modules`, icon: RectangleGroupIcon, }, { name: "Settings", href: `/${workspaceSlug}/projects/${projectId}/settings`, icon: Cog6ToothIcon, }, ]; const Sidebar: React.FC = ({ toggleSidebar, setToggleSidebar }) => { const helpOptionsRef = useRef(null); const { collapsed: sidebarCollapse, toggleCollapsed } = useTheme(); useOutsideClickDetector(helpOptionsRef, () => setIsNeedHelpOpen(false)); const [isNeedHelpOpen, setIsNeedHelpOpen] = useState(false); const helpOptionMode = sidebarCollapse ? "left-full" : "left-[-75px]"; return ( ); }; export default Sidebar;