// react import React from "react"; // next import { useRouter } from "next/router"; import Link from "next/link"; import Image from "next/image"; // services import userService from "lib/services/user.service"; import authenticationService from "lib/services/authentication.service"; // hooks import useUser from "lib/hooks/useUser"; // headless ui import { Menu, Transition } from "@headlessui/react"; // ui import { Spinner } from "ui"; // icons import { ChevronDownIcon, ClipboardDocumentListIcon, Cog6ToothIcon, HomeIcon, PlusIcon, RectangleStackIcon, UserGroupIcon, UserIcon, } from "@heroicons/react/24/outline"; // types import { IUser } from "types"; type Props = { sidebarCollapse: boolean; }; const workspaceLinks = [ { icon: HomeIcon, name: "Home", href: `/workspace`, }, { icon: ClipboardDocumentListIcon, name: "Projects", href: "/projects", }, { icon: RectangleStackIcon, name: "My Issues", href: "/me/my-issues", }, { icon: UserGroupIcon, name: "Members", href: "/workspace/members", }, // { // icon: InboxIcon, // name: "Inbox", // href: "#", // }, { icon: Cog6ToothIcon, name: "Settings", href: "/workspace/settings", }, ]; const userLinks = [ { name: "My Profile", href: "/me/profile", }, { name: "Workspace Invites", href: "/invitations", }, ]; const WorkspaceOptions: React.FC = ({ sidebarCollapse }) => { const { workspaces, activeWorkspace, user, mutateUser } = useUser(); const router = useRouter(); return (
{activeWorkspace?.logo && activeWorkspace.logo !== "" ? ( Workspace Logo ) : ( activeWorkspace?.name?.charAt(0) ?? "N" )}
{!sidebarCollapse && (

{activeWorkspace?.name ?? "Loading..."}

)}
{!sidebarCollapse && (
)}
{workspaces ? ( <> {workspaces.length > 0 ? ( workspaces.map((workspace: any) => ( {({ active }) => ( )} )) ) : (

No workspace found!

)} { router.push("/create-workspace"); }} className="w-full" > {({ active }) => ( Create Workspace )} ) : (
)}
{!sidebarCollapse && (
{user?.avatar && user.avatar !== "" ? ( User Avatar ) : ( )}
{userLinks.map((item) => ( {(active) => ( {item.name} )} ))}
)}
{workspaceLinks.map((link, index) => ( ))}
); }; export default WorkspaceOptions;