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
parent 745c1e466f
commit 7a167c0101
3 changed files with 14 additions and 13 deletions

View file

@ -185,7 +185,7 @@ const Router: React.FC<RouterProps> = (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<RouterProps> = (props) => {
component={enhancedComponents.SessionsOverview}
/>
<Route exact strict path={withSiteId(SESSION_PATH, siteIdList)} component={enhancedComponents.Session} />
<Route exact strict path={withSiteId(LIVE_SESSION_PATH, siteIdList)}
component={enhancedComponents.LiveSession} />
<Route
exact
strict
path={withSiteId(LIVE_SESSION_PATH, siteIdList)}
render={(props) => <enhancedComponents.Session {...props} live />}
/>
<Route exact strict path={withSiteId(LIVE_SESSION_PATH, siteIdList)} component={enhancedComponents.LiveSession} />
{Object.entries(routes.redirects).map(([fr, to]) => (
<Redirect key={fr} exact strict from={fr} to={to} />
))}

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>
);
}

View file

@ -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');