import "./DuplicateWarningModal.css"; import { useEffect, useRef } from "react"; import type { DuplicateMatch } from "../api"; interface DuplicateWarningModalProps { matches: DuplicateMatch[]; onOpen: (id: string) => void; onProceed: () => void; onCancel: () => void; } function toStatusClass(column: string): string { return `card-status-badge--${column}`; } export function DuplicateWarningModal({ matches, onOpen, onProceed, onCancel }: DuplicateWarningModalProps) { const cancelButtonRef = useRef(null); useEffect(() => { cancelButtonRef.current?.focus(); }, []); useEffect(() => { const onKeyDown = (event: KeyboardEvent) => { if (event.key === "Escape") { event.preventDefault(); onCancel(); } }; document.addEventListener("keydown", onKeyDown); return () => document.removeEventListener("keydown", onKeyDown); }, [onCancel]); return (

Possible duplicates

We found similar active tasks. Open an existing task or create this one anyway.

{matches.map((match) => (
{match.id} {match.column} {Math.round(match.score * 100)}%
{match.title || "Untitled task"}
))}
); }