From d07727a1b3c8b17fb9f4977f223ea04d2880686c Mon Sep 17 00:00:00 2001 From: Mohammed Huzaif Ahmed Date: Sat, 7 Oct 2023 22:32:53 +0530 Subject: [PATCH 1/3] Full screen toggling feature added --- .../Tutorials/subComps/TutorialTitle.jsx | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/components/Tutorials/subComps/TutorialTitle.jsx b/src/components/Tutorials/subComps/TutorialTitle.jsx index 7afb46cf..b93d70a4 100644 --- a/src/components/Tutorials/subComps/TutorialTitle.jsx +++ b/src/components/Tutorials/subComps/TutorialTitle.jsx @@ -4,6 +4,8 @@ import Tooltip from "@mui/material/Tooltip"; import Grid from "@mui/material/Grid"; import QueryBuilderIcon from "@mui/icons-material/QueryBuilder"; import FullscreenIcon from "@mui/icons-material/Fullscreen"; +import FullscreenExitIcon from '@mui/icons-material/FullscreenExit' +import { useState } from "react"; import { Typography } from "@mui/material"; const TutorialHeading = ({ @@ -13,9 +15,16 @@ const TutorialHeading = ({ tutorialData, timeRemaining }) => { + let [Fullscreen, setFullscreen] = useState(false); + const toggleFullscreen = () => { + setFullscreen(true); document.documentElement.requestFullscreen(); }; + const togglesmallScreen = () => { + setFullscreen(false); + document.exitFullscreen(); + } let styleProps = { backgroundColor: tutorialData.background_color || "#ffffff", @@ -50,16 +59,25 @@ const TutorialHeading = ({ {timeRemaining} mins remaining - + {Fullscreen ? + : + - + } )} From 811526aed68e9475e01187e5347e636be72a94c8 Mon Sep 17 00:00:00 2001 From: Mohammed Huzaif Ahmed Date: Sun, 8 Oct 2023 18:04:53 +0530 Subject: [PATCH 2/3] Fullscreen toggling in same function --- .../Tutorials/subComps/TutorialTitle.jsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/Tutorials/subComps/TutorialTitle.jsx b/src/components/Tutorials/subComps/TutorialTitle.jsx index b93d70a4..99a5f4bc 100644 --- a/src/components/Tutorials/subComps/TutorialTitle.jsx +++ b/src/components/Tutorials/subComps/TutorialTitle.jsx @@ -7,6 +7,7 @@ import FullscreenIcon from "@mui/icons-material/Fullscreen"; import FullscreenExitIcon from '@mui/icons-material/FullscreenExit' import { useState } from "react"; import { Typography } from "@mui/material"; +import { set } from "lodash"; const TutorialHeading = ({ stepPanelVisible, @@ -18,13 +19,15 @@ const TutorialHeading = ({ let [Fullscreen, setFullscreen] = useState(false); const toggleFullscreen = () => { - setFullscreen(true); - document.documentElement.requestFullscreen(); + if (Fullscreen) { + setFullscreen(false); + document.exitFullscreen(); + } else { + setFullscreen(true); + document.documentElement.requestFullscreen(); + } + setFullscreen(!document.fullscreenElement); }; - const togglesmallScreen = () => { - setFullscreen(false); - document.exitFullscreen(); - } let styleProps = { backgroundColor: tutorialData.background_color || "#ffffff", @@ -62,7 +65,7 @@ const TutorialHeading = ({ {Fullscreen ?