import cn from 'classnames'; import { observer } from 'mobx-react-lite'; import React from 'react'; import { connect } from 'react-redux'; import { useHistory } from 'react-router'; import { MobilePlayerContext } from 'App/components/Session/playerContext'; import { FullScreenButton, PlayButton, PlayingState } from 'App/player-ui'; import ControlButton from 'Components/Session_/Player/Controls/ControlButton'; import Timeline from 'Components/Session_/Player/Controls/Timeline'; import { LaunchConsoleShortcut, LaunchEventsShortcut, LaunchNetworkShortcut, LaunchPerformanceShortcut, LaunchXRaShortcut, } from 'Components/Session_/Player/Controls/components/KeyboardHelp'; import PlayerControls from 'Components/Session_/Player/Controls/components/PlayerControls'; import styles from 'Components/Session_/Player/Controls/controls.module.css'; import { fetchSessions } from 'Duck/liveSearch'; import { Tooltip } from 'UI'; import { CONSOLE, EXCEPTIONS, NETWORK, OVERVIEW, PERFORMANCE, STACKEVENTS, } from 'App/mstore/uiPlayerStore'; import { useStore } from 'App/mstore'; import { session as sessionRoute, withSiteId } from 'App/routes'; import { SummaryButton } from 'Components/Session_/Player/Controls/Controls'; import useShortcuts from '../ReplayPlayer/useShortcuts'; export const SKIP_INTERVALS = { 2: 2e3, 5: 5e3, 10: 1e4, 15: 15e3, 20: 2e4, 30: 3e4, 60: 6e4, }; function Controls(props: any) { const { player, store } = React.useContext(MobilePlayerContext); const history = useHistory(); const { playing, completed, skip, speed, messagesLoading } = store.get(); const { uiPlayerStore, projectsStore } = useStore(); const fullscreen = uiPlayerStore.fullscreen; const bottomBlock = uiPlayerStore.bottomBlock; const toggleBottomBlock = uiPlayerStore.toggleBottomBlock const fullscreenOn = uiPlayerStore.fullscreenOn; const fullscreenOff = uiPlayerStore.fullscreenOff; const changeSkipInterval = uiPlayerStore.changeSkipInterval; const skipInterval = uiPlayerStore.skipInterval; const siteId = projectsStore.siteId; const { session, setActiveTab, previousSessionId, nextSessionId, disableDevtools, } = props; const disabled = messagesLoading; const sessionTz = session?.timezone; const nextHandler = () => { history.push(withSiteId(sessionRoute(nextSessionId), siteId)); }; const prevHandler = () => { history.push(withSiteId(sessionRoute(previousSessionId), siteId)); }; useShortcuts({ skipInterval, fullScreenOn: fullscreenOn, fullScreenOff: fullscreenOff, toggleBottomBlock, openNextSession: nextHandler, openPrevSession: prevHandler, setActiveTab, disableDevtools }); const forthTenSeconds = () => { // @ts-ignore player.jumpInterval(SKIP_INTERVALS[skipInterval]); }; const backTenSeconds = () => { // @ts-ignore player.jumpInterval(-SKIP_INTERVALS[skipInterval]); }; const toggleBottomTools = (blockName: number) => { toggleBottomBlock(blockName); }; const state = completed ? PlayingState.Completed : playing ? PlayingState.Playing : PlayingState.Paused; return (