import React from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' import { Dropdown, MenuItem } from 'react-bootstrap' import { useTranslation } from 'react-i18next' function PreviewRecompileButton({ compilerState: { isAutoCompileOn, isCompiling, isDraftModeOn, isSyntaxCheckOn }, onRecompile, onRunSyntaxCheckNow, onSetAutoCompile, onSetDraftMode, onSetSyntaxCheck }) { const { t } = useTranslation() const iconClasses = { recompile: classNames('fa', 'fa-refresh', { 'fa-spin': isCompiling }), autoCompileOn: classNames('fa', 'fa-fw', { 'fa-check': isAutoCompileOn }), autoCompileOff: classNames('fa', 'fa-fw', { 'fa-check': !isAutoCompileOn }), compileModeNormal: classNames('fa', 'fa-fw', { 'fa-check': !isDraftModeOn }), compileModeDraft: classNames('fa', 'fa-fw', { 'fa-check': isDraftModeOn }), syntaxCheckOn: classNames('fa', 'fa-fw', { 'fa-check': isSyntaxCheckOn }), syntaxCheckOff: classNames('fa', 'fa-fw', { 'fa-check': !isSyntaxCheckOn }) } function handleSelectAutoCompileOn() { onSetAutoCompile(true) } function handleSelectAutoCompileOff() { onSetAutoCompile(false) } function handleSelectDraftModeOn() { onSetDraftMode(true) } function handleSelectDraftModeOff() { onSetDraftMode(false) } function handleSelectSyntaxCheckOn() { onSetSyntaxCheck(true) } function handleSelectSyntaxCheckOff() { onSetSyntaxCheck(false) } return (