Add user progress dashboard

This commit is contained in:
hz
2026-07-18 23:45:38 -05:00
parent 2e52a7ea0a
commit 2dcac51452
26 changed files with 983 additions and 17 deletions
+37 -7
View File
@@ -6,6 +6,7 @@ const NavigationRoutes := preload("res://scripts/ui/navigation_routes.gd")
var screens := {}
var header_panel: PanelContainer
var header_title: Label
var app_menu: PanelContainer
var menu_exit_button: Button
var sound_toggle: CheckButton
@@ -39,7 +40,7 @@ func _ready() -> void:
theme_service.theme_changed.connect(_on_theme_changed)
resized.connect(_update_responsive_layout)
_update_responsive_layout()
show_screen("selection" if AuthState.is_logged_in else "login", "exam")
show_screen("dashboard" if AuthState.is_logged_in else "login")
func _update_responsive_layout() -> void:
@@ -76,6 +77,7 @@ func show_screen(screen_name: String, payload: Variant = null) -> void:
return
current_screen_name = screen_name
_update_header_title(screen_name)
_apply_screen_margins(screen_name)
screen.visible = true
if header_panel != null:
@@ -140,6 +142,12 @@ func _build_ui() -> void:
menu_button.pressed.connect(_open_drawer)
header.add_child(menu_button)
header_title = Label.new()
header_title.add_theme_font_override("font", Brand.font)
header_title.add_theme_font_size_override("font_size", 22)
header_title.add_theme_color_override("font_color", Brand.text_color(UIThemeService.is_dark_mode()))
header.add_child(header_title)
var header_spacer := Control.new()
header_spacer.size_flags_horizontal = Control.SIZE_EXPAND_FILL
header.add_child(header_spacer)
@@ -208,6 +216,12 @@ func _build_ui() -> void:
screens_container.add_child(login)
screens["login"] = login
var dashboard := preload("res://scripts/ui/dashboard_screen.gd").new()
dashboard.name = "DashboardScreen"
dashboard.main = self
screens_container.add_child(dashboard)
screens["dashboard"] = dashboard
var selector := preload("res://scripts/ui/study_selector.gd").new()
selector.name = "StudySelector"
selector.main = self
@@ -355,15 +369,13 @@ func _populate_navigation(container: VBoxContainer, include_brand: bool) -> void
wordmark.add_child(mind)
container.add_child(HSeparator.new())
_add_nav_button(container, "home", "Home", "house", true)
_add_nav_button(container, "home", "Dashboard", "chart-no-axes-column-increasing", true)
_add_nav_button(container, "question_bank", "Question Bank", "clipboard-list", true)
_add_nav_button(container, "exams", "Exams", "clipboard-list", true)
_add_nav_button(container, "ccs", "CCS Cases", "stethoscope", true)
_add_nav_button(container, "performance", "Performance", "chart-no-axes-column-increasing", true)
_add_nav_button(container, "flashcards", "Flashcards", "copy", false)
_add_nav_button(container, "study_plan", "Study Plan", "calendar-days", true)
_add_nav_button(container, "exams", "Exam Simulations", "clipboard-list", true)
_add_nav_button(container, "bookmarks", "Bookmarks", "bookmark", true)
_add_nav_button(container, "notes", "Notes", "notebook-pen", true)
_add_nav_button(container, "performance", "Profile", "user-round", true)
var spacer := Control.new()
spacer.size_flags_vertical = Control.SIZE_EXPAND_FILL
@@ -399,7 +411,7 @@ func _add_nav_button(container: VBoxContainer, key: String, label_text: String,
func _on_navigation_pressed(key: String) -> void:
match key:
"home": show_screen("selection", "exam")
"home": show_screen("dashboard")
"question_bank": show_screen("selection", "question_bank")
"exams": show_screen("simulation_history")
"ccs": show_screen("ccs_hub")
@@ -411,6 +423,22 @@ func _on_navigation_pressed(key: String) -> void:
"logout": _logout()
func _update_header_title(screen_name: String) -> void:
if header_title == null:
return
var titles := {
"dashboard": "Dashboard",
"selection": "Question Bank",
"simulation_history": "Exam Simulations",
"ccs_hub": "CCS Cases",
"profile": "Profile",
"settings": "Settings",
"notes": "Notes",
"bookmarks": "Bookmarks"
}
header_title.text = str(titles.get(screen_name, ""))
func _build_account_menu() -> void:
account_menu = PanelContainer.new()
account_menu.visible = false
@@ -691,6 +719,8 @@ func _on_theme_changed(is_dark_mode: bool) -> void:
sidebar.add_theme_stylebox_override("panel", _sidebar_box())
if header_panel != null:
header_panel.add_theme_stylebox_override("panel", _top_bar_box())
if header_title != null:
header_title.add_theme_color_override("font_color", Brand.text_color(is_dark_mode))
if theme_button != null:
_style_shell_theme_button(theme_button)
for nav_key in nav_buttons: