eletrotupi / tcc/ frontend/app/(tabs)/new/entry.tsx9491cee07e5a589cb6ccb77be219b7fff62b924e
4.1 KB | 140 lines Raw
1
import { useState, useEffect } from 'react';
2
import {
3
  Link, router, useLocalSearchParams
4
} from 'expo-router';
5

6
import {
7
  View,
8
  Text,
9
  StyleSheet,
10
  ScrollView
11
} from 'react-native';
12

13
import { SafeAreaView } from 'react-native-safe-area-context';
14
import { ThemedText } from '@/components/misc/themed-text';
15
import { ThemedView } from '@/components/misc/themed-view';
16
import { ScreenLayout } from '@/components/ui/ScreenLayout';
17
import { useAuth } from '@/context/AuthContext';
18
import { Grid, Col, Row, Between, Center } from '@/components/ui/LayoutHelpers';
19
import { Card } from '@/components/ui/Cards';
20
import { Button } from '@/components/ui/Button';
21
import { Input, TextArea } from '@/components/ui/Input';
22
import { Section, SectionHeader } from '@/components/ui/Sections';
23
import { Spacing, Typography, Colors } from '@/constants/theme';
24
import { ScaleSlider } from '@/components/ui/ScaleSlider';
25
import { Ionicons } from '@expo/vector-icons';
26
import { useThemeColor } from '@/hooks/use-theme-color';
27

28
export default function NewMoodEntry() {
29
  const { user } = useAuth();
30
  const tintColor = useThemeColor({}, 'tint');
31

32
  // TODO: transform this into a specific mood component
33
  const { initialMood } = useLocalSearchParams();
34
  const [stress, setStress] = useState(0);
35
  const [anxiety, setAnxiety] = useState(0);
36
  const [energy, setEnergy] = useState(0);
37

38
  const editComponents = () => {
39
    console.log("Wants to open the components");
40
  }
41

42
  return (
43
    <View>
44
      <ScrollView
45
        scrollEventThrottle={16}>
46
        <View style={styles.container}>
47
          <Center>
48
            <ThemedText style={styles.statusPrefix}>
49
              Como você está se sentindo agora?
50
            </ThemedText>
51

52
            <ThemedText style={styles.statusText}>
53
              Muito Bem
54
            </ThemedText>
55
          </Center>
56

57
          <Card style={styles.resumeCard}>
58
            <Col gap={24}>
59
              <ScaleSlider
60
                variant="rich"
61
                label="Energia"
62
                value={energy}
63
                onValueChange={setEnergy}
64
                icon={<Ionicons name="flower-outline" size={20} color={tintColor} />}
65
                minLabel="Baixa"
66
                maxLabel="Alta"
67
              />
68

69
              <ScaleSlider
70
                variant="rich"
71
                label="Ansiedade"
72
                value={anxiety}
73
                onValueChange={setAnxiety}
74
                icon={<Ionicons name="sad-outline" size={20} color="#FB923C" />}
75
                minLabel="Calmo"
76
                maxLabel="Ansioso"
77
              />
78

79
              <ScaleSlider
80
                variant="rich"
81
                label="Estresse"
82
                value={stress}
83
                onValueChange={setStress}
84
                icon={<Ionicons name="flame" size={20} color="#f87171" />}
85
                minLabel="Relaxado"
86
                maxLabel="Estressado"
87
              />
88
            </Col>
89
          </Card>
90

91
          <Card style={styles.annotationsCard}>
92
            <TextArea
93
              label="Notas sobre o dia"
94
              type="text"
95
              variant="darkGhost"
96
              onChangeText={(val) => console.log(val)}
97
              minRows={4}
98
              maxRows={6}
99
              placeholder="Escreva uma nota rápida sobre o seu dia até o momento..."
100
            />
101
          </Card>
102

103
          <Section>
104
            <SectionHeader title="Componentes do Humor" info="Editar" />
105
            <Grid gap={4}>
106
              <Card style={{height: 38}} />
107
              <Card style={{height: 38}} />
108
            </Grid>
109

110
            <Button title="Adicionar Componentes"
111
                    onPress={editComponents}
112
                    textStyle={{ fontWeight: 500 }}
113
                    variant="dashed"
114
                    />
115
          </Section>
116
        </View>
117
      </ScrollView>
118
    </View>
119
  );
120
}
121

122
const styles = StyleSheet.create({
123
  container: {
124
    gap: 24,
125
    paddingHorizontal: Spacing.containerPadding,
126
    paddingVertical: Spacing.sectionGap,
127
  },
128
  statusText: {
129
    ...Typography.headlineXg,
130
  },
131
  statusPrefix: {
132
    ...Typography.bodyMd
133
  },
134
  annotationsCard: {
135
    padding: Spacing.cardGap
136
  },
137
  resumeCard: {
138
    padding: Spacing.cardGap,
139
  }
140
});