2020-09-28 06:51:15 -04:00
|
|
|
import React from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
2020-10-20 08:44:32 -04:00
|
|
|
import PreviewDownloadButton from './preview-download-button'
|
2020-09-28 06:51:15 -04:00
|
|
|
import PreviewRecompileButton from './preview-recompile-button'
|
2020-09-29 07:08:49 -04:00
|
|
|
import PreviewLogsToggleButton from './preview-logs-toggle-button'
|
2020-09-28 06:51:15 -04:00
|
|
|
|
|
|
|
function PreviewToolbar({
|
|
|
|
compilerState,
|
2020-09-29 07:08:49 -04:00
|
|
|
logsState,
|
2020-10-20 08:44:19 -04:00
|
|
|
onClearCache,
|
2020-09-28 06:51:15 -04:00
|
|
|
onRecompile,
|
|
|
|
onRunSyntaxCheckNow,
|
|
|
|
onSetAutoCompile,
|
|
|
|
onSetDraftMode,
|
|
|
|
onSetSyntaxCheck,
|
2020-09-29 07:08:49 -04:00
|
|
|
onToggleLogs,
|
2020-10-20 08:44:32 -04:00
|
|
|
outputFiles,
|
|
|
|
pdfDownloadUrl,
|
2020-09-29 07:08:49 -04:00
|
|
|
showLogs
|
2020-09-28 06:51:15 -04:00
|
|
|
}) {
|
|
|
|
return (
|
|
|
|
<div className="toolbar toolbar-pdf">
|
2020-09-29 07:08:49 -04:00
|
|
|
<div className="toolbar-pdf-left">
|
|
|
|
<PreviewRecompileButton
|
|
|
|
compilerState={compilerState}
|
|
|
|
onRecompile={onRecompile}
|
|
|
|
onRunSyntaxCheckNow={onRunSyntaxCheckNow}
|
|
|
|
onSetAutoCompile={onSetAutoCompile}
|
|
|
|
onSetDraftMode={onSetDraftMode}
|
|
|
|
onSetSyntaxCheck={onSetSyntaxCheck}
|
2020-10-20 08:44:19 -04:00
|
|
|
onClearCache={onClearCache}
|
2020-09-29 07:08:49 -04:00
|
|
|
/>
|
2020-10-20 08:44:32 -04:00
|
|
|
<PreviewDownloadButton
|
|
|
|
isCompiling={compilerState.isCompiling}
|
|
|
|
outputFiles={outputFiles}
|
|
|
|
pdfDownloadUrl={pdfDownloadUrl}
|
|
|
|
/>
|
2020-09-29 07:08:49 -04:00
|
|
|
</div>
|
|
|
|
<div className="toolbar-pdf-right">
|
|
|
|
<PreviewLogsToggleButton
|
|
|
|
logsState={logsState}
|
|
|
|
showLogs={showLogs}
|
|
|
|
onToggle={onToggleLogs}
|
|
|
|
/>
|
|
|
|
</div>
|
2020-09-28 06:51:15 -04:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
PreviewToolbar.propTypes = {
|
|
|
|
compilerState: PropTypes.shape({
|
|
|
|
isAutoCompileOn: PropTypes.bool.isRequired,
|
|
|
|
isCompiling: PropTypes.bool.isRequired,
|
|
|
|
isDraftModeOn: PropTypes.bool.isRequired,
|
2020-09-29 07:08:49 -04:00
|
|
|
isSyntaxCheckOn: PropTypes.bool.isRequired,
|
|
|
|
logEntries: PropTypes.object.isRequired
|
2020-09-28 06:51:15 -04:00
|
|
|
}),
|
2020-09-29 07:08:49 -04:00
|
|
|
logsState: PropTypes.shape({
|
|
|
|
nErrors: PropTypes.number.isRequired,
|
|
|
|
nWarnings: PropTypes.number.isRequired,
|
|
|
|
nLogEntries: PropTypes.number.isRequired
|
|
|
|
}),
|
|
|
|
showLogs: PropTypes.bool.isRequired,
|
2020-10-20 08:44:19 -04:00
|
|
|
onClearCache: PropTypes.func.isRequired,
|
2020-09-28 06:51:15 -04:00
|
|
|
onRecompile: PropTypes.func.isRequired,
|
|
|
|
onRunSyntaxCheckNow: PropTypes.func.isRequired,
|
|
|
|
onSetAutoCompile: PropTypes.func.isRequired,
|
|
|
|
onSetDraftMode: PropTypes.func.isRequired,
|
|
|
|
onSetSyntaxCheck: PropTypes.func.isRequired,
|
2020-10-20 08:44:32 -04:00
|
|
|
onToggleLogs: PropTypes.func.isRequired,
|
|
|
|
pdfDownloadUrl: PropTypes.string,
|
|
|
|
outputFiles: PropTypes.array
|
2020-09-28 06:51:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export default PreviewToolbar
|