11"use client" ;
2- import { useState } from "react" ;
2+
33import dynamic from "next/dynamic" ;
4+ import { mockOutbreakData } from "../../src/lib/data/mockData" ;
45
56// Dynamically import GlobalMap to avoid SSR issues with Leaflet
6- const DemoGlobalMap = dynamic (
7+ const GlobalMap = dynamic (
78 ( ) => import ( "../../src/components/maps/GlobalMap" ) ,
89 {
910 ssr : false ,
@@ -12,33 +13,23 @@ const DemoGlobalMap = dynamic(
1213 Loading map...
1314 </ div >
1415 ) ,
15- } ,
16+ }
1617) ;
1718
18- export default function MapPage ( ) {
19- const [ error ] = useState < string | null > ( null ) ;
20-
21- if ( error ) {
22- return (
23- < div className = "max-w-7xl mx-auto py-8" >
24- < h2 className = "text-2xl font-bold mb-4" > Global Outbreak Map</ h2 >
25- < div className = "bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded" >
26- Error loading map: { error }
27- </ div >
28- </ div >
29- ) ;
30- }
19+ // Flatten mockOutbreakData for deployment
20+ const outbreaksForMap = mockOutbreakData . map ( ( o ) => ( {
21+ id : o . id ,
22+ name : o . pathogen || "Unknown" ,
23+ lat : o . location . coordinates [ 1 ] , // latitude is second in [lng, lat]
24+ lng : o . location . coordinates [ 0 ] , // longitude is first
25+ country : o . location . country ,
26+ } ) ) ;
3127
28+ export default function MapPage ( ) {
3229 return (
33- < div className = "max-w-7xl mx-auto py-8" >
30+ < div className = "max-w-7xl mx-auto py-8 px-4 " >
3431 < h2 className = "text-2xl font-bold mb-4" > Global Outbreak Map</ h2 >
35- < div className = "bg-blue-50 p-4 rounded mb-4" >
36- < p className = "text-sm text-blue-800" >
37- Interactive map showing outbreak locations worldwide. Use the time
38- slider to filter by date.
39- </ p >
40- </ div >
41- < DemoGlobalMap />
32+ < GlobalMap outbreaks = { outbreaksForMap } />
4233 </ div >
4334 ) ;
4435}
0 commit comments