feat: separate albums/tracks into bordered panes, fix click handling

- Replace single Detail pane with separate Albums and Tracks panes,
  each with its own border that highlights yellow when focused
- Store rendered Rect areas on LibraryState instead of hardcoding
  layout offsets, fixing album click selection
- Split render functions into public components for isolated testing
- Restructure snapshot tests by component (artists, albums, tracks,
  header, detail) — 13 tests expanded to 26
This commit is contained in:
Alexander
2026-05-09 19:42:48 +02:00
parent c1205e5fb0
commit 7a35958c42
23 changed files with 684 additions and 212 deletions
@@ -0,0 +1,14 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"● Complete Album [Album] 2020 ▰▰▰▰▰▰▰▰▰▰ 10/10 FLAC "
"○ Wanted Album [Album] 2021 ▱▱▱▱▱▱▱▱▱▱ 0/8 — "
"◌ Unmonitored Single [Single] 2022 ▱▱▱▱▱▱▱▱▱▱ 0/1 — "
" "
" "
" "
" "
" "
" "
" "
@@ -0,0 +1,14 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"● OK Computer [Album] 1997 ▰▰▰▰▰▰▰▰▰▰ 12/12 FLAC "
"◐ Kid A [Album] 2000 ▰▰▰▰▰▱▱▱▱▱ 5/10 FLAC "
" "
" "
" "
" "
" "
" "
" "
" "
@@ -0,0 +1,14 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"● OK Computer [Album] 1997 ▰▰▰▰▰▰▰▰▰▰ 12/12 FLAC "
"◐ Kid A [Album] 2000 ▰▰▰▰▰▱▱▱▱▱ 5/10 FLAC "
" "
" "
" "
" "
" "
" "
" "
" "
@@ -0,0 +1,10 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"Radiohead "
" "
"status ● Monitored path /music/Radiohead "
"quality FLAC size 2.5 GB "
"albums 2 tracks 17 / 22 "
" "
@@ -0,0 +1,10 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"Tool "
" "
"status ◌ Unmonitored path /music/Tool "
"quality FLAC size 3.8 GB "
"albums 0 tracks 0 / 0 "
" "
@@ -0,0 +1,24 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"┌─[ Artists · 0 ]──────────────┐"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"└──────────────────────────────┘"
@@ -0,0 +1,24 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"┌─[ Artists · 2 ]──────────────┐"
"│◐ Radiohead 17/22 │"
"│! Pink Floyd 0/10 │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"└──────────────────────────────┘"
@@ -0,0 +1,24 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"┌─[ Artists · 2 ]──────────────┐"
"│◐ Radiohead 17/22 │"
"│! Pink Floyd 0/10 │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"└──────────────────────────────┘"
@@ -0,0 +1,28 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"No artist selected "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
@@ -0,0 +1,28 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"Radiohead "
" "
"status ● Monitored path /music/Radiohead "
"quality FLAC size 2.5 GB "
"albums 2 tracks 17 / 22 "
" "
"┌─[ Albums · 2 releases ]──────────────────────────────────────────┐"
"│● OK Computer [Album] 1997 ▰▰▰▰▰▰▰▰▰▰ 12/12 FLAC │"
"│◐ Kid A [Album] 2000 ▰▰▰▰▰▱▱▱▱▱ 5/10 FLAC │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"└──────────────────────────────────────────────────────────────────┘"
"┌─[ Tracks · OK Computer · 12/12 ]─────────────────────────────────┐"
"│(no album selected) │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"└──────────────────────────────────────────────────────────────────┘"
@@ -0,0 +1,28 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"Radiohead "
" "
"status ● Monitored path /music/Radiohead "
"quality FLAC size 2.5 GB "
"albums 2 tracks 17 / 22 "
" "
"┌─[ Albums · 2 releases ]──────────────────────────────────────────┐"
"│● OK Computer [Album] 1997 ▰▰▰▰▰▰▰▰▰▰ 12/12 FLAC │"
"│◐ Kid A [Album] 2000 ▰▰▰▰▰▱▱▱▱▱ 5/10 FLAC │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"└──────────────────────────────────────────────────────────────────┘"
"┌─[ Tracks · OK Computer · 12/12 ]─────────────────────────────────┐"
"│✓ 01 Airbag 4:44 FLAC │"
"│✓ 02 Paranoid Android 6:23 FLAC │"
"│✗ 03 Subterranean Homesick Alien 4:27 — │"
"│ │"
"│ │"
"│ │"
"└──────────────────────────────────────────────────────────────────┘"
@@ -0,0 +1,34 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"┌─[ Artists · 0 ]──────────────┐No artist selected "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"│ │ "
"└──────────────────────────────┘ "
@@ -2,14 +2,13 @@
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"┌─[ Artists · 2 ]──────────────┐┌─[ Detail · UK · Alternative ]────────────────────────────────────┐"
"│◐ Radiohead 17/22 ││Radiohead "
"│! Pink Floyd 0/10 │ "
"│ ││status ● Monitored path /music/Radiohead "
"│ ││quality FLAC size 2.5 GB "
"│ ││albums 2 tracks 17 / 22 "
"│ ││ │"
"│ ││─ albums ─ 2 releases │"
"┌─[ Artists · 2 ]──────────────┐Radiohead "
"│◐ Radiohead 17/22 │ "
"│! Pink Floyd 0/10 │status ● Monitored path /music/Radiohead "
"│ │quality FLAC size 2.5 GB "
"│ │albums 2 tracks 17 / 22 "
"│ │ "
"│ │┌─[ Albums · 2 releases ]──────────────────────────────────────────┐"
"│ ││● OK Computer [Album] 1997 ▰▰▰▰▰▰▰▰▰▰ 12/12 FLAC │"
"│ ││◐ Kid A [Album] 2000 ▰▰▰▰▰▱▱▱▱▱ 5/10 FLAC │"
"│ ││ │"
@@ -20,8 +19,8 @@ expression: terminal.backend()
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││─ tracks · OK Computer 12/12 "
"│ │└──────────────────────────────────────────────────────────────────┘"
"│ │┌─[ Tracks · OK Computer · 12/12 ]─────────────────────────────────┐"
"│ ││(no album selected) │"
"│ ││ │"
"│ ││ │"
@@ -31,4 +30,5 @@ expression: terminal.backend()
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"└──────────────────────────────┘└──────────────────────────────────────────────────────────────────┘"
@@ -1,34 +0,0 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"┌─[ Artists · 0 ]──────────────┐┌─[ Detail · ]────────────────────────────────────────────────────┐"
"│ ││No artist selected │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"└──────────────────────────────┘└──────────────────────────────────────────────────────────────────┘"
@@ -1,34 +0,0 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"┌─[ Artists · 2 ]──────────────┐┌─[ Detail · UK · Alternative ]────────────────────────────────────┐"
"│◐ Radiohead 17/22 ││Radiohead │"
"│! Pink Floyd 0/10 ││ │"
"│ ││status ● Monitored path /music/Radiohead │"
"│ ││quality FLAC size 2.5 GB │"
"│ ││albums 2 tracks 17 / 22 │"
"│ ││ │"
"│ ││─ albums ─ 2 releases │"
"│ ││● OK Computer [Album] 1997 ▰▰▰▰▰▰▰▰▰▰ 12/12 FLAC │"
"│ ││◐ Kid A [Album] 2000 ▰▰▰▰▰▱▱▱▱▱ 5/10 FLAC │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││─ tracks · OK Computer ─ 12/12 │"
"│ ││(no album selected) │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"│ ││ │"
"└──────────────────────────────┘└──────────────────────────────────────────────────────────────────┘"
@@ -0,0 +1,12 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"(no album selected) "
" "
" "
" "
" "
" "
" "
" "
@@ -0,0 +1,12 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"✓ 01 Airbag 4:44 FLAC "
"✓ 02 Paranoid Android 6:23 FLAC "
"✗ 03 Subterranean Homesick Alien 4:27 — "
" "
" "
" "
" "
" "
@@ -0,0 +1,12 @@
---
source: tests/ui_snapshots.rs
expression: terminal.backend()
---
"✓ 01 Airbag 4:44 FLAC "
"✓ 02 Paranoid Android 6:23 FLAC "
"✗ 03 Subterranean Homesick Alien 4:27 — "
" "
" "
" "
" "
" "