From a1e8a7ed48971150fe501d85f3124b1e3c42b3ef Mon Sep 17 00:00:00 2001 From: eddy Date: Wed, 5 Aug 2026 22:07:30 +0200 Subject: [PATCH] feat: toon positieve comments bij gelijk/gestegen gewicht (issue #17) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 'Vetje naar beneden' als vetmassa gedaald is - 💪 als spiermassa gestegen is - Combineer beide op één regel indien van toepassing - Alleen tonen bij diff >= 0 kg --- src/components/LatestMeasurementCard.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/LatestMeasurementCard.tsx b/src/components/LatestMeasurementCard.tsx index 0d4f494..ba999ba 100644 --- a/src/components/LatestMeasurementCard.tsx +++ b/src/components/LatestMeasurementCard.tsx @@ -32,6 +32,16 @@ export default function LatestMeasurementCard({ measurements }: Props) { const latest = measurements[0] const previous = measurements[1] const diff = previous ? (latest.weight - previous.weight) : null + const fatMassDiff = previous ? (latest.fatMass - previous.fatMass) : null + const muscleMassDiff = previous ? (latest.muscleMass - previous.muscleMass) : null + + let positiveComment: string | null = null + if (previous && diff !== null && diff >= 0) { + const parts: string[] = [] + if (fatMassDiff !== null && fatMassDiff < 0) parts.push('Vetje naar beneden') + if (muscleMassDiff !== null && muscleMassDiff > 0) parts.push('💪') + if (parts.length > 0) positiveComment = parts.join(' ') + } const handleShare = async () => { try { @@ -62,6 +72,9 @@ export default function LatestMeasurementCard({ measurements }: Props) { Verschil {diff !== null && (diff > 0 ? '+' : '')}{diff?.toFixed(1)} kg + {positiveComment && ( + {positiveComment} + )} )} @@ -100,4 +113,5 @@ const styles = StyleSheet.create({ previousTitle: { fontSize: 18, fontWeight: '700', marginBottom: 4 }, previousDate: { fontSize: 14, color: '#666', marginBottom: 4 }, diffLabel: { fontSize: 16, fontWeight: '700', color: '#2196F3' }, + positiveComment: { fontSize: 14, color: '#4CAF50', marginTop: 4 }, })