import React from "react"; import { useRouter } from "next/router"; import { Disclosure, Transition } from "@headlessui/react"; // store import { observer } from "mobx-react-lite"; import { useMobxStore } from "lib/mobx/store-provider"; // ui import { CustomMenu } from "@plane/ui"; // icons import { ChevronDown, Component, Pencil, Plus, Trash2, X } from "lucide-react"; // types import { IIssueLabels } from "types"; type Props = { label: IIssueLabels; labelChildren: IIssueLabels[]; handleLabelDelete: () => void; editLabel: (label: IIssueLabels) => void; addLabelToGroup: (parentLabel: IIssueLabels) => void; }; export const ProjectSettingLabelGroup: React.FC = observer((props) => { const { label, labelChildren, addLabelToGroup, editLabel, handleLabelDelete } = props; // router const router = useRouter(); const { workspaceSlug, projectId } = router.query; // store const { projectLabel: projectLabelStore } = useMobxStore(); const removeFromGroup = (label: IIssueLabels) => { if (!workspaceSlug || !projectId) return; projectLabelStore.updateLabel(workspaceSlug.toString(), projectId.toString(), label.id, { parent: null, }); }; return ( {({ open }) => ( <>
{label.name}
addLabelToGroup(label)}> Add more labels editLabel(label)}> Edit label Delete label
{labelChildren.map((child) => (
{child.name}
} > removeFromGroup(child)}> Remove from group editLabel(child)}> Edit label
))}
)}
); });