feat: running timers, symptom log, search, PDF export

- dashboard: ActiveTimers widget — live h:mm:ss for any in-progress timed event (breastfeed, nap, sleep, walk…), Terminer button patches endedAt
- dashboard: reorganised quick-log groups; Santé group (Température, Traitement, Symptôme)
- events: SYMPTOM type — tag chips (Fièvre, Reflux, Colique, Éruption, Toux, Congestion, Diarrhée, Vomissement, Irritabilité, Pleurs excessifs), stored in metadata.tags
- prisma: migration adding SYMPTOM to EventType enum
- search: GET /api/search (events by notes ILIKE, journal by content ILIKE), /search page with debounced input + keyword highlight
- nav: Recherche link added to LINKS + More drawer
- growth: PDF export button — generates formatted table with all measurements, zebra rows, downloads croissance-{name}.pdf

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 17:27:01 +02:00
parent cd677d9244
commit 009090b381
14 changed files with 549 additions and 10 deletions
+36
View File
@@ -0,0 +1,36 @@
import { NextResponse } from "next/server";
import { auth } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
export async function GET(req: Request) {
const session = await auth();
if (!session?.user?.id) return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
const { searchParams } = new URL(req.url);
const q = searchParams.get("q")?.trim() ?? "";
const babyId = searchParams.get("babyId");
if (!babyId || q.length < 2) return NextResponse.json({ events: [], notes: [] });
const [events, notes] = await Promise.all([
prisma.event.findMany({
where: {
babyId,
OR: [
{ notes: { contains: q, mode: "insensitive" } },
],
},
orderBy: { startedAt: "desc" },
take: 30,
include: { user: { select: { id: true, name: true } } },
}),
prisma.journalNote.findMany({
where: { babyId, content: { contains: q, mode: "insensitive" } },
orderBy: { date: "desc" },
take: 20,
include: { user: { select: { id: true, name: true } } },
}),
]);
return NextResponse.json({ events, notes });
}