chore: estimate dropdownn option order

This commit is contained in:
Anmol Singh Bhatia 2023-12-26 16:39:10 +05:30
parent e14baf17a7
commit 53759dffff

View File

@ -3,6 +3,7 @@ import { usePopper } from "react-popper";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Combobox } from "@headlessui/react"; import { Combobox } from "@headlessui/react";
import { Check, ChevronDown, Search, Triangle } from "lucide-react"; import { Check, ChevronDown, Search, Triangle } from "lucide-react";
import { sortBy } from "lodash";
// ui // ui
import { Tooltip } from "@plane/ui"; import { Tooltip } from "@plane/ui";
// types // types
@ -63,18 +64,18 @@ export const IssuePropertyEstimates: React.FC<IIssuePropertyEstimates> = observe
const estimatePoints = const estimatePoints =
projectDetails && isEstimateEnabled ? estimates?.find((e) => e.id === projectDetails.estimate)?.points : null; projectDetails && isEstimateEnabled ? estimates?.find((e) => e.id === projectDetails.estimate)?.points : null;
const options: { value: number | null; query: string; content: any }[] | undefined = (estimatePoints ?? []).map( const options: { value: number | null; query: string; content: any }[] | undefined = (
(estimate) => ({ sortBy(estimatePoints, "key") ?? []
value: estimate.key, ).map((estimate) => ({
query: estimate.value, value: estimate.key,
content: ( query: estimate.value,
<div className="flex items-center gap-2"> content: (
<Triangle className="h-3 w-3" strokeWidth={2} /> <div className="flex items-center gap-2">
{estimate.value} <Triangle className="h-3 w-3" strokeWidth={2} />
</div> {estimate.value}
), </div>
}) ),
); }));
options?.unshift({ options?.unshift({
value: null, value: null,
query: "none", query: "none",