frontend: accept a string intensity in MoodComponentCard
Pedro Lucas Porcellis porcellis@eletrotupi.com · 12 days ago
4f91bfff4faf05b737920b87ee6ce8108a2eef35 Browse filesParents
b4ed0dbChanged files
2
Additions
+2
Deletions
-10
frontend/app/entry/[id].tsx
1 1
import { useState, useEffect, use } from "react";
2 2
import {
3 3
StyleSheet,
4 4
View,
5 5
ScrollView,
168 168
</Section>
169 169
170 170
<Section>
171 171
<SectionHeader title="Além disso, sinto..." variant="subtle" />
172 172
<Col gap={0}>
173 -
{entry.moodComponents.map((comp, index) => {
174 -
const def = getMoodComponent(comp.component.toLowerCase());
175 -
const numericIntensity =
176 -
comp.intensity === "LIGHT"
177 -
? 2
178 -
: comp.intensity === "MODERATE"
179 -
? 5
180 -
: 8;
181 -
173 +
{entry.moodComponents.map((comp) => {
182 174
return (
183 175
<MoodComponentCard
184 176
key={comp.id}
185 177
id={comp.component.toLowerCase()}
186 178
intensity={comp.intensity}
443 435
height: "100%",
444 436
borderRadius: 99,
445 437
},
446 438
447 439
});
frontend/components/ui/MoodComponentCard.tsx
1 1
import React from 'react';
2 2
import { View, StyleSheet, ViewStyle } from 'react-native';
3 3
import { Text } from '@/components/ui/Text';
4 4
import { Row } from '@/components/ui/LayoutHelpers';
5 5
import { Card } from '@/components/ui/Cards';
6 6
import { getMoodComponent, intensityLabel } from '@/constants/mood-components';
7 7
import { Theme } from '@/constants/theme';
8 8
9 9
interface MoodComponentCardProps {
10 10
id: string;
11 -
intensity: number;
11 +
intensity: number | string;
12 12
style?: ViewStyle;
13 13
}
14 14
15 15
export const MoodComponentCard: React.FC<MoodComponentCardProps> = ({
16 16
id,
72 72
color: Theme.colors.light.moodIntensityLabel,
73 73
flexShrink: 1,
74 74
height: '100%',
75 75
},
76 76
});