From 9ef98269afcae8ed5f717917d04422d4a6dfd8dd Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 17 Dec 2024 14:47:14 -0700 Subject: [PATCH 01/11] add a console log for releases --- src/components/releases.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/releases.js b/src/components/releases.js index 36f6c33776..a86242c3a7 100644 --- a/src/components/releases.js +++ b/src/components/releases.js @@ -12,7 +12,10 @@ const shortcodes = { } const Releases = ({ data }) => ( - <> + console.log(data.allTerminusReleasesJson.edges); + + return( + <> {data.allTerminusReleasesJson.edges.map((release, i) => { return (
@@ -29,7 +32,8 @@ const Releases = ({ data }) => ( ) })} -) + ); +); export default props => ( Date: Tue, 17 Dec 2024 14:51:18 -0700 Subject: [PATCH 02/11] fix broken console logging --- src/components/releases.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/releases.js b/src/components/releases.js index a86242c3a7..03e00b2a85 100644 --- a/src/components/releases.js +++ b/src/components/releases.js @@ -11,8 +11,8 @@ const shortcodes = { h3: headline3, } -const Releases = ({ data }) => ( - console.log(data.allTerminusReleasesJson.edges); +const Releases = ({ data }) => { + console.log(data.allTerminusReleasesJson.edges) return( <> @@ -31,9 +31,9 @@ const Releases = ({ data }) => (
) })} - + ); -); +}; export default props => ( Date: Tue, 17 Dec 2024 21:52:22 +0000 Subject: [PATCH 03/11] Apply Prettier formatting --- src/components/releases.js | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/components/releases.js b/src/components/releases.js index 03e00b2a85..f973de642e 100644 --- a/src/components/releases.js +++ b/src/components/releases.js @@ -1,41 +1,41 @@ -import React from "react" -import { StaticQuery, graphql } from "gatsby" -import { MDXRenderer } from "gatsby-plugin-mdx" -import { MDXProvider } from "@mdx-js/react" +import React from 'react'; +import { StaticQuery, graphql } from 'gatsby'; +import { MDXRenderer } from 'gatsby-plugin-mdx'; +import { MDXProvider } from '@mdx-js/react'; -import { headline1, headline2, headline3 } from "./releaseHeadlines" +import { headline1, headline2, headline3 } from './releaseHeadlines'; const shortcodes = { h1: headline1, h2: headline2, h3: headline3, -} +}; const Releases = ({ data }) => { - console.log(data.allTerminusReleasesJson.edges) + console.log(data.allTerminusReleasesJson.edges); - return( + return ( <> - {data.allTerminusReleasesJson.edges.map((release, i) => { - return ( -
-

- {release.node.tag_name} -

- - - {release.node.fields.markdownBody.childMdx.body} - - -
-
- ) - })} + {data.allTerminusReleasesJson.edges.map((release, i) => { + return ( +
+

+ {release.node.tag_name} +

+ + + {release.node.fields.markdownBody.childMdx.body} + + +
+
+ ); + })} ); }; -export default props => ( +export default (props) => ( ( } } `} - render={data => } + render={(data) => } /> -) +); From 11765e1f810ca20c8814ae1abd486f86cab2b9dc Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 17 Dec 2024 15:38:50 -0700 Subject: [PATCH 04/11] update the graphql query to fix sorting --- src/components/terminusVersion.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/terminusVersion.js b/src/components/terminusVersion.js index 53229fbe7e..54febec8ec 100644 --- a/src/components/terminusVersion.js +++ b/src/components/terminusVersion.js @@ -2,19 +2,25 @@ import React from "react" import { useStaticQuery, graphql } from "gatsby" function TerminusVersion({ text }) { - const { terminusReleasesJson } = useStaticQuery( + const { allTerminusReleasesJson } = useStaticQuery( graphql` query { - terminusReleasesJson { - tag_name + allTerminusReleasesJson(sort: { fields: [published_at], order: DESC }) { + edges { + node { + tag_name + } + } } } ` ) + const latestRelease = allTerminusReleasesJson.edges[0].node.tag_name + return (

- {text} {terminusReleasesJson.tag_name} + {text} {latestRelease}

) } From f4b77672676697f9a54acf4137b041be82d99bbb Mon Sep 17 00:00:00 2001 From: Pantheon Bot Date: Tue, 17 Dec 2024 22:39:54 +0000 Subject: [PATCH 05/11] Apply Prettier formatting --- src/components/terminusVersion.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/components/terminusVersion.js b/src/components/terminusVersion.js index 54febec8ec..52910b2408 100644 --- a/src/components/terminusVersion.js +++ b/src/components/terminusVersion.js @@ -1,28 +1,26 @@ -import React from "react" -import { useStaticQuery, graphql } from "gatsby" +import React from 'react'; +import { useStaticQuery, graphql } from 'gatsby'; function TerminusVersion({ text }) { - const { allTerminusReleasesJson } = useStaticQuery( - graphql` - query { - allTerminusReleasesJson(sort: { fields: [published_at], order: DESC }) { - edges { - node { - tag_name - } + const { allTerminusReleasesJson } = useStaticQuery(graphql` + query { + allTerminusReleasesJson(sort: { fields: [published_at], order: DESC }) { + edges { + node { + tag_name } } } - ` - ) + } + `); - const latestRelease = allTerminusReleasesJson.edges[0].node.tag_name + const latestRelease = allTerminusReleasesJson.edges[0].node.tag_name; return (

{text} {latestRelease}

- ) + ); } -export default TerminusVersion +export default TerminusVersion; From 777f1f21440873ade875f5994a6e6bf63030eee0 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 17 Dec 2024 15:50:42 -0700 Subject: [PATCH 06/11] remove the graphql filter --- src/components/releases.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/releases.js b/src/components/releases.js index f973de642e..3124c0da5b 100644 --- a/src/components/releases.js +++ b/src/components/releases.js @@ -41,7 +41,6 @@ export default (props) => ( query { allTerminusReleasesJson( sort: { fields: [tag_name], order: DESC } - filter: { fields: { original_id: { gt: 5224487 } } } ) { edges { node { From b40b4166f948048f9f99c824bf73a45a120fcd68 Mon Sep 17 00:00:00 2001 From: Pantheon Bot Date: Tue, 17 Dec 2024 22:51:47 +0000 Subject: [PATCH 07/11] Apply Prettier formatting --- src/components/releases.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/releases.js b/src/components/releases.js index 3124c0da5b..7169faabb9 100644 --- a/src/components/releases.js +++ b/src/components/releases.js @@ -39,9 +39,7 @@ export default (props) => ( Date: Tue, 17 Dec 2024 16:05:44 -0700 Subject: [PATCH 08/11] don't display releases older than a year --- src/components/releases.js | 47 +++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/components/releases.js b/src/components/releases.js index 7169faabb9..395754f741 100644 --- a/src/components/releases.js +++ b/src/components/releases.js @@ -2,6 +2,7 @@ import React from 'react'; import { StaticQuery, graphql } from 'gatsby'; import { MDXRenderer } from 'gatsby-plugin-mdx'; import { MDXProvider } from '@mdx-js/react'; +import { format, subYears } from 'date-fns'; import { headline1, headline2, headline3 } from './releaseHeadlines'; @@ -35,28 +36,36 @@ const Releases = ({ data }) => { ); }; -export default (props) => ( - { + const oneYearAgo = format(subYears(new Date(), 1), 'yyyy-MM-dd'); + + return ( + } - /> -); + `} + variables={{ cutoffDate: oneYearAgo }} + render={(data) => } + /> + ); +}; From fc0e5a9c2af21caa76987e995805990b0ec31f0d Mon Sep 17 00:00:00 2001 From: Pantheon Bot Date: Tue, 17 Dec 2024 23:06:50 +0000 Subject: [PATCH 09/11] Apply Prettier formatting --- src/components/releases.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/releases.js b/src/components/releases.js index 395754f741..62d5454db8 100644 --- a/src/components/releases.js +++ b/src/components/releases.js @@ -42,7 +42,7 @@ export default (props) => { return ( Date: Tue, 17 Dec 2024 16:11:45 -0700 Subject: [PATCH 10/11] arbitrary change to trigger build --- src/components/releases.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/releases.js b/src/components/releases.js index 62d5454db8..a918bda160 100644 --- a/src/components/releases.js +++ b/src/components/releases.js @@ -37,6 +37,7 @@ const Releases = ({ data }) => { }; export default (props) => { + // Determine one year ago. Filter out releases over a year old. const oneYearAgo = format(subYears(new Date(), 1), 'yyyy-MM-dd'); return ( From e9b1c6fe424594ff366dbc558bd2f6249372dfe0 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 17 Dec 2024 16:28:53 -0700 Subject: [PATCH 11/11] filter releases earlier --- src/components/releases.js | 81 +++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 45 deletions(-) diff --git a/src/components/releases.js b/src/components/releases.js index a918bda160..f818635d4b 100644 --- a/src/components/releases.js +++ b/src/components/releases.js @@ -2,7 +2,7 @@ import React from 'react'; import { StaticQuery, graphql } from 'gatsby'; import { MDXRenderer } from 'gatsby-plugin-mdx'; import { MDXProvider } from '@mdx-js/react'; -import { format, subYears } from 'date-fns'; +import { subYears, parseISO, isAfter } from 'date-fns'; import { headline1, headline2, headline3 } from './releaseHeadlines'; @@ -13,60 +13,51 @@ const shortcodes = { }; const Releases = ({ data }) => { - console.log(data.allTerminusReleasesJson.edges); + const oneYearAgo = subYears(new Date(), 1); + + // Filter releases that are newer than one year + const filteredReleases = data.allTerminusReleasesJson.edges.filter((release) => + isAfter(parseISO(release.node.fields.markdownBody.childMdx.body.published_at), oneYearAgo) + ); return ( <> - {data.allTerminusReleasesJson.edges.map((release, i) => { - return ( -
-

- {release.node.tag_name} -

- - - {release.node.fields.markdownBody.childMdx.body} - - -
-
- ); - })} + {filteredReleases.map((release, i) => ( +
+

+ {release.node.tag_name} +

+ + {release.node.fields.markdownBody.childMdx.body} + +
+
+ ))} ); }; -export default (props) => { - // Determine one year ago. Filter out releases over a year old. - const oneYearAgo = format(subYears(new Date(), 1), 'yyyy-MM-dd'); - - return ( - ( + } - /> - ); -}; + } + `} + render={(data) => } + /> +);