feat(settings): library card grid max columns in Appearance (4–12, default 6)

Persist libraryGridMaxColumns, wire useCardGridMetrics and card grid layout,
add i18n and settings search index; document performance hint in copy.
This commit is contained in:
Maxim Isaev
2026-05-15 02:19:20 +03:00
parent 7c6d3694d4
commit 0f5ece6d03
21 changed files with 169 additions and 16 deletions
+15
View File
@@ -30,6 +30,10 @@ vi.mock('@/api/subsonic', () => ({
import { useAuthStore } from './authStore';
import { resetAuthStore, resetPlayerStore } from '@/test/helpers/storeReset';
import { onInvoke } from '@/test/mocks/tauri';
import {
LIBRARY_GRID_MAX_COLUMNS_MAX,
LIBRARY_GRID_MAX_COLUMNS_MIN,
} from './authStoreDefaults';
beforeEach(() => {
resetAuthStore();
@@ -120,6 +124,17 @@ describe('setters with validation / clamping', () => {
expect(useAuthStore.getState().trackPreviewDurationSec).toBe(31);
});
it('setLibraryGridMaxColumns clamps to the allowed column range', () => {
useAuthStore.getState().setLibraryGridMaxColumns(99);
expect(useAuthStore.getState().libraryGridMaxColumns).toBe(LIBRARY_GRID_MAX_COLUMNS_MAX);
useAuthStore.getState().setLibraryGridMaxColumns(1);
expect(useAuthStore.getState().libraryGridMaxColumns).toBe(LIBRARY_GRID_MAX_COLUMNS_MIN);
useAuthStore.getState().setLibraryGridMaxColumns(6);
expect(useAuthStore.getState().libraryGridMaxColumns).toBe(6);
});
it('setTrackPreviewsEnabled coerces truthy/falsy to boolean', () => {
useAuthStore.getState().setTrackPreviewsEnabled('yes' as unknown as boolean);
expect(useAuthStore.getState().trackPreviewsEnabled).toBe(true);