"use client"; import { Search } from "lucide-react"; import { useState } from "react"; import { Dialog } from "@/components/primitives/dialog"; import { Input } from "@/components/primitives/input"; import { cn } from "@/lib/utils"; export interface Message { id: string; content: string; username: string; channel: string; time: string; } export interface SearchOverlayProps { open: boolean; onClose: () => void; results: Message[]; onSelect: (msg: Message) => void; } export function SearchOverlay({ open, onClose, results, onSelect, }: SearchOverlayProps) { const [query, setQuery] = useState(""); const filtered = query ? results.filter( (m) => m.content.toLowerCase().includes(query.toLowerCase()) || m.username.toLowerCase().includes(query.toLowerCase()), ) : results; return (
setQuery(e.target.value)} className="pl-9 font-mono" />
{filtered.length === 0 ? (

No results.

) : (
{filtered.slice(0, 32).map((m) => ( ))}
)}
); }