diff options
Diffstat (limited to 'scraper/client/paper/paper.verify.js')
| -rw-r--r-- | scraper/client/paper/paper.verify.js | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/scraper/client/paper/paper.verify.js b/scraper/client/paper/paper.verify.js index cfce8f28..570899d5 100644 --- a/scraper/client/paper/paper.verify.js +++ b/scraper/client/paper/paper.verify.js @@ -10,7 +10,8 @@ import { Loader, Autocomplete } from '../common' const initialState = { citation: null, - verify: '', + uses_paper: false, + doesnt_use_paper: false, verified_by: '', notes: '', pdf_index: 0, @@ -24,7 +25,7 @@ class PaperVerify extends Component { const { sha256 } = this.props.match.params this.props.actions.getInstitutions() this.props.actions.getVerification(sha256) - const citationState = this.getVerificationState(sha256) + const citationState = this.getCitationState(sha256) console.log('DID MOUNT') this.setState(citationState) } @@ -55,12 +56,14 @@ class PaperVerify extends Component { }) } else { // console.log(paper) - console.log('GOT CUSTOM ADDRESS') + console.log('GOT CUSTOM CITATION STATE') const citationState = this.getCitationState(sha256) this.setState({ ...citationState, - verified: paper.verified, + uses_paper: paper.uses_paper, + doesnt_use_paper: paper.doesnt_use_paper, verified_by: paper.verified_by, + notes: paper.notes, }) } } else if (oldProps.api.unknownCitations !== this.props.api.unknownCitations) { @@ -77,12 +80,6 @@ class PaperVerify extends Component { } // console.log(sha256, citation) let state = { citation } - let addresses = citation ? citation.addresses : [] - if (addresses) { - addresses.forEach((address, i) => { - state['institution_' + (i + 1)] = address.address - }) - } return state } @@ -91,7 +88,8 @@ class PaperVerify extends Component { this.props.actions.postVerification({ paper_id: this.state.citation.id, title: this.state.citation.title, - verified: this.state.verified, + uses_paper: this.state.uses_paper, + doesnt_use_paper: this.state.doesnt_use_paper, verified_by: this.state.verified_by, notes: this.state.notes, }) @@ -100,31 +98,31 @@ class PaperVerify extends Component { next() { const { key } = this.props.api.paperInfo.dataset - const { unknownCitations } = this.props.api - let citationIndex = (unknownCitations.citations || []) + 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 >= unknownCitations.length) { + if (citationIndex >= paperInfo.citations.length) { history.push('/paper/' + key + '/info/') } else { - let nextId = unknownCitations.citations[citationIndex].id - history.push('/paper/' + key + '/address/' + nextId) + let nextId = paperInfo.citations[citationIndex].id + history.push('/paper/' + key + '/verify/' + nextId) } } } render() { - let { paperInfo, unknownCitations } = this.props.api - if (paperInfo.loading || unknownCitations.loading) return <Loader /> - console.log(this.state) + let { paperInfo } = this.props.api + if (paperInfo.loading) return <Loader /> + // console.log(this.state) const { citation } = this.state if (!citation) { return <div>Citation not found in this paper</div> } - console.log(citation) + // console.log(citation) return ( <div className='form'> <h3>{citation.title}</h3> @@ -146,27 +144,38 @@ class PaperVerify extends Component { </div> <div className='param'> + <label>Uses the paper?</label> <input className='vetting' type='checkbox' - value={this.state.verified} - onChange={e => this.setState({ - verified: e.target.value, - })} + checked={!!this.state.uses_paper} + onChange={e => this.setState({ uses_paper: e.target.checked })} /> </div> <div className='param'> + <label>{"Doesn't use paper"}</label> + <input + className='vetting' + type='checkbox' + checked={!!this.state.doesnt_use_paper} + onChange={e => this.setState({ doesnt_use_paper: e.target.checked })} + /> + </div> + + <div className='param'> + <label>Verified by:</label> <input type='text' className='verified_by' value={this.state.verified_by} placeholder='Verified by' - onChange={e => this.setState({ notes: e.target.value })} + onChange={e => this.setState({ verified_by: e.target.value })} /> </div> <div className='param'> + <label>Notes</label> <input type='text' className='notes' @@ -189,7 +198,7 @@ class PaperVerify extends Component { >{'Next >'}</button> </div> - <iframe className='pdfViewer' src={citation.pdf[this.state.pdf_index]} /> + <iframe className='pdfViewer' referrerPolicy='no-referrer' src={citation.pdf[this.state.pdf_index]} /> </div> ) } |
