'use client'; import { useState } from 'react'; import { ThumbsUp, ThumbsDown, MessageSquare, MapPin } from 'lucide-react'; import { PlaceSearchResult } from '@/lib/api'; interface SearchPanelProps { searchResults: PlaceSearchResult[]; onClose: () => void; onToastStatusUpdate: (restaurantId: number, hasToast: boolean) => void; onRestaurantClick: (restaurantId: number) => void; } export default function SearchPanel({ searchResults, onClose, onToastStatusUpdate, onRestaurantClick }: SearchPanelProps) { const [updatingIds, setUpdatingIds] = useState>(new Set()); const handleToastStatus = async (restaurantId: number, hasToast: boolean) => { setUpdatingIds(prev => new Set(prev).add(restaurantId)); try { await onToastStatusUpdate(restaurantId, hasToast); } finally { setUpdatingIds(prev => { const next = new Set(prev); next.delete(restaurantId); return next; }); } }; const getConfidenceColor = (confidence?: string) => { switch (confidence) { case 'high': return 'bg-green-100 text-green-800'; case 'medium': return 'bg-yellow-100 text-yellow-800'; default: return 'bg-gray-100 text-gray-800'; } }; const getConfidenceText = (confidence?: string) => { switch (confidence) { case 'high': return '🍞 Likely has toast!'; case 'medium': return '🤔 Might have toast'; default: return '❓ Check menu'; } }; return (

Found {searchResults.length} Places That Might Serve Toast 🍞

Help us map the toast! Vote if these places serve toast.

{searchResults.length === 0 ? (

No places found nearby. Try moving to a different area.

) : (
{searchResults.map((place) => (

{place.name}

{place.address}

{place.category && ( {place.category} )} {place.distance && ( {place.distance < 1 ? `${Math.round(place.distance * 1000)}m away` : `${place.distance.toFixed(1)}km away` } )} {place.confidence && ( {getConfidenceText(place.confidence)} )}
{/* Toast status section */}

{place.has_toast === null && "🤔 Does this place have toast?"} {place.has_toast === true && "✅ This place serves toast!"} {place.has_toast === false && "❌ No toast here"}

{/* Toast voting buttons */}
{/* Review button */}
))}
)}
); }