five-on-it / apps/client/src/renderer/social
apps/client/src/renderer/social
The page's social side (GAME_DESIGN §13), without React: what the game server says of the room (its chat lines and roster) and what the platform's feed brings (the party's and direct messages, friend requests, invitations, the party's room, the end of one of the player's creations, for its toast), kept as the overlay's SocialView and published into its store; and what the player does (SocialActions, the chat panel's and the Social tab's callbacks): say a line on the room's channel, the party's or to a friend, a quick-chat phrase, an emote, start or cast a vote to kick, mute, report, befriend, party up, join a friend's room.
The platform is optional: in the default room of a standalone server (no API) the room's channel, the roster and the votes still work; the feed starts in a room the platform opened, or when the Social tab asks, and then says where the page is every PRESENCE_EVERY_MS. When the party's leader opens or joins a room, the feed brings every member the URL that joins it, and the page goes there. The lobbies' events are followed too (lobby, run): a lobby's run opened sends the page to the member's seat (the lobby kept in its address); its results in, a run's page that came from it goes back to the lobby after LOBBY_RETURN_MS (time to see the winner on screen; never once the page is leaving, or the player is no longer in the lobby); a player whose party's leader took the party into a lobby is asked (lobbyPrompt: Join, or Stay, which leaves it); an invitation to a lobby joins the Social tab's list. A run's page knows whether its player is still in the lobby it came from (stillInLobby), so its results lead back there only then.