Skip to content

Commit

Permalink
ui: add h-index tooltip
Browse files Browse the repository at this point in the history
* INSPIR-3166
  • Loading branch information
miguelgrc authored and pazembrz committed Mar 3, 2020
1 parent b8dc98e commit ceb8566
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Map } from 'immutable';
import { Link } from 'react-router-dom';

import './CitationSummaryTable.scss';
import ExternalLink from '../ExternalLink';
Expand All @@ -9,7 +10,7 @@ import LoadingOrChildren from '../LoadingOrChildren';
import ErrorAlertOrChildren from '../ErrorAlertOrChildren';
import { ErrorPropType } from '../../propTypes';

const CITABLE_HELP_MESSAGE = (
const PUBLISHED_HELP_MESSAGE = (
<span>
Published papers are believed to have undergone rigorous peer review.{' '}
<ExternalLink href="http://inspirehep.net/info/faq/general#published">
Expand All @@ -18,6 +19,13 @@ const CITABLE_HELP_MESSAGE = (
</span>
);

const H_INDEX_HELP_MESSAGE = (
<span>
The h-index is defined as the number of papers with citation number higher
or equal to h. <Link to="/literature/690567">Learn more</Link>
</span>
);

class CitationSummaryTable extends Component {
render() {
const {
Expand Down Expand Up @@ -47,7 +55,7 @@ class CitationSummaryTable extends Component {
<th>
<LabelWithHelp
label="Published"
help={CITABLE_HELP_MESSAGE}
help={PUBLISHED_HELP_MESSAGE}
/>
</th>
</tr>
Expand All @@ -74,7 +82,12 @@ class CitationSummaryTable extends Component {
<td>{publishedBucket.getIn(['citations_count', 'value'])}</td>
</tr>
<tr>
<th>h-index</th>
<th>
<LabelWithHelp
label="h-index"
help={H_INDEX_HELP_MESSAGE}
/>
</th>
<td>{hIndex.get('all')}</td>
<td>{hIndex.get('published')}</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,20 @@ exports[`CitationSummaryTable renders table without render props 1`] = `
</tr>
<tr>
<th>
h-index
<LabelWithHelp
help={
<span>
The h-index is defined as the number of papers with citation number higher or equal to h.
<Link
replace={false}
to="/literature/690567"
>
Learn more
</Link>
</span>
}
label="h-index"
/>
</th>
<td />
<td />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ceb8566

Please sign in to comment.