aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-07-27 12:54:47 +0200
committerlonkaars <loek@pipeframe.xyz>2021-07-27 12:54:47 +0200
commitbccd4a7e46d0c9470822e8bd4334abc92b5bf85f (patch)
tree7d8425adb502d11f71724db7641777dfdce809d5 /pages
parenta6f2e01f825db7e4ec057c34f26bebf0f4d7a619 (diff)
janky beginnings of menu bar physics
Diffstat (limited to 'pages')
-rw-r--r--pages/present.tsx59
1 files changed, 27 insertions, 32 deletions
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() {
</div>
</div>
</div>
- <div className='fullscreenControls posabs a0'>
- <div
- className='control previous'
- onClick={() => {
- player.previous();
- rerender();
- }}
- />
- <div
- className='control menu'
- onClick={() => {
- document.getElementById('menu').classList.add('active');
- rerender();
- }}
- />
- <div
- className='control next'
- onClick={() => {
- player.next();
- player.player.play();
- rerender();
- }}
- />
- </div>
- <div className='menu posabs a0' id='menu'>
+ <MenuBarControls
+ next={() => {
+ player.next();
+ player.player.play();
+ rerender();
+ }}
+ previous={() => {
+ player.previous();
+ rerender();
+ }}
+ menu={() => setMenu(true)}
+ />
+ <div className={'menu posabs a0 ' + (menu ? 'active ' : '')} id='menu'>
<div
className='background posabs a0'
- onClick={() => {
- document.getElementById('menu').classList.remove('active');
- }}
+ onClick={() => setMenu(false)}
/>
<div className='info sidebyside posabs h0 b0'>
<div className='timetitle floatb'>
- <h3 className='time numbers nobr' id='time'>14:00:41</h3>
+ <h3 className='time numbers nobr'>{time}</h3>
<h1 className='title nobr'>{player.project?.name || '???'}</h1>
</div>
<div className='buttons floatb'>