Refactor navigation routes to include prefix and add new page components for admin hub, game lobby, game type, join private game, manage private subtask, manage subgroups, and team

This commit is contained in:
bobbert committed 2026-03-17 22:22:15 +00:00
1 parent 884f9e818b
commit 33f73105ad
32 files changed
+88 -77

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
import AdminHubPage from '../Screens/AdminHubPage';
export default AdminHubPage;
+5
View File
@@ -0,0 +1,5 @@
import GameLobbyPage from '../Screens/GameLobbyPage';
export default GameLobbyPage;
+5
View File
@@ -0,0 +1,5 @@
import GameTypePage from '../Screens/GameTypePage';
export default GameTypePage;
+1
View File
@@ -3,3 +3,4 @@ import { Redirect } from "expo-router";
export default function Index() {
return <Redirect href="/login" />;
}
+5
View File
@@ -0,0 +1,5 @@
import JoinPrivateGamePage from '../Screens/JoinPrivateGamePage';
export default JoinPrivateGamePage;
+5
View File
@@ -0,0 +1,5 @@
import LoginPage from '../Screens/LoginPage';
export default LoginPage;
+5
View File
@@ -0,0 +1,5 @@
import ManagePrivateSubtaskPage from '../Screens/ManagePrivateSubtaskPage';
export default ManagePrivateSubtaskPage;
+5
View File
@@ -0,0 +1,5 @@
import ManageSubgroupsPage from '../Screens/ManageSubgroupsPage';
export default ManageSubgroupsPage;
+5
View File
@@ -0,0 +1,5 @@
import MapPage from '../Screens/MapPage';
export default MapPage;
+5
View File
@@ -0,0 +1,5 @@
import RegisterPage from '../Screens/RegisterPage';
export default RegisterPage;
+5
View File
@@ -0,0 +1,5 @@
import TeamPage from '../Screens/TeamPage';
export default TeamPage;
+2 -2
View File
@@ -12,11 +12,11 @@ const useLoginLogic = () => {
}
if (email.trim().toLowerCase().includes('admin')) {
navigation.navigate('admin-hub');
navigation.navigate('(routes)/admin-hub');
return true;
}
navigation.navigate('game-type');
navigation.navigate('(routes)/game-type');
return true;
};
+3 -3
View File
@@ -15,7 +15,7 @@ const AdminHubPage = () => {
gameType: 'private',
isBusiness: true,
});
navigation.navigate('game-lobby');
navigation.navigate('(routes)/game-lobby');
};
return (
@@ -25,10 +25,10 @@ const AdminHubPage = () => {
<Pressable style={styles.button} onPress={handleCreateGame}>
<Text style={styles.buttonText}>Create a Game</Text>
</Pressable>
<Pressable style={styles.button} onPress={() => navigation.navigate('game-lobby')}>
<Pressable style={styles.button} onPress={() => navigation.navigate('(routes)/game-lobby')}>
<Text style={styles.buttonText}>Manage Existing Game</Text>
</Pressable>
<Pressable style={styles.button} onPress={() => navigation.navigate('manage-subgroups')}>
<Pressable style={styles.button} onPress={() => navigation.navigate('(routes)/manage-subgroups')}>
<Text style={styles.buttonText}>Manage Subgroups</Text>
</Pressable>
</View>
+3 -3
View File
@@ -17,7 +17,7 @@ const GameLobbyPage = () => {
return;
}
setHasTeam(true);
navigation.navigate('team');
navigation.navigate('(routes)/team');
};
const handleJoinTeam = async () => {
@@ -26,7 +26,7 @@ const GameLobbyPage = () => {
return;
}
setHasTeam(true);
navigation.navigate('team');
navigation.navigate('(routes)/team');
};
return (
@@ -47,7 +47,7 @@ const GameLobbyPage = () => {
<Pressable style={styles.primaryButton} onPress={handleCreateTeam}>
<Text style={styles.buttonText}>Create Team</Text>
</Pressable>
<Pressable style={styles.secondaryButton} onPress={() => navigation.navigate('map')}>
<Pressable style={styles.secondaryButton} onPress={() => navigation.navigate('(routes)/map')}>
<Text style={styles.buttonText}>Open Map</Text>
</Pressable>
{!!error && <Text style={styles.errorText}>{error}</Text>}
+3 -3
View File
@@ -9,14 +9,14 @@ const GameTypePage = () => {
const navigateByType = (label) => {
if (label === 'Join Global Game') {
navigation.navigate('game-lobby');
navigation.navigate('(routes)/game-lobby');
return;
}
if (label === 'Join Private Game') {
navigation.navigate('join-private-game');
navigation.navigate('(routes)/join-private-game');
return;
}
navigation.navigate('manage-private-subtask');
navigation.navigate('(routes)/manage-private-subtask');
};
return (
+1 -1
View File
@@ -15,7 +15,7 @@ const JoinPrivateGamePage = () => {
if (!group) {
return;
}
navigation.navigate('game-lobby');
navigation.navigate('(routes)/game-lobby');
};
return (
+3 -3
View File
@@ -23,10 +23,10 @@ const LoginPage = () => {
return;
}
if (user.SGid === 0) {
navigation.navigate('admin-hub');
navigation.navigate('(routes)/admin-hub');
return;
}
navigation.navigate('game-type');
navigation.navigate('(routes)/game-type');
};
return (
@@ -48,7 +48,7 @@ const LoginPage = () => {
onChangeText={setPassword}
/>
<View style={styles.row}>
<Pressable style={styles.leftButton} onPress={() => navigation.navigate('register')}>
<Pressable style={styles.leftButton} onPress={() => navigation.navigate('(routes)/register')}>
<Text style={styles.buttonText}>Register</Text>
</Pressable>
<Pressable style={styles.rightButton} onPress={handleLogin}>
+2 -2
View File
@@ -21,7 +21,7 @@ const ManagePrivateSubtaskPage = () => {
if (!group) {
return;
}
navigation.navigate('admin-hub');
navigation.navigate('(routes)/admin-hub');
};
const handleJoinAdmin = async () => {
@@ -31,7 +31,7 @@ const ManagePrivateSubtaskPage = () => {
if (!response) {
return;
}
navigation.navigate('admin-hub');
navigation.navigate('(routes)/admin-hub');
};
return (
+2 -2
View File
@@ -28,7 +28,7 @@ const RegisterPage = () => {
if (!user) {
return;
}
navigation.navigate(user.SGid === 0 ? 'admin-hub' : 'game-type');
navigation.navigate(user.SGid === 0 ? '(routes)/admin-hub' : '(routes)/game-type');
};
return (
@@ -68,7 +68,7 @@ const RegisterPage = () => {
<Pressable style={styles.submitButton} onPress={handleRegister}>
<Text style={styles.submitText}>{submitting ? 'Creating...' : 'Create Account'}</Text>
</Pressable>
<Pressable onPress={() => navigation.navigate('login')}>
<Pressable onPress={() => navigation.navigate('(routes)/login')}>
<Text style={styles.backText}>Back to Login</Text>
</Pressable>
{!!error && <Text style={styles.errorText}>{error}</Text>}
+12 -12
View File
@@ -2,18 +2,18 @@ import { Stack } from "expo-router";
export default function RootLayout() {
return (
<Stack initialRouteName="index">
<Stack.Screen name="index" options={{ headerShown: false }} />
<Stack.Screen name="login" options={{ title: "Login" }} />
<Stack.Screen name="register" options={{ title: "Register" }} />
<Stack.Screen name="game-type" options={{ title: "Select Game Type" }} />
<Stack.Screen name="join-private-game" options={{ title: "Join Private Game" }} />
<Stack.Screen name="manage-private-subtask" options={{ title: "Manage Private Game" }} />
<Stack.Screen name="game-lobby" options={{ title: "Game Lobby" }} />
<Stack.Screen name="team" options={{ title: "Team" }} />
<Stack.Screen name="map" options={{ title: "Map" }} />
<Stack.Screen name="admin-hub" options={{ title: "Admin Hub" }} />
<Stack.Screen name="manage-subgroups" options={{ title: "Manage Subgroups" }} />
<Stack initialRouteName="(routes)/index">
<Stack.Screen name="(routes)/index" options={{ headerShown: false }} />
<Stack.Screen name="(routes)/login" options={{ title: "Login" }} />
<Stack.Screen name="(routes)/register" options={{ title: "Register" }} />
<Stack.Screen name="(routes)/game-type" options={{ title: "Select Game Type" }} />
<Stack.Screen name="(routes)/join-private-game" options={{ title: "Join Private Game" }} />
<Stack.Screen name="(routes)/manage-private-subtask" options={{ title: "Manage Private Game" }} />
<Stack.Screen name="(routes)/game-lobby" options={{ title: "Game Lobby" }} />
<Stack.Screen name="(routes)/team" options={{ title: "Team" }} />
<Stack.Screen name="(routes)/map" options={{ title: "Map" }} />
<Stack.Screen name="(routes)/admin-hub" options={{ title: "Admin Hub" }} />
<Stack.Screen name="(routes)/manage-subgroups" options={{ title: "Manage Subgroups" }} />
</Stack>
);
}
-4
View File
@@ -1,4 +0,0 @@
import AdminHubPage from './Screens/AdminHubPage';
export default AdminHubPage;
+3 -3
View File
@@ -7,13 +7,13 @@ const AdminFooterNavbar = () => {
return (
<View style={styles.container}>
<Pressable style={styles.button} onPress={() => navigation.navigate('admin-hub')}>
<Pressable style={styles.button} onPress={() => navigation.navigate('(routes)/admin-hub')}>
<Text style={styles.text}>Admin Hub</Text>
</Pressable>
<Pressable style={styles.button} onPress={() => navigation.navigate('game-lobby')}>
<Pressable style={styles.button} onPress={() => navigation.navigate('(routes)/game-lobby')}>
<Text style={styles.text}>Manage Game</Text>
</Pressable>
<Pressable style={styles.button} onPress={() => navigation.navigate('team')}>
<Pressable style={styles.button} onPress={() => navigation.navigate('(routes)/team')}>
<Text style={styles.text}>Manage Team</Text>
</Pressable>
</View>
+3 -3
View File
@@ -11,13 +11,13 @@ const MemberFooterNavbar = ({ visible = false }) => {
return (
<View style={styles.container}>
<Pressable style={styles.button} onPress={() => navigation.navigate('game-lobby')}>
<Pressable style={styles.button} onPress={() => navigation.navigate('(routes)/game-lobby')}>
<Text style={styles.text}>Lobby</Text>
</Pressable>
<Pressable style={styles.button} onPress={() => navigation.navigate('team')}>
<Pressable style={styles.button} onPress={() => navigation.navigate('(routes)/team')}>
<Text style={styles.text}>Team</Text>
</Pressable>
<Pressable style={styles.button} onPress={() => navigation.navigate('map')}>
<Pressable style={styles.button} onPress={() => navigation.navigate('(routes)/map')}>
<Text style={styles.text}>Map</Text>
</Pressable>
</View>
-4
View File
@@ -1,4 +0,0 @@
import GameLobbyPage from './Screens/GameLobbyPage';
export default GameLobbyPage;
-4
View File
@@ -1,4 +0,0 @@
import GameTypePage from './Screens/GameTypePage';
export default GameTypePage;
-4
View File
@@ -1,4 +0,0 @@
import JoinPrivateGamePage from './Screens/JoinPrivateGamePage';
export default JoinPrivateGamePage;
-4
View File
@@ -1,4 +0,0 @@
import LoginPage from './Screens/LoginPage';
export default LoginPage;
-4
View File
@@ -1,4 +0,0 @@
import ManagePrivateSubtaskPage from './Screens/ManagePrivateSubtaskPage';
export default ManagePrivateSubtaskPage;
-4
View File
@@ -1,4 +0,0 @@
import ManageSubgroupsPage from './Screens/ManageSubgroupsPage';
export default ManageSubgroupsPage;
-4
View File
@@ -1,4 +0,0 @@
import MapPage from './Screens/MapPage';
export default MapPage;
-4
View File
@@ -1,4 +0,0 @@
import RegisterPage from './Screens/RegisterPage';
export default RegisterPage;
-4
View File
@@ -1,4 +0,0 @@
import TeamPage from './Screens/TeamPage';
export default TeamPage;