'use client'; import * as React from 'react'; import { KBPair } from '@/lib/kb-data'; interface QACardProps { qa: KBPair; onEdit: (qa: KBPair) => void; onDelete: (id: string) => void; isDeleting?: boolean; } function Spinner({ className = '' }: { className?: string }) { return ( ); } // Vibrant per-category gradient used for the category chip. const CATEGORY_GRADIENT: Record = { General: 'from-violet-500 to-indigo-500', HR: 'from-pink-500 to-fuchsia-500', Support: 'from-blue-500 to-cyan-500', Pricing: 'from-emerald-500 to-teal-500', Technical: 'from-orange-500 to-rose-500', }; // Per-category aurora glow colors bleeding up from the bottom of the card. const CATEGORY_AURORA: Record = { General: { ['--aurora-1' as string]: 'rgba(168,85,247,0.5)', ['--aurora-2' as string]: 'rgba(99,102,241,0.45)' }, HR: { ['--aurora-1' as string]: 'rgba(236,72,153,0.5)', ['--aurora-2' as string]: 'rgba(168,85,247,0.4)' }, Support: { ['--aurora-1' as string]: 'rgba(59,130,246,0.5)', ['--aurora-2' as string]: 'rgba(34,211,238,0.45)' }, Pricing: { ['--aurora-1' as string]: 'rgba(16,185,129,0.5)', ['--aurora-2' as string]: 'rgba(132,204,22,0.4)' }, Technical: { ['--aurora-1' as string]: 'rgba(249,115,22,0.5)', ['--aurora-2' as string]: 'rgba(244,63,94,0.4)' }, }; export default function QACard({ qa, onEdit, onDelete, isDeleting = false }: QACardProps) { const aurora = CATEGORY_AURORA[qa.category] ?? CATEGORY_AURORA.General; const gradient = CATEGORY_GRADIENT[qa.category] ?? CATEGORY_GRADIENT.General; return ( {/* badges line */} {qa.category || 'General'} {/* edit + delete buttons (or a Removing… indicator) */} {isDeleting ? ( Removing… ) : ( onEdit(qa)} title="Edit Q&A Pair" className="h-8 w-8 rounded-lg flex items-center justify-center text-white/40 hover:text-white hover:bg-white/10 border border-transparent transition-all duration-200 cursor-pointer" > onDelete(qa.id)} title="Delete Q&A Pair" className="h-8 w-8 rounded-lg flex items-center justify-center text-white/30 hover:text-red-400 hover:bg-red-500/20 border border-transparent transition-all duration-200 cursor-pointer" > )} {/* Question text */} {qa.question} {/* Answer text */} {qa.answer} ); }
{qa.answer}