import { useState, useRef, FC } from "react"; import Link from "next/link"; // headless ui import { Transition } from "@headlessui/react"; // hooks import useTheme from "hooks/use-theme"; import useOutsideClickDetector from "hooks/use-outside-click-detector"; // icons import { ArrowLongLeftIcon, ChatBubbleOvalLeftEllipsisIcon, RocketLaunchIcon, } from "@heroicons/react/24/outline"; import { QuestionMarkCircleIcon, DocumentIcon, DiscordIcon, GithubIcon } from "components/icons"; 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: null, onClick: () => (window as any).$crisp.push(["do", "chat:show"]), Icon: ChatBubbleOvalLeftEllipsisIcon, }, ]; export interface WorkspaceHelpSectionProps { setSidebarActive: React.Dispatch>; } export const WorkspaceHelpSection: FC = (props) => { const { setSidebarActive } = props; // theme const { collapsed: sidebarCollapse, toggleCollapsed } = useTheme(); // states const [isNeedHelpOpen, setIsNeedHelpOpen] = useState(false); // refs const helpOptionsRef = useRef(null); // hooks useOutsideClickDetector(helpOptionsRef, () => setIsNeedHelpOpen(false)); const helpOptionMode = sidebarCollapse ? "left-full" : "left-[-75px]"; return (
{helpOptions.map(({ name, Icon, href, onClick }) => { if (href) return ( {name} ); else return ( ); })}
); };