fix: apply missing bg overlay opacity for mobile fullscreen player

This commit is contained in:
jeffvli committed 2026-09-01 20:21:14 -07:00
1 parent 52656b80f8
commit 09d8cc443f
2 files changed
+61 -9

No files matched your search

@@ -20,6 +20,12 @@
background-size: cover;
}
.background-color {
position: absolute;
inset: 0;
z-index: -2;
}
.background-image-overlay {
position: absolute;
top: 0;
@@ -31,6 +37,13 @@
backdrop-filter: blur(var(--image-blur));
}
.background-overlay {
position: absolute;
inset: 0;
z-index: -1;
pointer-events: none;
}
.player-state,
.queue-state,
.lyrics-state {
@@ -217,10 +217,11 @@ const overlayVariants: Variants = {
interface BackgroundImageOverlayProps {
dynamicBackground: boolean | undefined;
dynamicImageBlur: number | undefined;
dynamicIsImage: boolean | undefined;
}
const BackgroundImageOverlay = memo(
({ dynamicBackground, dynamicImageBlur }: BackgroundImageOverlayProps) => {
({ dynamicBackground, dynamicImageBlur, dynamicIsImage }: BackgroundImageOverlayProps) => {
const currentSong = usePlayerSong();
const { nextSong } = usePlayerData();
@@ -254,7 +255,7 @@ const BackgroundImageOverlay = memo(
previousSongRef.current = currentSong?._uniqueId;
}, [currentSong?._uniqueId, nextSong?._uniqueId]);
if (!dynamicBackground) {
if (!dynamicBackground || !dynamicIsImage) {
return null;
}
@@ -298,14 +299,44 @@ const BackgroundImageOverlay = memo(
BackgroundImageOverlay.displayName = 'BackgroundImageOverlay';
interface BackgroundOverlayProps {
dynamicBackground: boolean | undefined;
opacity: number;
}
const BackgroundOverlay = memo(({ dynamicBackground, opacity }: BackgroundOverlayProps) => {
if (!dynamicBackground) {
return null;
}
const alpha = Math.min(1, Math.max(0, opacity / 120));
return (
<div
className={styles.backgroundOverlay}
style={{ backgroundColor: `rgba(0, 0, 0, ${alpha})` }}
/>
);
});
BackgroundOverlay.displayName = 'BackgroundOverlay';
interface MobilePlayerContainerProps {
children: ReactNode;
dynamicBackground: boolean | undefined;
dynamicImageBlur: number | undefined;
dynamicIsImage: boolean | undefined;
opacity: number;
}
const MobilePlayerContainer = memo(
({ children, dynamicBackground, dynamicIsImage }: MobilePlayerContainerProps) => {
({
children,
dynamicBackground,
dynamicImageBlur,
dynamicIsImage,
opacity,
}: MobilePlayerContainerProps) => {
const currentSong = usePlayerSong();
const imageUrl = useItemImageUrl({
id: currentSong?.imageId || undefined,
@@ -340,14 +371,23 @@ const MobilePlayerContainer = memo(
exit="closed"
initial="closed"
style={{
backgroundColor,
backgroundColor: dynamicBackground ? 'transparent' : backgroundColor,
}}
variants={mobileContainerVariants}
>
{dynamicBackground && (
<div className={styles.backgroundColor} style={{ backgroundColor }} />
)}
<BackgroundImage
dynamicBackground={dynamicBackground}
dynamicIsImage={dynamicIsImage}
/>
<BackgroundOverlay dynamicBackground={dynamicBackground} opacity={opacity} />
<BackgroundImageOverlay
dynamicBackground={dynamicBackground}
dynamicImageBlur={dynamicImageBlur}
dynamicIsImage={dynamicIsImage}
/>
{children}
</motion.div>
);
@@ -377,7 +417,7 @@ export const MobileFullscreenPlayer = () => {
const { t } = useTranslation();
const setFullScreenPlayerStore = useSetFullScreenPlayerStore();
const { setStore } = useFullScreenPlayerStoreActions();
const { activeTab, dynamicBackground, dynamicImageBlur, dynamicIsImage } =
const { activeTab, dynamicBackground, dynamicImageBlur, dynamicIsImage, opacity } =
useFullScreenPlayerStore();
const currentSong = usePlayerSong();
const { currentSong: currentSongData } = usePlayerData();
@@ -387,6 +427,7 @@ export const MobileFullscreenPlayer = () => {
const isPlayingRadio = isRadioActive && isRadioPlaying;
const effectiveDynamicBackground = dynamicBackground && !isPlayingRadio;
const setFavorite = useSetFavorite();
const showRatingsSetting = useShowRatings();
const showFavorites = useShowFavorites();
@@ -455,12 +496,10 @@ export const MobileFullscreenPlayer = () => {
return (
<MobilePlayerContainer
dynamicBackground={effectiveDynamicBackground}
dynamicImageBlur={dynamicImageBlur}
dynamicIsImage={dynamicIsImage}
opacity={opacity}
>
<BackgroundImageOverlay
dynamicBackground={effectiveDynamicBackground}
dynamicImageBlur={dynamicImageBlur}
/>
<motion.div
animate={{
opacity: isPlayerState ? 1 : 0,