Reach Settings/Profile from the pause menu, with a way back
The pause menu (Escape during a question/CCS/flashcards run) only had Resume/UI Sounds/Exit Run/Log Out. Settings already has an equivalent "Interface sounds" toggle, so drop the duplicate from the pause menu. More importantly, "player" and "ccs_player" hide the entire app shell (header + sidebar), so there was no way to reach Settings or Profile at all mid-session - add Profile/Settings buttons to the pause menu to close that gap. Navigating there follows the existing return_screen payload convention (already used by simulation_history/results/review) rather than inventing new navigation infrastructure: _navigate_from_pause() remembers current_screen_name and passes it through show_screen's payload. Both screens show a "Back to session" button when that's set, and hide it otherwise (including on ordinary non-paused visits). show_screen() unconditionally resumes the question timer via _close_app_menu() as a side effect of any navigation, so _navigate_from_pause() re-pauses it immediately when leaving "player" - the timer then resumes for real, for free, when the user actually returns via show_screen(return_screen). progress_profile.gd rebuilds its whole child tree on every theme toggle (_rebuild -> _build), which would otherwise wipe the button's visibility - added _refresh_back_to_session_visibility(), called both after _build() and from on_show(), so it survives a theme change while paused. Flipped tests/web_responsive_test.gd's assertion, which previously required the pause menu NOT to have a Profile button. Verified end-to-end headlessly: opening the pause menu from a live "player" session, navigating to Settings and Profile, confirming current_question_pause_started_at is correctly paused while away and resumed on return, confirming the back-to-session button appears only when reached via pause (not on ordinary nav), and confirming it survives a dark/light theme toggle on the Profile screen.
This commit is contained in:
@@ -13,6 +13,8 @@ var followups_toggle: CheckButton
|
||||
var question_scale_value_label: Label
|
||||
var ccs_scale_value_label: Label
|
||||
var core_block_size_value_label: Label
|
||||
var return_screen := ""
|
||||
var back_to_session_button: Button
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -39,6 +41,17 @@ func _ready() -> void:
|
||||
subtitle.add_theme_color_override("font_color", Brand.SLATE)
|
||||
add_child(subtitle)
|
||||
|
||||
back_to_session_button = Button.new()
|
||||
back_to_session_button.text = "Back to session"
|
||||
back_to_session_button.custom_minimum_size = Vector2(0, 44)
|
||||
back_to_session_button.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
||||
back_to_session_button.add_theme_stylebox_override("normal", Brand.gradient_button_box())
|
||||
back_to_session_button.add_theme_color_override("font_color", Color.WHITE)
|
||||
back_to_session_button.visible = false
|
||||
UISoundService.set_button_sound(back_to_session_button, "back")
|
||||
back_to_session_button.pressed.connect(_return_to_session)
|
||||
add_child(back_to_session_button)
|
||||
|
||||
var panel := PanelContainer.new()
|
||||
panel.custom_minimum_size = Vector2(520, 0)
|
||||
panel.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
||||
@@ -98,7 +111,10 @@ func _ready() -> void:
|
||||
_refresh_text_scale_labels()
|
||||
|
||||
|
||||
func on_show(_payload: Variant = null) -> void:
|
||||
func on_show(payload: Variant = null) -> void:
|
||||
var wrapper: Dictionary = payload if typeof(payload) == TYPE_DICTIONARY else {}
|
||||
return_screen = str(wrapper.get("return_screen", ""))
|
||||
back_to_session_button.visible = not return_screen.is_empty()
|
||||
theme_toggle.set_pressed_no_signal(UIThemeService.is_dark_mode())
|
||||
sound_toggle.set_pressed_no_signal(UISoundService.are_sounds_enabled())
|
||||
followups_toggle.set_pressed_no_signal(BlockSessionService.show_review_followups)
|
||||
@@ -209,6 +225,12 @@ func _open_legal_document(kind: String) -> void:
|
||||
main.open_legal_document(kind)
|
||||
|
||||
|
||||
func _return_to_session() -> void:
|
||||
if return_screen.is_empty():
|
||||
return
|
||||
main.show_screen(return_screen)
|
||||
|
||||
|
||||
func _on_theme_changed(is_dark: bool) -> void:
|
||||
theme_toggle.set_pressed_no_signal(is_dark)
|
||||
var panel := theme_toggle.get_parent().get_parent() as PanelContainer
|
||||
|
||||
Reference in New Issue
Block a user