import React, { useState } from "react"; import { observer } from "mobx-react-lite"; // hooks import { useIssueDetail } from "hooks/store"; // components import { ModuleDropdown } from "components/dropdowns"; // ui import { Spinner } from "@plane/ui"; // helpers import { cn } from "helpers/common.helper"; // types import type { TIssueOperations } from "./root"; type TIssueModuleSelect = { className?: string; workspaceSlug: string; projectId: string; issueId: string; issueOperations: TIssueOperations; disabled?: boolean; }; export const IssueModuleSelect: React.FC = observer((props) => { const { className = "", workspaceSlug, projectId, issueId, issueOperations, disabled = false } = props; // states const [isUpdating, setIsUpdating] = useState(false); // store hooks const { issue: { getIssueById }, } = useIssueDetail(); // derived values const issue = getIssueById(issueId); const disableSelect = disabled || isUpdating; const handleIssueModuleChange = async (moduleId: string | null) => { if (!issue || issue.module_id === moduleId) return; setIsUpdating(true); if (moduleId) await issueOperations.addIssueToModule(workspaceSlug, projectId, moduleId, [issueId]); else await issueOperations.removeIssueFromModule(workspaceSlug, projectId, issue.module_id ?? "", issueId); setIsUpdating(false); }; return (
{/* handleIssueModuleChange(value)} options={options} customButton={
} noChevron disabled={disableSelect} /> */} {isUpdating && }
); });