eletrotupi / tcc/ frontend/app/(tabs)/new/index.tsx76e9483088268939851e94ccbbce09c58b4ad86c
3.2 KB | 111 lines Raw
1
import { useEffect, useState } from 'react';
2
import { 
3
  StyleSheet
4
} from 'react-native';
5

6
import { ThemedText } from '@/components/misc/themed-text';
7
import { ThemedView } from '@/components/misc/themed-view';
8
import { ScreenLayout } from '@/components/ui/ScreenLayout';
9
import { useAuth } from '@/context/AuthContext';
10
import { Grid, Col, Row, Between } from '@/components/ui/LayoutHelpers';
11
import { Card } from '@/components/ui/Cards';
12
import { Button } from '@/components/ui/Button';
13
import { Section, SectionHeader } from '@/components/ui/Sections';
14
import { MoodSelector } from '@/components/ui/EmojiSelectors';
15
import { Typography, Spacing, Shadows } from '@/constants/theme';
16
import { useThemeColor } from '@/hooks/use-theme-color';
17

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

23
  const moodOptions = [
24
    { id: 'sad', icon: '😢', label: 'Triste' },
25
    { id: 'neutral', icon: '😐', label: 'Neutro' },
26
    { id: 'good', icon: '😊', label: 'Bem' },
27
    { id: 'great', icon: '🤩', label: 'Ótimo' },
28
    { id: 'angry', icon: '😠', label: 'Irritado' },
29
  ];
30

31
  const initQuickRegister = () => {
32
    console.log("Register: ", mood);
33
  };
34

35
  return (
36
    <ScreenLayout userName={user.firstName}
37
      onNotificationPress={() => console.log('Notifications')}
38
      showNotificationBadge={true}>
39
      <ThemedView>
40
        <Section>
41
          <SectionHeader
42
            title="Como você está hoje?"
43
            subtitle="Sua jornada começa agora"
44
            >
45
          </SectionHeader>
46

47
          <Card style={{ minHeight: 200 }}>
48
            <Col gap={16}>
49
              <Between style={styles.quickRegisterHeader}>
50
                <ThemedText style={styles.quickRegisterTitle}>
51
                  Registro rápido
52
                </ThemedText>
53

54
                <ThemedText style={styles.quickRegisterBadge}>
55
                  HOJE
56
                </ThemedText>
57
              </Between>
58

59
              <MoodSelector
60
                style={{paddingLeft: 8, paddingRight: 8, paddingTop: 16 }}
61
                items={moodOptions}
62
                value={mood}
63
                onSelect={setMood}
64
              />
65

66
              <Button
67
                title="Salvar Humor"
68
                onPress={initQuickRegister}
69
                loading={isLoading}
70
                style={styles.quickRegisterButton}
71
              />
72
            </Col>
73
          </Card>
74
        </Section>
75

76
        {/* TODO: Check whether we gonna have to generate these on demand */}
77
        <Section>
78
          <Grid gap={4}>
79
            <Card style={{minHeight: 150, backgroundColor: 'powderblue'}}>
80
            </Card>
81

82
            <Card style={{minHeight: 150, backgroundColor: 'tomato'}}>
83
            </Card>
84
          </Grid>
85
        </Section>
86
      </ThemedView>
87
    </ScreenLayout>
88
  )
89
}
90

91
const styles = StyleSheet.create({
92
  quickRegisterHeader: {
93
    marginTop: 16,
94
    paddingLeft: 16,
95
    paddingRight: 16
96
  },
97
  quickRegisterTitle: {
98
    ...Typography.bodyLg
99
  },
100
  // TODO: Replace when we have badges
101
  quickRegisterBadge: {
102
    fontSize: 12,
103
    lineHeight: 16
104
  },
105
  quickRegisterButton: {
106
    marginLeft: 16,
107
    marginRight: 16,
108
    marginBottom: 16,
109
    ...Shadows.lg
110
  }
111
});