chore: ControlBar & VolumeChangeIndicator show volume=0 with muted icon

Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
This commit is contained in:
Lachezar Lechev 2025-03-21 20:55:34 +02:00
parent acb441bbcf
commit 3c5bc1a12c
No known key found for this signature in database
GPG key ID: FDC9325CE311E8A4
2 changed files with 9 additions and 7 deletions

View file

@ -129,9 +129,10 @@ const ControlBar = ({
name={
(typeof muted === 'boolean' && muted) ? 'volume-mute' :
(volume === null || isNaN(volume)) ? 'volume-off' :
volume < 30 ? 'volume-low' :
volume < 70 ? 'volume-medium' :
'volume-high'
volume === 0 ? 'volume-mute' :
volume < 30 ? 'volume-low' :
volume < 70 ? 'volume-medium' :
'volume-high'
}
/>
</Button>

View file

@ -14,11 +14,12 @@ const VolumeChangeIndicator = React.memo(({ muted, volume }) => {
const prevVolume = React.useRef(volume);
const iconName = React.useMemo(() => {
return typeof muted === 'boolean' && muted ? 'volume-mute' :
return (typeof muted === 'boolean' && muted) ? 'volume-mute' :
volume === null || isNaN(volume) ? 'volume-off' :
volume < 30 ? 'volume-low' :
volume < 70 ? 'volume-medium' :
'volume-high';
volume === 0 ? 'volume-mute' :
volume < 30 ? 'volume-low' :
volume < 70 ? 'volume-medium' :
'volume-high';
}, [muted, volume]);
React.useEffect(() => {