Fix main content not always dimmed when a curtain is open.

This commit is contained in:
Madeorsk 2024-07-14 19:56:17 +02:00
parent cc3e292f40
commit 86e4c5aff2
Signed by: Madeorsk
SSH key fingerprint: SHA256:J9G0ofIOLKf7kyS2IfrMqtMaPdfsk1W02+oGueZzDDU

View file

@ -175,9 +175,10 @@ export function CurtainsProvider({children}: React.PropsWithChildren<{}>)
useEffect(() => { useEffect(() => {
if ( if (
Object.keys(curtains).filter((curtainId) => !closedCurtains[curtainId]).length > 0 Object.keys(curtains).filter((curtainId) => !closedCurtains[curtainId]).length > 0
&& !document.body.classList.contains("dimmed")
) // We should dim content if there is at least one open curtain. ) // We should dim content if there is at least one open curtain.
document.body.classList.add("dimmed"); { // Only dim if it's not already dimmed.
if (!document.body.classList.contains("dimmed")) document.body.classList.add("dimmed");
}
else else
// We shouldn't dim content. // We shouldn't dim content.
document.body.classList.remove("dimmed"); document.body.classList.remove("dimmed");