diff --git a/web/components/issues/workspace-views/workspace-issue-view-option.tsx b/web/components/issues/workspace-views/workspace-issue-view-option.tsx new file mode 100644 index 000000000..0faa58ecd --- /dev/null +++ b/web/components/issues/workspace-views/workspace-issue-view-option.tsx @@ -0,0 +1,330 @@ +import React from "react"; + +import { useRouter } from "next/router"; + +// headless ui +import { Popover, Transition } from "@headlessui/react"; +// hooks +import useMyIssuesFilters from "hooks/my-issues/use-my-issues-filter"; +import useEstimateOption from "hooks/use-estimate-option"; +// components +import { MyIssuesSelectFilters } from "components/issues"; +// ui +import { CustomMenu, ToggleSwitch, Tooltip } from "components/ui"; +// icons +import { ChevronDownIcon } from "@heroicons/react/24/outline"; +import { FormatListBulletedOutlined } from "@mui/icons-material"; +import { CreditCard } from "lucide-react"; +// helpers +import { replaceUnderscoreIfSnakeCase } from "helpers/string.helper"; +import { checkIfArraysHaveSameElements } from "helpers/array.helper"; +// types +import { Properties, TIssueViewOptions } from "types"; +// constants +import { GROUP_BY_OPTIONS, ORDER_BY_OPTIONS, FILTER_ISSUE_OPTIONS } from "constants/issue"; + +const issueViewOptions: { type: TIssueViewOptions; Icon: any }[] = [ + { + type: "list", + Icon: FormatListBulletedOutlined, + }, + { + type: "spreadsheet", + Icon: CreditCard, + }, +]; + +export const WorkspaceIssuesViewOptions: React.FC = () => { + const router = useRouter(); + const { workspaceSlug, workspaceViewId } = router.query; + + const { displayFilters, setDisplayFilters, properties, setProperty, filters, setFilters } = + useMyIssuesFilters(workspaceSlug?.toString()); + + const { isEstimateActive } = useEstimateOption(); + + const workspaceViewPathName = [ + "workspace-views/all-issues", + "workspace-views/assigned", + "workspace-views/created", + "workspace-views/subscribed", + ]; + + const isWorkspaceViewPath = workspaceViewPathName.some((pathname) => + router.pathname.includes(pathname) + ); + + const showFilters = isWorkspaceViewPath || workspaceViewId; + + return ( +