import { useEffect, useState } from "react" interface InputSuggestionsPopupProps { facts: string[] isLoading: boolean onFactSelect: (fact: string) => void onClose: () => void } export default function InputSuggestionsPopup({ facts, isLoading, onFactSelect, onClose }: InputSuggestionsPopupProps) { const [hoveredIndex, setHoveredIndex] = useState(null) // Auto-hide after 10 seconds useEffect(() => { const timer = setTimeout(() => { onClose() }, 10000) return () => clearTimeout(timer) }, [onClose]) return (
{/* Header */}
AI Suggestions
{/* Content */}
{isLoading ? (
Searching for relevant facts...
) : facts.length > 0 ? ( facts.slice(0, 5).map((fact, index) => (
onFactSelect(fact)} onMouseEnter={() => setHoveredIndex(index)} onMouseLeave={() => setHoveredIndex(null)} style={{ padding: "8px 12px", margin: "4px 0", background: hoveredIndex === index ? "#e9ecef" : "#f8f9fa", borderRadius: "4px", cursor: "pointer", border: "1px solid #e9ecef", transition: "background-color 0.2s" }}>
{fact}
)) ) : (
No relevant suggestions found
)}
) }