summaryrefslogtreecommitdiff
path: root/scraper/client/paper/paper.citations.js
diff options
context:
space:
mode:
Diffstat (limited to 'scraper/client/paper/paper.citations.js')
-rw-r--r--scraper/client/paper/paper.citations.js58
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)