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 /client/table/citations.table.js | |
| parent | 0a9a618925f3de31c7e8a45b2f3f047000d74c37 (diff) | |
reworking citations table
Diffstat (limited to 'client/table/citations.table.js')
| -rw-r--r-- | client/table/citations.table.js | 36 |
1 files changed, 23 insertions, 13 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 |
