Skip to content

Commit d7a4b51

Browse files
committed
Refactor to feature folders
1 parent 825a6e6 commit d7a4b51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+447
-452
lines changed

apps/mobile/src/app/(tabs)/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function ConversationsScreen() {
1010
const router = useRouter();
1111

1212
const handleConversationPress = (conversation: ConversationDetail) => {
13-
router.push(`/conversation/${conversation.id}`);
13+
router.push(`/chat/${conversation.id}`);
1414
};
1515

1616
const handleNewChat = () => {

apps/mobile/src/app/(tabs)/settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { router } from "expo-router";
22
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
3-
import { useAuthStore } from "../../stores/authStore";
3+
import { useAuthStore } from "../../features/auth";
44

55
export default function SettingsScreen() {
66
const { logout, cloudRegion } = useAuthStore();

apps/mobile/src/app/(tabs)/tasks.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { useRouter } from "expo-router";
22
import { Pressable, View } from "react-native";
33
import { Text } from "../../components/text";
4-
import { TaskList } from "../../features/tasks/components/TaskList";
4+
import { TaskList } from "../../features/tasks";
55

66
export default function TasksScreen() {
77
const router = useRouter();
88

99
const handleCreateTask = () => {
10-
router.push("/agent");
10+
router.push("/task");
11+
};
12+
13+
const handleTaskPress = (taskId: string) => {
14+
router.push(`/task/${taskId}`);
1115
};
1216

1317
return (
@@ -31,7 +35,7 @@ export default function TasksScreen() {
3135
</View>
3236

3337
{/* Task List */}
34-
<TaskList />
38+
<TaskList onTaskPress={handleTaskPress} />
3539
</View>
3640
);
3741
}

apps/mobile/src/app/_layout.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useEffect } from "react";
77
import { ActivityIndicator, View } from "react-native";
88
import { KeyboardProvider } from "react-native-keyboard-controller";
99
import { SafeAreaProvider } from "react-native-safe-area-context";
10-
import { useAuthStore } from "../stores/authStore";
10+
import { useAuthStore } from "../features/auth";
1111

1212
const queryClient = new QueryClient();
1313

@@ -36,8 +36,10 @@ function RootLayoutNav() {
3636
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
3737
<Stack.Screen name="auth" options={{ headerShown: false }} />
3838
<Stack.Screen name="index" options={{ headerShown: false }} />
39+
40+
{/* Chat routes - regular stack navigation */}
3941
<Stack.Screen
40-
name="chat"
42+
name="chat/index"
4143
options={{
4244
headerShown: true,
4345
headerBackTitle: "",
@@ -46,15 +48,35 @@ function RootLayoutNav() {
4648
}}
4749
/>
4850
<Stack.Screen
49-
name="agent"
51+
name="chat/[id]"
5052
options={{
5153
headerShown: true,
52-
title: "New task",
5354
headerBackTitle: "Back",
5455
headerStyle: { backgroundColor: "#09090b" },
56+
headerTintColor: "#fff",
57+
}}
58+
/>
59+
60+
{/* Task routes - modal presentation */}
61+
<Stack.Screen
62+
name="task/index"
63+
options={{
64+
presentation: "modal",
65+
headerShown: true,
66+
title: "New Task",
67+
headerStyle: { backgroundColor: "#09090b" },
5568
headerTintColor: "#f97316",
5669
}}
5770
/>
71+
<Stack.Screen
72+
name="task/[id]"
73+
options={{
74+
presentation: "modal",
75+
headerShown: true,
76+
headerStyle: { backgroundColor: "#09090b" },
77+
headerTintColor: "#fff",
78+
}}
79+
/>
5880
</Stack>
5981
);
6082
}

apps/mobile/src/app/agent.tsx

Lines changed: 0 additions & 154 deletions
This file was deleted.

apps/mobile/src/app/auth.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { router } from "expo-router";
22
import { useState } from "react";
33
import { ActivityIndicator, Text, TouchableOpacity, View } from "react-native";
44
import { SafeAreaView } from "react-native-safe-area-context";
5-
import { useAuthStore } from "../stores/authStore";
6-
import type { CloudRegion } from "../types/oauth";
5+
import { type CloudRegion, useAuthStore } from "../features/auth";
76

87
const REGIONS: { value: CloudRegion; label: string }[] = [
98
{ value: "us", label: "US Cloud" },
Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ import {
99
} from "react-native";
1010
import Animated, { useAnimatedStyle } from "react-native-reanimated";
1111
import { useSafeAreaInsets } from "react-native-safe-area-context";
12-
import { ChatInput } from "../../components/ChatInput";
13-
import { MessagesList } from "../../components/MessagesList";
14-
import { useGradualAnimation } from "../../hooks/useGradualAnimation";
15-
import { useMaxStore } from "../../stores/maxStore";
12+
import {
13+
ChatInput,
14+
MessagesList,
15+
useChatStore,
16+
useGradualAnimation,
17+
} from "../../features/chat";
1618

17-
export default function ConversationDetailScreen() {
19+
export default function ChatDetailScreen() {
1820
const { id } = useLocalSearchParams<{ id: string }>();
1921
const router = useRouter();
2022
const insets = useSafeAreaInsets();
@@ -29,7 +31,7 @@ export default function ConversationDetailScreen() {
2931
stopGeneration,
3032
loadConversation,
3133
resetThread,
32-
} = useMaxStore();
34+
} = useChatStore();
3335

3436
useEffect(() => {
3537
if (!id) return;
@@ -53,6 +55,13 @@ export default function ConversationDetailScreen() {
5355
[askMax, id],
5456
);
5557

58+
const handleOpenTask = useCallback(
59+
(taskId: string) => {
60+
router.push(`/task/${taskId}`);
61+
},
62+
[router],
63+
);
64+
5665
const headerRight = useCallback(() => {
5766
if (streamingActive) {
5867
return (
@@ -138,6 +147,7 @@ export default function ConversationDetailScreen() {
138147
<MessagesList
139148
messages={thread}
140149
streamingActive={streamingActive}
150+
onOpenTask={handleOpenTask}
141151
contentContainerStyle={{
142152
paddingTop: 80 + insets.bottom,
143153
paddingBottom: 16,
@@ -153,3 +163,4 @@ export default function ConversationDetailScreen() {
153163
</>
154164
);
155165
}
166+
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ import { useCallback } from "react";
33
import { Text, TouchableOpacity, View } from "react-native";
44
import Animated, { useAnimatedStyle } from "react-native-reanimated";
55
import { useSafeAreaInsets } from "react-native-safe-area-context";
6-
import { ChatInput } from "../components/ChatInput";
7-
import { MessagesList } from "../components/MessagesList";
8-
import { useGradualAnimation } from "../hooks/useGradualAnimation";
9-
import { useMaxStore } from "../stores/maxStore";
6+
import {
7+
ChatInput,
8+
MessagesList,
9+
useChatStore,
10+
useGradualAnimation,
11+
} from "../../features/chat";
1012

11-
export default function ChatScreen() {
13+
export default function NewChatScreen() {
1214
const insets = useSafeAreaInsets();
1315
const { thread, streamingActive, askMax, stopGeneration, resetThread } =
14-
useMaxStore();
16+
useChatStore();
1517

1618
const handleSend = useCallback(
1719
async (message: string) => {

apps/mobile/src/app/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Redirect } from "expo-router";
2-
import { useAuthStore } from "../stores/authStore";
2+
import { useAuthStore } from "../features/auth";
33

44
export default function Index() {
55
const { isAuthenticated } = useAuthStore();

0 commit comments

Comments
 (0)