import { LaunchConsoleShortcut, LaunchEventsShortcut, LaunchNetworkShortcut, LaunchPerformanceShortcut, LaunchXRaShortcut } from "Components/Session_/Player/Controls/components/KeyboardHelp"; import React from 'react'; import cn from 'classnames'; import { connect } from 'react-redux'; import { PlayButton, PlayingState, FullScreenButton } from 'App/player-ui'; import { Tooltip } from 'UI'; import { fullscreenOff, fullscreenOn, OVERVIEW, toggleBottomBlock, changeSkipInterval, CONSOLE, STACKEVENTS, NETWORK, PERFORMANCE, EXCEPTIONS, } from 'Duck/components/player'; import { MobilePlayerContext } from 'App/components/Session/playerContext'; import { observer } from 'mobx-react-lite'; import { fetchSessions } from 'Duck/liveSearch'; import Timeline from 'Components/Session_/Player/Controls/Timeline'; import ControlButton from 'Components/Session_/Player/Controls/ControlButton'; import PlayerControls from 'Components/Session_/Player/Controls/components/PlayerControls'; import styles from 'Components/Session_/Player/Controls/controls.module.css'; import XRayButton from 'Shared/XRayButton'; import CreateNote from 'Components/Session_/Player/Controls/components/CreateNote'; 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 { playing, completed, skip, speed, messagesLoading } = store.get(); const { bottomBlock, toggleBottomBlock, fullscreen, changeSkipInterval, skipInterval, session } = props; const disabled = messagesLoading; const sessionTz = session?.timezone; const onKeyDown = (e: any) => { if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) { return; } if (e.key === 'Esc' || e.key === 'Escape') { props.fullscreenOff(); } if (e.key === 'ArrowRight') { forthTenSeconds(); } if (e.key === 'ArrowLeft') { backTenSeconds(); } if (e.key === 'ArrowDown') { player.speedDown(); } if (e.key === 'ArrowUp') { player.speedUp(); } }; React.useEffect(() => { document.addEventListener('keydown', onKeyDown.bind(this)); return () => { document.removeEventListener('keydown', onKeyDown.bind(this)); }; }, []); 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 (