2024-06-10 12:16:23 +05:30
|
|
|
import { FC } from "react";
|
|
|
|
|
import { observer } from "mobx-react";
|
2024-07-15 19:48:27 +05:30
|
|
|
import { Pen, Trash } from "lucide-react";
|
2025-07-10 17:05:30 +05:30
|
|
|
import { PROJECT_SETTINGS_TRACKER_ELEMENTS } from "@plane/constants";
|
2024-06-13 15:51:41 +05:30
|
|
|
import { Tooltip } from "@plane/ui";
|
2024-07-15 19:48:27 +05:30
|
|
|
// components
|
2025-08-15 13:10:26 +05:30
|
|
|
import { ProIcon } from "@/components/common/pro-icon";
|
2024-06-10 12:16:23 +05:30
|
|
|
|
|
|
|
|
type TEstimateListItem = {
|
|
|
|
|
estimateId: string;
|
|
|
|
|
isAdmin: boolean;
|
|
|
|
|
isEstimateEnabled: boolean;
|
|
|
|
|
isEditable: boolean;
|
|
|
|
|
onEditClick?: (estimateId: string) => void;
|
|
|
|
|
onDeleteClick?: (estimateId: string) => void;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const EstimateListItemButtons: FC<TEstimateListItem> = observer((props) => {
|
2024-06-13 15:51:41 +05:30
|
|
|
const { estimateId, isAdmin, isEditable, onDeleteClick } = props;
|
2024-06-10 12:16:23 +05:30
|
|
|
|
2024-06-13 15:51:41 +05:30
|
|
|
if (!isAdmin || !isEditable) return <></>;
|
2024-06-10 12:16:23 +05:30
|
|
|
return (
|
|
|
|
|
<div className="relative flex items-center gap-1">
|
2024-06-13 15:51:41 +05:30
|
|
|
<Tooltip
|
|
|
|
|
tooltipContent={
|
|
|
|
|
<div className="relative flex items-center gap-2">
|
|
|
|
|
<div>Upgrade</div>
|
2024-07-15 19:48:27 +05:30
|
|
|
<ProIcon className="w-3 h-3" />
|
2024-06-13 15:51:41 +05:30
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
position="top"
|
2024-06-10 12:16:23 +05:30
|
|
|
>
|
2025-07-10 17:05:30 +05:30
|
|
|
<button
|
|
|
|
|
className="relative flex-shrink-0 w-6 h-6 flex justify-center items-center rounded cursor-pointer transition-colors overflow-hidden hover:bg-custom-background-80"
|
|
|
|
|
data-ph-element={PROJECT_SETTINGS_TRACKER_ELEMENTS.ESTIMATES_LIST_ITEM}
|
|
|
|
|
>
|
2024-06-13 15:51:41 +05:30
|
|
|
<Pen size={12} />
|
|
|
|
|
</button>
|
|
|
|
|
</Tooltip>
|
2024-06-10 12:16:23 +05:30
|
|
|
<button
|
|
|
|
|
className="relative flex-shrink-0 w-6 h-6 flex justify-center items-center rounded cursor-pointer transition-colors overflow-hidden hover:bg-custom-background-80"
|
|
|
|
|
onClick={() => onDeleteClick && onDeleteClick(estimateId)}
|
2025-07-10 17:05:30 +05:30
|
|
|
data-ph-element={PROJECT_SETTINGS_TRACKER_ELEMENTS.ESTIMATES_LIST_ITEM}
|
2024-06-10 12:16:23 +05:30
|
|
|
>
|
|
|
|
|
<Trash size={12} />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
});
|