import { FC } from "react"; import { X } from "lucide-react"; // types import { useLabel } from "@/hooks/store"; import { TLabelOperations } from "./root"; type TLabelListItem = { workspaceSlug: string; projectId: string; issueId: string; labelId: string; values: string[]; labelOperations: TLabelOperations; disabled: boolean; }; export const LabelListItem: FC = (props) => { const { workspaceSlug, projectId, issueId, labelId, values, labelOperations, disabled } = props; // hooks const { getLabelById } = useLabel(); const label = getLabelById(labelId); const handleLabel = async () => { if (values && !disabled) { const currentLabels = values.filter((_labelId) => _labelId !== labelId); await labelOperations.updateIssue(workspaceSlug, projectId, issueId, { label_ids: currentLabels }); } }; if (!label) return <>; return (
{label.name}
{!disabled && (
)}
); };