import React from 'react'; import { connect } from 'react-redux'; import { findDOMNode } from 'react-dom'; import cn from 'classnames'; import { EscapeButton } from 'UI'; import { hide as hideTargetDefiner } from 'Duck/components/targetDefiner'; import { NONE, CONSOLE, NETWORK, STACKEVENTS, STORAGE, PROFILER, PERFORMANCE, GRAPHQL, EXCEPTIONS, INSPECTOR, OVERVIEW, fullscreenOff, } from 'Duck/components/player'; import NetworkPanel from 'Shared/DevTools/NetworkPanel'; import Storage from '../Storage'; import { ConnectedPerformance } from '../Performance'; import GraphQL from '../GraphQL'; import Exceptions from '../Exceptions/Exceptions'; import Inspector from '../Inspector'; import Controls from './Controls'; import Overlay from './Overlay'; import stl from './player.module.css'; import { updateLastPlayedSession } from 'Duck/sessions'; import OverviewPanel from '../OverviewPanel'; import ConsolePanel from 'Shared/DevTools/ConsolePanel'; import ProfilerPanel from 'Shared/DevTools/ProfilerPanel'; import { PlayerContext } from 'App/components/Session/playerContext'; import StackEventPanel from 'Shared/DevTools/StackEventPanel'; function Player(props) { const { className, fullscreen, fullscreenOff, nextId, closedLive, bottomBlock, activeTab, fullView, } = props; const playerContext = React.useContext(PlayerContext) const screenWrapper = React.useRef(); const bottomBlockIsActive = !fullscreen && bottomBlock !== NONE React.useEffect(() => { props.updateLastPlayedSession(props.sessionId); if (!props.closedLive) { const parentElement = findDOMNode(screenWrapper.current); //TODO: good architecture playerContext.player.attach(parentElement); } }, []) React.useEffect(() => { playerContext.player.scale(); }, [props.bottomBlock, props.fullscreen, playerContext.player]) if (!playerContext.player) return null; const maxWidth = activeTab ? 'calc(100vw - 270px)' : '100vw'; return (