Skip to content

feat(playlist): add filename sort mode#19

Merged
InstaZDLL merged 2 commits into
mainfrom
feat/playlist-sort-filename
May 15, 2026
Merged

feat(playlist): add filename sort mode#19
InstaZDLL merged 2 commits into
mainfrom
feat/playlist-sort-filename

Conversation

@InstaZDLL
Copy link
Copy Markdown
Owner

@InstaZDLL InstaZDLL commented May 15, 2026

Summary

Adds a Filename option to the playlist sort dropdown. Sorts on the cross-platform basename of track.file_path with Intl.Collator({ numeric: true }) so users who manually number their files (01. …, 02. …, 10. …) get a natural order matching Explorer/Finder behaviour — and not the lexicographic 1, 10, 2, 20, 3 trap.

Same client-side sort pattern as the existing modes: doesn't touch playlist_track.position in the DB, so flipping back to "Custom order" restores the curated drag-and-drop order verbatim.

Test plan

  • Open a playlist containing files named like 1 Track.mp3, 2 Track.mp3, 10 Track.mp3 → switch sort to "Filename" → expect 1 / 2 / 10 order (not 1 / 10 / 2).
  • Mix files with leading-zero numbering (01.mp3 / 02.mp3) and unnumbered files → leading-zero numbered cluster first, unnumbered fall in lexicographic order.
  • Switch from "Filename" back to "Custom order" → drag-and-drop order returns intact.
  • Library scanned on Windows imported to Linux profile (cross-\ paths) → basename still resolves correctly.
  • All 17 locales render the new label without overflow.

Summary by CodeRabbit

  • New Features
    • Added a "Filename" sort option for playlists to order tracks by filename; this sort is display-only (affects visible order and enqueueing but does not change stored track order).
  • Localization
    • Added translations for the new "Filename" sort label across 16+ languages.

Review Change Stack

@github-actions github-actions Bot added scope: frontend React/Vite frontend (src/) scope: i18n Translations (src/i18n/) scope: docs Docs, README, assets type: feat New feature size: m 50-200 lines labels May 15, 2026
@InstaZDLL InstaZDLL self-assigned this May 15, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4432b7a1-7e89-444a-b8ef-6981245a79b1

📥 Commits

Reviewing files that changed from the base of the PR and between b2c6f28 and a2e0467.

📒 Files selected for processing (19)
  • CLAUDE.md
  • src/components/views/PlaylistView.tsx
  • src/i18n/locales/ar.json
  • src/i18n/locales/de.json
  • src/i18n/locales/en.json
  • src/i18n/locales/es.json
  • src/i18n/locales/fr.json
  • src/i18n/locales/hi.json
  • src/i18n/locales/id.json
  • src/i18n/locales/it.json
  • src/i18n/locales/ja.json
  • src/i18n/locales/kr.json
  • src/i18n/locales/nl.json
  • src/i18n/locales/pt-BR.json
  • src/i18n/locales/pt.json
  • src/i18n/locales/ru.json
  • src/i18n/locales/tr.json
  • src/i18n/locales/zh-CN.json
  • src/i18n/locales/zh-TW.json

📝 Walkthrough

Walkthrough

Adds filename-based playlist sorting that extracts file basenames cross-platform and sorts using numeric-aware collation. The feature is integrated into the sort menu with i18n support across 17 locales and documented for guidance.

Changes

Filename Playlist Sort Mode

