import { useGameRepairMutation, useGameResetMutation, useGameStartMutation, useGameStopMutation, useGameSwitchPlayerMutation } from '@/hooks/mutations/useGameMutation' import { useAuth } from '@/hooks/useAuth' import { useGame, useUpdateGameState } from '@/hooks/useGame' import { useRouter } from 'expo-router' import { useState } from 'react' import { Button, Dialog, FAB, List, Portal, Surface, Text } from 'react-native-paper' export default function HistoryScreen() { const router = useRouter() const auth = useAuth() const game = useGame() const updateGameState = useUpdateGameState() const gameStartMutation = useGameStartMutation({ auth, updateGameState, }) const gameStopMutation = useGameStopMutation({ auth, updateGameState, }) const gameSwitchMutation = useGameSwitchPlayerMutation({ auth, updateGameState, }) const gameRepairMutation = useGameRepairMutation({ auth, updateGameState, }) const gameResetMutation = useGameResetMutation({ auth, updateGameState, }) const [resetConfirmVisible, setResetConfirmVisible] = useState(false) return ( router.navigate('/login')} />} onPress={() => router.navigate('/login')} /> } onPress={() => gameStartMutation.mutate()} /> } onPress={() => gameStopMutation.mutate()} /> } onPress={() => gameSwitchMutation.mutate()} /> } onPress={() => gameRepairMutation.mutate()} /> } onPress={() => setResetConfirmVisible(true)} /> setResetConfirmVisible(false)}> Confirmer Cette action va réinitialiser TOUTES les données de jeu : l'historique des positions, les défis réalisés et les trains empruntés. Êtes-vous réellement sûr⋅e de vouloir tout supprimer ? ) }