diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-04-01 10:45:19 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-04-01 10:45:19 +0200 |
| commit | 7268da9248b89c4b020890ab6f4c86982501b342 (patch) | |
| tree | 9acf2845bbae0da964924a247c43000f3530639f | |
| parent | 0a9a618925f3de31c7e8a45b2f3f047000d74c37 (diff) | |
reworking citations table
| -rw-r--r-- | client/table/citations.table.js | 36 | ||||
| -rw-r--r-- | client/table/index.js | 3 | ||||
| -rw-r--r-- | client/table/tabulator.css | 26 |
3 files changed, 51 insertions, 14 deletions
diff --git a/client/table/citations.table.js b/client/table/citations.table.js index 1ec2d10c..f65998aa 100644 --- a/client/table/citations.table.js +++ b/client/table/citations.table.js @@ -19,22 +19,32 @@ class CitationsTable extends Component { render() { const { payload } = this.props const { paper, citations } = payload.data - console.log(this.props) + if (!citations.length) return <Loader /> - const formattedCitations = citations.map(citation => ({ - title: citation.title, - institution: citation.addresses[0].name, - country: citation.addresses[0].country, - year: citation.year, - pdf: (citation.pdf && citation.pdf.length) - ? citation.pdf[0] - : (citation.doi && citation.doi.length) - ? citation.doi[0] - : "", - })) + const formattedCitations = citations.map(citation => { + const pdf_link = (citation.pdf && citation.pdf.length) + ? citation.pdf[0] + : (citation.doi && citation.doi.length) + ? citation.doi[0] + : 'https://www.semanticscholar.org/paper/' + citation.id + let pdf_text + const pdf_partz = pdf_link.split('/')[2].split('.') + if (pdf_partz.length > 2 && pdf_partz[pdf_partz.length - 2].length == 2) { + pdf_text = pdf_partz.slice(-3).join('.') + } else { + pdf_text = pdf_partz.slice(-2).join('.') + } + return { + title: citation.title, + institution: citation.addresses[0].name, + country: citation.addresses[0].country, + year: citation.year, + pdf_link, pdf_text, + } + }) - console.log(formattedCitations) + // console.log(formattedCitations) return ( <ReactTabulator diff --git a/client/table/index.js b/client/table/index.js index 43db7dbb..c741f33e 100644 --- a/client/table/index.js +++ b/client/table/index.js @@ -1,5 +1,6 @@ import 'react-tabulator/lib/styles.css' -import 'react-tabulator/lib/css/tabulator.min.css' +import 'react-tabulator/lib/css/tabulator_midnight.css' +import './tabulator.css' import CitationsTable from './citations.table' import FileTable from './file.table' diff --git a/client/table/tabulator.css b/client/table/tabulator.css new file mode 100644 index 00000000..24005368 --- /dev/null +++ b/client/table/tabulator.css @@ -0,0 +1,26 @@ +.tabulator { + border-left: 1px solid #333; + border-bottom: 1px solid #333; +} +.tabulator-row.tabulator-row-odd { + background-color: #222; +} +.tabulator-row.tabulator-row-even { + background-color: #333; +} +.desktop .tabulator-row.tabulator-selectable:hover { + background-color: #555; +} +.tabulator-row .tabulator-cell { + border-right: 1px solid #444; + padding: 8px; +} +.tabulator .tabulator-header { + border-bottom: 0; +} +.tabulator .tabulator-header .tabulator-col { + border-right: 1px solid #444; +} +.tabulator .tabulator-tableHolder .tabulator-table { + background-color: #333; +}
\ No newline at end of file |
