import React from "react"; // hooks import useSpreadsheetIssuesView from "hooks/use-spreadsheet-issues-view"; import useLocalStorage from "hooks/use-local-storage"; // component import { CustomMenu, Icon } from "components/ui"; // icon import { CheckIcon, ChevronDownIcon } from "@heroicons/react/24/outline"; // types import { TIssueOrderByOptions } from "types"; type Props = { columnData: any; gridTemplateColumns: string; }; export const SpreadsheetColumns: React.FC = ({ columnData, gridTemplateColumns }) => { const { storedValue: selectedMenuItem, setValue: setSelectedMenuItem } = useLocalStorage( "spreadsheetViewSorting", "" ); const { orderBy, setOrderBy } = useSpreadsheetIssuesView(); const handleOrderBy = (order: TIssueOrderByOptions, itemKey: string) => { setOrderBy(order); setSelectedMenuItem(`${order}_${itemKey}`); }; return (
{columnData.map((col: any) => { if (col.isActive) { return (
{col.propertyName === "title" || col.propertyName === "priority" ? (
{col.icon ? (
) : ( {col.icon ? (
} menuItemsWhiteBg width="xl" > { handleOrderBy(col.ascendingOrder, col.propertyName); }} >
{col.propertyName === "assignee" || col.propertyName === "labels" ? ( <> A-Z Ascending ) : col.propertyName === "due_date" ? ( <> 1-9 Ascending ) : col.propertyName === "estimate" ? ( <> 0 10 ) : ( <> First Last )}
{ handleOrderBy(col.descendingOrder, col.propertyName); }} >
{col.propertyName === "assignee" || col.propertyName === "labels" ? ( <> Z-A Descending ) : col.propertyName === "due_date" ? ( <> 9-1 Descending ) : col.propertyName === "estimate" ? ( <> 10 0 ) : ( <> Last First )}
{ handleOrderBy("-created_at", col.propertyName); }} >
None
)}
); } })} ); };