diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-03-20 01:48:55 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-03-20 01:48:55 +0100 |
| commit | e5c69daa3c2428a067c61baca3d20c96398f9354 (patch) | |
| tree | c97bdc78d53a7b058c23deeadfdbe3a11ad7a1cf /scraper/client/paper | |
| parent | 7eb3c04ef85fa0311bdf30b24df2aba102757878 (diff) | |
s2 geocode server
Diffstat (limited to 'scraper/client/paper')
| -rw-r--r-- | scraper/client/paper/index.js | 2 | ||||
| -rw-r--r-- | scraper/client/paper/paper.address.js | 2 | ||||
| -rw-r--r-- | scraper/client/paper/paper.citations.js | 7 | ||||
| -rw-r--r-- | scraper/client/paper/paper.css | 12 | ||||
| -rw-r--r-- | scraper/client/paper/paper.verify.js | 61 |
5 files changed, 53 insertions, 31 deletions
diff --git a/scraper/client/paper/index.js b/scraper/client/paper/index.js index 4fad0316..99672684 100644 --- a/scraper/client/paper/index.js +++ b/scraper/client/paper/index.js @@ -4,6 +4,7 @@ import Citations from './paper.citations' import UnknownCitations from './paper.unknown' import Random from './paper.random' import Address from './paper.address' +import Verify from './paper.verify' import './paper.css' // import './search.css' @@ -15,4 +16,5 @@ export { UnknownCitations, Random, Address, + Verify, } diff --git a/scraper/client/paper/paper.address.js b/scraper/client/paper/paper.address.js index 90e28139..00532570 100644 --- a/scraper/client/paper/paper.address.js +++ b/scraper/client/paper/paper.address.js @@ -283,7 +283,7 @@ class PaperAddress 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> ) } diff --git a/scraper/client/paper/paper.citations.js b/scraper/client/paper/paper.citations.js index 1789a815..41ddd55e 100644 --- a/scraper/client/paper/paper.citations.js +++ b/scraper/client/paper/paper.citations.js @@ -12,6 +12,7 @@ class PaperCitations extends Component { const { dataset, citations } = this.props.api.paperInfo if (!dataset || !citations) return null console.log('rendering citations...') + console.log(citations) return ( <div className='citations'> <h2>{dataset.name_full}: Citations</h2> @@ -20,16 +21,16 @@ class PaperCitations extends Component { let cite = { ...citation } cite.id = { _raw: true, - value: <Link to={'/paper/' + dataset.key + '/address/' + citation.id}>{citation.id}</Link> + value: <Link to={'/paper/' + dataset.key + '/verify/' + citation.id}>{citation.id}</Link> } cite.pdf = { _raw: true, - value: cite.pdf ? <a href={cite.pdf} rel='noopener noreferrer' target="_blank">[pdf]</a> : "no pdf" + value: (cite.pdf && cite.pdf.length) ? <a href={cite.pdf[0]} rel='noopener noreferrer' target="_blank">[pdf]</a> : "no pdf" } cite.addresses = { _raw: true, value: cite.addresses.map((address, j) => ( - <div key={j}>{address.address}{', '}<span className='type'>{address.type}</span></div> + <div key={j}>{address.name}{', '}<span className='type'>{address.type}</span></div> )) } return ( diff --git a/scraper/client/paper/paper.css b/scraper/client/paper/paper.css index 91469e17..82b95d9c 100644 --- a/scraper/client/paper/paper.css +++ b/scraper/client/paper/paper.css @@ -33,7 +33,9 @@ justify-content: flex-start; align-items: flex-start; } -input.notes { width: 400px; } +input.notes { + width: 400px; +} .param .btn { margin-top: 5px; } @@ -41,6 +43,14 @@ input.notes { width: 400px; } width: 250px; margin-right: 10px; } +.param label { + display: block; + padding: 4px; + min-width: 140px; +} +.param input[type=checkbox] { + margin: 6px 0; +} .pdf_links a.selected { font-weight: bold; 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> ) } |
