eletrotupi / tcc/ commit / d09369f

frontend: guard the missing mood definition in the history card

Pedro Lucas Porcellis porcellis@eletrotupi.com · 12 days ago d09369f13e0c0517549a86d62451cfad5d8d5616 Browse files
Parents 7fee969
Changed files
1
Additions
+1
Deletions
-4
frontend/components/history/MoodHistoryCard.tsx
1 1
// components/history/cards/MoodHistoryCard.tsx
2 2
import { View, StyleSheet } from 'react-native';
3 3
import { Text } from '@/components/ui/Text';
4 -
import { MaterialIcons } from '@expo/vector-icons';
5 4
import { Card } from '@/components/ui/Cards';
6 5
import { Badge } from '@/components/ui/Badge';
7 6
import type { HistoryCard } from '@/lib/history/types';
8 7
import type { MoodEntry } from '@/lib/api';
9 8
import { Spacing } from '@/constants/theme';
40 39
  return (
41 40
    <Card style={styles.card} onPress={() => router.push(`/entry/${card.raw.id}`)}>
42 41
      <View style={styles.row}>
43 42
        <View style={[styles.iconWrap, { backgroundColor: meta.bg }]}>
44 43
          <Text style={styles.moodIconEmoji}>{moodDef?.icon ?? '😐'}</Text>
45 -

46 -
          {false && (<MaterialIcons name={meta.icon} size={22} color={meta.color} />)}
47 44
        </View>
48 45
        <View style={styles.body}>
49 46
          <View style={styles.titleRow}>
50 -
            <Text style={styles.title}>{moodDef.label}</Text>
47 +
            <Text style={styles.title}>{moodDef?.label ?? card.raw.selectedMood}</Text>
51 48
            <Text style={styles.time}>{time}</Text>
52 49
          </View>
53 50
          {card.raw.annotation ? (
54 51
            <Text style={styles.summary} numberOfLines={2}>
55 52
              {card.raw.annotation?.trim()}
108 105
    alignSelf: 'flex-start',
109 106
    marginTop: 4,
110 107
    maxWidth: '50%'
111 108
  }
112 109
})