Files
Psychotoxical-psysonic/src/store/authDiscoveryActions.ts
T
Frank Stellmacher c39465dfad feat(sidebar): toggle to pin Now Playing to the top (#1000)
* feat(sidebar): add toggle to pin Now Playing to the top

The fixed Now Playing entry can now be pinned to the very top of the
sidebar (above the Library label) instead of sitting above the bottom
spacer. Adds a persisted `nowPlayingAtTop` setting (default off, so
existing layouts are unchanged) and a toggle in the sidebar customizer
next to the Mix-navigation split. The entry stays non-hideable and
keeps its playing indicator in both positions.

* i18n(settings): Now Playing-at-top toggle strings (9 locales)

* docs(changelog): note Now Playing top toggle (#1000)
2026-06-05 12:35:39 +02:00

41 lines
1.6 KiB
TypeScript

import { clampMixFilterMinStars, clampRandomMixSize } from './authStoreHelpers';
import type { AuthState } from './authStoreTypes';
type SetState = (
partial: Partial<AuthState> | ((state: AuthState) => Partial<AuthState>),
) => void;
/**
* Discovery + auto-queue settings: mix min-rating thresholds (each
* clamped to 0…3 stars), random-mix size (snapped to the allowed
* RANDOM_MIX_SIZE_OPTIONS bucket), lucky-mix sidebar visibility,
* random-nav style, infinite-queue + preserve-play-next-order
* toggles.
*/
export function createDiscoveryActions(set: SetState): Pick<
AuthState,
| 'setMixMinRatingFilterEnabled'
| 'setMixMinRatingSong'
| 'setMixMinRatingAlbum'
| 'setMixMinRatingArtist'
| 'setRandomMixSize'
| 'setShowLuckyMixMenu'
| 'setRandomNavMode'
| 'setNowPlayingAtTop'
| 'setInfiniteQueueEnabled'
| 'setPreservePlayNextOrder'
> {
return {
setMixMinRatingFilterEnabled: (v) => set({ mixMinRatingFilterEnabled: v }),
setMixMinRatingSong: (v) => set({ mixMinRatingSong: clampMixFilterMinStars(v) }),
setMixMinRatingAlbum: (v) => set({ mixMinRatingAlbum: clampMixFilterMinStars(v) }),
setMixMinRatingArtist: (v) => set({ mixMinRatingArtist: clampMixFilterMinStars(v) }),
setRandomMixSize: (v) => set({ randomMixSize: clampRandomMixSize(v) }),
setShowLuckyMixMenu: (v) => set({ showLuckyMixMenu: v }),
setRandomNavMode: (v) => set({ randomNavMode: v }),
setNowPlayingAtTop: (v) => set({ nowPlayingAtTop: v }),
setInfiniteQueueEnabled: (v) => set({ infiniteQueueEnabled: v }),
setPreservePlayNextOrder: (v) => set({ preservePlayNextOrder: v }),
};
}