In the node app you can select the player, it is a bit confusing when users try to start a game and It also has a disadvantage because the second player could enter to a player1’s room, so I think is better to have a username text field to avoid to enter to the wrong room.
Necessary changes:
Remove the selectors in the home.tsx file
Create an input field instead
Adjust the handlePlayerForNewGameChange function to set the setPlayerForNewGame variable properly
Update the interface of players on the file components/game/types.ts
Update the useRedirectToGame, GamePage, GameContextProvider functions to allow string instead of int as player
Save the player1 and player2 name in the database
Check if there are other functions that receive the player as int
Check the impact of changing the player as a string in the database and refactor it in case of finding inconsistencies.
In the node app you can select the player, it is a bit confusing when users try to start a game and It also has a disadvantage because the second player could enter to a player1’s room, so I think is better to have a username text field to avoid to enter to the wrong room.![image](https://user-images.githubusercontent.com/16298508/190508086-c13d6291-a22d-468e-b663-508a52c5926f.png)
Necessary changes: