diff --git a/frontend/src/app/pages/home/home.ts b/frontend/src/app/pages/home/home.ts index 5da75c5..0af7996 100644 --- a/frontend/src/app/pages/home/home.ts +++ b/frontend/src/app/pages/home/home.ts @@ -61,13 +61,13 @@ export class Home implements OnInit, OnDestroy { // Propriétés pour les filtres searchText = ''; - selectedWhatFilter = 'culture'; + selectedWhatFilter = ''; availableWhatTypes: string[] = []; theme = signal(null); subthemes: Array<{ key: string, label: string, emoji: string }> = []; activeSubtheme = signal(null); // Option bbox - useBboxFilter = false; + useBboxFilter = true; currentBbox: { minLng: number, minLat: number, maxLng: number, maxLat: number } | null = null; // Debounce pour la recherche private searchDebounceTimer: any = null; @@ -130,7 +130,7 @@ export class Home implements OnInit, OnDestroy { }; if (overrides.what) { params.what = overrides.what; - } else if (this.selectedWhatFilter) { + } else if (this.selectedWhatFilter && this.selectedWhatFilter !== '') { params.what = this.selectedWhatFilter; } @@ -207,6 +207,11 @@ export class Home implements OnInit, OnDestroy { this.theme.set(t || null); this.buildSubthemes(); }); + + // Ajouter les catégories principales + whatTypes.add('culture'); + whatTypes.add('traffic'); + this.availableWhatTypes = Array.from(whatTypes).sort(); } @@ -244,9 +249,15 @@ export class Home implements OnInit, OnDestroy { // Filtre par type d'événement if (this.selectedWhatFilter) { - filtered = filtered.filter(feature => - feature?.properties?.what === this.selectedWhatFilter - ); + filtered = filtered.filter(feature => { + const what = feature?.properties?.what || ''; + // Si c'est une catégorie (culture, traffic), filtrer par préfixe + if (this.selectedWhatFilter === 'culture' || this.selectedWhatFilter === 'traffic') { + return what.startsWith(this.selectedWhatFilter + '.'); + } + // Sinon, correspondance exacte + return what === this.selectedWhatFilter; + }); } this.filteredFeatures = filtered; diff --git a/oedb/resources/demo.py b/oedb/resources/demo.py index bce150a..a9280b0 100644 --- a/oedb/resources/demo.py +++ b/oedb/resources/demo.py @@ -126,7 +126,7 @@ class DemoResource: # Fetch events from the API try: - response = requests.get('/event?limit=1000') + response = requests.get('/event?limit=5000') if response.status_code == 200 and response.text: events_data = response.json() else: diff --git a/oedb/resources/demo/templates/by_what.html b/oedb/resources/demo/templates/by_what.html index 420acfc..99f220b 100644 --- a/oedb/resources/demo/templates/by_what.html +++ b/oedb/resources/demo/templates/by_what.html @@ -10,6 +10,11 @@ color: #666; font-size: 0.9em; } + .event-details { + color: #888; + font-style: italic; + margin-left: 5px; + } {% endblock %} @@ -39,7 +44,14 @@