Refactor(Library): Replace sort dropdown with bottom sheet#286
Merged
theovilardo merged 1 commit intomasterfrom Oct 23, 2025
Merged
Refactor(Library): Replace sort dropdown with bottom sheet#286theovilardo merged 1 commit intomasterfrom
theovilardo merged 1 commit intomasterfrom
Conversation
This commit replaces the legacy dropdown menu for sorting in the library with a new `LibrarySortBottomSheet`. This improves the user experience and modernizes the component. Key changes include: - **`LibrarySortBottomSheet.kt`**: New composable for the bottom sheet UI. - **`LibraryActionRow.kt`**: Removed the `DropdownMenu` and replaced it with a simple `onSortClick` callback to trigger the bottom sheet. - **`SortOption.kt`**: Refactored to include a stable `storageKey` for persistence, separate from the `displayName`. A `fromStorageKey` companion function was added for safe parsing and legacy value migration. - **ViewModels**: `PlayerViewModel` and `PlaylistViewModel` are updated to use `storageKey` for saving sort preferences and to manage the visibility of the new bottom sheet. - **`LibraryScreen.kt`**: Integrated the `LibrarySortBottomSheet` and updated the logic to handle its state and actions. The tab management logic was also refactored to use `LibraryTabId` enum and `storageKey` for persistence and state handling. - **`UserPreferencesRepository.kt`**: Added logic to migrate old display name-based sort preferences to the new storage key system. - **`LibraryTabId.kt`**: Introduced a new enum to represent library tabs with stable `storageKey`, `title`, and default `SortOption`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit replaces the legacy dropdown menu for sorting in the library with a new
LibrarySortBottomSheet. This improves the user experience and modernizes the component.Key changes include:
LibrarySortBottomSheet.kt: New composable for the bottom sheet UI.LibraryActionRow.kt: Removed theDropdownMenuand replaced it with a simpleonSortClickcallback to trigger the bottom sheet.SortOption.kt: Refactored to include a stablestorageKeyfor persistence, separate from thedisplayName. AfromStorageKeycompanion function was added for safe parsing and legacy value migration.PlayerViewModelandPlaylistViewModelare updated to usestorageKeyfor saving sort preferences and to manage the visibility of the new bottom sheet.LibraryScreen.kt: Integrated theLibrarySortBottomSheetand updated the logic to handle its state and actions. The tab management logic was also refactored to useLibraryTabIdenum andstorageKeyfor persistence and state handling.UserPreferencesRepository.kt: Added logic to migrate old display name-based sort preferences to the new storage key system.LibraryTabId.kt: Introduced a new enum to represent library tabs with stablestorageKey,title, and defaultSortOption.