refactor(ui): move generic filter/list primitives into ui/ (filter buttons, SortDropdown, MarqueeText, SelectionToggleButton, InpageScrollSentinel)

This commit is contained in:
Psychotoxical
2026-06-30 18:25:20 +02:00
parent b3b7af0390
commit 8cd23e86db
21 changed files with 29 additions and 29 deletions
+7 -7
View File
@@ -9,10 +9,10 @@ import { useAuthStore } from '@/store/authStore';
import { clampLibraryGridMaxColumns } from '@/store/authStoreHelpers';
import { computeCardGridColumnCount } from '@/utils/cardGridLayout';
import GenreFilterBar from '@/components/GenreFilterBar';
import YearFilterButton from '@/components/YearFilterButton';
import StarFilterButton from '@/components/StarFilterButton';
import LosslessFilterButton from '@/components/LosslessFilterButton';
import SortDropdown from '@/components/SortDropdown';
import YearFilterButton from '@/ui/YearFilterButton';
import StarFilterButton from '@/ui/StarFilterButton';
import LosslessFilterButton from '@/ui/LosslessFilterButton';
import SortDropdown from '@/ui/SortDropdown';
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate } from 'react-router-dom';
import { useOfflineStore } from '@/features/offline';
@@ -23,13 +23,13 @@ import { join } from '@tauri-apps/api/path';
import { showToast } from '@/utils/ui/toast';
import { useZipDownloadStore } from '@/features/offline';
import { Download, HardDriveDownload, Disc3, ListPlus } from 'lucide-react';
import SelectionToggleButton from '@/components/SelectionToggleButton';
import FilterQuickClear from '@/components/FilterQuickClear';
import SelectionToggleButton from '@/ui/SelectionToggleButton';
import FilterQuickClear from '@/ui/FilterQuickClear';
import { usePerfProbeFlags } from '@/utils/perf/perfFlags';
import { useRangeSelection } from '@/lib/hooks/useRangeSelection';
import { useMainstageInpageHeaderTight } from '@/hooks/useMainstageInpageHeaderTight';
import { useInpageScrollViewport } from '@/hooks/useInpageScrollViewport';
import InpageScrollSentinel from '@/components/InpageScrollSentinel';
import InpageScrollSentinel from '@/ui/InpageScrollSentinel';
import { VirtualCardGrid } from '@/components/VirtualCardGrid';
import OverlayScrollArea from '@/ui/OverlayScrollArea';
import { ALBUMS_INPAGE_SCROLL_VIEWPORT_ID } from '@/constants/appScroll';
+3 -3
View File
@@ -19,16 +19,16 @@ import { showToast } from '@/utils/ui/toast';
import { invoke } from '@tauri-apps/api/core';
import { join } from '@tauri-apps/api/path';
import { Download, HardDriveDownload, ListPlus } from 'lucide-react';
import SelectionToggleButton from '@/components/SelectionToggleButton';
import SelectionToggleButton from '@/ui/SelectionToggleButton';
import { albumGridWarmCovers } from '@/cover/layoutSizes';
import { VirtualCardGrid } from '@/components/VirtualCardGrid';
import OverlayScrollArea from '@/ui/OverlayScrollArea';
import { LOSSLESS_ALBUMS_INPAGE_SCROLL_VIEWPORT_ID } from '@/constants/appScroll';
import { useInpageScrollSentinel } from '@/hooks/useInpageScrollSentinel';
import { useInpageScrollViewport } from '@/hooks/useInpageScrollViewport';
import InpageScrollSentinel from '@/components/InpageScrollSentinel';
import InpageScrollSentinel from '@/ui/InpageScrollSentinel';
import { useLibraryIndexStore } from '@/store/libraryIndexStore';
import SortDropdown from '@/components/SortDropdown';
import SortDropdown from '@/ui/SortDropdown';
import { albumArtistDisplayName } from '@/features/album/utils/deriveAlbumHeaderArtistRefs';
import {
albumBrowseSortForServer,
+2 -2
View File
@@ -6,7 +6,7 @@ import type { SubsonicAlbum } from '@/lib/api/subsonicTypes';
import { dedupeById } from '@/lib/util/dedupeById';
import { useEffect, useLayoutEffect, useState, useCallback, useRef, useMemo } from 'react';
import { Download, HardDriveDownload } from 'lucide-react';
import SelectionToggleButton from '@/components/SelectionToggleButton';
import SelectionToggleButton from '@/ui/SelectionToggleButton';
import AlbumCard from '@/features/album/components/AlbumCard';
import GenreFilterBar from '@/components/GenreFilterBar';
import { useTranslation } from 'react-i18next';
@@ -28,7 +28,7 @@ import { NEW_RELEASES_INPAGE_SCROLL_VIEWPORT_ID } from '@/constants/appScroll';
import { useAsyncInpagePagination } from '@/hooks/useAsyncInpagePagination';
import { useInpageScrollSentinel } from '@/hooks/useInpageScrollSentinel';
import { useInpageScrollViewport } from '@/hooks/useInpageScrollViewport';
import InpageScrollSentinel from '@/components/InpageScrollSentinel';
import InpageScrollSentinel from '@/ui/InpageScrollSentinel';
import { useAlbumGridBrowseFilters, type AlbumGridBrowseSnapshot } from '@/features/album/hooks/useAlbumGridBrowseFilters';
import { useAlbumBrowseScrollRestore } from '@/features/album/hooks/useAlbumBrowseScrollRestore';
import { useAlbumBrowseScrollReset } from '@/features/album/hooks/useAlbumBrowseScrollReset';
+1 -1
View File
@@ -7,7 +7,7 @@ import { dedupeById } from '@/lib/util/dedupeById';
import { shuffleArray } from '@/lib/util/shuffleArray';
import React, { useEffect, useLayoutEffect, useState, useCallback, useRef } from 'react';
import { RefreshCw, Download, HardDriveDownload } from 'lucide-react';
import SelectionToggleButton from '@/components/SelectionToggleButton';
import SelectionToggleButton from '@/ui/SelectionToggleButton';
import AlbumCard from '@/features/album/components/AlbumCard';
import GenreFilterBar from '@/components/GenreFilterBar';
import { useTranslation } from 'react-i18next';
+3 -3
View File
@@ -1,8 +1,8 @@
import { useEffect, useState, useCallback, useRef } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { LayoutGrid, List, Images } from 'lucide-react';
import SelectionToggleButton from '@/components/SelectionToggleButton';
import StarFilterButton from '@/components/StarFilterButton';
import SelectionToggleButton from '@/ui/SelectionToggleButton';
import StarFilterButton from '@/ui/StarFilterButton';
import OverlayScrollArea from '@/ui/OverlayScrollArea';
import { usePlayerStore } from '@/features/playback/store/playerStore';
import { useAuthStore } from '@/store/authStore';
@@ -30,7 +30,7 @@ import { useInpageScrollSentinel } from '@/hooks/useInpageScrollSentinel';
import { useInpageScrollViewport } from '@/hooks/useInpageScrollViewport';
import { ArtistsGridView } from '@/features/artist/components/ArtistsGridView';
import { ArtistsListView } from '@/features/artist/components/ArtistsListView';
import InpageScrollSentinel from '@/components/InpageScrollSentinel';
import InpageScrollSentinel from '@/ui/InpageScrollSentinel';
import { useArtistsBrowseFilters, type ArtistBrowseScrollSnapshot } from '@/features/artist/hooks/useArtistsBrowseFilters';
import { useArtistsBrowseScrollRestore } from '@/features/artist/hooks/useArtistsBrowseScrollRestore';
import { useArtistsBrowseScrollReset } from '@/features/artist/hooks/useArtistsBrowseScrollReset';
+2 -2
View File
@@ -3,7 +3,7 @@ import { useEffect, useState, useCallback, useRef, useMemo } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { ndListArtistsByRole } from '@/lib/api/navidromeBrowse';
import { LayoutGrid, List } from 'lucide-react';
import StarFilterButton from '@/components/StarFilterButton';
import StarFilterButton from '@/ui/StarFilterButton';
import { usePlayerStore } from '@/features/playback/store/playerStore';
import { useAuthStore } from '@/store/authStore';
import { useTranslation } from 'react-i18next';
@@ -28,7 +28,7 @@ import OverlayScrollArea from '@/ui/OverlayScrollArea';
import { useVirtualizerScrollMargin } from '@/lib/hooks/useVirtualizerScrollMargin';
import { useClientSliceInfiniteScroll } from '@/hooks/useClientSliceInfiniteScroll';
import { useInpageScrollViewport } from '@/hooks/useInpageScrollViewport';
import InpageScrollSentinel from '@/components/InpageScrollSentinel';
import InpageScrollSentinel from '@/ui/InpageScrollSentinel';
const ALPHABET = [ALL_SENTINEL, '#', ...'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')];
+1 -1
View File
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
import { ArrowLeft, Disc3, Play, ListPlus, Loader2 } from 'lucide-react';
import { AlbumCard } from '@/features/album';
import { LongPressWaveOverlay } from '@/components/LongPressWaveOverlay';
import InpageScrollSentinel from '@/components/InpageScrollSentinel';
import InpageScrollSentinel from '@/ui/InpageScrollSentinel';
import OverlayScrollArea from '@/ui/OverlayScrollArea';
import { VirtualCardGrid } from '@/components/VirtualCardGrid';
import { GENRE_DETAIL_INPAGE_SCROLL_VIEWPORT_ID } from '@/constants/appScroll';
@@ -1,7 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Search, X } from 'lucide-react';
import SortDropdown, { type SortOption } from '@/components/SortDropdown';
import SortDropdown, { type SortOption } from '@/ui/SortDropdown';
import type { PlaylistSortKey, PlaylistSortDir } from '@/features/playlist/utils/playlistDisplayedSongs';
type PlaylistSortValue =
@@ -10,7 +10,7 @@ import { AlbumRow } from '@/features/album';
import { ArtistRow } from '@/features/artist';
import PagedSongList from '@/components/PagedSongList';
import CustomSelect from '@/ui/CustomSelect';
import StarFilterButton from '@/components/StarFilterButton';
import StarFilterButton from '@/ui/StarFilterButton';
import { tooltipAttrs } from '@/ui/tooltipAttrs';
import { APP_MAIN_SCROLL_VIEWPORT_ID } from '@/constants/appScroll';
import { useAuthStore } from '@/store/authStore';