Add create game and manage game pages, update navigation and session handling for individual and business users

This commit is contained in:
bobbert committed 2026-03-17 23:33:30 +00:00
1 parent 1bd640f8d5
commit 6e5fe2b8b8
21 files changed
+831 -137

No files matched your search

+42 -11
View File
@@ -1,12 +1,14 @@
import React from 'react';
import { View, Text, Pressable, StyleSheet } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import {Pressable, ScrollView, StyleSheet, Text, View} from 'react-native';
import {useNavigation} from '@react-navigation/native';
import AdminFooterNavbar from '../components/AdminFooterNavbar';
import useAdminViewModel from '../ViewModel/useAdminViewModel';
import ScreenHeader from '../components/ScreenHeader';
import {getSession} from '../Model/SessionStore';
const AdminHubPage = () => {
const navigation = useNavigation();
const { currentIsBusiness } = getSession();
const { createGame } = useAdminViewModel();
const handleCreateGame = async () => {
@@ -19,19 +21,38 @@ const AdminHubPage = () => {
navigation.navigate('(routes)/game-lobby');
};
if (!currentIsBusiness) {
return (
<View style={styles.wrapper}>
<ScreenHeader title="Admin Hub" />
<View style={styles.container}>
<Text style={styles.message}>
As an individual, your game is managed automatically. You can view and manage your active team from the Game Lobby.
</Text>
<Pressable style={styles.button} onPress={() => navigation.navigate('(routes)/game-lobby')}>
<Text style={styles.buttonText}>Go to Game Lobby</Text>
</Pressable>
</View>
<AdminFooterNavbar />
</View>
);
}
return (
<View style={styles.wrapper}>
<ScreenHeader title="Admin Hub" />
<View style={styles.container}>
<Pressable style={styles.button} onPress={handleCreateGame}>
<Text style={styles.buttonText}>Create a Game</Text>
</Pressable>
<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('(routes)/manage-subgroups')}>
<Text style={styles.buttonText}>Manage Subgroups</Text>
</Pressable>
<ScrollView style={styles.buttonList}>
<Pressable style={styles.button} onPress={handleCreateGame}>
<Text style={styles.buttonText}>Create a Game</Text>
</Pressable>
<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('(routes)/manage-subgroups')}>
<Text style={styles.buttonText}>Manage Subgroups</Text>
</Pressable>
</ScrollView>
</View>
<AdminFooterNavbar />
</View>
@@ -49,11 +70,21 @@ const styles = StyleSheet.create({
padding: 20,
gap: 12,
},
message: {
color: '#4b5563',
fontSize: 15,
lineHeight: 22,
marginBottom: 20,
},
buttonList: {
flex: 1,
},
button: {
backgroundColor: '#2563eb',
borderRadius: 8,
paddingVertical: 12,
alignItems: 'center',
marginBottom: 10,
},
buttonText: {
color: '#ffffff',