eletrotupi / tcc/ frontend/app/profile.tsxb13456d98a5b20510f062a4d4fb619887728bd8f
3.8 KB | 158 lines Raw
1
import { useState, useEffect } from 'react';
2
import {
3
  ThemedView
4
} from '@/components/ui/themed-view'
5

6
import {
7
  ThemedText
8
} from '@/components/ui/themed-text'
9

10
import {
11
  View,
12
  Text,
13
  StyleSheet,
14
  ScrollView,
15
  KeyboardAvoidingView,
16
  Platform,
17
  Alert,
18
} from 'react-native';
19
import { Link, useLocalSearchParams, router } from 'expo-router';
20
import { SafeAreaView } from 'react-native-safe-area-context';
21
import { useThemeColor } from '@/hooks/use-theme-color';
22
import { Button, Input } from '@/components/ui';
23

24
export default function Profile() {
25
  const [firstName, setFirstName] = useState();
26
  const [lastName, setLastName] = useState();
27
  const [password, setPassword] = useState();
28
  const [confirmPassword, setConfirmPassword] = useState();
29
  const [email, setEmail] = useState();
30
  const [loading, setLoading] = useState(false);
31
  const [errors, setErrors] = useState<{
32
    password?: string;
33
    confirmPassword?: string;
34
  }>({});
35

36
  const backgroundColor = useThemeColor({}, 'background');
37
  const textColor = useThemeColor({}, 'text');
38

39
  const handleUpdate = () => {}
40

41
  return (
42
    <SafeAreaView style={[styles.container, { backgroundColor }]}>
43
      <KeyboardAvoidingView
44
        behavior='height'
45
        style={styles.keyboardView}
46
      >
47
        <ScrollView
48
          contentContainerStyle={styles.scrollContainer}
49
          showsVerticalScrollIndicator={false}
50
        >
51
          <View style={styles.header}>
52
            <Text style={[styles.title, { color: textColor }]}>Edite o seu perfil</Text>
53
            <Text style={[styles.subtitle, { color: textColor, opacity: 0.7 }]}>
54
              Altere suas configurações
55
            </Text>
56
          </View>
57

58
          <View style={styles.form}>
59
            <Input
60
              label="Primeiro Nome"
61
              type="text"
62
              value={firstName}
63
              onChangeText={setFirstName}
64
              placeholder="Qual seu nome?"
65
              error={errors.firstName}
66
            />
67

68
            <Input
69
              label="Sobrenome"
70
              type="text"
71
              value={lastName}
72
              onChangeText={setLastName}
73
              placeholder="Qual seu sobrenome?"
74
              error={errors.lastName}
75
            />
76

77
            <Input
78
              label="Nova senha"
79
              type="password"
80
              value={password}
81
              onChangeText={setPassword}
82
              placeholder="Digite uma nova senha"
83
              error={errors.password}
84
              showPasswordToggle
85
            />
86

87
            <Input
88
              label="Confirmar nova senha"
89
              type="password"
90
              value={confirmPassword}
91
              onChangeText={setConfirmPassword}
92
              placeholder="Confirme a nova senha"
93
              error={errors.confirmPassword}
94
              showPasswordToggle
95
            />
96

97
            <Button
98
              title="Trocar senha"
99
              onPress={handleUpdate}
100
              loading={loading}
101
              style={styles.resetButton}
102
            />
103
          </View>
104

105
        </ScrollView>
106
      </KeyboardAvoidingView>
107
    </SafeAreaView>
108
  )
109
}
110

111
const styles = StyleSheet.create({
112
  container: {
113
    flex: 1,
114
  },
115
  keyboardView: {
116
    flex: 1,
117
  },
118
  scrollContainer: {
119
    flexGrow: 1,
120
    paddingHorizontal: 24,
121
    justifyContent: 'start',
122
    minHeight: '100%',
123
  },
124
  header: {
125
    alignItems: 'left',
126
    marginBottom: 40,
127
  },
128
  title: {
129
    fontSize: 28,
130
    fontWeight: 'bold',
131
    marginBottom: 8,
132
  },
133
  subtitle: {
134
    fontSize: 16,
135
    textAlign: 'left',
136
  },
137
  form: {
138
    marginBottom: 32,
139
  },
140
  resetButton: {
141
    marginTop: 8,
142
  },
143
  link: {
144
    textAlign: 'center',
145
    fontSize: 14,
146
    fontWeight: '500',
147
  },
148
  footer: {
149
    flexDirection: 'row',
150
    justifyContent: 'center',
151
    alignItems: 'center',
152
    marginTop: 'auto',
153
    paddingBottom: 20,
154
  },
155
  footerText: {
156
    fontSize: 14,
157
  },
158
});