import type { Metadata } from "next"; import Link from "next/link"; import { apiSafe } from "@/lib/api"; import { AskBox } from "@/components/ask-box"; import { Card, Empty } from "@/components/ui"; import { PARTY_IDS, partyVar, partyLabel } from "@/lib/parties"; export const metadata: Metadata = { title: "Enjeux — ce que proposent les partis", description: "Positions et propositions des partis par enjeu (santé, logement, immigration, langue, environnement…), tirées de leurs documents officiels." }; export const revalidate = 300; interface Matrix { topics: { id: string; label: string; counts: Record }[] } export default async function Page() { const m = await apiSafe("/api/matrix"); if (!m) return ; return (
Issues tracker · {m.topics.length} enjeux documentés

Enjeux

Les principaux enjeux détectés dans les documents officiels des partis. Le nombre indique les propositions extraites (avec page et citation) par parti.

{m.topics.length === 0 ? : (
{m.topics.sort((a, b) => Object.values(b.counts).reduce((x, y) => x + y, 0) - Object.values(a.counts).reduce((x, y) => x + y, 0)).map((t) => { const total = Object.values(t.counts).reduce((x, y) => x + y, 0); return (
{t.label}
{total} propositions
{PARTY_IDS.map((id) =>
)}
{PARTY_IDS.map((id) => {partyLabel(id)} {t.counts[id] ?? 0})}
); })}
)}
); }