mirror of
https://github.com/mudabbir-ahmad/MAD-Treasure-Hunt.git
synced 2026-10-08 03:00:20 +00:00
66 lines
1.8 KiB
React
66 lines
1.8 KiB
React
import React from 'react';
|
|
import { View, Text, Pressable, StyleSheet } from 'react-native';
|
|
import { useNavigation } from '@react-navigation/native';
|
|
import AdminFooterNavbar from '../components/AdminFooterNavbar';
|
|
import useAdminViewModel from '../ViewModel/useAdminViewModel';
|
|
import ScreenHeader from '../components/ScreenHeader';
|
|
|
|
const AdminHubPage = () => {
|
|
const navigation = useNavigation();
|
|
const { createGame } = useAdminViewModel();
|
|
|
|
const handleCreateGame = async () => {
|
|
await createGame({
|
|
groupName: `Admin Game ${Date.now().toString().slice(-4)}`,
|
|
businessOrSchoolName: 'New Business',
|
|
gameType: 'private',
|
|
isBusiness: true,
|
|
});
|
|
navigation.navigate('(routes)/game-lobby');
|
|
};
|
|
|
|
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>
|
|
</View>
|
|
<AdminFooterNavbar />
|
|
</View>
|
|
);
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
wrapper: {
|
|
flex: 1,
|
|
backgroundColor: '#ffffff',
|
|
},
|
|
container: {
|
|
flex: 1,
|
|
justifyContent: 'center',
|
|
padding: 20,
|
|
gap: 12,
|
|
},
|
|
button: {
|
|
backgroundColor: '#2563eb',
|
|
borderRadius: 8,
|
|
paddingVertical: 12,
|
|
alignItems: 'center',
|
|
},
|
|
buttonText: {
|
|
color: '#ffffff',
|
|
fontWeight: '600',
|
|
},
|
|
});
|
|
|
|
export default AdminHubPage;
|
|
|