Implement persistent review queue

This commit is contained in:
hz
2026-07-19 12:51:24 -05:00
parent 1bfb3f5347
commit 7508d4fe1d
20 changed files with 1155 additions and 20 deletions
+56 -2
View File
@@ -20,12 +20,16 @@ var recent_list: VBoxContainer
var weekly_summary: VBoxContainer
var metric_values: Dictionary = {}
var metric_details: Dictionary = {}
var pending_review_launch := false
func _ready() -> void:
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
DashboardService.dashboard_changed.connect(_render)
DashboardService.dashboard_failed.connect(_show_error)
ReviewQueueService.question_loaded.connect(_on_review_question_loaded)
ReviewQueueService.question_failed.connect(_on_review_question_failed)
ReviewQueueService.pass_completed.connect(_on_review_pass_completed)
UIThemeService.theme_changed.connect(_rebuild)
resized.connect(_update_responsive)
_build()
@@ -229,7 +233,15 @@ func _render_focus(systems: Array) -> void:
func _render_review(data: Dictionary) -> void:
_clear(review_list)
review_list.add_child(_section_title("Review queue"))
review_list.add_child(_review_action("%d missed questions" % int(data.get("missedQuestionCount", 0)), "x", Brand.MAGENTA, "profile"))
var missed_count := int(data.get("missedQuestionCount", 0))
var missed_action := _review_action(
"%d missed questions" % missed_count if missed_count > 0 else "Review queue clear",
"x",
Brand.MAGENTA,
"")
missed_action.disabled = missed_count <= 0 or pending_review_launch
missed_action.pressed.connect(_start_review_queue)
review_list.add_child(missed_action)
review_list.add_child(_review_action("%d bookmarks" % int(data.get("bookmarkCount", 0)), "bookmark", Brand.ROYAL_BLUE, "bookmarks"))
review_list.add_child(_review_action("%d notes" % int(data.get("noteCount", 0)), "notebook-pen", Brand.AMBER, "notes"))
@@ -311,10 +323,52 @@ func _review_action(text: String, icon_name: String, accent: Color, route: Strin
var button := _button(text, icon_name, false)
button.alignment = HORIZONTAL_ALIGNMENT_LEFT
button.add_theme_color_override("icon_normal_color", accent)
button.pressed.connect(func(): main._on_navigation_pressed(route))
if not route.is_empty():
button.pressed.connect(func(): main._on_navigation_pressed(route))
return button
func _start_review_queue() -> void:
if pending_review_launch:
return
pending_review_launch = true
_show_loading_message("Preparing your review queue...")
ReviewQueueService.start_pass()
_render_review(DashboardService.data)
func _on_review_question_loaded(question: Dictionary) -> void:
if not pending_review_launch or not visible:
return
pending_review_launch = false
if BlockSessionService.start_review_question(question):
main.show_screen("player")
else:
_show_error("The review question could not be prepared.")
func _on_review_question_failed(message: String) -> void:
if not pending_review_launch or not visible:
return
pending_review_launch = false
_show_error(message)
_render_review(DashboardService.data)
func _on_review_pass_completed(_summary: Dictionary) -> void:
if not pending_review_launch or not visible:
return
pending_review_launch = false
DashboardService.refresh()
_show_loading_message("Your review queue is clear.")
func _show_loading_message(message: String) -> void:
status_label.text = message
status_label.add_theme_color_override("font_color", Brand.muted_color(UIThemeService.is_dark_mode()))
status_label.visible = true
func _summary_stat(value: String, caption: String, icon_name: String, accent: Color) -> HBoxContainer:
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 10)