import { useState } from "react"; import type { IntentBand, Opportunity } from "../../domain/types"; import { useI18n } from "../../i18n/I18nContext"; import { Badge, Button } from "../ui"; import { PrimaryProductPicker } from "./PrimaryProductPicker"; import { ProductMatchDetails } from "./ProductMatchDetails"; import { ReplyComposer } from "./ReplyComposer"; const BANDS: IntentBand[] = ["high", "mid", "low"]; type Props = { opportunity: Opportunity; onClose: () => void; onAccept?: (opportunity: Opportunity) => void; onComplete?: (opportunity: Opportunity) => void; /** 改主推產品(多產品匹配時);沒給就不顯示。 */ onSetPrimary?: (opportunity: Opportunity, productId: string, reason: string) => void; /** 覆寫意向分級;沒給就不顯示。 */ onOverrideBand?: (opportunity: Opportunity, band: IntentBand) => void; busy?: boolean; }; export function OpportunityDetailDrawer({ opportunity, onClose, onAccept, onComplete, onSetPrimary, onOverrideBand, busy = false, }: Props) { const { t } = useI18n(); const [overrideOpen, setOverrideOpen] = useState(false); const pending = (opportunity.review_state || "pending") === "pending"; const accepted = opportunity.status === "accepted" || Boolean(opportunity.contact_id); const matches = opportunity.product_matches ?? []; return ( ); }