up setting plein air

This commit is contained in:
Tykayn 2025-10-14 18:34:49 +02:00 committed by tykayn
parent 4f6a388129
commit a6331c8ced
5 changed files with 401 additions and 291 deletions

View file

@ -40,7 +40,7 @@ export class Home implements OnInit, OnDestroy {
showTable = false;
showFilters = false;
showEditForm = false;
showOptions = false;
showOptions = true;
pleinAirMode = false;
toasts: Array<{ id: number, type: 'success' | 'error' | 'info', message: string }> = [];
@ -71,6 +71,14 @@ export class Home implements OnInit, OnDestroy {
// Option bbox
useBboxFilter = true;
currentBbox: { minLng: number, minLat: number, maxLng: number, maxLat: number } | null = null;
// Bbox par défaut pour l'Île-de-France
private readonly IDF_BBOX = {
minLng: 1.4,
minLat: 48.1,
maxLng: 3.6,
maxLat: 49.2
};
// Debounce pour la recherche
private searchDebounceTimer: any = null;
// Non localisés / en ligne
@ -84,9 +92,13 @@ export class Home implements OnInit, OnDestroy {
const d = e?.detail || {}; this.pushToast(d.type || 'info', d.message || '');
});
} catch {}
// Initialiser la bbox par défaut pour l'Île-de-France
this.currentBbox = { ...this.IDF_BBOX };
this.route.queryParamMap.subscribe(map => {
const id = (map.get('id') || '').trim();
const what = (map.get('what') || '').trim();
const what = (map.get('what') || 'culture').trim();
const pleinAir = (map.get('pleinair') || '').trim().toLowerCase();
const preset = (map.get('preset') || '').trim().toLowerCase();
const limitParam = map.get('limit');
@ -111,6 +123,8 @@ export class Home implements OnInit, OnDestroy {
}
});
this.startAutoReload();
this.loadEvents({ what: "culture" , limit: 100 });
}
ngOnDestroy() {
@ -365,7 +379,7 @@ export class Home implements OnInit, OnDestroy {
this.selected = null;
// Après création rapide en plein air: recharger uniquement ce type pour feedback instantané
this.selectedWhatFilter = w;
this.loadEvents({ what: w });
this.loadEvents({ what: 'traffic' });
},
error: () => { this.pushToast('error', 'Échec de création'); }
});
@ -616,4 +630,9 @@ export class Home implements OnInit, OnDestroy {
this.loadEvents();
}
}
// Méthode pour recharger les événements quand la carte bouge
onMapMove(bbox: { minLng: number, minLat: number, maxLng: number, maxLat: number }) {
this.setCurrentBbox(bbox);
}
}