1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
import React, { Component } from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'
import * as actions from '../actions'
import { TableObject } from '../common'
import { USES_DATASET } from '../types'
class PaperCitations extends Component {
componentDidMount() {
this.props.actions.getVerifications()
}
render() {
const { dataset, citations } = this.props.api.paperInfo
let { verifications } = this.props.api.verifications
verifications = verifications || {}
if (!dataset || !citations) return null
console.log('rendering citations...')
// console.log(citations)
return (
<div className='citations'>
<h2>{dataset.name_full}: Citations</h2>
<ul>
{citations.map((citation, i) => {
let cite = { ...citation }
cite.id = {
_raw: true,
value: <Link to={'/paper/' + dataset.key + '/verify/' + citation.id}>{citation.id}</Link>
}
cite.pdf = {
_raw: true,
value: (cite.pdf && cite.pdf.length) ? <a href={cite.pdf[0]} rel='noopener noreferrer' target="_blank">[pdf]</a> : "no pdf"
}
cite.s2 = {
_raw: true,
value: <a
href={'https://www.semanticscholar.org/paper/' + citation.id}
target="_blank"
rel="noopener noreferrer"
className={'pdfLink'}
>{'[semantic scholar]'}</a>
}
cite.addresses = {
_raw: true,
value: cite.addresses.map((address, j) => (
<div key={j}>{address.name}{', '}<span className='type'>{address.type}</span></div>
))
}
if (citation.id in verifications && verifications[citation.id].dataset === dataset.key) {
const verification = verifications[citation.id]
cite.verified = {
_raw: true,
value: verification.uses_dataset === USES_DATASET.YES
? <span className='verified'>uses dataset</span>
: verification.uses_dataset === USES_DATASET.NO
? <span className='unverified'>doesn\'t use dataset</span>
: <span className='unknown'>not enough information</span>
}
}
else {
cite.verified = {
_raw: true,
value: <span className='unknown'>unknown</span>
}
}
return (
<li key={i}>
<TableObject
summary
object={cite}
tag={cite.title}
order={['id', 'pdf', 's2', 'year', 'addresses', 'verified']}
/>
</li>
)
})}
</ul>
</div>
)
}
}
const mapStateToProps = state => ({
api: state.api
})
const mapDispatchToProps = dispatch => ({
actions: bindActionCreators({ ...actions }, dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(PaperCitations)
|