summaryrefslogtreecommitdiff
path: root/scraper/client/paper/paper.unknown.js
blob: 0cb7d2da85a929e8a681ec0c29946c0177e9828d (plain)
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
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'

class PaperUnknown extends Component {
  render() {
    const { dataset } = this.props.api.paperInfo
    const { citations } = this.props.api.unknownCitations
    if (!dataset || !citations) return null
    console.log('rendering unknown citations...')
    return (
      <div className='citations'>
        <h2>{dataset.name_full}: Unknown Citations</h2>
        <ul>
        {citations.map((citation, i) => {
          let cite = { ...citation }
          cite.id = {
            _raw: true,
            value: <Link to={'/paper/' + dataset.key + '/address/' + 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"
          }
          return (
            <li key={i}>
              <TableObject
                summary
                object={cite}
                tag={cite.title}
              />
            </li>
          )
        })}
        </ul>
      </div>
    )
  }
}

const mapStateToProps = state => ({
  api: state.api
})
const mapDispatchToProps = dispatch => ({
  actions: bindActionCreators({ ...actions }, dispatch),
})

export default connect(mapStateToProps, mapDispatchToProps)(PaperUnknown)