Skip to content

Commit

Permalink
merging main
Browse files Browse the repository at this point in the history
  • Loading branch information
stevector committed Dec 18, 2024
2 parents 402d381 + 603eedb commit 0a71117
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 77 deletions.
54 changes: 29 additions & 25 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,57 @@
import React from "react"
import { location, globalHistory } from "@reach/router"
import React from 'react';
import { location, globalHistory } from '@reach/router';

// Import PDS Global wrapper for applying global context providers.
import { GlobalWrapper } from "@pantheon-systems/pds-toolkit-react"
import { MOBILE_MENU_BREAKPOINT } from './src/vars/responsive'
import { GlobalWrapper } from '@pantheon-systems/pds-toolkit-react';
import { MOBILE_MENU_BREAKPOINT } from './src/vars/responsive';

// Import PDS core styles.
import "./node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-core.css"
import "./node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-layouts.css"
import "./node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-components.css"
import './node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-core.css';
import './node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-layouts.css';
import './node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-components.css';

// Global styles
import "./src/styles/main.css"
import "./src/styles/custom-glyphicons.css"
import "./src/styles/pds-additions.css"
import './src/styles/main.css';
import './src/styles/custom-glyphicons.css';
import './src/styles/pds-additions.css';

// custom typefaces
import "prismjs/themes/prism-okaidia.css"
import 'prismjs/themes/prism-okaidia.css';

// Code block line numbering
import "prismjs/plugins/line-numbers/prism-line-numbers.css"
import 'prismjs/plugins/line-numbers/prism-line-numbers.css';

// Code block shell prompt
import "./src/styles/codeBlocks.css"
import './src/styles/codeBlocks.css';

// TOC generator
import "tocbot/dist/tocbot.css"
import "tocbot/dist/tocbot.min.js"
import 'tocbot/dist/tocbot.css';
import 'tocbot/dist/tocbot.min.js';

//Segment
export const onRouteUpdate = () => {
window.locations = window.locations || [document.referrer]
locations.push(window.location.href)
window.previousPath = locations[locations.length - 2]
window.locations = window.locations || [document.referrer];
locations.push(window.location.href);
window.previousPath = locations[locations.length - 2];
window.analytics &&
window.analytics.page({
url: window.location.href,
referrer: window.previousPath,
title: document.title,
})
});
//console.log("Title: ", document.title) //For debugging
}
};

// Trigger resize event once rendered
export const onInitialClientRender = () => {
window.dispatchEvent(new Event("resize"))
}
window.dispatchEvent(new Event('resize'));
};

// Global context providers
// Global context providers.
export const wrapRootElement = ({ element }) => {
return <GlobalWrapper mobileMenuMaxWidth={MOBILE_MENU_BREAKPOINT}>{element}</GlobalWrapper>
}
return (
<GlobalWrapper mobileMenuMaxWidth={MOBILE_MENU_BREAKPOINT}>
{element}
</GlobalWrapper>
);
};
5 changes: 4 additions & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ exports.onPreBootstrap = () => {
fs.copySync(scriptsCopyFrom, scriptsCopyTo);
};

/* This block is for debugging purposes. It writes the paths of all pages to a file.
exports.onPostBuild = async ({ graphql, getNodes }) => {
// Fetch all pages created by Gatsby
const pages = getNodes().filter((node) => node.internal.type === 'SitePage');
Expand Down Expand Up @@ -689,6 +690,8 @@ exports.onPostBuild = async ({ graphql, getNodes }) => {
// console.log(`Total Pages Created by Gatsby: ${pages.length}`);
// console.log(`Total Pages in Menu: ${pagesInMenu.length}`);
};
*/


/* todo should there be an error thrown if a release note category is set that is not allowed */
/* todo Should there be an error thrown if a release note category is set that is not allowed? */
/* todo, infer published date from file name. And throw an error if there are files that don't follow the pattern. */
2 changes: 1 addition & 1 deletion gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const onRenderBody = ({ setPostBodyComponents }) => {
]);
};

// Global context providers
// Global context providers.
export const wrapRootElement = ({ element }) => {
return (
<GlobalWrapper mobileMenuMaxWidth={MOBILE_MENU_BREAKPOINT}>
Expand Down
4 changes: 1 addition & 3 deletions source/content/terminus/11-updates.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Terminus Guide
subtitle: Current Terminus Release, Changelog, and Updates
subtitle: Terminus Changelog
description: Stay up to date on the latest Terminus version.
terminuspage: true
type: terminuspage
Expand All @@ -16,8 +16,6 @@ product: [terminus]
integration: [--]
---

<TerminusVersion text="Update to the Current Release" />

## Changelog

<Releases />
Expand Down
78 changes: 45 additions & 33 deletions src/components/releases.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,61 @@
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 (
<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>
</MDXProvider>
<hr />
</div>
)
})}
</>
)
const Releases = ({ data }) => {
const oneYearAgo = subYears(new Date(), 1);

export default props => (
// Safe Filtering: Ensure `published_at` exists before filtering
const filteredReleases = data.allTerminusReleasesJson.edges.filter(
(release) => {
const publishedDate = release.node.published_at;
return publishedDate && isAfter(parseISO(publishedDate), oneYearAgo);
},
);

return (
<>
{filteredReleases.length > 0 ? (
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>
</MDXProvider>
<hr />
</div>
))
) : (
<p>No recent releases found.</p>
)}
</>
);
};

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
published_at
fields {
markdownBody {
childMdx {
Expand All @@ -56,6 +68,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;
2 changes: 1 addition & 1 deletion src/templates/terminusCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const items = [
{
id: 'docs-terminus-updates',
link: '/terminus/updates',
title: 'Current Terminus Release and Changelog',
title: 'Terminus Changelog',
},

{
Expand Down
2 changes: 1 addition & 1 deletion src/templates/terminuspage.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const items = [
{
id: 'docs-terminus-updates',
link: '/terminus/updates',
title: 'Current Terminus Release and Changelog',
title: 'Terminus Changelog',
},

{
Expand Down

0 comments on commit 0a71117

Please sign in to comment.