import PropTypes from 'prop-types'; import React from 'react'; import classNames from 'classnames'; import Box from '../box/box.jsx'; import DOMElementRenderer from '../../containers/dom-element-renderer.jsx'; import Loupe from '../loupe/loupe.jsx'; import MonitorList from '../../containers/monitor-list.jsx'; import TargetHighlight from '../../containers/target-highlight.jsx'; import GreenFlagOverlay from '../../containers/green-flag-overlay.jsx'; import Question from '../../containers/question.jsx'; import MicIndicator from '../mic-indicator/mic-indicator.jsx'; import {STAGE_DISPLAY_SIZES} from '../../lib/layout-constants.js'; import {getStageDimensions, getMinWidth} from '../../lib/screen-utils.js'; import styles from './stage.css'; const StageComponent = props => { const { canvas, customStageSize, dragRef, isColorPicking, isFullScreen, isPlayerOnly, isStarted, isRtl, colorInfo, micIndicator, question, stageSize, useEditorDragStyle, onDeactivateColorPicker, onDoubleClick, onQuestionAnswered, ...boxProps } = props; const stageDimensions = getStageDimensions(stageSize, customStageSize, isFullScreen); const minWidth = getMinWidth(stageSize); const transformStyle = stageDimensions.width < minWidth && !isFullScreen ? { transform: `translateX(${(minWidth - stageDimensions.width) / (isRtl ? -2 : 2)}px)` } : {}; return ( {isColorPicking && colorInfo ? ( ) : null} {/* `stageOverlays` is for items that should *not* have their overflow contained within the stage */}
{micIndicator ? ( ) : null} {question === null ? null : (
)}
{isStarted ? null : ( )}
{isColorPicking ? ( ) : null}
); }; StageComponent.propTypes = { canvas: PropTypes.instanceOf(Element).isRequired, customStageSize: PropTypes.shape({ width: PropTypes.number, height: PropTypes.number }), overlay: PropTypes.instanceOf(Element).isRequired, colorInfo: Loupe.propTypes.colorInfo, dragRef: PropTypes.func, isColorPicking: PropTypes.bool, isFullScreen: PropTypes.bool.isRequired, isPlayerOnly: PropTypes.bool, isRtl: PropTypes.bool, isStarted: PropTypes.bool, micIndicator: PropTypes.bool, onDeactivateColorPicker: PropTypes.func, onDoubleClick: PropTypes.func, onQuestionAnswered: PropTypes.func, question: PropTypes.string, stageSize: PropTypes.oneOf(Object.keys(STAGE_DISPLAY_SIZES)).isRequired, useEditorDragStyle: PropTypes.bool }; StageComponent.defaultProps = { dragRef: () => {} }; export default StageComponent;