// react import React, { useState } from "react"; // next import { useRouter } from "next/router"; import Link from "next/link"; // hooks import useToast from "lib/hooks/useToast"; import useUser from "lib/hooks/useUser"; // components import CreateProjectModal from "components/project/create-project-modal"; // headless ui import { Disclosure, Menu, Transition } from "@headlessui/react"; // ui import { Spinner } from "ui"; // icons import { ChevronDownIcon, ClipboardDocumentIcon, EllipsisHorizontalIcon, PlusIcon, } from "@heroicons/react/24/outline"; // constants import { classNames, copyTextToClipboard } from "constants/common"; type Props = { navigation: (projectId: string) => Array<{ name: string; href: string; icon: (props: any) => JSX.Element; }>; sidebarCollapse: boolean; }; const ProjectsList: React.FC = ({ navigation, sidebarCollapse }) => { const [isCreateProjectModal, setCreateProjectModal] = useState(false); const { projects } = useUser(); const { setToastAlert } = useToast(); const router = useRouter(); const { projectId } = router.query; return ( <>
{projects ? ( <> {projects.length > 0 ? ( projects.map((project) => ( {({ open }) => ( <>
{project.icon ? ( {String.fromCodePoint(parseInt(project.icon))} ) : ( {project?.name.charAt(0)} )} {!sidebarCollapse && ( {project?.name} )} {!sidebarCollapse && (
{(active) => ( )}
)}
{navigation(project?.id).map((item) => ( ))} )}
)) ) : (
{!sidebarCollapse && (

You don{"'"}t have any project yet

)}
)} ) : (
)}
); }; export default ProjectsList;