frontend: new routes and laying some foundational work for mood <-> trigger linking
Parents:
d8d54243 file(s) changed
- frontend/app/(tabs)/actions.tsx +3 -4
- frontend/app/_layout.tsx +31 -0
- frontend/app/triggers/new.tsx +3 -2
frontend/app/(tabs)/actions.tsx
1 1
import { View, Text, StyleSheet } from "react-native";
2 2
import { ThemedText } from "@/components/misc/themed-text";
3 3
import { ThemedView } from "@/components/misc/themed-view";
4 4
import { ScreenLayout } from "@/components/ui/ScreenLayout";
5 5
import { useAuth } from "@/context/AuthContext";
▸ 36 unchanged lines
42 42
></SectionHeader>
43 43
44 44
<Button
45 45
title="Registrar ação de cuidado"
46 46
size="large"
47 -
style={{
48 -
...Shadows.lg,
49 -
}}
47 +
onPress={() => router.push('/care-actions/new')}
48 +
style={{ ...Shadows.lg }}
50 49
/>
51 50
</Section>
52 51
53 -
<Card style={{ padding: Spacing.cardGap, height: 150 }}>
52 +
<Card style={{ padding: Spacing.cardGap, height: 150 }} onPress={() => router.push('/medicine-regimens')}>
54 53
<View style={[styles.cardIcon, { backgroundColor: "#E7FDEF" }]}>
55 54
<Ionicons name="bandage-outline" size={20} color="#13EC5B" />
56 55
</View>
57 56
58 57
<Text style={styles.cardTitleHeadline}>Gerenciar Medicamentos</Text>
▸ 115 unchanged lines
174 173
fontSize: 12,
175 174
lineHeight: 16,
176 175
alignItems: "center",
177 176
},
178 177
});
frontend/app/_layout.tsx
1 1
import {
2 2
DarkTheme,
3 3
DefaultTheme,
4 4
ThemeProvider,
5 5
} from "@react-navigation/native";
▸ 48 unchanged lines
54 54
sheetInitialDetentIndex: 1,
55 55
}}
56 56
/>
57 57
58 58
<Stack.Screen
59 +
name="care-actions/post-appointment"
60 +
options={{ headerShown: false }}
61 +
/>
62 +
63 +
<Stack.Screen
59 64
name="sleep/new"
60 65
options={{
61 66
title: "Registrar Sono",
62 67
}}
63 68
/>
▸ 1 unchanged lines
65 70
<Stack.Screen
66 71
name="triggers/new"
67 72
options={{
68 73
title: "Registrar Gatilho",
69 74
}}
75 +
/>
76 +
77 +
<Stack.Screen
78 +
name="care-actions/new"
79 +
options={{
80 +
presentation: "formSheet",
81 +
title: "Registrar Ação de Cuidado",
82 +
sheetAllowedDetents: [0.25, 0.5, 0.7],
83 +
sheetInitialDetentIndex: 1,
84 +
}}
85 +
/>
86 +
<Stack.Screen
87 +
name="care-actions/medicine"
88 +
options={{ title: "Medicamento" }}
89 +
/>
90 +
<Stack.Screen
91 +
name="care-actions/medicine-new"
92 +
options={{ title: "Novo Medicamento" }}
93 +
/>
94 +
<Stack.Screen
95 +
name="care-actions/appointment"
96 +
options={{ title: "Consulta" }}
97 +
/>
98 +
<Stack.Screen
99 +
name="care-actions/activity"
100 +
options={{ title: "Atividade" }}
70 101
/>
71 102
72 103
<Stack.Screen
73 104
name="notifications"
74 105
options={{
▸ 10 unchanged lines
85 116
</AuthProvider>
86 117
</ThemeProvider>
87 118
</QueryClientProvider>
88 119
);
89 120
}
frontend/app/triggers/new.tsx
1 1
import {
2 2
View,
3 3
Text,
4 4
StyleSheet,
5 5
KeyboardAvoidingView,
6 6
ScrollView,
7 7
} from "react-native";
8 8
import { useState } from "react";
9 -
import { router } from "expo-router";
9 +
import { router, useLocalSearchParams } from "expo-router";
10 10
11 11
import { Card } from "@/components/ui/Cards";
12 12
import { TextArea } from "@/components/ui/Input";
13 13
import { Button } from "@/components/ui/Button";
14 14
import { Section, SectionHeader } from "@/components/ui/Sections";
▸ 15 unchanged lines
30 30
}));
31 31
32 32
export default function NewTrigger() {
33 33
const [moment, setMoment] = useState(new Date());
34 34
const [comment, setComment] = useState("");
35 -
const [category, setCategory] = useState("WORK");
35 +
const { category: initialCategory } = useLocalSearchParams<{ category?: string }>();
36 +
const [category, setCategory] = useState(initialCategory ?? "WORK");
36 37
const createTrigger = useCreateTrigger();
37 38
const [linkMood, setLinkMood] = useState(false);
38 39
const { data: moodEntries, isLoading: isLoadingMood } = useMoodEntries({
39 40
limit: 1,
40 41
});
▸ 167 unchanged lines
208 209
alignItems: "center",
209 210
justifyContent: "center",
210 211
marginTop: 1,
211 212
},
212 213
});