From 16bb87c6b0d46f4cf1adee1012d6a10022a2f584 Mon Sep 17 00:00:00 2001 From: coder-bot Date: Thu, 20 Aug 2026 13:56:44 +0000 Subject: [PATCH 1/3] WIP checkpoint: Main menu: fix Register-mode UI trapping the user (remove the confusing mode toggle) --- scripts/main_menu.gd | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/scripts/main_menu.gd b/scripts/main_menu.gd index 6cea46e..8d8d76d 100644 --- a/scripts/main_menu.gd +++ b/scripts/main_menu.gd @@ -3,14 +3,11 @@ extends Control ## ## The AuthPanel is hidden by default. When the user clicks the LoginButton or ## RegisterButton (AuthButtonsRow, above the panel), the auth panel slides in. -## The ModeToggle switches between Login and Register modes, showing/hiding -## the email and DOB fields accordingly. -## -## On successful auth the token is stored via ApiClient, AuthButtonsRow hides, -## the welcome label shows the username, and the Play button becomes enabled. +## The Login and Register buttons in AuthButtonsRow also switch the panel's mode +## when clicked while the panel is already open, so the user can toggle between +## Login and Register modes at any time. - -# ── UI references ──────────────────────────────────────────────────────────── +# ─── UI references ──────────────────────────────────────────────────────────── var _auth_buttons_row: HBoxContainer var _login_button: Button @@ -21,7 +18,6 @@ var _username_edit: LineEdit var _password_edit: LineEdit var _email_edit: LineEdit var _dob_edit: LineEdit -var _mode_toggle: CheckButton var _auth_button: Button var _status_label: Label var _welcome_label: Label @@ -32,7 +28,7 @@ var _is_register_mode: bool = false var _is_authenticating: bool = false -# ── Lifecycle ──────────────────────────────────────────────────────────────── +# ─── Lifecycle ──────────────────────────────────────────────────────────────── func _ready() -> void: # Cache node references. @@ -45,7 +41,6 @@ func _ready() -> void: _password_edit = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/PasswordEdit _email_edit = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/EmailEdit _dob_edit = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/DOBEdit - _mode_toggle = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/ModeToggle _auth_button = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthButton _status_label = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthStatusLabel _welcome_label = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/WelcomeLabel @@ -62,7 +57,7 @@ func _ready() -> void: _update_auth_mode_ui() -# ── Play / Quit ────────────────────────────────────────────────────────────── +# ─── Play / Quit ────────────────────────────────────────────────────────────── func _on_play_button_pressed() -> void: if _play_button.disabled: @@ -76,11 +71,14 @@ func _on_quit_button_pressed() -> void: get_tree().quit() -# ── Auth panel toggle ──────────────────────────────────────────────────────── +# ─── Auth panel toggle ──────────────────────────────────────────────────────── func _on_login_button_pressed() -> void: - """Show the auth panel, called from AuthButtonsRow/LoginButton.""" + """Show the auth panel in login mode, called from AuthButtonsRow/LoginButton.""" _auth_panel.visible = true + _is_register_mode = false + _update_auth_mode_ui() + _clear_status() _username_edit.grab_focus() @@ -88,20 +86,11 @@ func _on_register_button_pressed() -> void: """Show the auth panel in register mode, called from AuthButtonsRow/RegisterButton.""" _auth_panel.visible = true _is_register_mode = true - _mode_toggle.button_pressed = true _update_auth_mode_ui() _clear_status() _username_edit.grab_focus() -# ── Mode toggle (Login / Register) ─────────────────────────────────────────── - -func _on_mode_toggle_toggled(button_pressed: bool) -> void: - _is_register_mode = button_pressed - _update_auth_mode_ui() - _clear_status() - - func _update_auth_mode_ui() -> void: """Update labels and field visibility based on login vs register mode.""" if _is_register_mode: @@ -116,7 +105,7 @@ func _update_auth_mode_ui() -> void: _dob_edit.visible = false -# ── Auth submission ────────────────────────────────────────────────────────── +# ─── Auth submission ────────────────────────────────────────────────────────── func _on_auth_button_pressed() -> void: """Handle login or register button press.""" @@ -187,7 +176,7 @@ func _on_auth_complete(result: Dictionary) -> void: _show_status(result.detail) -# ── Status helpers ─────────────────────────────────────────────────────────── +# ─── Status helpers ─────────────────────────────────────────────────────────── func _show_status(message: String) -> void: _status_label.text = message @@ -199,7 +188,7 @@ func _clear_status() -> void: _status_label.visible = false -# ── Validation ─────────────────────────────────────────────────────────────── +# ─── Validation ─────────────────────────────────────────────────────────────── func _is_valid_date(date_str: String) -> bool: """Check if a string looks like a valid YYYY-MM-DD date.""" -- 2.52.0 From af50819a16e08a440f59c15036a6554bbca99a08 Mon Sep 17 00:00:00 2001 From: coder-bot Date: Thu, 20 Aug 2026 14:01:20 +0000 Subject: [PATCH 2/3] WIP checkpoint: Main menu: fix Register-mode UI trapping the user (remove the confusing mode toggle) --- scenes/main_menu.tscn | 5 ----- scripts/main_menu.gd | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/scenes/main_menu.tscn b/scenes/main_menu.tscn index 6f5e688..b7371b7 100644 --- a/scenes/main_menu.tscn +++ b/scenes/main_menu.tscn @@ -89,10 +89,6 @@ visible = false placeholder_text = "Date of Birth (YYYY-MM-DD)" size_flags_horizontal = 3 -[node name="ModeToggle" type="CheckButton" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"] -layout_mode = 1 -text = "Register" - [node name="AuthButton" type="Button" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"] layout_mode = 1 text = "Login" @@ -125,7 +121,6 @@ size_flags_horizontal = 4 [connection signal="pressed" from="CenterContainer/VBoxContainer/AuthButtonsRow/RegisterButton" to="." method="_on_register_button_pressed"] [connection signal="pressed" from="CenterContainer/VBoxContainer/PlayButton" to="." method="_on_play_button_pressed"] [connection signal="pressed" from="CenterContainer/VBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"] -[connection signal="toggled" from="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/ModeToggle" to="." method="_on_mode_toggle_toggled"] [connection signal="pressed" from="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthButton" to="." method="_on_auth_button_pressed"] [connection signal="text_submitted" from="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/UsernameEdit" to="." method="_on_auth_button_pressed"] [connection signal="text_submitted" from="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/PasswordEdit" to="." method="_on_auth_button_pressed"] diff --git a/scripts/main_menu.gd b/scripts/main_menu.gd index 8d8d76d..06b2d94 100644 --- a/scripts/main_menu.gd +++ b/scripts/main_menu.gd @@ -3,9 +3,9 @@ extends Control ## ## The AuthPanel is hidden by default. When the user clicks the LoginButton or ## RegisterButton (AuthButtonsRow, above the panel), the auth panel slides in. -## The Login and Register buttons in AuthButtonsRow also switch the panel's mode -## when clicked while the panel is already open, so the user can toggle between -## Login and Register modes at any time. +## The Login and Register buttons on the AuthButtonsRow directly set the panel's +## mode, so the user can switch between Login and Register at any time while +## the panel is open. # ─── UI references ──────────────────────────────────────────────────────────── -- 2.52.0 From 12fef5102044988f3660cb81d79d281e0d2a83a6 Mon Sep 17 00:00:00 2001 From: coder-bot Date: Thu, 20 Aug 2026 14:03:57 +0000 Subject: [PATCH 3/3] WIP checkpoint: Main menu: fix Register-mode UI trapping the user (remove the confusing mode toggle) --- scripts/smoke_test_main_menu_ui.gd | 84 ++++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 9 deletions(-) diff --git a/scripts/smoke_test_main_menu_ui.gd b/scripts/smoke_test_main_menu_ui.gd index 9195b4a..570e81c 100644 --- a/scripts/smoke_test_main_menu_ui.gd +++ b/scripts/smoke_test_main_menu_ui.gd @@ -1,9 +1,14 @@ extends SceneTree -## Verifies the main menu's Login/Register buttons actually open the auth -## panel via a real signal emission (not calling the handler method -## directly) -- that's the exact gap that shipped without ever being -## caught: the AuthPanel and its logic were all correct, but nothing in -## the scene was ever wired to open it. +## Verifies the main menu's Login/Register buttons correctly open the auth +## panel and toggle between Login and Register modes via signal emission. +## +## Key tests: +## - AuthPanel starts hidden. +## - LoginButton press opens the panel in Login mode. +## - RegisterButton press opens the panel in Register mode. +## - Clicking Login while in Register mode switches back to Login mode. +## - Clicking Register while in Login mode switches to Register mode. +## - The ModeToggle CheckButton no longer exists in the scene. func _initialize() -> void: @@ -24,26 +29,87 @@ func _run() -> void: var login_button: Button = instance.get_node("CenterContainer/VBoxContainer/AuthButtonsRow/LoginButton") var register_button: Button = instance.get_node("CenterContainer/VBoxContainer/AuthButtonsRow/RegisterButton") var auth_panel: PanelContainer = instance.get_node("CenterContainer/VBoxContainer/AuthPanel") + var auth_mode_label: Label = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthModeLabel") + var email_edit: LineEdit = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/EmailEdit") + var dob_edit: LineEdit = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/DOBEdit") + # --- Test 1: auth panel starts hidden --- if _check("auth panel starts hidden", not auth_panel.visible): passed += 1 else: failed += 1 + # --- Test 2: LoginButton press opens panel in Login mode --- login_button.pressed.emit() await process_frame - if _check("auth panel visible after a real LoginButton press signal", auth_panel.visible): + if _check("auth panel visible after LoginButton press", auth_panel.visible): passed += 1 else: failed += 1 - # Reset and check RegisterButton independently too. - auth_panel.visible = false + if _check("Login mode label after LoginButton press", auth_mode_label.text == "Login"): + passed += 1 + else: + failed += 1 + + if _check("Email field hidden in Login mode", not email_edit.visible): + passed += 1 + else: + failed += 1 + + if _check("DOB field hidden in Login mode", not dob_edit.visible): + passed += 1 + else: + failed += 1 + + # --- Test 3: RegisterButton press switches to Register mode --- register_button.pressed.emit() await process_frame - if _check("auth panel visible after a real RegisterButton press signal", auth_panel.visible): + if _check("auth panel still visible after RegisterButton press", auth_panel.visible): + passed += 1 + else: + failed += 1 + + if _check("Register mode label after RegisterButton press", auth_mode_label.text == "Register"): + passed += 1 + else: + failed += 1 + + if _check("Email field visible in Register mode", email_edit.visible): + passed += 1 + else: + failed += 1 + + if _check("DOB field visible in Register mode", dob_edit.visible): + passed += 1 + else: + failed += 1 + + # --- Test 4: LoginButton press switches back to Login mode --- + login_button.pressed.emit() + await process_frame + + if _check("Login mode label after second LoginButton press", auth_mode_label.text == "Login"): + passed += 1 + else: + failed += 1 + + if _check("Email field hidden after switching back to Login", not email_edit.visible): + passed += 1 + else: + failed += 1 + + if _check("DOB field hidden after switching back to Login", not dob_edit.visible): + passed += 1 + else: + failed += 1 + + # --- Test 5: ModeToggle CheckButton no longer exists --- + var mode_toggle_path = "CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/ModeToggle" + var has_mode_toggle = instance.has_node(mode_toggle_path) + if _check("ModeToggle CheckButton removed from scene", not has_mode_toggle): passed += 1 else: failed += 1 -- 2.52.0