/** * Stadium Finder UI Panel Component */ import { escapeHTML, setHTML } from '../utils/dom.js'; export class StadiumFinderPanel { constructor(containerEl, venueMapService) { this.containerEl = containerEl; this.venueMapService = venueMapService; } async render() { if (!this.containerEl) return; const venue = await this.venueMapService.findNearestVenue(); const route = this.venueMapService.getAccessibleRoute(venue.id, 'gate-7'); const safeDensity = (value) => { const density = String(value || 'low').toLowerCase(); return ['low', 'medium', 'high'].includes(density) ? density : 'low'; }; const gatesHTML = venue.gates.map(g => `
${escapeHTML(g.name)} ${g.isAccessible ? ' ' : ''} ${g.hasCover ? ' ☂️' : ''}
${safeDensity(g.density).toUpperCase()} (${Number(g.waitMinutes) || 0}m wait)
`).join(''); setHTML(this.containerEl, `

🏟️ ${escapeHTML(venue.name)}

${escapeHTML(venue.city)} · ${Number(venue.distanceKm) || 0} km away

${escapeHTML(venue.weather.icon)} ${Number(venue.weather.tempC) || 0}°C · ${escapeHTML(venue.weather.condition)}

📊 Live Gate Density & Crowd Routing

${gatesHTML}

♿ Wheelchair Accessible Entry Route

Destination: ${escapeHTML(route.destination)} (${escapeHTML(route.totalDistance)}, ~${escapeHTML(route.estimatedTime)})

    ${route.steps.map(s => `
  1. ${escapeHTML(s.instruction)}
  2. `).join('')}
`); } }