mirror of
https://github.com/soconnor0919/lewisburg-coffee.git
synced 2026-02-04 23:56:32 -05:00
refactor: Add type definitions for map loader and remove unused imports and HydrateClient.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { HydrateClient } from "~/trpc/server";
|
|
||||||
import MapLoader from "~/components/MapLoader";
|
import MapLoader from "~/components/MapLoader";
|
||||||
import Navbar from "~/components/Navbar";
|
import Navbar from "~/components/Navbar";
|
||||||
import Drawer from "~/components/Drawer";
|
import Drawer from "~/components/Drawer";
|
||||||
@@ -22,24 +21,22 @@ export default function Home() {
|
|||||||
const [selectedShop, setSelectedShop] = useState<typeof COFFEE_SHOPS[0] | null>(null);
|
const [selectedShop, setSelectedShop] = useState<typeof COFFEE_SHOPS[0] | null>(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HydrateClient>
|
<main className="relative h-screen w-screen overflow-hidden bg-black text-white font-serif">
|
||||||
<main className="relative h-screen w-screen overflow-hidden bg-black text-white font-serif">
|
<Navbar />
|
||||||
<Navbar />
|
|
||||||
|
|
||||||
{/* Map Background */}
|
{/* Map Background */}
|
||||||
<div className="absolute inset-0 z-0">
|
<div className="absolute inset-0 z-0">
|
||||||
<MapLoader
|
<MapLoader
|
||||||
shops={COFFEE_SHOPS}
|
shops={COFFEE_SHOPS}
|
||||||
onShopSelect={(shop) => setSelectedShop(shop)}
|
onShopSelect={(shop: typeof COFFEE_SHOPS[0]) => setSelectedShop(shop)}
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Right Drawer */}
|
|
||||||
<Drawer
|
|
||||||
shop={selectedShop}
|
|
||||||
onClose={() => setSelectedShop(null)}
|
|
||||||
/>
|
/>
|
||||||
</main>
|
</div>
|
||||||
</HydrateClient>
|
|
||||||
|
{/* Right Drawer */}
|
||||||
|
<Drawer
|
||||||
|
shop={selectedShop}
|
||||||
|
onClose={() => setSelectedShop(null)}
|
||||||
|
/>
|
||||||
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet';
|
import { MapContainer, TileLayer, Marker } from 'react-leaflet';
|
||||||
import 'leaflet/dist/leaflet.css';
|
import 'leaflet/dist/leaflet.css';
|
||||||
import L from 'leaflet';
|
import L from 'leaflet';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|||||||
@@ -7,6 +7,19 @@ const Map = dynamic(() => import("./Map"), {
|
|||||||
loading: () => <div className="w-full h-full bg-gray-100 animate-pulse flex items-center justify-center text-gray-400">Loading Map...</div>
|
loading: () => <div className="w-full h-full bg-gray-100 animate-pulse flex items-center justify-center text-gray-400">Loading Map...</div>
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function MapLoader({ shops, onShopSelect }: { shops: any[], onShopSelect: (shop: any) => void }) {
|
interface CoffeeShop {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
lat: number;
|
||||||
|
lng: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MapLoaderProps {
|
||||||
|
shops: CoffeeShop[];
|
||||||
|
onShopSelect: (shop: CoffeeShop) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function MapLoader({ shops, onShopSelect }: MapLoaderProps) {
|
||||||
return <Map shops={shops} onShopSelect={onShopSelect} />;
|
return <Map shops={shops} onShopSelect={onShopSelect} />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import Link from "next/link";
|
|
||||||
import { Coffee } from "lucide-react";
|
import { Coffee } from "lucide-react";
|
||||||
|
|
||||||
export default function Navbar() {
|
export default function Navbar() {
|
||||||
|
|||||||
Reference in New Issue
Block a user