eletrotupi / tcc/ commit / aba81d9

frontend: apply screen layout on tabs pages and redirect to insights after saving

Pedro Lucas Porcellis porcellis@eletrotupi.com · 5 months ago aba81d95d4708f53c546b720093b00fe1ec2e6c0 Browse files
Parents 1180f89
Changed files
5
Additions
+53
Deletions
-21
frontend/app/(tabs)/actions/index.tsx
1 1
import { ThemedText } from '@/components/misc/themed-text';
2 2
import { ThemedView } from '@/components/misc/themed-view';
3 +
import { ScreenLayout } from '@/components/ui/ScreenLayout';
4 +
import { useAuth } from '@/context/AuthContext';
3 5

4 6
export default function Actions() {
7 +
  const { user } = useAuth();
8 +

5 9
  return (
6 -
    <ThemedView>
7 -
      <ThemedText>
8 -
        Actions
9 -
      </ThemedText>
10 -
    </ThemedView>
10 +
    <ScreenLayout userName={user.firstName}
11 +
      onNotificationPress={() => console.log('Notifications')}
12 +
      showNotificationBadge={true}>
13 +
      <ThemedView>
14 +
        <ThemedText>
15 +
          Novo
16 +
        </ThemedText>
17 +
      </ThemedView>
18 +
    </ScreenLayout>
11 19
  )
12 20
}
frontend/app/(tabs)/history/index.tsx
1 1
import { ThemedText } from '@/components/misc/themed-text';
2 2
import { ThemedView } from '@/components/misc/themed-view';
3 +
import { ScreenLayout } from '@/components/ui/ScreenLayout';
4 +
import { useAuth } from '@/context/AuthContext';
3 5

4 6
export default function History() {
7 +
  const { user } = useAuth();
8 +

5 9
  return (
6 -
    <ThemedView>
7 -
      <ThemedText>
8 -
        History
9 -
      </ThemedText>
10 -
    </ThemedView>
10 +
    <ScreenLayout userName={user.firstName}
11 +
      onNotificationPress={() => console.log('Notifications')}
12 +
      showNotificationBadge={true}>
13 +
      <ThemedView>
14 +
        <ThemedText>
15 +
          History
16 +
        </ThemedText>
17 +
      </ThemedView>
18 +
    </ScreenLayout>
11 19
  )
12 20
}
frontend/app/(tabs)/insights/index.tsx
1 1
import { ThemedText } from '@/components/misc/themed-text';
2 2
import { ThemedView } from '@/components/misc/themed-view';
3 +
import { ScreenLayout } from '@/components/ui/ScreenLayout';
4 +
import { useAuth } from '@/context/AuthContext';
3 5

4 6
export default function Insights() {
7 +
  const { user } = useAuth();
8 +

5 9
  return (
6 -
    <ThemedView>
7 -
      <ThemedText>
8 -
        Insights
9 -
      </ThemedText>
10 -
    </ThemedView>
10 +
    <ScreenLayout userName={user.firstName}
11 +
      onNotificationPress={() => console.log('Notifications')}
12 +
      showNotificationBadge={true}>
13 +
      <ThemedView>
14 +
        <ThemedText>
15 +
          Insights
16 +
        </ThemedText>
17 +
      </ThemedView>
18 +
    </ScreenLayout>
11 19
  )
12 20
}
frontend/app/(tabs)/new/index.tsx
1 1
import { ThemedText } from '@/components/misc/themed-text';
2 2
import { ThemedView } from '@/components/misc/themed-view';
3 +
import { ScreenLayout } from '@/components/ui/ScreenLayout';
4 +
import { useAuth } from '@/context/AuthContext';
3 5

4 6
export default function New() {
7 +
  const { user } = useAuth();
8 +

5 9
  return (
6 -
    <ThemedView>
7 -
      <ThemedText>
8 -
        New
9 -
      </ThemedText>
10 -
    </ThemedView>
10 +
    <ScreenLayout userName={user.firstName}
11 +
      onNotificationPress={() => console.log('Notifications')}
12 +
      showNotificationBadge={true}>
13 +
      <ThemedView>
14 +
        <ThemedText>
15 +
          Novo
16 +
        </ThemedText>
17 +
      </ThemedView>
18 +
    </ScreenLayout>
11 19
  )
12 20
}
frontend/app/profile.tsx
1 1
import { useState, useEffect } from 'react';
2 2
import {
3 3
  View,
4 4
  Text,
5 5
  StyleSheet,
97 97
        password
98 98
      });
99 99

100 100
      updateAuthUser(response.user);
101 101

102 -
      router.replace('/(tabs)');
102 +
      router.replace('/(tabs)/insights');
103 103
    } catch (error: any) {
104 104
      console.error("[PROFILE]", error)
105 105
      Alert.alert('Erro: ', 'Falha ao tentar atualizar o usuário');
106 106
    }
107 107
  }
232 232
  },
233 233
  footerText: {
234 234
    fontSize: 14,
235 235
  },
236 236
});