fix: updated the issue create sorting

This commit is contained in:
guru_sainath 2024-06-03 21:53:17 +05:30
parent 4025ddca51
commit a26cf199f7
3 changed files with 8 additions and 10 deletions

View File

@ -60,8 +60,8 @@ export const DeleteEstimateModal: FC<TDeleteEstimateModal> = observer((props) =>
{/* estimate steps */} {/* estimate steps */}
<div className="px-5"> <div className="px-5">
<div className="text-base"> <div className="text-base text-custom-text-200">
Deleting the estimate <span className="font-medium text-custom-primary-100">{estimate?.name}</span> Deleting the estimate <span className="font-bold text-custom-text-100">{estimate?.name}</span>
&nbsp;system will remove it from all issues permanently. This action cannot be undone. If you add estimates &nbsp;system will remove it from all issues permanently. This action cannot be undone. If you add estimates
again, you will need to update all the issues. again, you will need to update all the issues.
</div> </div>

View File

@ -7,8 +7,6 @@ import { Button, Sortable } from "@plane/ui";
import { EstimatePointCreate, EstimatePointItemPreview } from "@/components/estimates/points"; import { EstimatePointCreate, EstimatePointItemPreview } from "@/components/estimates/points";
// constants // constants
import { maxEstimatesCount } from "@/constants/estimates"; import { maxEstimatesCount } from "@/constants/estimates";
// hooks
import { useEstimate } from "@/hooks/store";
type TEstimatePointCreateRoot = { type TEstimatePointCreateRoot = {
workspaceSlug: string; workspaceSlug: string;
@ -22,8 +20,6 @@ type TEstimatePointCreateRoot = {
export const EstimatePointCreateRoot: FC<TEstimatePointCreateRoot> = observer((props) => { export const EstimatePointCreateRoot: FC<TEstimatePointCreateRoot> = observer((props) => {
// props // props
const { workspaceSlug, projectId, estimateId, estimateType, estimatePoints, setEstimatePoints } = props; const { workspaceSlug, projectId, estimateId, estimateType, estimatePoints, setEstimatePoints } = props;
// hooks
const { asJson: estimate, updateEstimateSortOrder } = useEstimate(estimateId);
// states // states
const [estimatePointCreate, setEstimatePointCreate] = useState<TEstimatePointsObject[] | undefined>(undefined); const [estimatePointCreate, setEstimatePointCreate] = useState<TEstimatePointsObject[] | undefined>(undefined);
@ -76,13 +72,14 @@ export const EstimatePointCreateRoot: FC<TEstimatePointCreateRoot> = observer((p
const handleDragEstimatePoints = (updatedEstimatedOrder: TEstimatePointsObject[]) => { const handleDragEstimatePoints = (updatedEstimatedOrder: TEstimatePointsObject[]) => {
const updatedEstimateKeysOrder = updatedEstimatedOrder.map((item, index) => ({ ...item, key: index + 1 })); const updatedEstimateKeysOrder = updatedEstimatedOrder.map((item, index) => ({ ...item, key: index + 1 }));
updateEstimateSortOrder(workspaceSlug, projectId, updatedEstimateKeysOrder); setEstimatePoints(() => updatedEstimateKeysOrder);
}; };
if (!workspaceSlug || !projectId) return <></>; if (!workspaceSlug || !projectId) return <></>;
return ( return (
<div className="space-y-3"> <div className="space-y-3">
<div className="text-sm font-medium text-custom-text-200 capitalize">{estimate?.type}</div> <div className="text-sm font-medium text-custom-text-200 capitalize">{estimateType}</div>
<div> <div>
<Sortable <Sortable
data={estimatePoints} data={estimatePoints}
@ -105,6 +102,7 @@ export const EstimatePointCreateRoot: FC<TEstimatePointCreateRoot> = observer((p
keyExtractor={(item: TEstimatePointsObject) => item?.id?.toString() || item.value.toString()} keyExtractor={(item: TEstimatePointsObject) => item?.id?.toString() || item.value.toString()}
/> />
</div> </div>
{estimatePointCreate && {estimatePointCreate &&
estimatePointCreate.map((estimatePoint) => ( estimatePointCreate.map((estimatePoint) => (
<EstimatePointCreate <EstimatePointCreate
@ -133,7 +131,7 @@ export const EstimatePointCreateRoot: FC<TEstimatePointCreateRoot> = observer((p
}) })
} }
> >
Add {estimate?.type} Add {estimateType}
</Button> </Button>
)} )}
</div> </div>

View File

@ -2,7 +2,7 @@ import { FC, Fragment, useState } from "react";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { Plus } from "lucide-react"; import { Plus } from "lucide-react";
import { TEstimatePointsObject } from "@plane/types"; import { TEstimatePointsObject } from "@plane/types";
import { Button, Draggable, Sortable, TOAST_TYPE, setToast } from "@plane/ui"; import { Button, Sortable, TOAST_TYPE, setToast } from "@plane/ui";
// components // components
import { EstimatePointItemPreview, EstimatePointCreate } from "@/components/estimates/points"; import { EstimatePointItemPreview, EstimatePointCreate } from "@/components/estimates/points";
// constants // constants