fix album art res 0 and allow resizing volume bar

This commit is contained in:
Kendall Garner 2024-08-22 21:57:58 -07:00
parent 37b0407188
commit 028ccfb1cd
No known key found for this signature in database
GPG Key ID: 18D2767419676C87
4 changed files with 35 additions and 5 deletions

View File

@ -621,6 +621,8 @@
"useSystemTheme_description": "follow the system-defined light or dark preference", "useSystemTheme_description": "follow the system-defined light or dark preference",
"volumeWheelStep": "volume wheel step", "volumeWheelStep": "volume wheel step",
"volumeWheelStep_description": "the amount of volume to change when scrolling the mouse wheel on the volume slider", "volumeWheelStep_description": "the amount of volume to change when scrolling the mouse wheel on the volume slider",
"volumeWidth": "volume slider width",
"volumeWidth_description": "the width of the volume slider",
"windowBarStyle": "window bar style", "windowBarStyle": "window bar style",
"windowBarStyle_description": "select the style of the window bar", "windowBarStyle_description": "select the style of the window bar",
"zoom": "zoom percentage", "zoom": "zoom percentage",

View File

@ -18,6 +18,7 @@ import {
useHotkeySettings, useHotkeySettings,
useMuted, useMuted,
usePreviousSong, usePreviousSong,
useSettingsStore,
useSidebarStore, useSidebarStore,
useSpeed, useSpeed,
useVolume, useVolume,
@ -54,6 +55,7 @@ export const RightControls = () => {
} = useRightControls(); } = useRightControls();
const speed = useSpeed(); const speed = useSpeed();
const volumeWidth = useSettingsStore((state) => state.general.volumeWidth);
const updateRatingMutation = useSetRating({}); const updateRatingMutation = useSetRating({});
const addToFavoritesMutation = useCreateFavorite({}); const addToFavoritesMutation = useCreateFavorite({});
@ -324,7 +326,7 @@ export const RightControls = () => {
min={0} min={0}
size={6} size={6}
value={volume} value={volume}
w="60px" w={volumeWidth}
onChange={handleVolumeSlider} onChange={handleVolumeSlider}
onWheel={handleVolumeWheel} onWheel={handleVolumeWheel}
/> />

View File

@ -71,14 +71,15 @@ export const ControlSettings = () => {
<NumberInput <NumberInput
defaultValue={settings.albumArtRes || undefined} defaultValue={settings.albumArtRes || undefined}
max={2500} max={2500}
min={175}
placeholder="0" placeholder="0"
rightSection="px" rightSection="px"
value={settings.albumArtRes ?? 0}
width={75} width={75}
onBlur={(e) => { onBlur={(e) => {
const newVal = e.currentTarget.value const newVal =
? Math.min(Math.max(Number(e.currentTarget.value), 175), 2500) e.currentTarget.value !== '0'
: null; ? Math.min(Math.max(Number(e.currentTarget.value), 175), 2500)
: null;
setSettings({ general: { ...settings, albumArtRes: newVal } }); setSettings({ general: { ...settings, albumArtRes: newVal } });
}} }}
/> />
@ -322,6 +323,29 @@ export const ControlSettings = () => {
isHidden: false, isHidden: false,
title: t('setting.volumeWheelStep', { postProcess: 'sentenceCase' }), title: t('setting.volumeWheelStep', { postProcess: 'sentenceCase' }),
}, },
{
control: (
<NumberInput
defaultValue={settings.volumeWidth}
max={180}
min={30}
placeholder="0"
rightSection="px"
width={75}
onBlur={(e) => {
setSettings({
general: { ...settings, volumeWidth: Number(e.currentTarget.value) },
});
}}
/>
),
description: t('setting.volumeWidth', {
context: 'description',
postProcess: 'sentenceCase',
}),
isHidden: false,
title: t('setting.volumeWidth', { postProcess: 'sentenceCase' }),
},
{ {
control: ( control: (
<Switch <Switch

View File

@ -220,6 +220,7 @@ export interface SettingsState {
themeDark: AppTheme; themeDark: AppTheme;
themeLight: AppTheme; themeLight: AppTheme;
volumeWheelStep: number; volumeWheelStep: number;
volumeWidth: number;
zoomFactor: number; zoomFactor: number;
}; };
hotkeys: { hotkeys: {
@ -344,6 +345,7 @@ const initialState: SettingsState = {
themeDark: AppTheme.DEFAULT_DARK, themeDark: AppTheme.DEFAULT_DARK,
themeLight: AppTheme.DEFAULT_LIGHT, themeLight: AppTheme.DEFAULT_LIGHT,
volumeWheelStep: 5, volumeWheelStep: 5,
volumeWidth: 60,
zoomFactor: 100, zoomFactor: 100,
}, },
hotkeys: { hotkeys: {