From 7a95e071b311682814388e7d76052109ebd5b2f1 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Thu, 13 Jun 2024 10:09:37 +0200 Subject: [PATCH] fix ui: fix "open next session" shortcut --- .../Session_/Player/Controls/Controls.tsx | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/frontend/app/components/Session_/Player/Controls/Controls.tsx b/frontend/app/components/Session_/Player/Controls/Controls.tsx index 682b8b0e5..dbb3682a0 100644 --- a/frontend/app/components/Session_/Player/Controls/Controls.tsx +++ b/frontend/app/components/Session_/Player/Controls/Controls.tsx @@ -4,28 +4,45 @@ import cn from 'classnames'; import { observer } from 'mobx-react-lite'; import React from 'react'; import { connect } from 'react-redux'; - - +import { useHistory } from 'react-router-dom'; import { PlayerContext } from 'App/components/Session/playerContext'; import { useStore } from 'App/mstore'; import { FullScreenButton, PlayButton, PlayingState } from 'App/player-ui'; import { session as sessionRoute, withSiteId } from 'App/routes'; import useShortcuts from 'Components/Session/Player/ReplayPlayer/useShortcuts'; -import { LaunchConsoleShortcut, LaunchEventsShortcut, LaunchNetworkShortcut, LaunchPerformanceShortcut, LaunchStateShortcut, LaunchXRaShortcut } from 'Components/Session_/Player/Controls/components/KeyboardHelp'; -import { CONSOLE, GRAPHQL, INSPECTOR, NETWORK, OVERVIEW, PERFORMANCE, PROFILER, STACKEVENTS, STORAGE, changeSkipInterval, fullscreenOff, fullscreenOn, toggleBottomBlock } from 'Duck/components/player'; +import { + LaunchConsoleShortcut, + LaunchEventsShortcut, + LaunchNetworkShortcut, + LaunchPerformanceShortcut, + LaunchStateShortcut, + LaunchXRaShortcut, +} from 'Components/Session_/Player/Controls/components/KeyboardHelp'; +import { + CONSOLE, + GRAPHQL, + INSPECTOR, + NETWORK, + OVERVIEW, + PERFORMANCE, + PROFILER, + STACKEVENTS, + STORAGE, + changeSkipInterval, + fullscreenOff, + fullscreenOn, + toggleBottomBlock, +} from 'Duck/components/player'; import { fetchSessions } from 'Duck/liveSearch'; import { Icon } from 'UI'; - - import DropdownAudioPlayer from '../../../Session/Player/ReplayPlayer/AudioPlayer'; import ControlButton from './ControlButton'; import Timeline from './Timeline'; import PlayerControls from './components/PlayerControls'; import styles from './controls.module.css'; - export const SKIP_INTERVALS = { 2: 2e3, 5: 5e3, @@ -58,7 +75,7 @@ function getStorageName(type: any) { function Controls(props: any) { const { player, store } = React.useContext(PlayerContext); const { uxtestingStore } = useStore(); - + const history = useHistory(); const { playing, completed, @@ -89,11 +106,11 @@ function Controls(props: any) { const sessionTz = session?.timezone; const nextHandler = () => { - props.history.push(withSiteId(sessionRoute(nextSessionId), siteId)); + history.push(withSiteId(sessionRoute(nextSessionId), siteId)); }; const prevHandler = () => { - props.history.push(withSiteId(sessionRoute(previousSessionId), siteId)); + history.push(withSiteId(sessionRoute(previousSessionId), siteId)); }; useShortcuts({ @@ -337,7 +354,9 @@ const DevtoolsButtons = observer( label="Profiler" /> )} - {possibleAudio.length ? : null} + {possibleAudio.length ? ( + + ) : null} ); }