From 338729d96ddfe5413babb3a0ddde43eb70812e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa?= Date: Wed, 2 Oct 2024 18:50:32 +0200 Subject: [PATCH] empty fullscreen fix --- .../src/containers/welcome-message/index.tsx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/client/src/containers/welcome-message/index.tsx b/client/src/containers/welcome-message/index.tsx index 8650af0..87662b5 100644 --- a/client/src/containers/welcome-message/index.tsx +++ b/client/src/containers/welcome-message/index.tsx @@ -2,6 +2,8 @@ import { useEffect, useRef, useState } from "react"; +import isEmpty from "lodash-es/isEmpty"; + import { useCookies } from "react-cookie"; import ReactPlayer from "react-player"; @@ -10,8 +12,6 @@ import Image from "next/image"; import { LuPlay } from "react-icons/lu"; import screenfull from "screenfull"; -import env from "@/env.mjs"; - import { cn } from "@/lib/classnames"; import { useGetWelcomeMessage } from "@/types/generated/welcome-message"; @@ -43,14 +43,15 @@ export default function WelcomeMessage() { const handleFullscreen = () => { setFullscreen(screenfull?.isFullscreen); }; - - // useEffect(() => { - // screenfull?.on("change", handleFullscreen); - - // return () => { - // screenfull?.off("change", handleFullscreen); - // }; - // }, []); + useEffect(() => { + if (!isEmpty(screenfull)) { + screenfull?.on("change", handleFullscreen); + + return () => { + screenfull?.off("change", handleFullscreen); + }; + } + }, []); return (