import React from "react"; import { useRouter } from "next/router"; // hooks import useIssuesProperties from "hooks/use-issue-properties"; import useIssueView from "hooks/use-issue-view"; // headless ui import { Popover, Transition } from "@headlessui/react"; // ui import { CustomMenu } from "components/ui"; // icons import { ChevronDownIcon, ListBulletIcon } from "@heroicons/react/24/outline"; import { Squares2X2Icon } from "@heroicons/react/20/solid"; // helpers import { replaceUnderscoreIfSnakeCase } from "helpers/string.helper"; // types import { IIssue, Properties } from "types"; // common import { filterIssueOptions, groupByOptions, orderByOptions } from "constants/"; type Props = { issues?: IIssue[]; }; const View: React.FC = ({ issues }) => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; const { issueView, setIssueViewToList, setIssueViewToKanban, groupByProperty, setGroupByProperty, setOrderBy, setFilterIssue, orderBy, filterIssue, resetFilterToDefault, setNewFilterDefaultView, } = useIssueView(issues ?? []); const [properties, setProperties] = useIssuesProperties( workspaceSlug as string, projectId as string ); return (
{issues && ( <> )}
{({ open }) => ( <> View
{issues && (

Group by

option.key === groupByProperty)?.name ?? "Select" } width="lg" > {groupByOptions.map((option) => ( setGroupByProperty(option.key)} > {option.name} ))}

Order by

option.key === orderBy)?.name ?? "Select" } width="lg" > {orderByOptions.map((option) => groupByProperty === "priority" && option.key === "priority" ? null : ( setOrderBy(option.key)} > {option.name} ) )}

Issue type

option.key === filterIssue)?.name ?? "Select" } width="lg" > {filterIssueOptions.map((option) => ( setFilterIssue(option.key)} > {option.name} ))}
)}

Display Properties

{Object.keys(properties).map((key) => ( ))}
)}
); }; export default View;