summaryrefslogtreecommitdiff
path: root/scraper/client/common
diff options
context:
space:
mode:
Diffstat (limited to 'scraper/client/common')
-rw-r--r--scraper/client/common/common.css1
-rw-r--r--scraper/client/common/header.component.js21
-rw-r--r--scraper/client/common/table.component.js15
3 files changed, 25 insertions, 12 deletions
diff --git a/scraper/client/common/common.css b/scraper/client/common/common.css
index 4b939df0..b014541a 100644
--- a/scraper/client/common/common.css
+++ b/scraper/client/common/common.css
@@ -65,6 +65,7 @@ header > section {
display: flex;
flex: 1 0;
font-weight: bold;
+ padding: 10px;
}
header > section:last-of-type {
justify-content: flex-end;
diff --git a/scraper/client/common/header.component.js b/scraper/client/common/header.component.js
index d82a8db0..5a100e90 100644
--- a/scraper/client/common/header.component.js
+++ b/scraper/client/common/header.component.js
@@ -1,8 +1,10 @@
import React, { Component } from 'react'
-import { NavLink } from 'react-router-dom'
+// import { NavLink } from 'react-router-dom'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
+import { history } from '../store'
+
import * as actions from '../actions'
class Header extends Component {
@@ -11,19 +13,26 @@ class Header extends Component {
this.props.actions.getPapers()
}
+ pickPaper(e) {
+ console.log(e.target.value)
+ history.push('/paper/' + e.target.value)
+ // this.props.actions.getPaperData(e.target.value)
+ }
+
render() {
- console.log(this.props)
let { papers } = this.props.api.papers
papers = papers || {}
const paperOptions = Object.keys(papers).map(key => (
<option key={key} value={key}>{papers[key][1]}</option>
))
- console.log(papers)
return (
<header>
- <select>
- {paperOptions}
- </select>
+ <section>
+ <select onChange={this.pickPaper.bind(this)}>
+ {paperOptions}
+ </select>
+ </section>
+ <section></section>
</header>
)
}
diff --git a/scraper/client/common/table.component.js b/scraper/client/common/table.component.js
index 76a1d57c..f9be0669 100644
--- a/scraper/client/common/table.component.js
+++ b/scraper/client/common/table.component.js
@@ -12,9 +12,12 @@ export function TableObject({ tag, object, order, summary }) {
if (object.err) {
return <div className='tableObject error'>{tag}{' Error: '}{object.err}</div>
}
- let objects = Object.keys(object)
+ let keys = Object.keys(object)
if (order) {
- const grouped = objects.reduce((a, b) => {
+ const grouped = keys.reduce((a, b) => {
+ if (summary && !object[b].trim().length) {
+ return a
+ }
const index = order.indexOf(b)
if (index !== -1) {
a.order.push([index, b])
@@ -23,23 +26,23 @@ export function TableObject({ tag, object, order, summary }) {
}
return a
}, { order: [], alpha: [] })
- objects = grouped.order
+ keys = grouped.order
.sort((a, b) => a[0] - b[0])
.map(([i, s]) => s)
if (!summary) {
- objects = objects
+ keys = keys
// .concat([__HR__])
.concat(grouped.alpha.sort())
}
} else {
- objects = objects.sort()
+ keys = keys.sort()
}
return (
<div>
{tag && <h3>{tag}</h3>}
<table className={'tableObject ' + tag}>
<tbody>
- {objects.map((key, i) => (
+ {keys.map((key, i) => (
<TableRow key={key + '_' + i} name={key} value={object[key]} />
))}
</tbody>