/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ /** * "Create BCF issue" affordance shown under the focused change (issue #1199). * Extracted from ComparePanel; the actual topic creation lives in the panel so * it can coordinate the BCF store + viewpoint capture. */ import { useMemo } from 'react'; import { MessageSquarePlus, CheckCircle2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import type { BCFTopic } from '@ifc-lite/bcf'; import type { ChangeDetail } from '@/lib/compare/describeChange'; import { BCFCreateTopicForm } from '../bcf/BCFCreateTopicForm'; import { bcfTextFromChange, type CompareRow } from './changeRow'; interface BcfFromChangeProps { row: CompareRow; detail: ChangeDetail | null; author: string; open: boolean; createdTitle: string | null; onStart: () => void; onCancel: () => void; onSubmit: (topic: Partial, options?: { includeSnapshot: boolean }) => void; onOpenBcfPanel: () => void; /** Live viewpoint snapshot preview (data URL) for the create form. */ snapshot?: string | null; /** (Re)capture the snapshot from the current view. */ onCaptureSnapshot?: () => void; /** True while a snapshot capture is in flight. */ capturingSnapshot?: boolean; } export function BcfFromChange({ row, detail, author, open, createdTitle, onStart, onCancel, onSubmit, onOpenBcfPanel, snapshot, onCaptureSnapshot, capturingSnapshot, }: BcfFromChangeProps) { const prefill = useMemo(() => bcfTextFromChange(row, detail), [row, detail]); if (createdTitle) { return (
BCF issue created: “{createdTitle}”
); } if (open) { // Composing a BCF issue: the diff chrome is collapsed (ComparePanel), so the // form owns the remaining height and scrolls internally — its actions stay // reachable instead of being clipped off the bottom of the panel. return (
); } return (
); }