Skip to content

Commit 0b0d6bd

Browse files
committed
Refactor Game and Home screens for improved navigation and layout
- Updated HomeScreen to remove unnecessary time parameter in routing for singleplayer mode. - Modified GameScreen to replace the back navigation with a direct route to the home screen. - Enhanced layout adjustments in GameScreen and ResultsScreen for better responsiveness and padding based on device insets.
1 parent b1ae0db commit 0b0d6bd

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

mobile/app/(tabs)/home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export default function HomeScreen() {
157157
case 'singleplayer':
158158
router.push({
159159
pathname: '/game/[id]',
160-
params: { id: 'singleplayer', map: 'all', rounds: '5', time: '60' },
160+
params: { id: 'singleplayer', map: 'all', rounds: '5' },
161161
});
162162
break;
163163
case 'rankedDuel':

mobile/app/game/[id].tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default function GameScreen() {
6868
const router = useRouter();
6969
const { width, height } = useWindowDimensions();
7070
const insets = useSafeAreaInsets();
71+
const isSingleplayer = id === 'singleplayer';
7172

7273
const [isLoading, setIsLoading] = useState(true);
7374
const [loadError, setLoadError] = useState<string | null>(null);
@@ -344,7 +345,7 @@ export default function GameScreen() {
344345
}, [gameState, router]);
345346

346347
const handleQuit = () => {
347-
router.back();
348+
router.replace('/(tabs)/home');
348349
};
349350

350351
const getPointsColor = (pts: number) => {
@@ -395,9 +396,9 @@ export default function GameScreen() {
395396
/>
396397
</View>
397398

398-
{/* Timer pill - top right, matching web .timer styling */}
399+
{/* Round/score pill - top right */}
399400
{!gameState.isShowingResult && (
400-
<SafeAreaView style={styles.timerContainer} edges={['top']} pointerEvents="box-none">
401+
<SafeAreaView style={[styles.timerContainer, { paddingRight: Math.max(insets.right, spacing.lg) }]} edges={['top']} pointerEvents="box-none">
401402
<View style={styles.timerPill}>
402403
<Text style={styles.timerText}>
403404
Round {gameState.currentRound}/{gameState.totalRounds}
@@ -406,16 +407,18 @@ export default function GameScreen() {
406407
{gameState.totalScore.toLocaleString()} pts
407408
</Text>
408409
</View>
409-
<GameTimer
410-
timeRemaining={gameState.timePerRound}
411-
onTimeUp={handleTimeUp}
412-
isPaused={gameState.isShowingResult}
413-
/>
410+
{!isSingleplayer && (
411+
<GameTimer
412+
timeRemaining={gameState.timePerRound}
413+
onTimeUp={handleTimeUp}
414+
isPaused={gameState.isShowingResult}
415+
/>
416+
)}
414417
</SafeAreaView>
415418
)}
416419

417420
{/* Close button - top left */}
418-
<SafeAreaView style={styles.closeButtonContainer} edges={['top']} pointerEvents="box-none">
421+
<SafeAreaView style={[styles.closeButtonContainer, { paddingLeft: Math.max(insets.left, spacing.lg) }]} edges={['top']} pointerEvents="box-none">
419422
<Pressable
420423
style={({ pressed }) => [
421424
styles.closeButton,
@@ -459,7 +462,7 @@ export default function GameScreen() {
459462
<Animated.View
460463
style={[
461464
styles.mapButtonsRow,
462-
{ bottom: height * 0.7 + 8 },
465+
{ bottom: height * 0.7 + 8, paddingHorizontal: Math.max(insets.right, spacing.md) },
463466
{
464467
opacity: mapBtnsAnim,
465468
transform: [{
@@ -525,6 +528,7 @@ export default function GameScreen() {
525528
{
526529
transform: [{ scale: fabScaleAnim }],
527530
bottom: Math.max(insets.bottom, 20) + 20,
531+
right: Math.max(insets.right, 20),
528532
},
529533
]}
530534
>
@@ -554,6 +558,8 @@ export default function GameScreen() {
554558
{
555559
transform: [{ translateY: bannerSlideAnim }],
556560
paddingBottom: Math.max(insets.bottom, spacing.lg),
561+
paddingLeft: insets.left,
562+
paddingRight: insets.right,
557563
},
558564
]}
559565
>

mobile/app/game/results.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
Platform,
1111
useWindowDimensions,
1212
} from 'react-native';
13-
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
13+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
1414
import { useLocalSearchParams, useRouter } from 'expo-router';
1515
import { Ionicons } from '@expo/vector-icons';
1616
import { LinearGradient } from 'expo-linear-gradient';
@@ -548,8 +548,7 @@ export default function GameResultsScreen() {
548548
</View>
549549

550550
{/* Sidebar — matches web .game-summary-sidebar */}
551-
<SafeAreaView
552-
edges={['top', 'bottom', 'right']}
551+
<View
553552
style={[styles.sidebar, { width: SIDEBAR_WIDTH }]}
554553
>
555554
<LinearGradient
@@ -568,7 +567,7 @@ export default function GameResultsScreen() {
568567
{renderRoundsList()}
569568
</ScrollView>
570569
</LinearGradient>
571-
</SafeAreaView>
570+
</View>
572571
</View>
573572
</View>
574573
);

spec-claude/01-overview.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# WorldGuessr - Overview & Architecture
2-
Hi Claude, today we will primarily be working on stuff for the WorldGuessr mobile app located in the mobile/ folder of this directory. To
3-
get more context about this project please read the files in spec-claude/ which are a good starting place to understand this proj. I
4-
suggest you take a bit of time to immerse yourself with that and the codebase in mobile/ first and we will proceed!
2+
n
53

64
## What is WorldGuessr
75
- Free GeoGuessr alternative web game

0 commit comments

Comments
 (0)