eletrotupi / tcc/ frontend/app/(tabs)/insights.tsx2e52778e4d0781399ac5a94fdcf90eda1ab41975
3.5 KB | 148 lines Raw
1
import { View, Text, ScrollView, StyleSheet } from "react-native";
2

3
import { ThemedText } from "@/components/misc/themed-text";
4
import { ThemedView } from "@/components/misc/themed-view";
5
import { ScreenLayout } from "@/components/ui/ScreenLayout";
6
import { useAuth } from "@/context/AuthContext";
7
import { Card } from "@/components/ui/Cards";
8
import { Section, SectionHeader } from "@/components/ui/Sections";
9
import { useThemeColor } from "@/hooks/use-theme-color";
10
import { Spacing, BorderRadius, Colors, Typography } from "@/constants/theme";
11
import { WeeklyResume } from "@/components/insights/WeeklyResume";
12
import { InsightCard, Highlight } from "@/components/insights/InsightCard";
13
import { MoodTrendWidget } from "@/components/insights/MoodTrendWidget";
14

15
export default function Insights() {
16
  const { user } = useAuth();
17

18
  return (
19
    <ScreenLayout
20
      userName={user.firstName}
21
      userAvatar={user.avatarURL}
22
      onNotificationPress={() => console.log("Notifications")}
23
      showNotificationBadge={true}
24
    >
25
      <WeeklyResume
26
        avgMood="Neutro"
27
        stats={[
28
          { label: "Média de Sono", value: "7.2h" },
29
          { label: "Humor Estável", value: "92%" },
30
        ]}
31
      />
32

33
      <Section>
34
        <SectionHeader title="Indicadores" />
35

36
        <InsightCard
37
          category="Energia"
38
          body={
39
            <Text style={styles.insightBody}>
40
              Aumento de <Highlight>20%</Highlight> correlacionado ao sono.
41
            </Text>
42
          }
43
          metric="+20%"
44
          accent="green"
45
        />
46

47
        <MoodTrendWidget />
48

49
        <InsightCard
50
          category="Gatilhos"
51
          body="Trabalho representa 45% dos registros."
52
          metric="45%"
53
          accent="neutral"
54
        />
55
      </Section>
56
    </ScreenLayout>
57
  );
58
}
59

60
const styles = StyleSheet.create({
61
  scrollView: {
62
    flex: 1,
63
    backgroundColor: Colors.light.background,
64
  },
65
  contentContainer: {
66
    padding: Spacing.containerPadding,
67
    paddingBottom: 40,
68
  },
69

70
  // Hero card
71
  heroCard: {
72
    backgroundColor: Colors.light.textBlack,
73
    borderRadius: BorderRadius.lg,
74
    padding: 20,
75
    marginBottom: Spacing.sectionGap,
76
  },
77
  heroLabel: {
78
    fontSize: 11,
79
    fontWeight: "600",
80
    letterSpacing: 0.8,
81
    textTransform: "uppercase",
82
    color: Colors.light.tint,
83
    marginBottom: 8,
84
  },
85
  heroScoreRow: {
86
    flexDirection: "row",
87
    alignItems: "center",
88
    gap: 10,
89
  },
90
  heroScore: {
91
    ...Typography.headlineXg,
92
    fontSize: 52,
93
    color: "#ffffff",
94
  },
95
  heroTrendIcon: {
96
    marginTop: 6,
97
  },
98
  heroDivider: {
99
    height: StyleSheet.hairlineWidth,
100
    backgroundColor: "rgba(255,255,255,0.12)",
101
    marginVertical: 16,
102
  },
103
  heroStats: {
104
    flexDirection: "row",
105
    gap: Spacing.sectionGap,
106
  },
107
  heroStatItem: {
108
    flex: 1,
109
  },
110
  heroStatLabel: {
111
    fontSize: 12,
112
    color: "rgba(255,255,255,0.45)",
113
    fontWeight: "500",
114
    marginBottom: 4,
115
  },
116
  heroStatValue: {
117
    ...Typography.bodyLg,
118
    fontSize: 20,
119
    color: "#ffffff",
120
  },
121

122
  // Insight cards
123
  insightCardInner: {
124
    flexDirection: "row",
125
    alignItems: "center",
126
    justifyContent: "space-between",
127
    gap: 12,
128
  },
129
  insightCardLeft: {
130
    flex: 1,
131
    gap: 6,
132
  },
133
  insightCategory: {
134
    fontSize: 11,
135
    fontWeight: "600",
136
    letterSpacing: 0.8,
137
    textTransform: "uppercase",
138
    color: Colors.light.textSecondary,
139
  },
140
  insightBody: {
141
    ...Typography.bodyMd,
142
    color: Colors.light.text,
143
  },
144
  insightMetric: {
145
    ...Typography.headlineLg,
146
    fontSize: 22,
147
  },
148
});