Merge main into agent/470f875e0416 to resolve PR #44 conflicts

# Conflicts:
#	scripts/main_menu.gd
This commit is contained in:
claude-checkpoint-tooling
2026-08-20 16:47:44 +00:00
4 changed files with 89 additions and 39 deletions
+14 -23
View File
@@ -3,15 +3,15 @@ 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.
## 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.
##
## On successful auth the token is stored via ApiClient, AuthButtonsRow hides,
## the welcome label shows the username, and the Play button becomes enabled.
## The auth form fields are hidden, leaving only the welcome message visible.
# ── UI references ────────────────────────────────────────────────────────────
# ─── UI references ────────────────────────────────────────────────────────────
var _auth_buttons_row: HBoxContainer
var _login_button: Button
@@ -22,7 +22,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
@@ -33,7 +32,7 @@ var _is_register_mode: bool = false
var _is_authenticating: bool = false
# ── Lifecycle ────────────────────────────────────────────────────────────────
# ─── Lifecycle ────────────────────────────────────────────────────────────────
func _ready() -> void:
# Cache node references.
@@ -46,7 +45,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
@@ -63,7 +61,7 @@ func _ready() -> void:
_update_auth_mode_ui()
# ── Play / Quit ──────────────────────────────────────────────────────────────
# ─── Play / Quit ──────────────────────────────────────────────────────────────
func _on_play_button_pressed() -> void:
if _play_button.disabled:
@@ -77,11 +75,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()
@@ -89,20 +90,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:
@@ -117,7 +109,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."""
@@ -179,7 +171,6 @@ func _on_auth_complete(result: Dictionary) -> void:
_password_edit.visible = false
_email_edit.visible = false
_dob_edit.visible = false
_mode_toggle.visible = false
_auth_button.visible = false
_auth_mode_label.visible = false
_status_label.visible = false
@@ -193,7 +184,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
@@ -205,7 +196,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."""