import { View, Text } from 'react-native'; import { Ionicons } from '@expo/vector-icons'; import { useColors } from '../../lib/theme'; export type HelpedByEntry = { key: 'breathing' | 'game' | 'talk' | 'other'; label: string; count: number; }; type Props = { sessions: number; overcome: number; helpedBy: HelpedByEntry[]; topEmotion: string | null; }; export function UrgeStatsCard({ sessions, overcome, helpedBy, topEmotion }: Props) { const colors = useColors(); const overcomePct = sessions > 0 ? Math.round((overcome / sessions) * 100) : 0; const totalHelped = helpedBy.reduce((sum, h) => sum + h.count, 0); return ( LYRA INSIGHTS Letzte 30 Tage {sessions === 0 ? ( Noch keine SOS-Session. Lyra ist da, wenn du sie brauchst. ) : ( <> {sessions} SOS-Sessions, {overcome} bewältigt {overcomePct}% bewältigt {totalHelped > 0 ? ( Was hat geholfen {helpedBy.map((h) => { const pct = totalHelped > 0 ? (h.count / totalHelped) * 100 : 0; return ( {h.label} {h.count} {h.count === 1 ? 'Session' : 'Sessions'} ); })} ) : null} {topEmotion ? ( Häufigste Emotion: {topEmotion} ) : null} )} ); }