feat(ui): 'noFooter' query param to remove controls from assist page

This commit is contained in:
nick-delirium 2023-10-20 17:06:05 +02:00 committed by Shekar Siri
parent 3bbff218c4
commit 26f465ec69
2 changed files with 12 additions and 7 deletions

View file

@ -189,7 +189,7 @@ class Router extends React.Component {
destinationPath !== routes.login() &&
destinationPath !== '/'
) {
this.props.history.push(destinationPath);
history.push(destinationPath + window.location.search);
}
if (!prevProps.isLoggedIn && this.props.isLoggedIn) {
@ -232,9 +232,6 @@ class Router extends React.Component {
<Switch key='content'>
<Route exact strict path={withSiteId(SESSION_PATH, siteIdList)} component={Session} />
<Route exact strict path={withSiteId(LIVE_SESSION_PATH, siteIdList)} component={LiveSession} />
<Route exact strict path={withSiteId(LIVE_SESSION_PATH, siteIdList)}
render={(props) => <Session {...props} live />} />
<Route path='*' render={NotFoundPage} />
</Switch>
</Suspense>

View file

@ -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<ILivePlayerContext>(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 (
<div className={styles.controls}>
<Timeline />
{!noMulti ?
<div className={cn(styles.buttons, '!px-5 !pt-0')} data-is-live>
<div className="flex items-center">
{!closedLive && (
@ -112,6 +119,7 @@ function Controls(props: any) {
/>
</div>
</div>
: null}
</div>
);
}