Wire flashcard CSV/JSON import/export and fix theme/responsive gaps
Import and export were stubbed with status-text placeholders; wire them to the existing backend endpoints with a real file picker (web JS bridge or native FileDialog) and browser/desktop download, plus an import preview with create/update/skip/error counts before commit. Also fix the library and study screens' theme-refresh handlers, which were no-op stubs so cards never restyled on a theme toggle, and add responsive layout handling for narrow viewports.
This commit is contained in:
@@ -33,12 +33,15 @@ var grade_row: HBoxContainer
|
||||
var grade_buttons: Dictionary = {}
|
||||
var undo_button: Button
|
||||
var empty_label: Label
|
||||
var compact_layout := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
add_theme_constant_override("separation", 14)
|
||||
_build()
|
||||
resized.connect(_update_responsive_layout)
|
||||
call_deferred("_update_responsive_layout")
|
||||
FlashcardService.next_card_loaded.connect(_on_next_card_loaded)
|
||||
FlashcardService.next_card_failed.connect(_on_next_card_failed)
|
||||
FlashcardService.review_synced.connect(_on_review_synced)
|
||||
@@ -98,6 +101,7 @@ func _build() -> void:
|
||||
|
||||
card_panel = PanelContainer.new()
|
||||
card_panel.custom_minimum_size = Vector2(640, 360)
|
||||
card_panel.add_theme_stylebox_override("panel", Brand.content_card_box(UIThemeService.is_dark_mode(), true, Brand.ROYAL_BLUE))
|
||||
center.add_child(card_panel)
|
||||
var card_content := VBoxContainer.new()
|
||||
card_content.add_theme_constant_override("separation", 18)
|
||||
@@ -155,7 +159,20 @@ func _build() -> void:
|
||||
|
||||
|
||||
func refresh_theme_controls() -> void:
|
||||
pass
|
||||
if card_panel == null:
|
||||
return
|
||||
var dark := UIThemeService.is_dark_mode()
|
||||
card_panel.add_theme_stylebox_override("panel", Brand.content_card_box(dark, true, Brand.ROYAL_BLUE))
|
||||
empty_label.add_theme_color_override("font_color", Brand.muted_color(dark))
|
||||
|
||||
|
||||
func _update_responsive_layout() -> void:
|
||||
if card_panel == null:
|
||||
return
|
||||
compact_layout = size.x < 720.0
|
||||
var available := maxf(size.x - 48.0, 240.0)
|
||||
card_panel.custom_minimum_size.x = minf(640.0, available)
|
||||
card_panel.custom_minimum_size.y = 300.0 if compact_layout else 360.0
|
||||
|
||||
|
||||
func _load_next() -> void:
|
||||
|
||||
Reference in New Issue
Block a user