diff --git a/redux/GamesSlice.ts b/redux/GamesSlice.ts index c52a4dd5..09484f54 100644 --- a/redux/GamesSlice.ts +++ b/redux/GamesSlice.ts @@ -56,6 +56,17 @@ const gamesSlice = createSlice({ }, gameDelete(state, action: PayloadAction) { gamesAdapter.removeOne(state, action.payload); + }, + reorderPlayers(state, action: PayloadAction<{ gameId: string, playerIds: string[]; }>) { + const game = state.entities[action.payload.gameId]; + if (!game) { return; } + + gamesAdapter.updateOne(state, { + id: action.payload.gameId, + changes: { + playerIds: action.payload.playerIds, + } + }); } } }); @@ -179,6 +190,7 @@ export const { roundPrevious, gameSave, gameDelete, + reorderPlayers, } = gamesSlice.actions; export default gamesSlice.reducer; diff --git a/src/screens/EditPlayerScreen.tsx b/src/screens/EditPlayerScreen.tsx index 6cf61db3..d42011f9 100644 --- a/src/screens/EditPlayerScreen.tsx +++ b/src/screens/EditPlayerScreen.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { RouteProp } from '@react-navigation/native'; import { StyleSheet, Text, View } from 'react-native'; -import { Input } from 'react-native-elements'; +import { Button, Input } from 'react-native-elements'; import { palette } from '../constants'; @@ -30,11 +30,6 @@ const EditPlayerScreen: React.FC = ({ return ( - Edit Player Screen - - {index + 1} - - = ({ inputContainerStyle={{ borderBottomWidth: 0 }} /> +