|
All checks were successful
CI / test (pull_request) Successful in 2m34s
src/lib/analytics.ts (NEW) — 3 queries server-only :
- getMonthlyRevenueSeries({organizationId?, monthsBack=12}) → 12
buckets « YYYY-MM » avec carbetRevenue + rentalRevenue + total.
Scope optionnel par org via memberships (Booking) et
provider.organizationId (RentalBooking).
- getCarbetsOccupancy({organizationId?, monthsBack=3}) → liste triée
par occupancyPct avec bookedNights/totalNights pour chaque carbet
PUBLISHED (filtré par memberships si org).
- getAdminGlobalKpis() → users (total + breakdown par rôle),
carbetsPublished, bookings/rentals 30j, revenue 30j, top 5 carbets
+ top 5 providers par CA 30j.
src/components/analytics/MonthlyRevenueChart.tsx (NEW) — bar chart
SVG simple (pas de lib externe), stack carbet + rental, grid Y, tooltips
via <title>, légende couleurs. Responsive overflow-x-auto.
/espace-ce/analytics/page.tsx (NEW) :
- 3 KPIs (CA 12 mois total / Carbet / Matériel)
- MonthlyRevenueChart scopé par org
- Liste taux d'occupation carbets 3 derniers mois (barres horizontales)
- Lien ajouté depuis le dashboard /espace-ce
/admin/analytics/page.tsx (NEW) :
- 4 KPIs (utilisateurs, carbets publiés, bookings 30j, CA 30j)
- Breakdown users par rôle (barres horizontales + pourcentages)
- Carte « Activité 30j » avec bookings carbet + locations matériel
- MonthlyRevenueChart global
- Top 5 carbets (CA 30j) + Top 5 prestataires rental (CA 30j)
- Sidebar admin gagne entrée « Analytics » sous « Vue d'ensemble »
Pas de nouvelle dépendance npm — graphiques en SVG natif.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| analytics | ||
| audit | ||
| bookings | ||
| carbets | ||
| content-pages | ||
| home | ||
| media | ||
| organizations | ||
| pirogue-providers | ||
| plugins | ||
| rental-items | ||
| rental-providers | ||
| rentals | ||
| reviews | ||
| settings | ||
| users | ||
| layout.tsx | ||
| page.tsx | ||