Layer / File(s) Summary
Sort mode type and helper
src/components/views/PlaylistView.tsx
PlaylistSortMode union and PLAYLIST_SORT_MODES array are extended to include "filename". New basename() helper extracts the final path segment from both POSIX and Windows file paths.
Sorting implementation and menu integration
src/components/views/PlaylistView.tsx
displayTracks memo adds a new "filename" case that sorts tracks by numeric-aware Intl.Collator comparison of extracted basenames. PlaylistSortMenu labels map gains a filename entry using t("sort.filename").
Internationalization support
src/i18n/locales/{ar,de,en,es,fr,hi,id,it,ja,kr,nl,pt-BR,pt,ru,tr,zh-CN,zh-TW}.json
Added sort.filename translation key across all locale files with language-specific labels (e.g., "Filename", "Dateiname", "Nom de fichier", "文件名").
Feature documentation
CLAUDE.md
Updated playlist sort mode guidance to document the new "Filename" option that sorts tracks by basename using Intl.Collator, persisted per playlist, and remains display-only client-side sorting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • InstaZDLL/WaveFlow#19: The main PR’s added "filename" playlist sort mode (including the PlaylistView.tsx sorter/basename helper and the corresponding sort.filename i18n keys) directly matches the retrieved PR’s implementation of the same feature.

Poem

🐰 A filename by any path, now sorted neat and bright,
Basenames hop from slash to backslash in light.
Seventeen tongues sing the sort's new name,
Tracks line up tidy, no positions changed.
A rabbit applauds this tidy little tweak.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(playlist): add filename sort mode' directly matches the main change, following Conventional Commits format with kebab-case scope and clearly describing the new feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description comprehensively covers the feature, rationale, implementation approach, and detailed test plan aligned with the template requirements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/playlist-sort-filename

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/views/PlaylistView.tsx`:
- Line 1250: The code currently uses a per-key i18n fallback for the
"sort.filename" key in the PlaylistView component; remove the inline English
fallback and call t("sort.filename") instead so the string relies solely on
locale JSONs (locate the usage in PlaylistView where filename:
t("sort.filename", "Filename") is set and replace it with t("sort.filename")).
Ensure all locale JSON files under src/i18n/locales/ include a "sort.filename"
entry so there is no per-key fallback at runtime.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b41d5475-d8f9-4c04-9267-1e37e287828c

📥 Commits

Reviewing files that changed from the base of the PR and between ade9f13 and b2c6f28.

📒 Files selected for processing (19)
  • CLAUDE.md
  • src/components/views/PlaylistView.tsx
  • src/i18n/locales/ar.json
  • src/i18n/locales/de.json
  • src/i18n/locales/en.json
  • src/i18n/locales/es.json
  • src/i18n/locales/fr.json
  • src/i18n/locales/hi.json
  • src/i18n/locales/id.json
  • src/i18n/locales/it.json
  • src/i18n/locales/ja.json
  • src/i18n/locales/kr.json
  • src/i18n/locales/nl.json
  • src/i18n/locales/pt-BR.json
  • src/i18n/locales/pt.json
  • src/i18n/locales/ru.json
  • src/i18n/locales/tr.json
  • src/i18n/locales/zh-CN.json
  • src/i18n/locales/zh-TW.json

Comment thread src/components/views/PlaylistView.tsx Outdated
InstaZDLL added 2 commits May 15, 2026 21:21
Many users (including the project owner) number their files manually
(`01. Track.mp3`, `02. Track.mp3`) and rely on filename ordering to
preserve a sequence that doesn't match any tag-derived field. The
new mode sorts on the cross-platform basename of `file_path` with
`Intl.Collator` (numeric:true) so "1 …" / "2 …" / "10 …" land in
natural order like Explorer/Finder.
The key is now defined in all 17 locales (added in the same commit
that introduced the sort mode) so the inline English fallback in
t("sort.filename", "Filename") is unreachable. Per the project's
locale-completeness contract, drop it.
@InstaZDLL InstaZDLL force-pushed the feat/playlist-sort-filename branch from 8504f93 to a2e0467 Compare May 15, 2026 19:22
@InstaZDLL InstaZDLL merged commit 83b5fda into main May 15, 2026
12 checks passed
@InstaZDLL InstaZDLL deleted the feat/playlist-sort-filename branch May 15, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: docs Docs, README, assets scope: frontend React/Vite frontend (src/) scope: i18n Translations (src/i18n/) size: m 50-200 lines type: feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant