eletrotupi / tcc/ commit / b1af73d

frontend: fix routes & fix default mood selector

Pedro Lucas Porcellis porcellis@eletrotupi.com · 5 months ago b1af73df0b955e7eb8762629e9691f2f3c54b7ad Browse files
Parents 201b6a4
Changed files
3
Additions
+3
Deletions
-3
frontend/app/(tabs)/new/index.tsx
1 1
import { useEffect, useState } from 'react';
2 2
import {
3 3
  StyleSheet
4 4
} from 'react-native';
5 5

16 16
import { useThemeColor } from '@/hooks/use-theme-color';
17 17
import { router } from 'expo-router';
18 18

19 19
export default function New() {
20 20
  const { user } = useAuth();
21 -
  const [mood, setMood] = useState<string>('bem');
21 +
  const [mood, setMood] = useState<string>('good');
22 22
  const [isLoading, setIsLoading] = useState<boolean>(false);
23 23

24 24
  // TODO: Move these elsewhere
25 25
  const moodOptions = [
26 26
    { id: 'sad', icon: '😢', label: 'Triste' },
112 112
    marginRight: 16,
113 113
    marginBottom: 16,
114 114
    ...Shadows.lg
115 115
  }
116 116
});
frontend/app/_layout.tsx
1 1
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'
2 2
import { Stack } from 'expo-router';
3 3
import { useColorScheme } from 'react-native'
4 4

5 5
import { AuthProvider } from '@/context/AuthContext';
6 6

7 7
export const unstable_settings = {
8 -
  anchor: '(tabs)',
8 +
  anchor: '(tabs)/new',
9 9
};
10 10

11 11
export default function RootLayout() {
12 12
  const colorScheme = useColorScheme();
13 13

27 27
        </Stack>
28 28
      </AuthProvider>
29 29
    </ThemeProvider>
30 30
  );
31 31
}
frontend/app/auth/login.tsx
1 1
import React, { useState } from 'react';
2 2
import {
3 3
  View,
4 4
  Text,
5 5
  StyleSheet,
45 45
  const handleLogin = async () => {
46 46
    if (!validateForm()) return;
47 47

48 48
    try {
49 49
      await login(email, password);
50 -
      router.replace('/(tabs)');
50 +
      router.replace('/(tabs)/new');
51 51
    } catch (error: any) {
52 52
	  Alert.alert('Erro: ', 'Falha ao fazer login');
53 53
    }
54 54
  };
55 55

169 169
  },
170 170
  footerText: {
171 171
    fontSize: 14,
172 172
  },
173 173
});