3 KiB
3 KiB
S008 — Folder model and details view
Category 03 File browsing · Model: Opus · Effort: medium · Depends on: S006, S005 · Size: L · Human: no Files touched: crates/tunal-core/src/playlist.rs, crates/tunal/src/folder/**, crates/tunal/src/icons.rs, crates/tunal/ui/views/details-view.slint, crates/tunal/src/main.rs, crates/tunal/ui/app.slint
Goal
A folder model fed from the location layer off the UI thread (sorting, grouping, hidden files, type-to-filter, live updates, selection) shown in a virtualized details view.
Read
CLAUDE.md §3, §4; crates/tunal-core trait; crates/tunal/ui/components/list-row.slint, menu.slint.
Steps
FolderModel: load off-thread in chunks, apply watch diffs (insert/remove/change) keeping selection; a SlintModelthat stays fast at 10 000+ rows.- Sorting (natural name order, size, type, modified; folders first toggle; asc/desc) and grouping (none, type, modified date buckets, size buckets) with group header rows.
- Playlist sort (D-021): in folders under
XDG_MUSIC_DIRthat hold a playlist (.m3u,.m3u8,.pls,.xspf), the sort options show Playlist sort (one entry per playlist when there are several); files listed in the playlist come first in playlist order, the rest follow in natural name order; desc reverses; the playlist file is watched and re-sorts on change. Parser intunal-core::playlist(relative/absolute paths,file://URLs, percent-decoding,#EXTlines skipped). - Hidden files toggle (dot files) and type-to-filter (typing filters by substring, a filter chip shows the text, Esc clears).
- Mime → Material Symbols glyph map (folder, image, audio, video, text, code, archive, PDF, executable, generic, symlink badge).
- Details view:
ListViewrows onListRow, column header with click-to-sort and animated indicator, empty/loading/error states. - Selection: click, Ctrl, Shift range, Ctrl+A, arrows/Home/End/PageUp/PageDown, Enter on a folder opens it. Temporary:
tunal <dir>opens that folder. - PROGRESS entry, INDEX line, commit
S008: …
End criteria
cargo build --workspace,cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkpass.tunal <scratch dir with 10 000 files> --screenshotrenders in light and dark; you looked at both.grep -rnE '#[0-9a-fA-F]{6}|[0-9]+ms' crates/tunal/ui/components crates/tunal/ui/views crates/tunal/ui/shell crates/tunal/ui/dialogs 2>/dev/nullfinds no literal colour or duration outsidetheme.slint/motion.slint.
Pitfalls
- Never build the whole row list on the UI thread for big folders.
- Natural sort must handle non-UTF-8 names (sort on lossy display name, keep raw name).
- Load the
app-tasteandanimateskills before writing motion; tokens only, hover tint + press squeeze, interruptible, reduced motion honoured, nothing animates while idle. - No new tests in this plan (D-013): verify with build, clippy and the smoke run; tests come in phase 12.
Handoff (→ PROGRESS.md)
FolderModel API (open, sort, group, filter, selection) used by grid view, tabs and actions.