From bccd4a7e46d0c9470822e8bd4334abc92b5bf85f Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 27 Jul 2021 12:54:47 +0200 Subject: janky beginnings of menu bar physics --- pages/present.tsx | 59 +++++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 32 deletions(-) (limited to 'pages') diff --git a/pages/present.tsx b/pages/present.tsx index 0468d48..2cb8e98 100644 --- a/pages/present.tsx +++ b/pages/present.tsx @@ -1,6 +1,7 @@ import Button from '@material-ui/core/Button'; import { useEffect, useState } from 'react'; import Timecode from 'timecode-boss'; +import { FullScreenControls, MenuBarControls } from '../components/controls'; import Project, { arrayBufferToBase64 } from '../project'; import timeline, { delaySlide, loopSlide, slide, speedChangeSlide } from '../timeline'; @@ -203,10 +204,18 @@ export default function Present() { var [project, _setProject] = useState(new Project()); player.project = project; + var controlType = project.settings?.controls?.ControlType; + var [menu, setMenu] = useState(true); + + var Controls = { + 'FullScreen': FullScreenControls, + 'MenuBar': MenuBarControls, + }[controlType] || (() => null); + + var [time, setTime] = useState(''); + useEffect(() => { - setInterval(() => { - document.getElementById('time').innerText = new Date().toLocaleTimeString(); - }, 500); + setInterval(() => setTime(new Date().toLocaleTimeString()), 500); }, []); useEffect(() => { @@ -222,40 +231,26 @@ export default function Present() { -
-
{ - player.previous(); - rerender(); - }} - /> -
{ - document.getElementById('menu').classList.add('active'); - rerender(); - }} - /> -
{ - player.next(); - player.player.play(); - rerender(); - }} - /> -
-