From 7a167c01016736e678d7d05ace1b48d9925a0b26 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 20 Oct 2023 17:06:05 +0200 Subject: [PATCH] feat(ui): 'noFooter' query param to remove controls from assist page --- frontend/app/Router.tsx | 12 +++--------- .../Session/Player/LivePlayer/LiveControls.tsx | 14 +++++++++++--- frontend/app/mstore/types/sessionSettings.ts | 1 - 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/frontend/app/Router.tsx b/frontend/app/Router.tsx index 604731397..2e24b0116 100644 --- a/frontend/app/Router.tsx +++ b/frontend/app/Router.tsx @@ -185,7 +185,7 @@ const Router: React.FC = (props) => { destinationPath !== routes.login() && destinationPath !== '/' ) { - history.push(destinationPath); + history.push(destinationPath + window.location.search); } if (!prevIsLoggedIn && props.isLoggedIn) { @@ -292,14 +292,8 @@ const Router: React.FC = (props) => { component={enhancedComponents.SessionsOverview} /> - - } - /> + + {Object.entries(routes.redirects).map(([fr, to]) => ( ))} diff --git a/frontend/app/components/Session/Player/LivePlayer/LiveControls.tsx b/frontend/app/components/Session/Player/LivePlayer/LiveControls.tsx index fa32bba1c..38393d947 100644 --- a/frontend/app/components/Session/Player/LivePlayer/LiveControls.tsx +++ b/frontend/app/components/Session/Player/LivePlayer/LiveControls.tsx @@ -10,7 +10,7 @@ import { import { PlayerContext, ILivePlayerContext } from 'App/components/Session/playerContext'; import { observer } from 'mobx-react-lite'; import { fetchSessions } from 'Duck/liveSearch'; - +import { useLocation } from "react-router-dom"; import AssistDuration from './AssistDuration'; import Timeline from './Timeline'; import ControlButton from 'Components/Session_/Player/Controls/ControlButton'; @@ -20,6 +20,8 @@ import styles from 'Components/Session_/Player/Controls/controls.module.css'; function Controls(props: any) { // @ts-ignore ?? TODO const { player, store } = React.useContext(PlayerContext); + const [noMulti, setNoMulti] = React.useState(false); + const { search } = useLocation(); const { jumpToLive } = player; const { @@ -58,6 +60,12 @@ function Controls(props: any) { if (totalAssistSessions === 0) { fetchAssistSessions(); } + const queryParams = new URLSearchParams(search); + if ( + (queryParams.has('noFooter') && queryParams.get('noFooter') === 'true') + ) { + setNoMulti(true); + } return () => { document.removeEventListener('keydown', onKeyDown.bind(this)); }; @@ -73,8 +81,6 @@ function Controls(props: any) { player.jumpInterval(-SKIP_INTERVALS[skipInterval]); }; - - const toggleBottomTools = (blockName: number) => { toggleBottomBlock(blockName); }; @@ -82,6 +88,7 @@ function Controls(props: any) { return (
+ {!noMulti ?
{!closedLive && ( @@ -112,6 +119,7 @@ function Controls(props: any) { />
+ : null}
); } diff --git a/frontend/app/mstore/types/sessionSettings.ts b/frontend/app/mstore/types/sessionSettings.ts index a07a41189..876d3a57a 100644 --- a/frontend/app/mstore/types/sessionSettings.ts +++ b/frontend/app/mstore/types/sessionSettings.ts @@ -74,7 +74,6 @@ export default class SessionSettings { constructor() { - console.log(localStorage.getItem(SHOWN_TIMEZONE)) // compatibility fix for old timezone storage // TODO: remove after a while (1.7.1?) const userTimezoneOffset = moment().format('Z');