Refactor screen names for consistency and rename component files to match updated naming conventions

This commit is contained in:
bobbert committed 2026-03-31 14:28:10 +01:00
1 parent 0a50220d66
commit 8686f0e1ff
31 files changed
+17 -78

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
import React, { useState } from 'react';
import { View, Text, TextInput, Pressable, StyleSheet } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import usePrivateGameViewModel from '../ViewModel/usePrivateGameViewModel';
import ScreenHeader from '../components/ScreenHeader';
const JoinPrivateGamePage = () => {
const navigation = useNavigation();
const { joinCode, error, setJoinCode, joinWithCode } = usePrivateGameViewModel();
const [submitting, setSubmitting] = useState(false);
const handleJoinGame = async () => {
setSubmitting(true);
const group = await joinWithCode();
setSubmitting(false);
if (!group) {
return;
}
navigation.navigate('(routes)/game-lobby');
};
return (
<View style={styles.wrapper}>
<ScreenHeader title="Join Private Game" />
<View style={styles.container}>
<TextInput
style={styles.input}
placeholder="Enter Join Code"
autoCapitalize="characters"
maxLength={6}
value={joinCode}
onChangeText={setJoinCode}
/>
<Pressable style={styles.button} onPress={handleJoinGame}>
<Text style={styles.buttonText}>{submitting ? 'Joining...' : 'Join Game'}</Text>
</Pressable>
{!!error && <Text style={styles.errorText}>{error}</Text>}
</View>
</View>
);
};
const styles = StyleSheet.create({
wrapper: {
flex: 1,
backgroundColor: '#ffffff',
},
container: {
flex: 1,
justifyContent: 'center',
padding: 20,
gap: 12,
},
input: {
borderWidth: 1,
borderColor: '#d1d5db',
borderRadius: 8,
paddingHorizontal: 12,
paddingVertical: 10,
},
button: {
backgroundColor: '#2563eb',
borderRadius: 8,
paddingVertical: 12,
alignItems: 'center',
},
buttonText: {
color: '#ffffff',
fontWeight: '600',
},
errorText: {
color: '#dc2626',
},
});
export default JoinPrivateGamePage;