Skip to content

Live Hard Mode toggle until first guess, move How to Play/Dev Mode into Settings#145

Open
dhoepp wants to merge 1 commit into
devfrom
feature/hard-mode-live-toggle-and-header-cleanup
Open

Live Hard Mode toggle until first guess, move How to Play/Dev Mode into Settings#145
dhoepp wants to merge 1 commit into
devfrom
feature/hard-mode-live-toggle-and-header-cleanup

Conversation

@dhoepp

@dhoepp dhoepp commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Hard Mode now tracks the live Settings toggle until the first guess is submitted, then locks for the rest of that game. Previously the value was snapshotted once at /game mount and stayed locked for the entire session (even across "New Game" clicks in Infinity mode) until a full page reload — so flipping the setting mid-session silently did nothing until you reloaded. State is set during render (not inside an effect) per the react-hooks/set-state-in-effect rule, avoiding an extra cascading re-render.
  • Moved "How to Play" and the Dev Mode toggle into the Settings modal, out of the header. The header was cramped below ~430px wide with up to 6-7 icon buttons; it's now down to Home / Settings / dark-mode toggle / sign-in-out.

Why

  • Hard Mode: the "next game only" behavior was confusing — toggling the setting felt like it should apply right away if you hadn't committed to anything yet in the current game.
  • Header: mobile users under 430px were seeing squeezed/overlapping icons.

Reviewer notes

  • GamePage.tsx: hardMode state is now nudged back to the live hardModeSetting during render whenever guesses.length === 0 (React's documented "adjust state when a value changes" pattern), then frozen once a guess exists. Re-unlocks automatically when handleNewGame resets guesses to [].
  • SettingsModal.tsx gained a required onOpenHowToPlay prop; Header.tsx still owns the showHelp/showSettings open state and just passes the callback through.
  • Dev Mode row in Settings is gated the same way the old header button was (!loading && configured && user && canUseDevMode).

Test plan

  • tsc -b and eslint clean (pre-existing unrelated exhaustive-deps warning left as-is)
  • Verified in browser: toggling Hard Mode on with 0 guesses shows the badge immediately (no reload)
  • Verified in browser: after 1 guess, toggling Hard Mode off leaves the badge/enforcement in place for the rest of that game
  • Verified in browser at 375px: header no longer cramped; Settings modal shows "How to Play" row and (when eligible) Dev Mode toggle; "How to Play" opens correctly from Settings

🤖 Generated with Claude Code

… Settings

Hard Mode previously snapshotted the Settings toggle once at mount and
stayed locked for the entire /game session, even across "new game"
clicks, so a mid-session flip only ever took effect on a full page
reload. It now tracks the live setting until the first guess is
submitted, then locks for the rest of that game (and re-unlocks when a
new game starts) — set during render rather than in an effect, per
react-hooks/set-state-in-effect.

Also moved "How to Play" and the Dev Mode toggle out of the header and
into the Settings modal, cutting the header down to Home/Settings/dark
toggle/sign-in so it's no longer cramped below 430px wide.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dhoepp
dhoepp requested a review from a team July 20, 2026 21:50
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v61-tier3-team-99 Ready Ready Preview, Comment Jul 20, 2026 9:51pm

@github-actions

Copy link
Copy Markdown

🤖 AI Review (Gemini 2.5 Flash)

This pull request refactors the location of the Dev Mode toggle and the 'How to Play' button, moving them from the Header component into the SettingsModal. Additionally, it updates the Hard Mode game logic to dynamically apply the setting when no guesses have been made in the current game, and lock it in once a guess is submitted. The changes appear to be well-implemented according to the revised feature specifications.

@dhoepp
dhoepp enabled auto-merge July 21, 2026 12:53
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.

1 participant