eletrotupi / tcc/ commit / 2984ae1

frontend: centralize and display high energy levels infer

Pedro Lucas Porcellis porcellis@eletrotupi.com 1 month ago 2984ae1cefef3e0e22e3367867ce09be0d69026e
Parents: 1177778
2 file(s) changed
  • frontend/app/(tabs)/new/post-mood.tsx +4 -6
  • frontend/components/history/MoodHistoryCard.tsx +1 -0
frontend/app/(tabs)/new/post-mood.tsx
1 1
import { useState } from "react";
2 2
import {
3 3
  View,
4 4
  Text,
5 5
  StyleSheet,
▸ 33 unchanged lines
39 39
    await linkMoodToTrigger.mutateAsync({
40 40
      triggerId: String(selectedTrigger.id),
41 41
      moodId,
42 42
      perceivedImpact: impact,
43 43
    });
44 +

44 45
    setLinked(true);
45 46
    setSelectedTrigger(null);
46 -
  };
47 -

48 -
  const onNotificationPress = () => {
49 -
    router.push("/notifications");
50 47
  };
51 48

52 49
  return (
53 50
    <ScreenLayout
54 51
      userName={user?.firstName}
55 52
      userAvatar={user?.avatarURL}
56 -
      onNotificationPress={onNotificationPress}
57 53
    >
58 54
      {/* Confirmation block */}
59 55
      <View style={styles.confirmationBlock}>
60 56
        <View style={styles.outerRing}>
61 57
          <View style={styles.innerCircle}>
▸ 136 unchanged lines
198 194
          )}
199 195
        </Card>
200 196
      )}
201 197

202 198
      <Button
203 -
        title="Pular essa etapa"
199 +
        title={linked ? 'Voltar para a tela inicial' : 'Pular essa etapa'}
204 200
        variant="ghost"
205 201
        onPress={() => router.replace("/(tabs)/new")}
206 202
        style={styles.concludeButton}
207 203
      />
208 204
    </ScreenLayout>
▸ 146 unchanged lines
355 351
  },
356 352
  // Linked success
357 353
  linkedRow: {
358 354
    flexDirection: "row",
359 355
    alignItems: "center",
356 +
    justifyContent: "center",
360 357
    gap: 8,
361 358
    marginBottom: Spacing.sectionGap,
362 359
    paddingHorizontal: 4,
363 360
  },
364 361
  linkedText: {
365 362
    ...Typography.bodyMd,
366 363
    fontWeight: "600",
367 364
    color: Colors.light.tint,
365 +
    textAlign: 'center'
368 366
  },
369 367
  moodList: {
370 368
    gap: 8,
371 369
  },
372 370
  concludeButton: {
373 371
    marginTop: 8,
374 372
  },
375 373
});
frontend/components/history/MoodHistoryCard.tsx
1 1
// components/history/cards/MoodHistoryCard.tsx
2 2
import { View, Text, StyleSheet } from 'react-native';
3 3
import { MaterialIcons } from '@expo/vector-icons';
4 4
import { Card } from '@/components/ui/Cards';
5 5
import { Badge } from '@/components/ui/Badge';
▸ 6 unchanged lines
12 12

13 13
function inferBadge(anxiety: number, stress: number, energy: number) {
14 14
  if (anxiety >= 7) return { label: 'Ansiedade alta', variant: 'red'    } as const
15 15
  if (stress  >= 7) return { label: 'Estresse alto',  variant: 'orange' } as const
16 16
  if (energy  <= 3) return { label: 'Energia baixa',  variant: 'yellow' } as const
17 +
  if (energy  >= 7) return { label: 'Energia alta', variant: 'green' } as const
17 18

18 19
  return undefined
19 20
}
20 21

21 22
// TODO: Perhaps we could move these into the constants instead and use it everywhere?
▸ 84 unchanged lines
106 107
    alignSelf: 'flex-start',
107 108
    marginTop: 4,
108 109
    maxWidth: '50%'
109 110
  }
110 111
})