import React from 'react'; import { connect } from 'react-redux'; import InputRange from 'react-input-range'; import screenfull from 'screenfull'; import FontAwesomeIcon from '@fortawesome/react-fontawesome'; import faAngleRight from '@fortawesome/fontawesome-free-solid/faAngleRight'; import faCaretDown from '@fortawesome/fontawesome-free-solid/faCaretDown'; import faCaretRight from '@fortawesome/fontawesome-free-solid/faCaretRight'; import faShare from '@fortawesome/fontawesome-free-solid/faShare'; import faPlay from '@fortawesome/fontawesome-free-solid/faPlay'; import faChevronLeft from '@fortawesome/fontawesome-free-solid/faChevronLeft'; import faPause from '@fortawesome/fontawesome-free-solid/faPause'; import faExpandArrowsAlt from '@fortawesome/fontawesome-free-solid/faExpandArrowsAlt'; import { actions as envActions } from '/reducers/env'; import { classes } from '/common/util'; import { Button, Ellipsis } from '/components'; import { tracerManager } from '/core'; import styles from './stylesheet.scss'; @connect( ({ env }) => ({ env, }), { ...envActions, } ) class Header extends React.Component { constructor(props) { super(props); const { interval, paused, started } = tracerManager; this.state = { interval, paused, started }; } componentDidMount() { tracerManager.setOnUpdateStatus(update => this.setState(update)); } componentWillUnmount() { tracerManager.setOnUpdateStatus(null); } handleClickFullScreen() { if (screenfull.enabled) { if (screenfull.isFullscreen) { screenfull.exit(); } else { screenfull.request(); } } } render() { const { interval, paused, started } = this.state; const { className, onClickTitleBar, navigatorOpened } = this.props; const { categories, categoryKey, algorithmKey } = this.props.env; const category = categories.find(category => category.key === categoryKey); const algorithm = category.algorithms.find(algorithm => algorithm.key === algorithmKey); return (
{ started ? ( ) : ( ) } { paused ? ( ) : ( ) }
Speed tracerManager.setInterval(interval)} />
); } } export default Header;