eletrotupi / tcc/ frontend/app/(tabs)/new/index.tsx87c2c7279a81f897d50a9cef8c07aaf8fca0cc0c
3.4 KB | 116 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
import { router } from 'expo-router';
18

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

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

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

36
    // TODO: Set down on camelCase vs kebab case
37
    router.navigate(`/new/entry?initialMood=${mood}`)
38
  };
39

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

52
          <Card style={{ minHeight: 200 }}>
53
            <Col gap={16}>
54
              <Between style={styles.quickRegisterHeader}>
55
                <ThemedText style={styles.quickRegisterTitle}>
56
                  Registro rápido
57
                </ThemedText>
58

59
                <ThemedText style={styles.quickRegisterBadge}>
60
                  HOJE
61
                </ThemedText>
62
              </Between>
63

64
              <MoodSelector
65
                style={{paddingLeft: 8, paddingRight: 8, paddingTop: 16 }}
66
                items={moodOptions}
67
                value={mood}
68
                onSelect={setMood}
69
              />
70

71
              <Button
72
                title="Salvar Humor"
73
                onPress={initQuickRegister}
74
                loading={isLoading}
75
                style={styles.quickRegisterButton}
76
              />
77
            </Col>
78
          </Card>
79
        </Section>
80

81
        {/* TODO: Check whether we gonna have to generate these on demand */}
82
        <Section>
83
          <Grid gap={4}>
84
            <Card style={{minHeight: 150, backgroundColor: 'powderblue'}}>
85
            </Card>
86

87
            <Card style={{minHeight: 150, backgroundColor: 'tomato'}}>
88
            </Card>
89
          </Grid>
90
        </Section>
91
      </ThemedView>
92
    </ScreenLayout>
93
  )
94
}
95

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