routes doc, future, express mode thematique
This commit is contained in:
parent
eeb219cffa
commit
23c598034c
11 changed files with 228 additions and 18 deletions
44
frontend/src/app/pages/events-docs/events-docs.ts
Normal file
44
frontend/src/app/pages/events-docs/events-docs.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
import { Component, inject } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { OedbApi } from '../../services/oedb-api';
|
||||
import { AllEvents } from '../../maps/all-events/all-events';
|
||||
|
||||
@Component({
|
||||
selector: 'app-events-docs',
|
||||
imports: [CommonModule, AllEvents],
|
||||
templateUrl: './events-docs.html',
|
||||
styleUrl: './events-docs.scss'
|
||||
})
|
||||
export class EventsDocs {
|
||||
private api = inject(OedbApi);
|
||||
|
||||
features: Array<any> = [];
|
||||
counts: Array<{ what: string, count: number }> = [];
|
||||
filtered: Array<any> = [];
|
||||
selected: any | null = null;
|
||||
|
||||
ngOnInit() {
|
||||
// Charger 1000 events récents
|
||||
this.api.getEvents({ when: 'NEXT30DAYS', limit: 1000 }).subscribe((events: any) => {
|
||||
this.features = Array.isArray(events?.features) ? events.features : [];
|
||||
this.buildCounts();
|
||||
this.filtered = this.features;
|
||||
});
|
||||
}
|
||||
|
||||
buildCounts() {
|
||||
const map = new Map<string, number>();
|
||||
for (const f of this.features) {
|
||||
const w = (f?.properties?.what || '').trim();
|
||||
if (!w) continue;
|
||||
map.set(w, (map.get(w) || 0) + 1);
|
||||
}
|
||||
this.counts = Array.from(map.entries()).sort((a,b) => b[1]-a[1]).map(([what, count]) => ({ what, count }));
|
||||
}
|
||||
|
||||
filterByWhat(what: string) {
|
||||
this.filtered = this.features.filter(f => String(f?.properties?.what || '').startsWith(what));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue