Skip to content

Commit

Permalink
Merge e9b1c6f into 57cefcd
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzsequence authored Dec 17, 2024
2 parents 57cefcd + e9b1c6f commit cd2c5f0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 37 deletions.
52 changes: 27 additions & 25 deletions src/components/releases.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,51 @@
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 { subYears, parseISO, isAfter } from 'date-fns';

import { headline1, headline2, headline3 } from "./releaseHeadlines"
import { headline1, headline2, headline3 } from './releaseHeadlines';

const shortcodes = {
h1: headline1,
h2: headline2,
h3: headline3,
}
};

const Releases = ({ data }) => (
<>
{data.allTerminusReleasesJson.edges.map((release, i) => {
return (
const Releases = ({ data }) => {
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 (
<>
{filteredReleases.map((release, i) => (
<div key={i}>
<h3 className="toc-ignore" id={release.node.tag_name}>
{release.node.tag_name}
</h3>
<MDXProvider components={shortcodes}>
<MDXRenderer>
{release.node.fields.markdownBody.childMdx.body}
</MDXRenderer>
<MDXRenderer>{release.node.fields.markdownBody.childMdx.body}</MDXRenderer>
</MDXProvider>
<hr />
</div>
)
})}
</>
)
))}
</>
);
};

export default props => (
export default (props) => (
<StaticQuery
query={graphql`
query {
allTerminusReleasesJson(
sort: { fields: [tag_name], order: DESC }
filter: { fields: { original_id: { gt: 5224487 } } }
) {
allTerminusReleasesJson(sort: { fields: [published_at], order: DESC }) {
edges {
node {
id
tag_name
body
fields {
markdownBody {
childMdx {
Expand All @@ -56,6 +58,6 @@ export default props => (
}
}
`}
render={data => <Releases data={data} {...props} />}
render={(data) => <Releases data={data} {...props} />}
/>
)
);
28 changes: 16 additions & 12 deletions src/components/terminusVersion.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import React from 'react';
import { useStaticQuery, graphql } from 'gatsby';

function TerminusVersion({ text }) {
const { terminusReleasesJson } = useStaticQuery(
graphql`
query {
terminusReleasesJson {
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;

return (
<h2>
{text} {terminusReleasesJson.tag_name}
{text} {latestRelease}
</h2>
)
);
}

export default TerminusVersion
export default TerminusVersion;

0 comments on commit cd2c5f0

Please sign in to comment.