diff options
Diffstat (limited to 'scraper/client/paper/paper.address.js')
| -rw-r--r-- | scraper/client/paper/paper.address.js | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/scraper/client/paper/paper.address.js b/scraper/client/paper/paper.address.js index 09b20758..9256d4ad 100644 --- a/scraper/client/paper/paper.address.js +++ b/scraper/client/paper/paper.address.js @@ -19,6 +19,7 @@ const initialState = { institution_3_vetting: '', institution_4_vetting: '', notes: '', + pdf_index: 0, } class PaperAddress extends Component { state = { @@ -111,7 +112,25 @@ class PaperAddress extends Component { institution_4_vetting: this.state.institution_4_vetting, notes: this.state.notes, }) - history.push('/paper/' + this.props.api.paperInfo.dataset.key + '/random/') + this.next(false) + } + + next() { + const { key } = this.props.api.paperInfo.dataset + const { unknownCitations } = this.props.api + let citationIndex = (unknownCitations.citations || []) + .findIndex(f => f.id === this.state.citation.id) + if (citationIndex === -1) { + history.push('/paper/' + key + '/info/') + } else { + citationIndex += 1 + if (citationIndex >= unknownCitations.length) { + history.push('/paper/' + key + '/info/') + } else { + let nextId = unknownCitations.citations[citationIndex].id + history.push('/paper/' + key + '/address/' + nextId) + } + } } render() { @@ -229,9 +248,30 @@ class PaperAddress extends Component { onClick={this.save.bind(this)} ref={ref => this.button = ref} >Save Institutions</button> + + <button + className='btn' + onClick={this.next.bind(this)} + >{'Next >'}</button> + </div> + + <div className='param pdf_links'> + {citation.pdf.map((pdf,i) => { + const pdf_partz = pdf.replace('www.','').split('/').slice(2,3)[0] || 'unknown' + let domain = '' + return ( + <a + key={i} + onClick={() => this.setState({ pdf_index: i })} + className={i === this.state.pdf_index ? 'selected' : ''} + > + {'[' + domain + ']'} + </a> + ) + })} </div> - <iframe className='pdfViewer' src={citation.pdf} /> + <iframe className='pdfViewer' src={citation.pdf[this.state.pdf_index]} /> </div> ) } |
