From d0dc5cd83f1c436185d247600c3c5be9360bf1ca Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 13 Feb 2019 16:46:10 +0100 Subject: displaying more info about the papers --- scraper/client/paper/index.js | 8 +++++ scraper/client/paper/paper.container.js | 31 ++++++++++++++++++ scraper/client/paper/paper.css | 3 ++ scraper/client/paper/paper.info.js | 57 +++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 scraper/client/paper/index.js create mode 100644 scraper/client/paper/paper.container.js create mode 100644 scraper/client/paper/paper.css create mode 100644 scraper/client/paper/paper.info.js (limited to 'scraper/client/paper') 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 + if (!this.props.api.paperInfo.dataset) return null + return ( + + ) + } +} + +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 ( +
+

{dataset.name_full}

+ + + + +
+ ) + } +} + +const mapStateToProps = state => ({ + api: state.api +}) +const mapDispatchToProps = dispatch => ({ + actions: bindActionCreators({ ...actions }, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(PaperInfo) -- cgit v1.2.3-70-g09d2