/* eslint-disable @next/next/no-img-element */ import React, { useState } from 'react'; import { cn } from "@/lib/utils"; import dynamic from 'next/dynamic'; import PlaceCard from './place-card'; import { Badge } from './ui/badge'; interface Location { lat: number; lng: number; } interface Photo { thumbnail: string; small: string; medium: string; large: string; original: string; caption?: string; } interface Place { name: string; location: Location; place_id: string; vicinity: string; rating?: number; reviews_count?: number; price_level?: string; description?: string; photos?: Photo[]; is_closed?: boolean; next_open_close?: string; type?: string; cuisine?: string; source?: string; phone?: string; website?: string; hours?: string[]; distance?: string; bearing?: string; } // Dynamic import for the map component const InteractiveMap = dynamic(() => import('./interactive-maps'), { ssr: false }); interface NearbySearchMapViewProps { center: { lat: number; lng: number; }; places: Place[]; type: string; } const NearbySearchMapView: React.FC = ({ center, places, type, }) => { const [viewMode, setViewMode] = useState<'map' | 'list'>('map'); const [selectedPlace, setSelectedPlace] = useState(null); return (
Beta {/* View Toggle */}
{/* Map Container */}
{/* Selected Place Overlay - Only show in map view */} {selectedPlace && viewMode === 'map' && (
{}} isSelected={true} variant="overlay" />
)}
{/* List Container */} {viewMode === 'list' && (
{places.map((place, index) => ( setSelectedPlace(place)} isSelected={selectedPlace?.place_id === place.place_id} variant="list" /> ))}
)}
); }; export default NearbySearchMapView;