Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Che bato/end game screen #61

Merged
merged 17 commits into from
Jan 19, 2025
Merged

Che bato/end game screen #61

merged 17 commits into from
Jan 19, 2025

Conversation

CheBato
Copy link
Collaborator

@CheBato CheBato commented Jan 15, 2025

End game screen & Homepage preferences

GameBoard/page.tsx

  • Added check that if lobbyState exists and a game doesn't exist that we send the user to the lobby.
  • Added check if we have winners in the gameState. If we have winners we permanently open the preference page with the end game screen.

Preferences/page.tsx

  • Added Preferences screen for the homePage it is similar to the preferences currently it adds the block list and logout.

Controlhub.tsx

  • Added Preferences link

OpponentCardTray.tsx

  • Changed sendManualDisconnectMessage to sendMessage since they do the same.

SetUp.tsx (lobby)

  • Added the manualDisconnect to the handleExit function since we know a user wishes to leave the lobby if they click exit.

PreferencesComponent.tsx

  • Redid the preference page so we receive the tabs, openState, title and subtitle from a parent component.
  • Changed the background color so its more in line with the design
  • minor design fixes for differentiating between homePage and gameBoard

BlockListTab.tsx

  • Added the BlockListTab to list of components for handling blocking users.

Preferences.types.ts

  • Added buttonFnc to preference buttons this way we send what the buttons does from a parent component
  • remade the PreferenceProps to support receiving properties from a parent component

CardSleevesTab.tsx

  • Removed the scroll from cardSleevesTab and moved it to a parent component (this will make scrolls available in other screens).

CurrentGameTab.tsx

  • Added Concede functionality
  • Minor design fix

EndGameTab.tsx

  • Added a new endGameTab which checks what type of game we are in and returns the appropriate component.

GameOptionsTab.tsx & KeyboardShortcutsTab.tsx

  • Minor design fix

BlockedUser.tsx

  • Added a new component that represents a row in blocked users accepts username for now.

EndGameOptionsCustom.tsx

  • New EndGameTab component for custom/private games

EndGameOptionsQuickMatch

  • New EndGameTab component for quickMatches
  • I used the API call enter-queue to reenter the user into a queue. After multiple testing scenarios this was by far the most elegant and stable option.

PreferenceButton.tsx

  • Added buttonFunctionalities
  • Added disabled check.

VerticalTabs.tsx

  • Added the scroll for overflow here so its accessible to all subTabs.
  • Added the endGame screen tab, BlockedUserTab and Logout tab.

Game.context.tsx

  • Added resetStates which resets the states of GameState and LobbyState. I found that we need to do this to requeue a user into the queue otherwise the user will just be sent back into the game.
  • Added socketKey as a userEffect dependable since when a user wanted to requeue we closed the connection with the socket but the user wasn't able to reconnect to a new socket since there wasn't a dependable triggered. This way when we change the socketKey for the user in resetStates we can make sure the user can requeue with a new socket.
  • Removed sendManualDisconnectMessage since it was redundant (we can send the message via sendMessage()).

User.context.tsx

  • Added callbackUrl to logout function. Since if we logout in the preference page it redirects to the preference page which it shouldn't. This way we always redirect to the homepage.

Lobby/page.tsx

  • Changed how we check if a game is onGoing we have a new parameter in the lobbyState that gives us that information. We do this since otherwise when users want to rejoin the lobby from the match we can't send gameState as null from the BE hence why we set this parameter to allow users back into the lobby.

quickGame/page.tsx

  • minor design fixes.

new changes

  • Refactored the way time was count down when two users matched in the quickMatch
  • Refactored both endgame screens to allow for users to send and receive rematch requests
  • Refactored states so all rematches, requeues work correctly.
  • Refactored requeue to use the same socket instead of an API call
  • Fixes to certain hooks so we don't get warnings or errors when requeueing or rematching.

- first pass at end game screen
- Second pass for endgamescreen
- Final pass
- Added homepage preferences
# Conflicts:
#	src/app/_contexts/Game.context.tsx
#	src/app/lobby/page.tsx
Copy link
Contributor

@danbastin danbastin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of quick bugs:

  • When returning to the lobby for a new game players should not be ready
  • With the end game windows up after one player leaves the other play cannot close the window

src/app/Preferences/page.tsx Outdated Show resolved Hide resolved
src/app/_contexts/Game.context.tsx Outdated Show resolved Hide resolved
- Intermediate work.
- Cleanup for PR and added button changes based on the state.
- Cleanup for PR and added button changes based on the state.
@CheBato CheBato marked this pull request as ready for review January 18, 2025 13:47
@danbastin danbastin merged commit b7ee1e5 into main Jan 19, 2025
1 check passed
@danbastin danbastin deleted the CheBato/EndGameScreen branch January 19, 2025 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants