Files
Psychotoxical-psysonic/src/store/authLyricsSettingsActions.ts
T
Frank Stellmacher fe6acdaa4c refactor(auth): E.45 — extract seven settings factories (#610)
Seven small domain-eng factories peel ~53 trivial setters out of the
authStore body:

- `createCacheStorageActions` — disk caches (max cache MB, download
  folder, offline download dir, hot-cache enable/MB/debounce/dir).
- `createDiscordSettingsActions` — rich presence, cover source,
  Bandsintown toggle, three template strings.
- `createUiAppearanceActions` — visual chrome: tray, titlebar, sidebar
  toggles, fullscreen-lyrics rendering, changelog banner, seekbar
  style, queue collapse, kinetic scroll, mini-player preload.
- `createLyricsSettingsActions` — lyrics fetch pipeline (server-first,
  netease enablement, source order, mode, static-only).
- `createTrackPreviewActions` — preview enable + per-location +
  start ratio (clamped 0…0.9) + duration (clamped 5…120s).
- `createDiscoveryActions` — mix min-rating filters (clamped 0…3),
  random-mix size (snapped to allowed bucket), lucky-mix visibility,
  random-nav mode, infinite-queue, preserve-play-next-order.
- `createPlumbingSettingsActions` — logging mode, getNowPlaying
  toggle, preload mode + custom seconds, audiobook exclusion,
  genre blacklist.

Pure code-move. authStore.ts: 428 → 384 LOC (−44).
2026-05-12 23:38:09 +02:00

29 lines
955 B
TypeScript

import type { AuthState } from './authStoreTypes';
type SetState = (
partial: Partial<AuthState> | ((state: AuthState) => Partial<AuthState>),
) => void;
/**
* Lyrics fetch-pipeline settings: source order/enablement, mode
* (standard pipeline vs lyricsplus first), and the static-only
* rendering toggle. Visual lyrics chrome (rail vs apple,
* fullscreen show/hide) lives in `authUiAppearanceActions.ts`.
*/
export function createLyricsSettingsActions(set: SetState): Pick<
AuthState,
| 'setLyricsServerFirst'
| 'setEnableNeteaselyrics'
| 'setLyricsSources'
| 'setLyricsMode'
| 'setLyricsStaticOnly'
> {
return {
setLyricsServerFirst: (v) => set({ lyricsServerFirst: v }),
setEnableNeteaselyrics: (v) => set({ enableNeteaselyrics: v }),
setLyricsSources: (sources) => set({ lyricsSources: sources }),
setLyricsMode: (v) => set({ lyricsMode: v }),
setLyricsStaticOnly: (v) => set({ lyricsStaticOnly: v }),
};
}