alex-bezek / cartesia

Server and UI for cartersia
1 stars 0 forks source link

Create game lobby view #7

Open alex-bezek opened 5 years ago

alex-bezek commented 5 years ago

We need a page component that will show the data of a game lobby.

Currently, the app component checks if they are authenticated and if so direct them to game list. Enhance this to be a HOC to use to wrap multiple components (look up the authentication HOC from the amplify product )

Might need to implement the game state and join game functionality to test. Or can break out into its own issue.

We should handle showing them the game view under 2 scenarios

To handle the second case, we probably need to some status or something of the player. Perhaps on connect, the backend tells the user of their current status (in game, in game list, etc).. Another way woule be for the game list to also send all the players in each game, and the UI calculates if the player is actually in a game. This would increase the amount of data we send heavily, but its not like it will be an issue for our scale. It also opens us up for enhancements like seeing what game your friends are in.

The lobby view should also update as game data updates are sent from the backend. For now, it will just be the list of players joining. The story after this would also recieve an update of the status, and the backend will push data like teams, queens, etc

alex-bezek commented 5 years ago

Thinking about how to show the game a bit more, I'm thinking we have a single component for the Game page, that is a mere switch statement and renders 1 of a few other page components, and that is all.

The switch would map 1-1 with the states the game could have (LOBBY, SETUP, PLAY, END) or something. I don't think each one should have its own url, as itt would be weird to go to /game-lobby when your game is in active state. /game or /game/:id makes more sense to me. I would startt with just /game as i'm not sure what would happen if we let them choose a game id to view. but it could be a nice enhancement for watching games later

alex-bezek commented 5 years ago

Might need to implement the game state and join game functionality to test. Or can break out into its own issue.

The event for this was mostly done, i'm adding in a bit of code to actually have the player added to the game so I can test capping the count at 8.