frontend: rename variables to match api fields
Parents:
a07da011 file(s) changed
- frontend/app/sleep/new.tsx +12 -12
frontend/app/sleep/new.tsx
@@ -15,9 +15,9 @@ import DatePickerField from '@/components/ui/DatePickerField';
15 15 import { ScaleSlider } from '@/components/ui/ScaleSlider';
16 16
17 17 export default function NewSleepRecord() {
18 - const [day, setDay] = useState(new Date())
19 - const [annotation, setAnnotation] = useState();
20 - const [duration, setDuration] = useState(7.5);
18 + const [date, setDate] = useState(new Date())
19 + const [annotations, setAnnotations] = useState();
20 + const [average, setAverage] = useState(7.5);
21 21
22 22 const formatValue = (value: number): string => {
23 23 return String(value).replaceAll('.', ',');
@@ -25,9 +25,9 @@ };
25 25
26 26 const save = async () => {
27 27 const data = {
28 - day,
29 - annotation,
30 - duration
28 + date,
29 + annotations,
30 + average
31 31 };
32 32
33 33 console.log("Sleep record:", data)
@@ -60,16 +60,16 @@
60 60 <Card style={styles.mainCard}>
61 61 <DatePickerField
62 62 label="Data do Registro"
63 - initialDate={day}
63 + initialDate={date}
64 64 maximumDate={new Date()}
65 - onChange={setDay}
65 + onChange={setDate}
66 66 />
67 67
68 68 <View style={{ marginVertical: 15 }}>
69 69 <ScaleSlider
70 70 label="Duração"
71 - value={duration}
72 - onValueChange={setDuration}
71 + value={average}
72 + onValueChange={setAverage}
73 73 onValueFormat={formatValue}
74 74 step={0.5}
75 75 min={0.0}
@@ -82,8 +82,8 @@ <TextArea
82 82 label="Notas sobre a qualidade"
83 83 type="text"
84 84 variant="darkGhost"
85 - onChangeText={(val) => setAnnotation(val)}
86 - value={annotation}
85 + onChangeText={(val) => setAnnotations(val)}
86 + value={annotations}
87 87 minRows={5}
88 88 maxRows={10}
89 89 placeholder="Como você se sentiu ao acordar? Teve sonhos marcantes?"