From 196a0c6877e250cd6334c5f01ead668b9f83b7e9 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 4 Oct 2022 13:12:07 -0400 Subject: [PATCH] Add supporting links tab in publication page (#441) * Add supporting links tab in publication page * Use node v16.0.0 * Change tab link to supporting_links * Add banner on supporting links tab * Add linkout icon and change url to supporting-links --- components/PublicationTabs.tsx | 74 ++++++++++++++++++++++++++++++++++ package.json | 2 +- yarn.lock | 6 +-- 3 files changed, 78 insertions(+), 4 deletions(-) diff --git a/components/PublicationTabs.tsx b/components/PublicationTabs.tsx index 0c454b75..fea0c593 100644 --- a/components/PublicationTabs.tsx +++ b/components/PublicationTabs.tsx @@ -10,6 +10,8 @@ import { groupFilesByAttrNameAndValue } from '../lib/filterHelpers'; import { Atlas, Entity, setTab } from '../lib/helpers'; import styles from './PublicationTabs.module.scss'; import { Badge } from 'react-bootstrap'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons'; interface IPublicationTabsProps { router: NextRouter; @@ -29,6 +31,7 @@ export enum PublicationTab { PARTICIPANTS = 'participants', BIOSPECIMENS = 'biospecimens', TOOLS = 'tools', + SUPPORTING_LINKS = 'supporting-links', // other tab names are autogenerated based on assay names } @@ -229,6 +232,23 @@ const toolsContent: { [id: string]: JSX.Element[] } = { , ], }; + +const supportingLinks: { [id: string]: JSX.Element[] } = { + vanderbilt_crc_chen_2021: [ + , + ], +}; + const PublicationTabs: React.FunctionComponent = observer( (props) => { const activeTab = props.router.query.tab || PublicationTab.ABSTRACT; @@ -363,6 +383,26 @@ const PublicationTabs: React.FunctionComponent = observer )} + {pubId && pubId in supportingLinks && ( +
  • + + setTab( + PublicationTab.SUPPORTING_LINKS, + props.router + ) + } + className={`nav-link ${ + activeTab === + PublicationTab.SUPPORTING_LINKS + ? 'active' + : '' + }`} + > + Supporting Links + +
  • + )} @@ -488,6 +528,40 @@ const PublicationTabs: React.FunctionComponent = observer )} )} + {activeTab === PublicationTab.SUPPORTING_LINKS && ( +
    +
    + Supporting Links and Supporting Link + Descriptions are provided by authors and are not + verified by the NIH NCI or the HTAN DCC. If you + think a link has been provided erroneously, + please contact the corresponding author(s) and + the{' '} + + HTAN DCC + + . +
    + {props.router.query.id && + props.router.query.id.toString() in + supportingLinks ? ( + supportingLinks[ + props.router.query.id.toString() + ] + ) : ( +
    + )} +
    + )}
    ); diff --git a/package.json b/package.json index bf5fe165..7c692ebf 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,8 @@ "mobx": "^6.0.4", "mobx-react": "^7.0.0", "mobx-utils": "^5.6.2", - "next-mdx-remote": "^3.0.8", "next": "12.1", + "next-mdx-remote": "^3.0.8", "node-fetch": "^2.6.0", "node-sass": "6.0.1", "pluralize": "^8.0.0", diff --git a/yarn.lock b/yarn.lock index 0e235664..52725cbd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1100,9 +1100,9 @@ camelize@^1.0.0: integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs= caniuse-lite@^1.0.30001283: - version "1.0.30001312" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz#e11eba4b87e24d22697dae05455d5aea28550d5f" - integrity sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ== + version "1.0.30001414" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001414.tgz" + integrity sha512-t55jfSaWjCdocnFdKQoO+d2ct9C59UZg4dY3OnUlSZ447r8pUtIKdp0hpAzrGFultmTC+Us+KpKi4GZl/LXlFg== caseless@~0.12.0: version "0.12.0"