summaryrefslogtreecommitdiff
path: root/scraper/client/paper/paper.verify.js
diff options
context:
space:
mode:
Diffstat (limited to 'scraper/client/paper/paper.verify.js')
-rw-r--r--scraper/client/paper/paper.verify.js62
1 files changed, 56 insertions, 6 deletions
diff --git a/scraper/client/paper/paper.verify.js b/scraper/client/paper/paper.verify.js
index 8cb14d84..5f85a551 100644
--- a/scraper/client/paper/paper.verify.js
+++ b/scraper/client/paper/paper.verify.js
@@ -11,12 +11,14 @@ import { Loader, Autocomplete } from '../common'
const initialState = {
citation: null,
uses_dataset: false,
- doesnt_use_dataset: false,
+ doesnt_use_dataset: true,
images_in_paper: false,
- verified_by: '',
+ verified_by: localStorage.getItem('verify.username') || '',
+ reference: '',
notes: '',
pdf_index: 0,
}
+
class PaperVerify extends Component {
state = {
...initialState
@@ -65,6 +67,7 @@ class PaperVerify extends Component {
doesnt_use_dataset: paper.doesnt_use_dataset === "TRUE",
images_in_paper: paper.images_in_paper === "TRUE",
verified_by: paper.verified_by,
+ reference: paper.reference,
notes: paper.notes,
})
}
@@ -87,18 +90,47 @@ class PaperVerify extends Component {
save() {
console.log(this.state)
+ let date = new Date()
+ let mon = date.getMonth() + 1
+ if (mon < 10) mon = "0" + mon
+ let day = date.getDate()
+ if (day < 10) day = "0" + day
+ let time = date.toTimeString().split(" ")[0]
+ let dateString = date.getFullYear() + '-' + mon + '-' + day + ' ' + time
+ localStorage.setItem('verify.username', this.state.verified_by)
this.props.actions.postVerification({
paper_id: this.state.citation.id,
title: this.state.citation.title,
+ dataset: this.props.api.paperInfo.dataset.key,
uses_dataset: this.state.uses_dataset,
doesnt_use_dataset: this.state.doesnt_use_dataset,
images_in_paper: this.state.images_in_paper,
verified_by: this.state.verified_by,
+ reference: this.state.reference,
notes: this.state.notes,
+ date: dateString,
})
this.next(false)
}
+ prev() {
+ const { key } = this.props.api.paperInfo.dataset
+ const { paperInfo } = this.props.api
+ let citationIndex = (paperInfo.citations || [])
+ .findIndex(f => f.id === this.state.citation.id)
+ if (citationIndex === -1) {
+ history.push('/paper/' + key + '/info/')
+ } else {
+ citationIndex -= 1
+ if (citationIndex < 0) {
+ history.push('/paper/' + key + '/info/')
+ } else {
+ let nextId = paperInfo.citations[citationIndex].id
+ history.push('/paper/' + key + '/verify/' + nextId)
+ }
+ }
+ }
+
next() {
const { key } = this.props.api.paperInfo.dataset
const { paperInfo } = this.props.api
@@ -148,7 +180,7 @@ class PaperVerify extends Component {
<a
href={'https://www.semanticscholar.org/paper/' + citation.id}
target="_blank"
- className={i === this.state.pdf_index ? 'selected pdfLink' : 'pdfLink'}
+ className={'pdfLink'}
>
{'[semantic scholar]'}
</a>
@@ -186,11 +218,11 @@ class PaperVerify extends Component {
<label>{"Uses images from dataset"}</label>
<input
className='vetting'
- type='radio'
+ type='checkbox'
name='images_in_paper'
checked={!!this.state.images_in_paper}
onChange={e => this.setState({
- images_in_paper: !e.target.checked,
+ images_in_paper: e.target.checked,
})}
/>
</div>
@@ -207,9 +239,22 @@ class PaperVerify extends Component {
</div>
<div className='param'>
+ <label>Reference</label>
+ <textarea
+ rows={3}
+ cols={50}
+ type='text'
+ className='notes'
+ value={this.state.notes}
+ placeholder='Notes'
+ onChange={e => this.setState({ notes: e.target.value })}
+ />
+ </div>
+
+ <div className='param'>
<label>Notes</label>
<textarea
- rows={4}
+ rows={3}
cols={50}
type='text'
className='notes'
@@ -228,6 +273,11 @@ class PaperVerify extends Component {
<button
className='btn'
+ onClick={this.prev.bind(this)}
+ >{'Prev >'}</button>
+
+ <button
+ className='btn'
onClick={this.next.bind(this)}
>{'Next >'}</button>
</div>