summaryrefslogtreecommitdiff
path: root/scraper/client/paper
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-02-13 16:46:10 +0100
committerJules Laplace <julescarbon@gmail.com>2019-02-13 16:46:10 +0100
commitd0dc5cd83f1c436185d247600c3c5be9360bf1ca (patch)
tree92db65b2a525b6512fd7f5349da561c476fe997e /scraper/client/paper
parent1563d1da307a78ddc388483fd95a68a511e18048 (diff)
displaying more info about the papers
Diffstat (limited to 'scraper/client/paper')
-rw-r--r--scraper/client/paper/index.js8
-rw-r--r--scraper/client/paper/paper.container.js31
-rw-r--r--scraper/client/paper/paper.css3
-rw-r--r--scraper/client/paper/paper.info.js57
4 files changed, 99 insertions, 0 deletions
diff --git a/scraper/client/paper/index.js b/scraper/client/paper/index.js
new file mode 100644
index 00000000..60206179
--- /dev/null
+++ b/scraper/client/paper/index.js
@@ -0,0 +1,8 @@
+import Container from './paper.container'
+import './paper.css'
+
+// import './search.css'
+
+export {
+ Container
+}
diff --git a/scraper/client/paper/paper.container.js b/scraper/client/paper/paper.container.js
new file mode 100644
index 00000000..eeb0dfa3
--- /dev/null
+++ b/scraper/client/paper/paper.container.js
@@ -0,0 +1,31 @@
+import React, { Component } from 'react'
+import { bindActionCreators } from 'redux'
+import { connect } from 'react-redux'
+
+import * as actions from '../actions'
+
+import { Loader } from '../common'
+import PaperInfo from './paper.info'
+
+class PaperContainer extends Component {
+ componentDidMount() {
+ this.props.actions.getPaperInfo(this.props.match.params.key)
+ }
+
+ render() {
+ if (this.props.api.paperInfo.loading) return <Loader />
+ if (!this.props.api.paperInfo.dataset) return null
+ return (
+ <PaperInfo />
+ )
+ }
+}
+
+const mapStateToProps = state => ({
+ api: state.api,
+})
+const mapDispatchToProps = dispatch => ({
+ actions: bindActionCreators({ ...actions }, dispatch),
+})
+
+export default connect(mapStateToProps, mapDispatchToProps)(PaperContainer)
diff --git a/scraper/client/paper/paper.css b/scraper/client/paper/paper.css
new file mode 100644
index 00000000..c1a775c1
--- /dev/null
+++ b/scraper/client/paper/paper.css
@@ -0,0 +1,3 @@
+.paperInfo {
+ padding: 10px;
+} \ No newline at end of file
diff --git a/scraper/client/paper/paper.info.js b/scraper/client/paper/paper.info.js
new file mode 100644
index 00000000..dab4ce5b
--- /dev/null
+++ b/scraper/client/paper/paper.info.js
@@ -0,0 +1,57 @@
+import React, { Component } from 'react'
+import { bindActionCreators } from 'redux'
+import { connect } from 'react-redux'
+
+import * as actions from '../actions'
+
+import { TableObject } from '../common'
+
+class PaperInfo extends Component {
+ render() {
+ const { paperInfo, unknownCitations } = this.props.api
+ const { dataset, statistics, address } = paperInfo
+ return (
+ <div className='paperInfo'>
+ <h2>{dataset.name_full}</h2>
+ <TableObject summary
+ tag="Dataset"
+ object={dataset}
+ order={['key', 'name_full', 'relevance', 'subset_of', 'superset_of']}
+ />
+ <TableObject summary
+ tag="Statistics"
+ object={statistics}
+ order={['year_published', 'purpose_short',
+ 'wild', 'indoor', 'outdoor', 'cyberspace',
+ 'names', 'downloaded',
+ 'year_published', 'year_start', 'year_end', 'ongoing', 'images', 'videos',
+ 'faces_unique', 'total_faces', 'img_per_person', 'num_cameras', 'faces_persons', 'female', 'male',
+ 'landmarks', 'width', 'height',
+ 'comment',
+ ]}
+ />
+ <TableObject
+ tag="Address"
+ object={address}
+ order={['address', 'type', 'lat', 'lng']}
+ />
+ <TableObject summary
+ tag="Citations"
+ object={{
+ 'geocoded': paperInfo.citations.length,
+ 'unknown': unknownCitations.citations ? unknownCitations.citations.length : 'Loading',
+ }}
+ />
+ </div>
+ )
+ }
+}
+
+const mapStateToProps = state => ({
+ api: state.api
+})
+const mapDispatchToProps = dispatch => ({
+ actions: bindActionCreators({ ...actions }, dispatch),
+})
+
+export default connect(mapStateToProps, mapDispatchToProps)(PaperInfo)