mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 14:55:43 +00:00
606a150e01
* feat(settings): clock format setting (Auto / 24h / 12h) Reported on the Psysonic Discord — the Queue side panel's ETA label and the sleep-timer preview both render via `formatClockTime`, which just calls `toLocaleTimeString` and so follows the user's system locale. On en-US that means AM/PM, with no in-app way out. Add a tri-state **Clock Format** setting under **Settings → System → App Behavior**: * `auto` (default) — keep the existing locale-driven behaviour, so bestehende installs are unaffected on first launch. * `24h` — force 24-hour wall-clock output everywhere `formatClockTime` is used. * `12h` — force AM/PM output. Wired through `authStore` (`clockFormat`, `setClockFormat`), exposed via `CustomSelect` in `SystemTab`, and threaded into the two consumers (`QueueHeader`, `PlaybackDelayModal`) so they re-render on change. `formatClockTime` itself stays a pure helper — it accepts the setting as an optional second argument and maps it to `hour12`. Locale coverage: all nine bundled locales (en, de, es, fr, nl, nb, ru, zh, ro) get the four new settings strings. Pin tests added for the `setClockFormat` setter and the `hour12` mapping in `formatClockTime`. * docs(changelog): clock format setting + contributors (PR #742)
59 lines
2.3 KiB
TypeScript
59 lines
2.3 KiB
TypeScript
import type { AuthState } from './authStoreTypes';
|
|
import { clampLibraryGridMaxColumns } from './authStoreHelpers';
|
|
|
|
type SetState = (
|
|
partial: Partial<AuthState> | ((state: AuthState) => Partial<AuthState>),
|
|
) => void;
|
|
|
|
/**
|
|
* Visual / chrome settings. Pure pass-through setters: tray, titlebar,
|
|
* sidebar toggles, fullscreen lyrics rendering options, changelog
|
|
* banner. No side effects.
|
|
*/
|
|
export function createUiAppearanceActions(set: SetState): Pick<
|
|
AuthState,
|
|
| 'setShowArtistImages'
|
|
| 'setLibraryGridMaxColumns'
|
|
| 'setShowTrayIcon'
|
|
| 'setMinimizeToTray'
|
|
| 'setClockFormat'
|
|
| 'setShowOrbitTrigger'
|
|
| 'setUseCustomTitlebar'
|
|
| 'setPreloadMiniPlayer'
|
|
| 'setLinuxWebkitKineticScroll'
|
|
| 'setSeekbarStyle'
|
|
| 'setQueueNowPlayingCollapsed'
|
|
| 'setQueueDurationDisplayMode'
|
|
| 'setShowFullscreenLyrics'
|
|
| 'setFsLyricsStyle'
|
|
| 'setSidebarLyricsStyle'
|
|
| 'setShowFsArtistPortrait'
|
|
| 'setFsPortraitDim'
|
|
| 'setShowChangelogOnUpdate'
|
|
| 'setLastSeenChangelogVersion'
|
|
| 'setAdvancedSettingsEnabled'
|
|
> {
|
|
return {
|
|
setShowArtistImages: (v) => set({ showArtistImages: v }),
|
|
setLibraryGridMaxColumns: (v) => set({ libraryGridMaxColumns: clampLibraryGridMaxColumns(v) }),
|
|
setShowTrayIcon: (v) => set({ showTrayIcon: v }),
|
|
setMinimizeToTray: (v) => set({ minimizeToTray: v }),
|
|
setClockFormat: (v) => set({ clockFormat: v }),
|
|
setShowOrbitTrigger: (v) => set({ showOrbitTrigger: v }),
|
|
setUseCustomTitlebar: (v) => set({ useCustomTitlebar: v }),
|
|
setPreloadMiniPlayer: (v) => set({ preloadMiniPlayer: v }),
|
|
setLinuxWebkitKineticScroll: (v) => set({ linuxWebkitKineticScroll: v }),
|
|
setSeekbarStyle: (v) => set({ seekbarStyle: v }),
|
|
setQueueNowPlayingCollapsed: (v) => set({ queueNowPlayingCollapsed: v }),
|
|
setQueueDurationDisplayMode: (v) => set({ queueDurationDisplayMode: v }),
|
|
setShowFullscreenLyrics: (v) => set({ showFullscreenLyrics: v }),
|
|
setFsLyricsStyle: (v) => set({ fsLyricsStyle: v }),
|
|
setSidebarLyricsStyle: (v) => set({ sidebarLyricsStyle: v }),
|
|
setShowFsArtistPortrait: (v) => set({ showFsArtistPortrait: v }),
|
|
setFsPortraitDim: (v) => set({ fsPortraitDim: v }),
|
|
setShowChangelogOnUpdate: (v) => set({ showChangelogOnUpdate: v }),
|
|
setLastSeenChangelogVersion: (v) => set({ lastSeenChangelogVersion: v }),
|
|
setAdvancedSettingsEnabled: (v) => set({ advancedSettingsEnabled: v }),
|
|
};
|
|
}
|