diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-02-13 18:05:35 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-02-13 18:05:35 +0100 |
| commit | 83063b97105c7514d71ec2afaaf66def49116214 (patch) | |
| tree | b538a8b913cec7e563d23778a0cc4c523f559bda /scraper/client/paper/paper.citations.js | |
| parent | 8d17c7b8491f270ae1785921b0ae0d89f8290c7b (diff) | |
listing citations, known and unknown
Diffstat (limited to 'scraper/client/paper/paper.citations.js')
| -rw-r--r-- | scraper/client/paper/paper.citations.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/scraper/client/paper/paper.citations.js b/scraper/client/paper/paper.citations.js new file mode 100644 index 00000000..de423a77 --- /dev/null +++ b/scraper/client/paper/paper.citations.js @@ -0,0 +1,58 @@ +import React, { Component } from 'react' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' + +import * as actions from '../actions' + +import { TableObject } from '../common' + +class PaperCitations extends Component { + render() { + const { dataset, citations } = this.props.api.paperInfo + if (!dataset || !citations) return null + console.log('rendering citations...') + return ( + <div className='citations'> + <h2>{dataset.name_full}: Citations</h2> + <ul> + {citations.map((citation, i) => { + let cite = { ...citation } + cite.id = { + _raw: true, + value: <a href={'/api/address/' + dataset.key + '/' + citation.id}>{citation.id}</a> + } + cite.pdf = { + _raw: true, + value: cite.pdf ? <a href={cite.pdf} 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> + )) + } + return ( + <li key={i}> + <TableObject + summary + object={cite} + tag={cite.title} + order={['id', 'pdf', 'year', 'addresses']} + /> + </li> + ) + })} + </ul> + </div> + ) + } +} + +const mapStateToProps = state => ({ + api: state.api +}) +const mapDispatchToProps = dispatch => ({ + actions: bindActionCreators({ ...actions }, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(PaperCitations) |
