Closed ryanmio closed 7 months ago
Name | Link |
---|---|
Latest commit | d2f622d7743c7612638c79b3f661d2294b9ea3e3 |
Latest deploy log | https://app.netlify.com/sites/decode-me/deploys/65b7ab121f38ee00089e9450 |
Deploy Preview | https://deploy-preview-70--decode-me.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
This commit introduces a feature that prompts the user for confirmation when they attempt to navigate away from an ongoing game session. The following changes have been made:
Added a new state variable
intendedRoute
inindex.js
to store the destination route when a user tries to navigate away during a game.Modified the
promptEndGame
function inindex.js
to accept a route parameter and set theintendedRoute
state, which triggers the display of theEndGameModal
.Updated the
confirmEndGame
function inindex.js
to perform navigation to theintendedRoute
after the game state has been reset and the modal is closed.Ensured that the
cancelEndGame
function inindex.js
clears theintendedRoute
state and closes the modal without navigating away, allowing the user to continue the game.Passed the updated
promptEndGame
function as a prop to theOptionsMenu
component and modified the navigation-related event handlers withinOptionsMenu.js
to callpromptEndGame
with the intended route.Ensured proper import and usage of the
useRouter
hook fromnext/router
in bothindex.js
andOptionsMenu.js
for programmatic navigation.These changes enhance the user experience by preventing accidental loss of game progress and providing a clear and user-friendly way to confirm navigation actions during gameplay.