"use client"; import { useLoadScript, GoogleMap } from "@react-google-maps/api"; import type { NextPage } from "next"; import { useMemo } from "react"; import { Card, CardContent, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"; import { cn } from "@/lib/utils"; import Geohash from "latlon-geohash"; import { HiMapPin } from "react-icons/hi2"; type LocationPreviewProps = { geohash: string; address: string; className?: string; }; export default function LocationPreview({ geohash, address, className, }: LocationPreviewProps) { const libraries = useMemo(() => ["places"], []); const { lat, lon } = Geohash.decode(geohash); const mapCenter = useMemo(() => ({ lat, lng: lon }), []); const mapOptions = useMemo( () => ({ disableDefaultUI: true, clickableIcons: true, scrollwheel: false, }), [], ); const { isLoaded } = useLoadScript({ googleMapsApiKey: process.env.NEXT_PUBLIC_GOOGLE_MAPS_KEY as string, libraries: libraries as any, }); if (!isLoaded) { return ( Location
{address}
); } return ( Location console.log("Map Component Loaded...")} /> {address} ); }