ziyi01 / Inkposter

Project for course DH2643 at KTH.
Apache License 2.0
1 stars 0 forks source link

Handle disconnects and update routes #45

Open ziyi01 opened 4 hours ago

ziyi01 commented 4 hours ago

Extends the #44 branch by moving routes, nesting them together for example: /player-game --> /player/game (Be cautious here that no routes are destroyed, can be reverted if necessary).

Adds a playerInterface.ts file that exports interfaces for Player and PlayerCanvas (used in playerGame) that are reused between presenters and views. PlayerCanvas is modified in view and presenter to add a connection-key to render players differently depending on whether they leave or not (relevant for @JuliaHallberg?).

Adds events in the socket.js and socket-client.tsx (and subscribes to the events in relevant presenters) to handle disconnect and perform appropriate action in host/players when one disconnects. For example, all players get redirected back when the host leaves and player is removed in the waiting room when they disconnect. Also updates UserModel to accommodate for these changes.

Closes #40