From 388406621f63d574300a091d1a4acd46fe743206 Mon Sep 17 00:00:00 2001 From: Bernt Christian Egeland Date: Sat, 28 Aug 2021 22:41:32 +0200 Subject: [PATCH] removed some video controls for mobile devices --- web/src/components/VideoPlayer.jsx | 2 +- web/src/index.css | 17 ++++++++- web/src/routes/Event.jsx | 35 ++++++++++++------- web/src/routes/Events/components/tableRow.jsx | 9 +++-- .../routes/Events/hooks/useClickOutside.jsx | 2 +- web/src/routes/Events/index.jsx | 2 -- 6 files changed, 44 insertions(+), 23 deletions(-) diff --git a/web/src/components/VideoPlayer.jsx b/web/src/components/VideoPlayer.jsx index 3560d964a..24ba747b5 100644 --- a/web/src/components/VideoPlayer.jsx +++ b/web/src/components/VideoPlayer.jsx @@ -88,7 +88,7 @@ export default function VideoPlayer({ children, options, seekOptions = {}, onRea return (
-
); diff --git a/web/src/index.css b/web/src/index.css index 2278ef964..b7b93a69e 100644 --- a/web/src/index.css +++ b/web/src/index.css @@ -36,5 +36,20 @@ Maintain aspect ratio and scale down the video container Could not find a proper tailwind css. */ .outer-max-width { - max-width: 60%; + max-width: 70%; +} + +/* + Hide some videoplayer controls on mobile devices to + align the video player and bottom control bar properly. +*/ +@media only screen and (max-width: 700px) { + .small-player .vjs-time-control, + .small-player .vjs-time-divider { + display: none; + } + div.vjs-control-bar > .skip-back.skip-5, + div.vjs-control-bar > .skip-forward.skip-10 { + display: none; + } } diff --git a/web/src/routes/Event.jsx b/web/src/routes/Event.jsx index b6d5e6b40..a92e097a0 100644 --- a/web/src/routes/Event.jsx +++ b/web/src/routes/Event.jsx @@ -1,5 +1,5 @@ import { h, Fragment } from 'preact'; -import { useCallback, useState, useEffect, useRef } from 'preact/hooks'; +import { useCallback, useState, useEffect } from 'preact/hooks'; import Link from '../components/Link'; import ActivityIndicator from '../components/ActivityIndicator'; import Button from '../components/Button'; @@ -33,9 +33,8 @@ export default function Event({ eventId, close, scrollRef }) { // When opening new event window, the previous one will sometimes cause the // navbar to be visible, hence the "hide nav" code bellow. // Navbar will be hided if we add the - translate - y - full class.appBar.js - console.log('getElementById'); - let element = document.getElementById('appbar'); - element.classList.add('-translate-y-full'); + const element = document.getElementById('appbar'); + if (element) element.classList.add('-translate-y-full'); }; }, [data, scrollRef, eventId, shouldScroll]); @@ -70,23 +69,33 @@ export default function Event({ eventId, close, scrollRef }) { return (
-
- - -
-
- -
@@ -141,13 +150,13 @@ export default function Event({ eventId, close, scrollRef }) { ) : null}
-
+
{data.has_clip ? ( Clip + viewEventHandler(id)} ref={lastRowRef} data-start-time={startTime} - // data-reached-end={reachedEnd} + // data-reached-end={reachedEnd} <-- Enable this will cause all events to re-render when reaching end. > { diff --git a/web/src/routes/Events/index.jsx b/web/src/routes/Events/index.jsx index 0597b230f..eb9c9223f 100644 --- a/web/src/routes/Events/index.jsx +++ b/web/src/routes/Events/index.jsx @@ -80,8 +80,6 @@ export default function Events({ path: pathname, limit = API_LIMIT } = {}) { ), [apiHost, handleFilter, pathname, scrollToRef] ); - - // console.log('main render'); return (
Events