Commit 066d9158 authored by Adrià Labay's avatar Adrià Labay
Browse files

use const variable and prevent default in shortcuts

parent 64b09fab
Pipeline #44025 passed with stages
in 4 minutes and 25 seconds
......@@ -85,8 +85,14 @@ class CheckStudents extends React.Component {
// If we change the keybindings here we should also remember to
// update the tooltips for the associated widgets (in render()).
// Also add the shortcut to ./client/components/help/ShortcutsHelp.md
this.props.bindShortcut(['left', 'h'], this.prev)
this.props.bindShortcut(['right', 'l'], this.next)
this.props.bindShortcut(['left', 'h'], (event) => {
event.preventDefault()
this.prev()
})
this.props.bindShortcut(['right', 'l'], (event) => {
event.preventDefault()
this.next()
})
this.props.bindShortcut(['up', 'k'], (event) => {
event.preventDefault()
this.nextUnchecked()
......@@ -195,7 +201,6 @@ class CheckStudents extends React.Component {
render () {
const copies = this.state.copies
const copy = this.state.copy
const hero = <Hero title='Match Students' subtitle='Check that all submissions are correctly identified' />
......@@ -204,6 +209,7 @@ class CheckStudents extends React.Component {
return hero
}
const copy = this.state.copy
const validated = copy && copy.validated
const total = copies.length
const done = copies.filter(c => c.validated).length
......@@ -234,7 +240,7 @@ class CheckStudents extends React.Component {
<div className='control'>
<button type='submit' className='button is-info is-rounded is-hidden-mobile'
onClick={this.prevUnchecked}>unchecked</button>
<button type='submit' className={'button' + (copy.validated ? ' is-success' : ' is-link')}
<button type='submit' className={'button' + (validated ? ' is-success' : ' is-link')}
onClick={this.prev}>Previous</button>
</div>
<div className='control is-wider'>
......@@ -289,7 +295,7 @@ class CheckStudents extends React.Component {
<ProgressBar done={done} total={total} />
<p className='box'>
<img src={'api/images/signature/' + this.state.examID + '/' + copy.number} alt='' />
<img src={'api/images/signature/' + this.state.examID + '/' + (copy && copy.number)} alt='' />
</p>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment