💄 Make stuff sḿoother
Changes
10 files changed, +34 -78
MODIFY
app/(tabs)/calendar.tsx
+1 -1
@@ -113,7 +113,7 @@
113
113
};
114
114
115
115
const handleTaskPress = (task: Task) => {
116
- router.push(`/task/${task.id}`);
116
+ router.push({ pathname: '/modal', params: { taskId: task.id } });
117
117
};
118
118
119
119
const handleAddTask = () => {
MODIFY
app/(tabs)/index.tsx
+3 -3
@@ -60,7 +60,7 @@
60
60
};
61
61
62
62
const handleTaskPress = (task: Task) => {
63
- router.push(`/task/${task.id}`);
63
+ router.push({ pathname: '/modal', params: { taskId: task.id } });
64
64
};
65
65
66
66
const handleAddTask = () => {
@@ -145,7 +145,7 @@
145
145
header: {
146
146
paddingHorizontal: 16,
147
147
paddingTop: 16,
148
- paddingBottom: 20,
148
+ paddingBottom: 8,
149
149
},
150
150
count: {
151
151
fontSize: 14,
@@ -153,7 +153,7 @@
153
153
marginTop: 4,
154
154
},
155
155
filterContainer: {
156
- paddingVertical: 8,
156
+ paddingVertical: 4,
157
157
paddingBottom: 4,
158
158
},
159
159
filterScroll: {
MODIFY
app/(tabs)/today.tsx
+1 -1
@@ -48,7 +48,7 @@
48
48
};
49
49
50
50
const handleTaskPress = (task: Task) => {
51
- router.push(`/task/${task.id}`);
51
+ router.push({ pathname: '/modal', params: { taskId: task.id } });
52
52
};
53
53
54
54
const handleAddTask = () => {
MODIFY
app/_layout.tsx
+10 -4
@@ -19,11 +19,17 @@
19
19
<NavigationThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
20
20
<Stack>
21
21
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
22
- <Stack.Screen name="task/[id]" options={{ headerShown: false }} />
23
22
<Stack.Screen name="project/[id]" options={{ headerShown: false }} />
24
- <Stack.Screen name="archive" options={{ title: 'Archive', headerBackTitle: 'Back' }} />
25
- <Stack.Screen name="webdav-setup" options={{ title: 'WebDAV Setup', headerBackTitle: 'Back' }} />
26
- <Stack.Screen name="modal" options={{ presentation: 'transparentModal', title: 'Modal', headerShown: false }} />
23
+ <Stack.Screen name="archive" options={{ headerShown: false }} />
24
+ <Stack.Screen
25
+ name="modal"
26
+ options={{
27
+ presentation: 'transparentModal',
28
+ animation: 'fade',
29
+ headerShown: false
30
+ }}
31
+ />
32
+ <Stack.Screen name="webdav-setup" options={{ headerShown: false }} />
27
33
</Stack>
28
34
<StatusBar style="auto" />
29
35
</NavigationThemeProvider>
MODIFY
app/archive.tsx
+1 -1
@@ -31,7 +31,7 @@
31
31
};
32
32
33
33
const handleTaskPress = (task: Task) => {
34
- router.push(`/task/${task.id}`);
34
+ router.push({ pathname: '/modal', params: { taskId: task.id } });
35
35
};
36
36
37
37
const handleToggleComplete = async (taskId: string) => {
MODIFY
app/modal.tsx
+3 -4
@@ -1,7 +1,7 @@
1
1
import React, { useRef } from 'react';
2
2
import { StyleSheet, TouchableOpacity, Platform, Dimensions, Keyboard } from 'react-native';
3
3
import { ThemedView } from '@/components/themed-view';
4
-import { router, useRouter } from 'expo-router';
4
+import { router, useRouter, useLocalSearchParams } from 'expo-router';
5
5
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
6
6
import Animated, {
7
7
useSharedValue,
@@ -16,13 +16,12 @@
16
16
const { height: SCREEN_HEIGHT } = Dimensions.get('window');
17
17
18
18
export default function ModalScreen() {
19
- const taskFormRef = useRef<{ handleSave: () => void }>(null);
20
19
const translateY = useSharedValue(0);
21
20
const colorScheme = useColorScheme() ?? 'light';
22
21
const colors = Colors[colorScheme];
22
+ const { taskId } = useLocalSearchParams<{ taskId?: string }>();
23
23
24
24
const handleClose = () => {
25
- taskFormRef.current?.handleSave();
26
25
if (router.canDismiss()) {
27
26
router.dismiss();
28
27
} else if (router.canGoBack()) {
@@ -68,7 +67,7 @@
68
67
<Animated.View style={[styles.modal, animatedStyle]}>
69
68
<ThemedView style={styles.handle} />
70
69
<ThemedView style={{ flex: 1, backgroundColor: colors.background }}>
71
- <TaskForm ref={taskFormRef} id="new" onSave={handleClose} />
70
+ <TaskForm id={taskId ?? 'new'} onSave={handleClose} />
72
71
</ThemedView>
73
72
</Animated.View>
74
73
</GestureDetector>
MODIFY
app/project/[id].tsx
+1 -1
@@ -127,7 +127,7 @@
127
127
};
128
128
129
129
const handleTaskPress = (task: Task) => {
130
- router.push(`/task/${task.id}`);
130
+ router.push({ pathname: '/modal', params: { taskId: task.id } });
131
131
};
132
132
133
133
const handleAddTask = () => {
DELETE
app/task/[id].tsx
+0 -56
@@ -1,56 +0,0 @@
1
-import React from 'react';
2
-import { StyleSheet, TouchableOpacity } from 'react-native';
3
-import { SafeAreaView } from 'react-native-safe-area-context';
4
-import { router, useLocalSearchParams } from 'expo-router';
5
-import { ThemedView } from '@/components/themed-view';
6
-import { ThemedText } from '@/components/themed-text';
7
-import { TaskForm } from '@/components/task-form';
8
-import { Colors } from '@/constants/theme';
9
-import { useColorScheme } from '@/hooks/use-color-scheme';
10
-
11
-export default function TaskDetailScreen() {
12
- const { id } = useLocalSearchParams<{ id: string }>();
13
- const isNew = id === 'new';
14
- const colorScheme = useColorScheme() ?? 'light';
15
- const colors = Colors[colorScheme];
16
-
17
- const handleSave = () => {
18
- // This will be handled by the TaskForm's internal save
19
- };
20
-
21
- return (
22
- <SafeAreaView style={styles.container}>
23
- <ThemedView style={[styles.header, { borderBottomColor: colors.border }]}>
24
- <TouchableOpacity onPress={() => router.back()}>
25
- <ThemedText style={[styles.cancelButton, { color: colors.subtitle }]}>Cancel</ThemedText>
26
- </TouchableOpacity>
27
- <ThemedText type="defaultSemiBold">{isNew ? 'New Task' : 'Edit Task'}</ThemedText>
28
- <TouchableOpacity onPress={handleSave}>
29
- <ThemedText style={[styles.saveButton, { color: colors.tint }]}>Save</ThemedText>
30
- </TouchableOpacity>
31
- </ThemedView>
32
-
33
- <TaskForm id={id} onSave={() => router.back()} onClose={() => router.back()} />
34
- </SafeAreaView>
35
- );
36
-}
37
-
38
-const styles = StyleSheet.create({
39
- container: {
40
- flex: 1,
41
- },
42
- header: {
43
- flexDirection: 'row',
44
- justifyContent: 'space-between',
45
- alignItems: 'center',
46
- paddingHorizontal: 16,
47
- paddingVertical: 12,
48
- borderBottomWidth: StyleSheet.hairlineWidth,
49
- },
50
- cancelButton: {
51
- fontWeight: '400',
52
- },
53
- saveButton: {
54
- fontWeight: '600',
55
- },
56
-});
MODIFY
components/swipeable-tab-bar.tsx
+7 -3
@@ -20,7 +20,13 @@
20
20
const insets = useSafeAreaInsets();
21
21
22
22
return (
23
- <View style={[styles.tabBar, { height: 60 + insets.bottom, paddingBottom: insets.bottom }]}>
23
+ <View style={[styles.tabBar, {
24
+ height: 60 + insets.bottom,
25
+ paddingBottom: insets.bottom,
26
+ backgroundColor: colors.background,
27
+ borderTopWidth: 1,
28
+ borderTopColor: colors.border,
29
+ }]}>
24
30
{navigationState.routes.map((route, i) => {
25
31
const isFocused = navigationState.index === i;
26
32
const iconName = isFocused ? iconMap[route.key].focused : iconMap[route.key].unfocused;
@@ -33,7 +39,6 @@
33
39
style={styles.tabItem}
34
40
>
35
41
<Ionicons name={iconName} size={24} color={color} />
36
- <ThemedText style={{ color, fontSize: 10 }}>{route.title}</ThemedText>
37
42
</TouchableOpacity>
38
43
);
39
44
})}
@@ -44,7 +49,6 @@
44
49
const styles = StyleSheet.create({
45
50
tabBar: {
46
51
flexDirection: 'row',
47
- backgroundColor: 'transparent',
48
52
},
49
53
tabItem: {
50
54
flex: 1,
MODIFY
components/task-form.tsx
+7 -4
@@ -11,7 +11,7 @@
11
11
12
12
interface TaskFormProps {
13
13
id?: string;
14
- onSave?: (task: Partial<Task>) => void;
14
+ onSave?: (taskId: string) => void;
15
15
onClose?: () => void;
16
16
}
17
17
@@ -77,13 +77,16 @@
77
77
}
78
78
79
79
try {
80
+ let savedTask: Task | undefined;
80
81
if (isNew) {
81
- await taskService.createTask(task);
82
+ savedTask = await taskService.createTask(task);
82
83
} else if (id) {
83
- await taskService.updateTask(id, task);
84
+ savedTask = await taskService.updateTask(id, task);
84
85
}
85
86
86
- onSave?.(task);
87
+ if (savedTask) {
88
+ onSave?.(savedTask.id);
89
+ }
87
90
} catch (error) {
88
91
Alert.alert('Error', 'Failed to save task');
89
92
}