diff options
Diffstat (limited to 'scraper')
| -rw-r--r-- | scraper/client/paper/paper.verify.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/scraper/client/paper/paper.verify.js b/scraper/client/paper/paper.verify.js index 83eb5b44..fcebac02 100644 --- a/scraper/client/paper/paper.verify.js +++ b/scraper/client/paper/paper.verify.js @@ -60,6 +60,7 @@ class PaperVerify extends Component { ...initialState, ...citationState, ...address.paper, + pdfIndex: citationState.citations.pdf.findIndex(el => el.pdf.match(/^http:/)), } this.setState(newState) } else if (verify && !verify.loading && verify.paper && (!oldPaper || oldPaper !== verify.paper)) { @@ -70,6 +71,7 @@ class PaperVerify extends Component { ...initialState, ...citationState, ...address.paper, + pdfIndex: citationState.citations.pdf.findIndex(el => el.pdf.match(/^http:/)), } this.setState(newState) } else { @@ -79,6 +81,7 @@ class PaperVerify extends Component { newState = { ...citationState, ...address.paper, + pdfIndex: citationState.citations.pdf.findIndex(el => el.pdf.match(/^http:/)), uses_dataset: paper.uses_dataset, images_in_paper: paper.images_in_paper, verified_by: paper.verified_by, @@ -156,7 +159,7 @@ class PaperVerify extends Component { if (citationIndex < 0) { history.push('/paper/' + key + '/info/') } else { - let nextId = citations[citationIndex].id + let nextId = sortedCitations[citationIndex].id history.push('/paper/' + key + '/verify/' + nextId) } } @@ -172,10 +175,10 @@ class PaperVerify extends Component { history.push('/paper/' + key + '/info/') } else { citationIndex += 1 - if (citationIndex >= citations.length) { + if (citationIndex >= sortedCitations.length) { history.push('/paper/' + key + '/info/') } else { - let nextId = citations[citationIndex].id + let nextId = sortedCitations[citationIndex].id history.push('/paper/' + key + '/verify/' + nextId) } } @@ -414,7 +417,10 @@ class PaperVerify extends Component { >{'Next >'}</button> </div> - <iframe className='pdfViewer' referrerPolicy='no-referrer' src={citation.pdf[this.state.pdf_index]} /> + {citation.pdf.length + ? <iframe className='pdfViewer' referrerPolicy='no-referrer' src={citation.pdf[this.state.pdf_index] || "about:blank"} /> + : '' + } </div> ) } |
