From 8bcbe1a9dd26bd211a22b49a786fae73311239ea Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:26:55 -0700 Subject: [PATCH] Add "Data updated" date to byline This seems like important information that shouldn't only be buried at the bottom of the page. Keep the existing text at the bottom for users who are used to finding it there. Suggested by @joverlee521. --- src/components/info/byline.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/components/info/byline.js b/src/components/info/byline.js index 6dd008260..83f136611 100644 --- a/src/components/info/byline.js +++ b/src/components/info/byline.js @@ -22,6 +22,7 @@ class Byline extends React.Component { {renderAvatar(t, this.props.metadata)} {renderBuildInfo(t, this.props.metadata)} {renderMaintainers(t, this.props.metadata)} + {renderDataUpdated(t, this.props.metadata)} {renderDataProvenance(t, this.props.metadata)} ); @@ -101,6 +102,20 @@ function renderMaintainers(t, metadata) { return null; } +/** + * Returns a React component detailing the date the data was last updated. + * Renders a containing "Data updated X", where X derives from `metadata.updated` + */ +function renderDataUpdated(t, metadata) { + if (metadata.updated) { + return ( + + {`${t("Data updated")} ${metadata.updated}. `} + + ); + } + return null; +} /** * Returns a React component detailing the data provenance of the build (pipeline).