diff options
Diffstat (limited to 'client/table/citations.table.js')
| -rw-r--r-- | client/table/citations.table.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/client/table/citations.table.js b/client/table/citations.table.js index 8fe46b69..c1c71906 100644 --- a/client/table/citations.table.js +++ b/client/table/citations.table.js @@ -1,11 +1,9 @@ import React, { Component } from 'react' -import { bindActionCreators } from 'redux' -import { connect } from 'react-redux' import { ReactTabulator } from 'react-tabulator' import { saveAs } from 'file-saver' import { Loader } from '../common' -import { toArray, toTuples, domainFromUrl } from '../util' +import { domainFromUrl } from '../util' export const citationsColumns = [ { title: 'Title', field: 'title', sorter: 'string' }, @@ -64,12 +62,12 @@ class CitationsTable extends Component { if (!q.length) { this.setState({ q, filteredCitations: formattedCitations }) } else { - let q_re = new RegExp('(' + q.replace(/\s+/g, ' ').trim().replace(' ', '|') + ')', 'gi') + let qRe = new RegExp('(' + q.replace(/\s+/g, ' ').trim().replace(' ', '|') + ')', 'gi') let filteredCitations = formattedCitations.filter(citation => ( - citation.title.match(q_re) || - citation.institution.match(q_re) || - citation.country.match(q_re) - )) + citation.title.match(qRe) || + citation.institution.match(qRe) || + citation.country.match(qRe) + )) this.setState({ q, filteredCitations }) } } @@ -85,7 +83,7 @@ class CitationsTable extends Component { case 'number': return String(data) default: - return '\"' + String(data) + '\"' + return '"' + String(data) + '"' } }) return row.join(",") @@ -96,8 +94,8 @@ class CitationsTable extends Component { titles.join(','), ...rows, ].join('\n') - ], {type: "text/csv;charset=utf-8"}); - saveAs(blob, fn); + ], { type: "text/csv;charset=utf-8" }) + saveAs(blob, fn) } render() { @@ -111,7 +109,7 @@ class CitationsTable extends Component { value={this.state.q} onChange={e => this.updateFilter(e.target.value)} className='q' - placeholder='Enter text to search citations...' + placeholder='Enter text to search citations' /> <span className='download' onClick={() => this.download()}>Download CSV</span> </div> |
