|
|
@ -18,8 +18,8 @@ const mapStateToProps = (state) => ({
|
|
|
|
recordsVisible: state.ui.records.visible,
|
|
|
|
recordsVisible: state.ui.records.visible,
|
|
|
|
isPosting: state.ui.isPosting,
|
|
|
|
isPosting: state.ui.isPosting,
|
|
|
|
isRunning: state.pretest.isRunning,
|
|
|
|
isRunning: state.pretest.isRunning,
|
|
|
|
isWaiting: state.ui.isWaiting,
|
|
|
|
pretestWaitSec: state.ui.pretestWaitSec,
|
|
|
|
waitSec: state.ui.waitSec,
|
|
|
|
submitWaitSec: state.ui.submitWaitSec,
|
|
|
|
editorLang: state.editor.lang,
|
|
|
|
editorLang: state.editor.lang,
|
|
|
|
editorCode: state.editor.code,
|
|
|
|
editorCode: state.editor.code,
|
|
|
|
pretestInput: state.pretest.input,
|
|
|
|
pretestInput: state.pretest.input,
|
|
|
@ -96,7 +96,9 @@ export default connect(mapStateToProps, mapDispatchToProps)(class ScratchpadTool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate() {
|
|
|
|
componentDidUpdate() {
|
|
|
|
if (this.props.waitSec > 0) setTimeout(() => this.props.tick(), 1000);
|
|
|
|
if (this.props.pretestWaitSec > 0 || this.props.submitWaitSec > 0) {
|
|
|
|
|
|
|
|
setTimeout(() => this.props.tick(), 1000);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
@ -109,7 +111,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class ScratchpadTool
|
|
|
|
<Toolbar>
|
|
|
|
<Toolbar>
|
|
|
|
{canUsePretest && (
|
|
|
|
{canUsePretest && (
|
|
|
|
<ToolbarButton
|
|
|
|
<ToolbarButton
|
|
|
|
disabled={this.props.isPosting || this.props.isRunning || this.props.isWaiting}
|
|
|
|
disabled={this.props.isPosting || this.props.isRunning || this.props.pretestWaitSec}
|
|
|
|
className="scratchpad__toolbar__pretest"
|
|
|
|
className="scratchpad__toolbar__pretest"
|
|
|
|
onClick={() => this.props.postPretest(this.props)}
|
|
|
|
onClick={() => this.props.postPretest(this.props)}
|
|
|
|
data-global-hotkey="f9"
|
|
|
|
data-global-hotkey="f9"
|
|
|
@ -119,11 +121,11 @@ export default connect(mapStateToProps, mapDispatchToProps)(class ScratchpadTool
|
|
|
|
{' '}
|
|
|
|
{' '}
|
|
|
|
{i18n('Run Pretest')}
|
|
|
|
{i18n('Run Pretest')}
|
|
|
|
{' '}
|
|
|
|
{' '}
|
|
|
|
{this.props.isWaiting ? `(${this.props.waitSec}s)` : '(F9)'}
|
|
|
|
{this.props.pretestWaitSec ? `(${this.props.pretestWaitSec}s)` : '(F9)'}
|
|
|
|
</ToolbarButton>
|
|
|
|
</ToolbarButton>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
<ToolbarButton
|
|
|
|
<ToolbarButton
|
|
|
|
disabled={this.props.isPosting || this.props.isWaiting}
|
|
|
|
disabled={this.props.isPosting || this.props.submitWaitSec}
|
|
|
|
className="scratchpad__toolbar__submit"
|
|
|
|
className="scratchpad__toolbar__submit"
|
|
|
|
onClick={() => this.props.postSubmit(this.props)}
|
|
|
|
onClick={() => this.props.postSubmit(this.props)}
|
|
|
|
data-global-hotkey="f10"
|
|
|
|
data-global-hotkey="f10"
|
|
|
@ -133,7 +135,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class ScratchpadTool
|
|
|
|
{' '}
|
|
|
|
{' '}
|
|
|
|
{i18n('Submit Solution')}
|
|
|
|
{i18n('Submit Solution')}
|
|
|
|
{' '}
|
|
|
|
{' '}
|
|
|
|
{this.props.isWaiting ? `(${this.props.waitSec}s)` : '(F10)'}
|
|
|
|
{this.props.submitWaitSec ? `(${this.props.submitWaitSec}s)` : '(F10)'}
|
|
|
|
</ToolbarButton>
|
|
|
|
</ToolbarButton>
|
|
|
|
<ToolbarButton
|
|
|
|
<ToolbarButton
|
|
|
|
data-global-hotkey="alt+q"
|
|
|
|
data-global-hotkey="alt+q"
|
|
|
|