-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
495 lines (455 loc) · 30.9 KB
/
index.html
File metadata and controls
495 lines (455 loc) · 30.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>London Study Spot Explorer</title>
<!-- Tab Logo (Favicon) - Orange Pin -->
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ea580c'%3E%3Cpath d='M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z'/%3E%3Ccircle cx='12' cy='10' r='3' fill='white'/%3E%3C/svg%3E">
<!-- Tailwind CSS for styling -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- React and ReactDOM -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<!-- Babel for JSX parsing -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/7.23.5/babel.min.js"></script>
<!-- Leaflet for Mapping -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<!-- ShpJS for Shapefile processing -->
<script src="https://unpkg.com/shpjs@4.0.4/dist/shp.min.js"></script>
<style>
body, html, #root {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
background: #f8fafc;
}
#map-container {
height: 100vh !important;
width: 100vw !important;
z-index: 0;
}
.custom-marker { display: flex; align-items: center; justify-content: center; transform-origin: center; cursor: pointer; }
.custom-marker:hover { transform: scale(1.3); transition: transform 0.2s cubic-bezier(0.17, 0.67, 0.83, 0.67); }
.animate-up { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.custom-tooltip {
background: #0f172a !important;
color: white !important;
border: none !important;
border-radius: 12px !important;
padding: 8px 14px !important;
font-size: 11px !important;
font-weight: 900 !important;
text-transform: uppercase;
letter-spacing: 0.1em;
z-index: 2000;
}
.custom-tooltip:before { display: none !important; }
.leaflet-interactive { transition: fill-opacity 0.2s, fill 0.2s, stroke 0.2s, stroke-width 0.2s; }
</style>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
const { useState, useEffect, useMemo, useRef } = React;
const normalize = (name) => {
if (!name) return "";
return name.toString()
.toLowerCase()
.trim()
.replace(/^(london borough of|city of|royal borough of) /i, "")
.replace(/ borough$/i, "")
.trim();
};
const MAP_STYLES = {
original: { name: "Original", url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", attr: '© OpenStreetMap' },
satellite: { name: "Satellite", url: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", attr: 'Esri' },
muted: { name: "Muted Light", url: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png", attr: 'CARTO' },
darkmatter: { name: "Dark Matter", url: "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png", attr: 'CartoDB' }
};
// --- Inline Icon Components ---
const Icon = ({ children, size = 24, className = "" }) => (
<svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>{children}</svg>
);
const Search = (p) => <Icon {...p}><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></Icon>;
const MapPin = (p) => <Icon {...p}><path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"/><circle cx="12" cy="10" r="3"/></Icon>;
const X = (p) => <Icon {...p}><path d="M18 6 6 18M6 6l12 12"/></Icon>;
const Navigation = (p) => <Icon {...p}><polygon points="3 11 22 2 13 21 11 13 3 11"/></Icon>;
const CheckCircle2 = (p) => <Icon {...p}><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></Icon>;
const AlertCircle = (p) => <Icon {...p}><circle cx="12" cy="12" r="10"/><line x1="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></Icon>;
const Loader2 = (p) => <Icon {...p} className={`${p.className} animate-spin`}><path d="M21 12a9 9 0 1 1-6.219-8.56"/></Icon>;
const Globe = (p) => <Icon {...p}><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10z"/></Icon>;
const Layers = (p) => <Icon {...p}><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></Icon>;
const ChevronDown = (p) => <Icon {...p}><path d="m6 9 6 6 6-6"/></Icon>;
const Palette = (p) => <Icon {...p}><circle cx="13.5" cy="6.5" r=".5"/><circle cx="17.5" cy="10.5" r=".5"/><circle cx="8.5" cy="7.5" r=".5"/><circle cx="6.5" cy="12.5" r=".5"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.9 0 1.6-.7 1.6-1.6 0-.4-.2-.8-.5-1.1-.3-.3-.4-.7-.4-1.1 0-.9.7-1.6 1.6-1.6H16c3.3 0 6-2.7 6-6 0-4.4-4.5-8-10-8Z"/></Icon>;
const RotateCcw = (p) => <Icon {...p}><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></Icon>;
const App = () => {
const [cafeData, setCafeData] = useState([]);
const [selectedSpot, setSelectedSpot] = useState(null);
const [activeBorough, setActiveBorough] = useState(null);
const [searchTerm, setSearchTerm] = useState("");
const [loading, setLoading] = useState(true);
const [mapStyle, setMapStyle] = useState('original');
const [showLinker, setShowLinker] = useState(false);
const [showDetails, setShowDetails] = useState(false);
const [mapReady, setMapReady] = useState(false);
const [dataLoaded, setDataLoaded] = useState(0);
const mapRef = useRef(null);
const tileLayerRef = useRef(null);
const geoJsonLayerRef = useRef(null);
const markersRef = useRef([]);
// Derived Data
const boroughStats = useMemo(() => {
return cafeData.reduce((acc, curr) => {
const normName = normalize(curr.borough);
if (normName) acc[normName] = (acc[normName] || 0) + 1;
return acc;
}, {});
}, [cafeData]);
const filteredData = useMemo(() => {
let data = cafeData;
if (activeBorough) data = data.filter(s => normalize(s.borough) === normalize(activeBorough));
if (searchTerm.trim() && !activeBorough) {
const lower = searchTerm.toLowerCase();
data = data.filter(s => s.name?.toLowerCase().includes(lower) || s.borough?.toLowerCase().includes(lower));
}
return data;
}, [searchTerm, cafeData, activeBorough]);
const boroughsInFile = useMemo(() => {
if (!geoJsonLayerRef.current) return [];
const names = new Set();
geoJsonLayerRef.current.eachLayer(l => {
const props = l.feature.properties;
const n = props.LAD24NM || props.LAD23NM || props.name || props.NAME || props.BOROUGH;
if (n) names.add(n);
});
return Array.from(names).sort();
}, [dataLoaded]);
const searchSuggestions = useMemo(() => {
if (searchTerm.length < 2) return [];
const lower = searchTerm.toLowerCase();
const bMatches = boroughsInFile
.filter(b => b.toLowerCase().includes(lower))
.map(b => ({ type: 'borough', name: b, count: boroughStats[normalize(b)] || 0 }));
const cMatches = cafeData
.filter(c => c.name.toLowerCase().includes(lower))
.map(c => ({ type: 'cafe', name: c.name, data: c }));
return [...bMatches, ...cMatches].slice(0, 8);
}, [searchTerm, boroughsInFile, cafeData, boroughStats]);
const parseCSV = (text) => {
const rows = [];
let currentRow = [];
let currentCell = '';
let inQuotes = false;
for (let i = 0; i < text.length; i++) {
const char = text[i];
const nextChar = text[i + 1];
if (char === '"') {
if (inQuotes && nextChar === '"') { currentCell += '"'; i++; }
else inQuotes = !inQuotes;
} else if (char === ',' && !inQuotes) {
currentRow.push(currentCell.trim()); currentCell = '';
} else if ((char === '\r' || char === '\n') && !inQuotes) {
if (currentCell || currentRow.length > 0) {
currentRow.push(currentCell.trim()); rows.push(currentRow);
currentCell = ''; currentRow = [];
}
if (char === '\r' && nextChar === '\n') i++;
} else currentCell += char;
}
if (currentCell || currentRow.length > 0) { currentRow.push(currentCell.trim()); rows.push(currentRow); }
return rows.slice(1).map(cells => {
const name = cells[0] || "";
const nameLower = name.toLowerCase();
// Expanded chain recognition logic
const chainKeywords = [
'nero', 'pret', 'starbucks', 'costa',
'blank street', 'hoxton', 'roasting plant',
'gail\'s', 'black sheep', 'joe & the juice'
];
const isChain = chainKeywords.some(keyword => nameLower.includes(keyword));
return {
name: name,
address: cells[1] || "",
borough: cells[2] || "",
lat: parseFloat(cells[3]),
lng: parseFloat(cells[4]),
pros: (cells[5] || "").split(/\r?\n/).map(p => p.replace(/^- /, '').trim()).filter(p => p),
cons: (cells[6] || "").split(/\r?\n/).map(c => c.replace(/^- /, '').trim()).filter(c => c),
type: isChain ? "Chain" : "Local Spot"
};
}).filter(item => !isNaN(item.lat) && !isNaN(item.lng));
};
const renderGeoJson = (data) => {
if (!window.L || !mapRef.current) return;
if (geoJsonLayerRef.current) mapRef.current.removeLayer(geoJsonLayerRef.current);
geoJsonLayerRef.current = window.L.geoJSON(data, {
onEachFeature: (f, layer) => {
const props = f.properties;
const name = props.LAD24NM || props.LAD23NM || props.name || props.NAME || "";
layer.on('click', (e) => {
window.L.DomEvent.stopPropagation(e);
handleBoroughSelect(name);
});
}
}).addTo(mapRef.current);
setDataLoaded(prev => prev + 1);
};
// Dynamic Styling Effect for Boroughs - Orange Accent
useEffect(() => {
if (geoJsonLayerRef.current && mapRef.current) {
geoJsonLayerRef.current.setStyle((f) => {
const props = f.properties;
const name = props.LAD24NM || props.LAD23NM || props.name || props.NAME || "";
const hasSpots = !!boroughStats[normalize(name)];
return {
fillColor: hasSpots ? '#f97316' : '#64748b',
fillOpacity: hasSpots ? 0.3 : 0.7,
color: hasSpots ? '#f97316' : '#334155',
weight: (activeBorough && normalize(name) === normalize(activeBorough)) ? 4 : (hasSpots ? 2 : 1)
};
});
geoJsonLayerRef.current.eachLayer(layer => {
const props = layer.feature.properties;
const name = props.LAD24NM || props.LAD23NM || props.name || props.NAME || "";
const count = boroughStats[normalize(name)] || 0;
layer.unbindTooltip();
if (count > 0) {
layer.bindTooltip(`<strong>${name}</strong><br/>${count} active locations`, {
sticky: true,
className: 'custom-tooltip'
});
}
});
}
}, [boroughStats, activeBorough, dataLoaded]);
// Asset Pre-loading logic
useEffect(() => {
const loadAssets = async () => {
setLoading(true);
try {
// Change source of data to data.csv
const csvRes = await fetch('public/data.csv');
if (csvRes.ok) {
const text = await csvRes.text();
setCafeData(parseCSV(text));
}
const shpRes = await fetch('public/shapefile_London.shp');
const dbfRes = await fetch('public/shapefile_London.dbf');
if (shpRes.ok && dbfRes.ok && window.shp) {
const shpBuf = await shpRes.arrayBuffer();
const dbfBuf = await dbfRes.arrayBuffer();
const geojson = window.shp.combine([window.shp.parseShp(shpBuf), window.shp.parseDbf(dbfBuf)]);
renderGeoJson(geojson);
}
} catch (err) { console.error("Asset load failed.", err); }
finally { setLoading(false); }
};
if (mapReady) loadAssets();
}, [mapReady]);
// Map Engine Init
useEffect(() => {
const map = L.map('map-container', {
zoomControl: false,
attributionControl: false,
tap: false,
minZoom: 6 // Set minimum zoom to stay focused on UK area rather than whole world
}).setView([51.5074, -0.1278], 11);
tileLayerRef.current = L.tileLayer(MAP_STYLES.original.url, { maxZoom: 19, attribution: MAP_STYLES.original.attr }).addTo(map);
map.on('click', () => {
setShowDetails(false);
setShowLinker(false);
});
mapRef.current = map;
setMapReady(true);
setTimeout(() => map.invalidateSize(), 500);
}, []);
useEffect(() => { if (tileLayerRef.current) tileLayerRef.current.setUrl(MAP_STYLES[mapStyle].url); }, [mapStyle]);
// Markers Update - Orange dots with Pin for selected
useEffect(() => {
if (!mapRef.current) return;
markersRef.current.forEach(m => m.remove());
markersRef.current = [];
filteredData.forEach(spot => {
if (isNaN(spot.lat) || isNaN(spot.lng)) return;
const isSelected = selectedSpot && selectedSpot.lat === spot.lat && selectedSpot.lng === spot.lng;
const html = isSelected
? `<div class="relative drop-shadow-2xl">
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="#ea580c" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="animate-bounce"><path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"/><circle cx="12" cy="10" r="3" fill="white"/></svg>
</div>`
: `<div class="w-4 h-4 bg-orange-600 rounded-full border-2 border-white shadow-xl"></div>`;
const customIcon = L.divIcon({
className: 'custom-marker',
html: html,
iconSize: isSelected ? [36, 36] : [16, 16],
iconAnchor: isSelected ? [18, 36] : [8, 8]
});
const marker = L.marker([spot.lat, spot.lng], {
icon: customIcon,
zIndexOffset: isSelected ? 2000 : 1000
})
.addTo(mapRef.current)
.on('click', (e) => {
window.L.DomEvent.stopPropagation(e);
handleSpotSelect(spot, false);
});
markersRef.current.push(marker);
});
}, [filteredData, mapReady, selectedSpot]);
const handleSpotSelect = (spot, shouldZoom = false) => {
setSelectedSpot(spot); setShowDetails(true); setSearchTerm("");
if (shouldZoom && mapRef.current) mapRef.current.setView([spot.lat, spot.lng], 16);
};
const handleBoroughSelect = (bName) => {
setSearchTerm(""); setActiveBorough(bName);
if (!geoJsonLayerRef.current || !mapRef.current) return;
let targetLayer = null;
geoJsonLayerRef.current.eachLayer(layer => {
const props = layer.feature.properties;
const name = props.LAD24NM || props.LAD23NM || props.name || props.NAME || "";
if (normalize(name) === normalize(bName)) targetLayer = layer;
});
if (targetLayer) mapRef.current.fitBounds(targetLayer.getBounds(), { padding: [50, 50] });
};
const clearActiveBorough = () => {
setActiveBorough(null);
if (mapRef.current) mapRef.current.setView([51.5074, -0.1278], 11);
};
// Dynamic date helper to detect when the file was last updated on the server
const lastUpdatedString = useMemo(() => {
const date = new Date(document.lastModified);
return date.toLocaleString('en-GB', {
day: '2-digit',
month: 'short',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
timeZoneName: 'short'
}).replace(',', ' —');
}, [dataLoaded]);
return (
<div className="relative w-full h-full font-sans select-none overflow-hidden bg-slate-100">
<div id="map-container" className="absolute inset-0 z-0" />
{loading && (
<div className="fixed top-8 right-8 z-50 bg-white/90 backdrop-blur px-6 py-4 rounded-3xl shadow-2xl flex items-center gap-4 border border-slate-200 animate-up">
<Loader2 className="text-orange-600" size={20} />
<span className="text-sm font-black text-slate-800 uppercase tracking-widest">Pre-loading data...</span>
</div>
)}
<div className="fixed bottom-0 left-0 right-0 p-4 md:p-6 z-40 pointer-events-none flex flex-col items-center">
{searchSuggestions.length > 0 && (
<div className="w-full max-w-xl bg-white/95 backdrop-blur-xl rounded-[2rem] shadow-2xl border border-slate-200 mb-2 overflow-hidden pointer-events-auto">
{searchSuggestions.map((s, idx) => (
<button key={idx} onClick={() => s.type === 'borough' ? handleBoroughSelect(s.name) : handleSpotSelect(s.data, true)}
className="w-full flex items-center justify-between px-6 py-4 hover:bg-slate-50 text-left border-b border-slate-100 last:border-0 group">
<div className="flex items-center gap-3">
{s.type === 'borough' ? <Globe className="text-orange-500" size={18} /> : <MapPin className="text-orange-600" size={18} />}
<div>
<div className="text-sm font-black text-slate-800">{s.name}</div>
<div className="text-[9px] text-slate-400 uppercase tracking-widest font-black">{s.type}</div>
</div>
</div>
{s.type === 'borough' && <div className={`text-[10px] font-black px-3 py-1 rounded-full ${s.count > 0 ? 'bg-orange-100 text-orange-700' : 'bg-slate-100 text-slate-400'}`}>{s.count} SPOTS</div>}
</button>
))}
</div>
)}
<div className="w-full max-w-4xl flex flex-col md:flex-row gap-4 mb-4 pointer-events-none items-end">
{showLinker && (
<div className="w-full md:w-80 bg-white/95 backdrop-blur-xl rounded-[2rem] shadow-2xl border border-slate-200 p-6 pointer-events-auto animate-up">
<div className="flex justify-between items-center mb-6">
<h3 className="font-black text-slate-900 flex items-center gap-2 uppercase text-[10px] tracking-[0.2em]"><Layers size={18} className="text-orange-600" /> Layer Visuals</h3>
<button onClick={() => setShowLinker(false)} className="text-slate-400 hover:text-slate-600"><X size={20} /></button>
</div>
<div className="grid grid-cols-2 gap-2 mb-6">
{Object.entries(MAP_STYLES).map(([key, style]) => (
<button key={key} onClick={() => setMapStyle(key)} className={`px-3 py-2.5 rounded-xl text-[10px] font-black border transition-all uppercase ${mapStyle === key ? 'bg-orange-600 text-white border-orange-600 shadow-md shadow-orange-200' : 'bg-slate-50 text-slate-600 border-slate-200'}`}>
{style.name}
</button>
))}
</div>
<div className="flex flex-col gap-1 border-t border-slate-100 pt-4">
<span className="text-[8px] font-black text-slate-400 uppercase tracking-widest italic">Updated: {lastUpdatedString}</span>
<span className="text-[8px] font-black text-orange-600 uppercase tracking-[0.2em]">By Palpatine Fendi</span>
</div>
</div>
)}
{showDetails && selectedSpot && (
<div className="flex-1 w-full bg-white/95 backdrop-blur-xl rounded-[2.5rem] shadow-2xl border border-slate-200 overflow-hidden pointer-events-auto animate-up">
<div className="p-8 border-b border-slate-100 flex justify-between items-start">
<div>
<div className="flex items-center gap-3 mb-2">
<span className="text-[10px] font-black bg-orange-600 text-white px-3 py-1 rounded-full uppercase tracking-widest">{selectedSpot.type}</span>
<span className="text-[10px] font-black text-slate-400 uppercase tracking-widest flex items-center gap-1.5"><Globe size={12}/> {selectedSpot.borough}</span>
</div>
<h2 className="text-3xl md:text-4xl font-black text-slate-900 tracking-tighter leading-none flex items-center gap-2">
<MapPin className="text-orange-600 shrink-0" size={32} />
{selectedSpot.name}
</h2>
</div>
<button onClick={() => setShowDetails(false)} className="p-2.5 bg-slate-100 hover:bg-slate-200 rounded-full text-slate-500 transition-colors"><X size={24} /></button>
</div>
<div className="px-8 pt-6 pb-0">
<a href={`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(selectedSpot.address)}`}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-2 text-sm text-slate-500 hover:text-orange-600 transition-colors group inline-flex"
>
<Navigation size={18} className="group-hover:translate-x-1 group-hover:-translate-y-1 transition-transform" />
<span className="underline decoration-slate-300 underline-offset-[10px]">{selectedSpot.address}</span>
</a>
</div>
<div className="p-8 grid grid-cols-1 md:grid-cols-2 gap-8">
<div className="bg-orange-50/40 p-6 rounded-[2rem] border border-orange-100/50">
<h4 className="text-[10px] font-black text-orange-700 uppercase tracking-[0.25em] mb-4 flex items-center gap-2"><CheckCircle2 size={16} className="text-orange-600"/> Essential Pros</h4>
<ul className="space-y-3">
{selectedSpot.pros.length > 0 ? selectedSpot.pros.map((p, i) => (
<li key={i} className="text-sm font-bold flex gap-3 leading-snug italic text-slate-700">
<div className="w-1.5 h-1.5 rounded-full bg-orange-500 mt-2 shrink-0" /> {p}
</li>
)) : <li className="text-sm text-slate-400 italic">No specific pros listed</li>}
</ul>
</div>
<div className="bg-slate-50/50 p-6 rounded-[2rem] border border-slate-200/50">
<h4 className="text-[10px] font-black text-red-600 uppercase tracking-[0.25em] mb-4 flex items-center gap-2"><AlertCircle size={16}/> Noteable Cons</h4>
<ul className="space-y-3">
{selectedSpot.cons.length > 0 ? selectedSpot.cons.map((c, i) => (
<li key={i} className="text-sm font-bold flex gap-3 leading-snug text-slate-500">
<div className="w-1.5 h-1.5 rounded-full bg-red-500 mt-2 shrink-0" /> {c}
</li>
)) : <li className="text-sm text-slate-400 italic">No specific cons listed</li>}
</ul>
</div>
</div>
</div>
)}
</div>
<div className="w-full max-w-xl bg-white/90 backdrop-blur-2xl border border-slate-200 rounded-[2.5rem] shadow-2xl flex items-center p-2.5 pointer-events-auto transition-all">
<button onClick={() => { setShowLinker(!showLinker); setShowDetails(false); }} className={`p-4 rounded-full transition-all ${showLinker ? 'bg-orange-600 text-white shadow-xl shadow-orange-200' : 'text-slate-400 hover:bg-slate-50'}`}>
{showLinker ? <ChevronDown size={22} /> : <Palette size={22} />}
</button>
<div className="flex-1 relative flex items-center px-3">
<Search className="absolute left-5 text-slate-400" size={20} />
<input type="text" placeholder={activeBorough ? `Focused on ${activeBorough}` : "Find borough or cafe..."} className={`w-full bg-transparent py-4 pl-12 pr-4 text-slate-900 placeholder-slate-400 outline-none text-base font-black tracking-tight ${activeBorough ? 'text-orange-600' : ''}`} value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} />
</div>
{activeBorough ? (
<button onClick={clearActiveBorough} className="p-4 rounded-full bg-red-50 text-red-600 hover:bg-red-100 mr-1"><RotateCcw size={20} /></button>
) : selectedSpot && (
<button onClick={() => { setShowDetails(!showDetails); setShowLinker(false); }} className={`p-4 rounded-full transition-all ${showDetails ? 'bg-orange-600 text-white shadow-xl shadow-orange-200' : 'text-orange-600 bg-orange-50 hover:bg-orange-100'}`}>
{showDetails ? <ChevronDown size={22} /> : <MapPin size={22} />}
</button>
)}
</div>
</div>
</div>
);
};
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);
</script>
</body>
</html> eof