'use client'; import React from 'react'; import { Activity, AlertCircle, CheckCircle, Zap, TrendingUp } from 'lucide-react'; import { Area, AreaChart, ResponsiveContainer, Tooltip, XAxis, YAxis, CartesianGrid } from 'recharts'; interface ABVTasting { id: string; abv: number; tasted_at: string; } interface SessionABVCurveProps { tastings: ABVTasting[]; } export default function SessionABVCurve({ tastings }: SessionABVCurveProps) { if (!tastings || tastings.length < 2) { return (

Kurve wird ab 2 Drams berechnet

); } const data = [...tastings] .sort((a, b) => new Date(a.tasted_at).getTime() - new Date(b.tasted_at).getTime()) .map((t: ABVTasting, i: number) => ({ name: `Dram ${i + 1}`, abv: t.abv, timestamp: new Date(t.tasted_at).toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' }), id: t.id })); const hasBigJump = tastings.some((t: ABVTasting, i: number) => i > 0 && Math.abs(t.abv - tastings[i - 1].abv) > 10); const avgAbv = (tastings.reduce((acc: number, t: ABVTasting) => acc + t.abv, 0) / tastings.length).toFixed(1); return (
{/* Header */}

ABV Progression

Alcohol By Volume Intensity

{hasBigJump && (
Spike Alert
)}
{/* Chart Container */}
{ if (active && payload && payload.length) { return (

{payload[0].payload.name} • {payload[0].payload.timestamp}

{payload[0].value}% ABV

); } return null; }} />
{/* Stats Footer */}
Ø Intensity
{avgAbv} %
Flow State
{hasBigJump ? ( <> Aggressive ) : ( <> Smooth )}
); }