// Map screen — full world map with incident index // // Clicking a pin OR an index row opens that incident's full record // (the same onSelectEntry callback the entry cards use). The category // chip bar filters pins and the index together. function MapScreen({ onSelectEntry, onNav }) { const { ENTRIES, ENCOUNTER_TYPES } = window.ARCHIVE; const [typeFilter, setTypeFilter] = React.useState(new Set()); // An entry's pin is shown if ANY of its categories matches the active // filter — multi-category entries appear under each of their categories. const visible = typeFilter.size === 0 ? ENTRIES : ENTRIES.filter(e => { const list = Array.isArray(e.types) && e.types.length > 0 ? e.types : (e.type ? [e.type] : []); return list.some(t => typeFilter.has(t)); }); // Only entries with coordinates can appear as pins; the index mirrors that. const onMap = visible.filter(e => Number.isFinite(e.lat) && Number.isFinite(e.lng)); const toggleType = (id) => { setTypeFilter(prev => { const n = new Set(prev); n.has(id) ? n.delete(id) : n.add(id); return n; }); }; const sig = (n) => ( {[1,2,3,4,5].map(i => )} ); return (
{/* Map — pin click navigates straight to the entry */}
{/* Filter strip — drives both the pins and the index. zIndex must beat Leaflet's panes (400) or the chips paint under the tiles. */}
setTypeFilter(new Set())}>ALL · {ENTRIES.length} {ENCOUNTER_TYPES.map(t => { const acc = window.catGroup(t.id); const on = typeFilter.has(t.id); return ( toggleType(t.id)} style={{ background: 'rgba(7,8,12,0.9)', cursor: 'pointer', borderColor: on ? acc.dim : 'var(--line-2)', color: on ? acc.solid : 'var(--ink-1)' }}> {t.icon} {t.label} ); })}
{/* Incident index — every row is a click target, redundant with its pin */}
INCIDENT INDEX
{onMap.length} on the map
Click a pin or a row to open the full record
{onMap.map(e => { const acc = window.entryAccent(e); return (
onSelectEntry(e)} style={{ padding: '16px 24px', borderBottom: '1px solid var(--line)', display: 'grid', gridTemplateColumns: '14px 1fr', gap: 12, alignItems: 'start' }}>
{e.id} {sig(e.credibility)}
{e.title}
⌖ {e.place} · ◷ {window.formatDate(e.date)}
▲ {e.believe ?? 0} ▼ {e.skeptical ?? 0} ◊ {e.comments ?? 0}
OPEN →
); })} {onMap.length === 0 && (
No incidents match this filter.
Clear the category chips to see every pinned report.
)}
); } window.MapScreen = MapScreen;