Skip to content

Commit

Permalink
Modify byline for nextstrain.org/ncov
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshadfield committed Mar 20, 2020
1 parent 53e5bd3 commit 18d5d21
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions src/components/info/byline.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@ const styles = {
};

const Byline = ({width, metadata}) => {

/** Render a special byline for nexstrain's nCoV (SARS-CoV-2) builds.
* This is somewhat temporary and may be switched to a nextstrain.org
* auspice customisation in the future.
*/
if (
window.location.hostname === "nextstrain.org" && // comment out this line for testing on localhost
window.location.pathname.startsWith("/ncov")
) {
return (
<div width={width} style={styles.byline}>
{renderAvatar(metadata)}
{renderMaintainers(metadata)}
<span>
{" Enabled by data from "}
<img src="https://www.gisaid.org/fileadmin/gisaid/img/schild.png" alt="gisaid-logo" width="65"/>
</span>
</div>
)
}
/* End nextstrain-specific ncov / SARS-CoV-2 code */


return (
<div width={width} style={styles.byline}>
{renderAvatar(metadata)}
Expand Down Expand Up @@ -61,7 +84,6 @@ function renderBuildInfo(metadata) {
<Link url={repo}>
{repo.replace(/^(http[s]?:\/\/)/, "").replace(/^www\./, "").replace(/^github.com\//, "")}
</Link>
<PotentialGisaidExtraByline/>
{". "}
</span>
);
Expand All @@ -71,27 +93,6 @@ function renderBuildInfo(metadata) {
return null;
}

/** Additional byline content to be added when certain criteria met.
* This was introduced during the 2019 nCoV outbreak. In the future this
* design should be switched a JSON key or a nextstrain.org auspice customisation
*/
function PotentialGisaidExtraByline() {
if (
window.location.hostname === "nextstrain.org" && // use "localhost" for testing
window.location.pathname.startsWith("/ncov")
) {
return (
<span>
{" using data from "}
<a key={1} href="https://gisaid.org" target="_blank" rel="noopener noreferrer">
<img src="https://www.gisaid.org/fileadmin/gisaid/img/schild.png" alt="gisaid-logo" width="65"/>
</a>
</span>
);
}
return null;
}

function renderMaintainers(metadata) {
let maintainersArray;
if (Object.prototype.hasOwnProperty.call(metadata, "maintainers")) {
Expand Down

0 comments on commit 18d5d21

Please sign in to comment.