From 33f73105ad50faa6bf3a1dfb25f937466553391b Mon Sep 17 00:00:00 2001 From: mudabbir-ahmad Date: Tue, 17 Mar 2026 22:22:15 +0000 Subject: [PATCH] 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 --- app/(routes)/admin-hub.tsx | 5 +++++ app/(routes)/game-lobby.tsx | 5 +++++ app/(routes)/game-type.tsx | 5 +++++ app/{ => (routes)}/index.tsx | 1 + app/(routes)/join-private-game.tsx | 5 +++++ app/(routes)/login.tsx | 5 +++++ app/(routes)/manage-private-subtask.tsx | 5 +++++ app/(routes)/manage-subgroups.tsx | 5 +++++ app/(routes)/map.tsx | 5 +++++ app/(routes)/register.tsx | 5 +++++ app/(routes)/team.tsx | 5 +++++ app/Controller/LoginLogic.js | 4 ++-- app/Screens/AdminHubPage.jsx | 6 +++--- app/Screens/GameLobbyPage.jsx | 6 +++--- app/Screens/GameTypePage.jsx | 6 +++--- app/Screens/JoinPrivateGamePage.jsx | 2 +- app/Screens/LoginPage.jsx | 6 +++--- app/Screens/ManagePrivateSubtaskPage.jsx | 4 ++-- app/Screens/RegisterPage.jsx | 4 ++-- app/_layout.tsx | 24 ++++++++++++------------ app/admin-hub.tsx | 4 ---- app/components/AdminFooterNavbar.jsx | 6 +++--- app/components/MemberFooterNavbar.jsx | 6 +++--- app/game-lobby.tsx | 4 ---- app/game-type.tsx | 4 ---- app/join-private-game.tsx | 4 ---- app/login.tsx | 4 ---- app/manage-private-subtask.tsx | 4 ---- app/manage-subgroups.tsx | 4 ---- app/map.tsx | 4 ---- app/register.tsx | 4 ---- app/team.tsx | 4 ---- 32 files changed, 88 insertions(+), 77 deletions(-) create mode 100644 app/(routes)/admin-hub.tsx create mode 100644 app/(routes)/game-lobby.tsx create mode 100644 app/(routes)/game-type.tsx rename app/{ => (routes)}/index.tsx (99%) create mode 100644 app/(routes)/join-private-game.tsx create mode 100644 app/(routes)/login.tsx create mode 100644 app/(routes)/manage-private-subtask.tsx create mode 100644 app/(routes)/manage-subgroups.tsx create mode 100644 app/(routes)/map.tsx create mode 100644 app/(routes)/register.tsx create mode 100644 app/(routes)/team.tsx delete mode 100644 app/admin-hub.tsx delete mode 100644 app/game-lobby.tsx delete mode 100644 app/game-type.tsx delete mode 100644 app/join-private-game.tsx delete mode 100644 app/login.tsx delete mode 100644 app/manage-private-subtask.tsx delete mode 100644 app/manage-subgroups.tsx delete mode 100644 app/map.tsx delete mode 100644 app/register.tsx delete mode 100644 app/team.tsx diff --git a/app/(routes)/admin-hub.tsx b/app/(routes)/admin-hub.tsx new file mode 100644 index 0000000..1c7fcdd --- /dev/null +++ b/app/(routes)/admin-hub.tsx @@ -0,0 +1,5 @@ +import AdminHubPage from '../Screens/AdminHubPage'; + +export default AdminHubPage; + + diff --git a/app/(routes)/game-lobby.tsx b/app/(routes)/game-lobby.tsx new file mode 100644 index 0000000..ec913ba --- /dev/null +++ b/app/(routes)/game-lobby.tsx @@ -0,0 +1,5 @@ +import GameLobbyPage from '../Screens/GameLobbyPage'; + +export default GameLobbyPage; + + diff --git a/app/(routes)/game-type.tsx b/app/(routes)/game-type.tsx new file mode 100644 index 0000000..926d16f --- /dev/null +++ b/app/(routes)/game-type.tsx @@ -0,0 +1,5 @@ +import GameTypePage from '../Screens/GameTypePage'; + +export default GameTypePage; + + diff --git a/app/index.tsx b/app/(routes)/index.tsx similarity index 99% rename from app/index.tsx rename to app/(routes)/index.tsx index a7345f4..05a4473 100644 --- a/app/index.tsx +++ b/app/(routes)/index.tsx @@ -3,3 +3,4 @@ import { Redirect } from "expo-router"; export default function Index() { return ; } + diff --git a/app/(routes)/join-private-game.tsx b/app/(routes)/join-private-game.tsx new file mode 100644 index 0000000..0a0539b --- /dev/null +++ b/app/(routes)/join-private-game.tsx @@ -0,0 +1,5 @@ +import JoinPrivateGamePage from '../Screens/JoinPrivateGamePage'; + +export default JoinPrivateGamePage; + + diff --git a/app/(routes)/login.tsx b/app/(routes)/login.tsx new file mode 100644 index 0000000..fa48979 --- /dev/null +++ b/app/(routes)/login.tsx @@ -0,0 +1,5 @@ +import LoginPage from '../Screens/LoginPage'; + +export default LoginPage; + + diff --git a/app/(routes)/manage-private-subtask.tsx b/app/(routes)/manage-private-subtask.tsx new file mode 100644 index 0000000..b8c57d1 --- /dev/null +++ b/app/(routes)/manage-private-subtask.tsx @@ -0,0 +1,5 @@ +import ManagePrivateSubtaskPage from '../Screens/ManagePrivateSubtaskPage'; + +export default ManagePrivateSubtaskPage; + + diff --git a/app/(routes)/manage-subgroups.tsx b/app/(routes)/manage-subgroups.tsx new file mode 100644 index 0000000..e9ec549 --- /dev/null +++ b/app/(routes)/manage-subgroups.tsx @@ -0,0 +1,5 @@ +import ManageSubgroupsPage from '../Screens/ManageSubgroupsPage'; + +export default ManageSubgroupsPage; + + diff --git a/app/(routes)/map.tsx b/app/(routes)/map.tsx new file mode 100644 index 0000000..fbcc6c7 --- /dev/null +++ b/app/(routes)/map.tsx @@ -0,0 +1,5 @@ +import MapPage from '../Screens/MapPage'; + +export default MapPage; + + diff --git a/app/(routes)/register.tsx b/app/(routes)/register.tsx new file mode 100644 index 0000000..f0e4820 --- /dev/null +++ b/app/(routes)/register.tsx @@ -0,0 +1,5 @@ +import RegisterPage from '../Screens/RegisterPage'; + +export default RegisterPage; + + diff --git a/app/(routes)/team.tsx b/app/(routes)/team.tsx new file mode 100644 index 0000000..7b875c7 --- /dev/null +++ b/app/(routes)/team.tsx @@ -0,0 +1,5 @@ +import TeamPage from '../Screens/TeamPage'; + +export default TeamPage; + + diff --git a/app/Controller/LoginLogic.js b/app/Controller/LoginLogic.js index 7d4adda..ceb2b83 100644 --- a/app/Controller/LoginLogic.js +++ b/app/Controller/LoginLogic.js @@ -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; }; diff --git a/app/Screens/AdminHubPage.jsx b/app/Screens/AdminHubPage.jsx index cdd6389..7f2e776 100644 --- a/app/Screens/AdminHubPage.jsx +++ b/app/Screens/AdminHubPage.jsx @@ -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 = () => { Create a Game - navigation.navigate('game-lobby')}> + navigation.navigate('(routes)/game-lobby')}> Manage Existing Game - navigation.navigate('manage-subgroups')}> + navigation.navigate('(routes)/manage-subgroups')}> Manage Subgroups diff --git a/app/Screens/GameLobbyPage.jsx b/app/Screens/GameLobbyPage.jsx index 44fc92c..da90dbb 100644 --- a/app/Screens/GameLobbyPage.jsx +++ b/app/Screens/GameLobbyPage.jsx @@ -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 = () => { Create Team - navigation.navigate('map')}> + navigation.navigate('(routes)/map')}> Open Map {!!error && {error}} diff --git a/app/Screens/GameTypePage.jsx b/app/Screens/GameTypePage.jsx index 8d76939..e3f39e4 100644 --- a/app/Screens/GameTypePage.jsx +++ b/app/Screens/GameTypePage.jsx @@ -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 ( diff --git a/app/Screens/JoinPrivateGamePage.jsx b/app/Screens/JoinPrivateGamePage.jsx index a291819..9972305 100644 --- a/app/Screens/JoinPrivateGamePage.jsx +++ b/app/Screens/JoinPrivateGamePage.jsx @@ -15,7 +15,7 @@ const JoinPrivateGamePage = () => { if (!group) { return; } - navigation.navigate('game-lobby'); + navigation.navigate('(routes)/game-lobby'); }; return ( diff --git a/app/Screens/LoginPage.jsx b/app/Screens/LoginPage.jsx index d99b25b..18e96a1 100644 --- a/app/Screens/LoginPage.jsx +++ b/app/Screens/LoginPage.jsx @@ -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} /> - navigation.navigate('register')}> + navigation.navigate('(routes)/register')}> Register diff --git a/app/Screens/ManagePrivateSubtaskPage.jsx b/app/Screens/ManagePrivateSubtaskPage.jsx index d560ed4..2b5847f 100644 --- a/app/Screens/ManagePrivateSubtaskPage.jsx +++ b/app/Screens/ManagePrivateSubtaskPage.jsx @@ -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 ( diff --git a/app/Screens/RegisterPage.jsx b/app/Screens/RegisterPage.jsx index 9894610..d4b3bbe 100644 --- a/app/Screens/RegisterPage.jsx +++ b/app/Screens/RegisterPage.jsx @@ -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 = () => { {submitting ? 'Creating...' : 'Create Account'} - navigation.navigate('login')}> + navigation.navigate('(routes)/login')}> Back to Login {!!error && {error}} diff --git a/app/_layout.tsx b/app/_layout.tsx index 0366010..fdf760e 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -2,18 +2,18 @@ import { Stack } from "expo-router"; export default function RootLayout() { return ( - - - - - - - - - - - - + + + + + + + + + + + + ); } diff --git a/app/admin-hub.tsx b/app/admin-hub.tsx deleted file mode 100644 index bdbc094..0000000 --- a/app/admin-hub.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import AdminHubPage from './Screens/AdminHubPage'; - -export default AdminHubPage; - diff --git a/app/components/AdminFooterNavbar.jsx b/app/components/AdminFooterNavbar.jsx index a80f5c3..e24be26 100644 --- a/app/components/AdminFooterNavbar.jsx +++ b/app/components/AdminFooterNavbar.jsx @@ -7,13 +7,13 @@ const AdminFooterNavbar = () => { return ( - navigation.navigate('admin-hub')}> + navigation.navigate('(routes)/admin-hub')}> Admin Hub - navigation.navigate('game-lobby')}> + navigation.navigate('(routes)/game-lobby')}> Manage Game - navigation.navigate('team')}> + navigation.navigate('(routes)/team')}> Manage Team diff --git a/app/components/MemberFooterNavbar.jsx b/app/components/MemberFooterNavbar.jsx index 9b94b70..6b31b8a 100644 --- a/app/components/MemberFooterNavbar.jsx +++ b/app/components/MemberFooterNavbar.jsx @@ -11,13 +11,13 @@ const MemberFooterNavbar = ({ visible = false }) => { return ( - navigation.navigate('game-lobby')}> + navigation.navigate('(routes)/game-lobby')}> Lobby - navigation.navigate('team')}> + navigation.navigate('(routes)/team')}> Team - navigation.navigate('map')}> + navigation.navigate('(routes)/map')}> Map diff --git a/app/game-lobby.tsx b/app/game-lobby.tsx deleted file mode 100644 index 48fb944..0000000 --- a/app/game-lobby.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import GameLobbyPage from './Screens/GameLobbyPage'; - -export default GameLobbyPage; - diff --git a/app/game-type.tsx b/app/game-type.tsx deleted file mode 100644 index fc54b5d..0000000 --- a/app/game-type.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import GameTypePage from './Screens/GameTypePage'; - -export default GameTypePage; - diff --git a/app/join-private-game.tsx b/app/join-private-game.tsx deleted file mode 100644 index c4f80db..0000000 --- a/app/join-private-game.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import JoinPrivateGamePage from './Screens/JoinPrivateGamePage'; - -export default JoinPrivateGamePage; - diff --git a/app/login.tsx b/app/login.tsx deleted file mode 100644 index d5833a6..0000000 --- a/app/login.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import LoginPage from './Screens/LoginPage'; - -export default LoginPage; - diff --git a/app/manage-private-subtask.tsx b/app/manage-private-subtask.tsx deleted file mode 100644 index b7f8a9c..0000000 --- a/app/manage-private-subtask.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import ManagePrivateSubtaskPage from './Screens/ManagePrivateSubtaskPage'; - -export default ManagePrivateSubtaskPage; - diff --git a/app/manage-subgroups.tsx b/app/manage-subgroups.tsx deleted file mode 100644 index 3ebbbeb..0000000 --- a/app/manage-subgroups.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import ManageSubgroupsPage from './Screens/ManageSubgroupsPage'; - -export default ManageSubgroupsPage; - diff --git a/app/map.tsx b/app/map.tsx deleted file mode 100644 index f5ba3cd..0000000 --- a/app/map.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import MapPage from './Screens/MapPage'; - -export default MapPage; - diff --git a/app/register.tsx b/app/register.tsx deleted file mode 100644 index 7664bf4..0000000 --- a/app/register.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import RegisterPage from './Screens/RegisterPage'; - -export default RegisterPage; - diff --git a/app/team.tsx b/app/team.tsx deleted file mode 100644 index c402c24..0000000 --- a/app/team.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import TeamPage from './Screens/TeamPage'; - -export default TeamPage; -