'use client'; import { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Checkbox } from '@/components/ui/checkbox'; import { X, Plus } from 'lucide-react'; interface AcceptanceCriteriaEditorProps { criteria: string[]; onChange: (criteria: string[]) => void; disabled?: boolean; } export function AcceptanceCriteriaEditor({ criteria, onChange, disabled, }: AcceptanceCriteriaEditorProps) { const [newCriterion, setNewCriterion] = useState(''); const addCriterion = () => { if (newCriterion.trim()) { onChange([...criteria, newCriterion.trim()]); setNewCriterion(''); } }; const removeCriterion = (index: number) => { onChange(criteria.filter((_, i) => i !== index)); }; const handleKeyPress = (e: React.KeyboardEvent) => { if (e.key === 'Enter') { e.preventDefault(); addCriterion(); } }; return (
{/* Existing criteria list */} {criteria.length > 0 && (
{criteria.map((criterion, index) => (
{criterion} {!disabled && ( )}
))}
)} {/* Add new criterion */} {!disabled && (
setNewCriterion(e.target.value)} onKeyPress={handleKeyPress} />
)} {criteria.length === 0 && disabled && (

No acceptance criteria defined

)}
); }