Skip to content

Commit

Permalink
Hide build date from Percy
Browse files Browse the repository at this point in the history
Hide the app's build date from Percy (since it will change all the time)
and make the build date retrieval consistent with MoS.
  • Loading branch information
brianlove committed Jul 25, 2023
1 parent b87bc37 commit b34b8e3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
22 changes: 10 additions & 12 deletions web/gui-v2/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { css } from '@emotion/react';
import { DateTime } from 'luxon';
import { graphql } from 'gatsby';
import { graphql, useStaticQuery } from 'gatsby';

import { AppWrapper, InfoCard, breakpoints } from '@eto/eto-ui-components';

Expand All @@ -27,8 +27,14 @@ const styles = {
`,
};

const IndexPage = ({ data }) => {
const formattedDate = DateTime.fromISO(data.site.buildTime).toLocaleString(DateTime.DATE_FULL);
const IndexPage = () => {
const data = useStaticQuery(graphql`
query {
site {
buildTime(formatString: "MMMM DD, YYYY")
}
}
`);

return (
<AppWrapper>
Expand All @@ -45,7 +51,7 @@ const IndexPage = ({ data }) => {
title="ETO Private-sector AI-Related Activity Tracker"
>
<div css={styles.lastUpdated}>
Site last updated {formattedDate}
Site last updated <span className="no-percy">{data.site.buildTime}</span>
</div>
</InfoCard>
<ListView css={styles.listView} />
Expand All @@ -55,12 +61,4 @@ const IndexPage = ({ data }) => {

export default IndexPage;

export const query = graphql`
query {
site {
buildTime
}
}
`;

export const Head = () => <title>PARAT &ndash; Emerging Technology Observatory</title>;
6 changes: 6 additions & 0 deletions web/gui-v2/src/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
font-family: GTZirkonLight;
scroll-behavior: smooth;
}

@media only percy {
.no-percy {
visibility: hidden;
}
}

0 comments on commit b34b8e3

Please sign in to comment.