import { MONTHS } from '../config.js'; export class EventCard { constructor(container) { this.container = container; this.currentEvent = null; this.onClose = () => {}; } show(event) { this.currentEvent = event; this.container.classList.remove('hidden'); this.render(event); } hide() { this.container.classList.add('hidden'); this.currentEvent = null; } render(event) { const date = new Date(event.date); const formattedDate = `${date.getDate()} ${MONTHS[date.getMonth()]} ${date.getFullYear()}`; this.container.innerHTML = ` ${this.getTypeLabel(event.type)}

${event.name}

${event.location.city}

${formattedDate}

`; this.container.querySelector('.close-btn').addEventListener('click', () => { this.hide(); this.onClose(); }); } getTypeLabel(type) { const labels = { international: 'International', national: 'National', training: 'EntraƮnement' }; return labels[type] || type; } setOnClose(callback) { this.onClose = callback; } }