import { TAX_TYPES, YEARS } from './constants' import { getTaxSum, getTaxAverage, getRegionDistribution, type RegionDistributionEntry } from './services/stats.services' import StatCard from './components/molecules/StatCard' import RegionRanking from './components/molecules/RegionRanking' import TeamAvatar from './components/molecules/TeamAvatar' import ErrorDiv from './components/molecules/ErrorDiv' import { TrendingUp, Calculator, DollarSign, BarChart3 } from 'lucide-react' import { formatCurrency } from './utils/format' const TAX_LABELS: Record = { tfpnb: 'Taxe Foncière sur les Propriétés Non Bâties', tfpb: 'Taxe Foncière sur les Propriétés Bâties', th: "Taxe d'Habitation", cfe: 'Cotisation Foncière des Entreprises', } const TAX_SHORT: Record = { tfpnb: 'TFPNB', tfpb: 'TFPB', th: 'TH', cfe: 'CFE', } const TAX_ICONS: Record> = { tfpnb: TrendingUp, tfpb: DollarSign, th: BarChart3, cfe: Calculator, } const TAX_COLORS: Record = { tfpnb: '#82ca9d', tfpb: '#8884d8', th: '#ffc658', cfe: '#ff7300', } export default async function Home() { const year = Math.max(...YEARS) let data: { field: string; sum: number | null; average: number | null }[] = [] const rankings: Record = {} let error: string | null = null try { const [statsResults, ...distributionResults] = await Promise.all([ Promise.all( TAX_TYPES.map(async field => { const [sumRes, avgRes] = await Promise.all([getTaxSum(field, year), getTaxAverage(field, year)]) return { field, sum: sumRes.sum, average: avgRes.average } }) ), ...TAX_TYPES.map(field => getRegionDistribution(field, year)), ]) data = statsResults TAX_TYPES.forEach((field, i) => { rankings[field] = distributionResults[i]?.data ?? [] }) } catch (e) { error = e instanceof Error ? e.message : 'Une erreur est survenue' } return (

Tableau de bord

Vue d'ensemble des taxes locales françaises - Année {year}

{error && }
{data.map(item => ( ))}

Classement par région

{TAX_TYPES.map(field => ( ))}

Équipe de développement

{[ { name: 'Adrien', img: '/team/marco.png', color: '#8884d8' }, { name: 'Clément', img: '/team/Gohmma.png', color: '#82ca9d' }, { name: 'Jérémy', img: '/team/Dede.png', color: '#ffc658' }, { name: 'Julien', img: '/team/PotiFlamby.png', color: '#ff7300' }, { name: 'Yoann', img: '/team/Yoann.png', color: '#00C49F' }, ].map(member => ( ))}
) }