diff --git a/app/components/MapView.tsx b/app/components/MapView.tsx index ba20077..c23f3af 100644 --- a/app/components/MapView.tsx +++ b/app/components/MapView.tsx @@ -1,6 +1,6 @@ "use client" -import { useEffect, useRef } from "react" +import { useEffect } from "react" import { MapContainer, TileLayer, Marker, Popup, useMap } from "react-leaflet" import L from "leaflet" import "leaflet/dist/leaflet.css" @@ -14,7 +14,7 @@ function createAmberIcon(isSelected: boolean) { - + ` return L.divIcon({ @@ -53,24 +53,30 @@ interface Props { restaurants: Restaurant[] selectedId: string | null onSelect: (id: string | null) => void + theme?: "light" | "dark" } -export default function MapView({ restaurants, selectedId, onSelect }: Props) { +export default function MapView({ restaurants, selectedId, onSelect, theme = "dark" }: Props) { const center: [number, number] = restaurants.length > 0 ? [restaurants[0].lat, restaurants[0].lng] : [51.5, 10] + const tileUrl = theme === "dark" + ? "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png" + : "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png" + return ( @@ -88,8 +94,8 @@ export default function MapView({ restaurants, selectedId, onSelect }: Props) { >
-

{r.name}

-

+

{r.name}

+

{r.city}, {r.country}

@@ -106,7 +112,7 @@ export default function MapView({ restaurants, selectedId, onSelect }: Props) { {avgRating(r).toFixed(1)} - + {r.visits.length} {r.visits.length === 1 ? "visit" : "visits"}
diff --git a/app/components/Nav.tsx b/app/components/Nav.tsx index 42d7743..4fd1584 100644 --- a/app/components/Nav.tsx +++ b/app/components/Nav.tsx @@ -3,20 +3,46 @@ import Link from "next/link" import { usePathname } from "next/navigation" import { motion } from "framer-motion" +import { useTheme } from "@/app/components/ThemeProvider" const navItems = [ { href: "/", label: "Home", icon: "◈" }, { href: "/map", label: "Map", icon: "◉" }, ] +function SunIcon() { + return ( + + + + + + + + + + + + ) +} + +function MoonIcon() { + return ( + + + + ) +} + export default function Nav() { const pathname = usePathname() + const { theme, toggle } = useTheme() return ( <> {/* Desktop top nav */} -