From 8a90c53f014cd36e1f155af1cd49377c40dc353c Mon Sep 17 00:00:00 2001 From: Bonvic Bundi Date: Thu, 27 Feb 2020 10:41:35 +0200 Subject: [PATCH] refractor(www): Use `nodes` in gatsbyjs.org code instead of `edges.node` --- www/gatsby-config.js | 26 +++--- www/src/components/diagram.js | 12 ++- .../components/features/evaluation-table.js | 10 +-- .../features/simple-evaluation-table.js | 2 +- .../homepage/homepage-logo-banner.js | 14 ++-- www/src/pages/creators/agencies.js | 6 +- www/src/pages/creators/companies.js | 6 +- www/src/pages/creators/index.js | 6 +- www/src/pages/creators/people.js | 6 +- www/src/pages/ecosystem.js | 60 +++++++------- www/src/pages/features.js | 16 ++-- www/src/pages/features/cms.js | 20 +++-- www/src/pages/features/jamstack.js | 24 +++--- www/src/pages/guidelines/logo.js | 26 +++--- www/src/pages/index.js | 74 ++++++++--------- www/src/pages/showcase.js | 64 +++++++-------- www/src/pages/starters.js | 62 +++++++------- www/src/templates/tags.js | 10 +-- www/src/templates/template-blog-list.js | 10 +-- www/src/templates/template-creator-details.js | 34 ++++---- .../templates/template-feature-comparison.js | 44 +++++----- .../utils/__tests__/get-csv-features-data.js | 80 ++++++++----------- www/src/utils/get-csv-features-data.js | 8 +- www/src/views/creators/index.js | 36 ++++----- www/src/views/shared/sidebar.js | 4 +- www/src/views/showcase/featured-sites.js | 7 +- www/src/views/showcase/filtered-showcase.js | 38 ++++----- www/src/views/showcase/index.js | 2 +- www/src/views/showcase/showcase-list.js | 2 +- .../starter-library/filtered-starters.js | 31 ++++--- www/src/views/starter-library/starter-list.js | 8 +- 31 files changed, 343 insertions(+), 405 deletions(-) diff --git a/www/gatsby-config.js b/www/gatsby-config.js index 946503c556efb..ff79a87e35998 100644 --- a/www/gatsby-config.js +++ b/www/gatsby-config.js @@ -287,21 +287,19 @@ module.exports = { fileAbsolutePath: { regex: "/docs.blog/" } } ) { - edges { - node { - html - frontmatter { - title - date - author { - id - } - } - fields { - excerpt - slug + nodes { + html + frontmatter { + title + date + author { + id } } + fields { + excerpt + slug + } } } } @@ -321,7 +319,7 @@ module.exports = { } }, serialize: ({ query: { site, allMdx } }) => - allMdx.edges.map(({ node }) => { + allMdx.nodes.map(node => { return { title: node.frontmatter.title, description: node.fields.excerpt, diff --git a/www/src/components/diagram.js b/www/src/components/diagram.js index c551c677fe2db..d0805701dae79 100644 --- a/www/src/components/diagram.js +++ b/www/src/components/diagram.js @@ -204,16 +204,14 @@ const Diagram = () => ( query={graphql` query StaticHostsQuery { allStaticHostsYaml { - edges { - node { - title - url - } + nodes { + title + url } } } `} - render={({ allStaticHostsYaml: { edges: staticHosts } }) => ( + render={({ allStaticHostsYaml: { nodes: staticHosts } }) => (
( > Web Hosting - {staticHosts.map(({ node: staticHost }, index) => ( + {staticHosts.map((staticHost, index) => ( {index > 0 && `, `} diff --git a/www/src/components/features/evaluation-table.js b/www/src/components/features/evaluation-table.js index 93438b3a42870..345c62fdf729e 100644 --- a/www/src/components/features/evaluation-table.js +++ b/www/src/components/features/evaluation-table.js @@ -53,8 +53,8 @@ class EvaluationTable extends Component { [].concat([ , // table row with the name of the feature and corresponding scores @@ -81,7 +81,7 @@ class EvaluationTable extends Component { }} id={ j === 0 - ? row.node.Feature.toLowerCase() + ? row.Feature.toLowerCase() .split(` `) .join(`-`) : undefined @@ -92,7 +92,7 @@ class EvaluationTable extends Component { }) }} > - {renderCell(row.node[nodeProperty], j)} + {renderCell(row[nodeProperty], j)} ))} , @@ -117,7 +117,7 @@ class EvaluationTable extends Component { { } diff --git a/www/src/components/features/simple-evaluation-table.js b/www/src/components/features/simple-evaluation-table.js index 652ab08f8b1c0..06f95fd41d9c6 100644 --- a/www/src/components/features/simple-evaluation-table.js +++ b/www/src/components/features/simple-evaluation-table.js @@ -12,7 +12,7 @@ const SimpleEvaluationTable = ({ title, headers, data }) => ( h.display)} /> - {data.map(({ node }, idx) => ( + {data.map((node, idx) => ( {headers.map((header, i) => (
{ } sort: { fields: publicURL } ) { - edges { - node { - base - childImageSharp { - fixed(quality: 75, height: 24) { - ...GatsbyImageSharpFixed_tracedSVG - } + nodes { + base + childImageSharp { + fixed(quality: 75, height: 24) { + ...GatsbyImageSharpFixed_tracedSVG } } } @@ -93,7 +91,7 @@ const HomepageLogoBanner = () => { Trusted by - {data.allFile.edges.map(({ node: image }) => ( + {data.allFile.nodes.map(image => ( {`${image.base.split(`.`)[0]}`} { const { - node: { - fields: { - starterShowcase: { slug, name, description, stars }, - }, - childScreenshot: { - screenshotFile: { - childImageSharp: { fixed: thumbnail }, - }, + fields: { + starterShowcase: { slug, name, description, stars }, + }, + childScreenshot: { + screenshotFile: { + childImageSharp: { fixed: thumbnail }, }, }, } = item @@ -42,7 +40,7 @@ class EcosystemPage extends Component { } }) - const plugins = pluginsData.map(item => item.node) + const plugins = pluginsData const pageTitle = `Ecosystem` const boardIcons = { plugins: PluginsIcon, starters: StartersIcon } @@ -76,22 +74,20 @@ export const ecosystemQuery = graphql` fields: { featured: { eq: true }, hasScreenshot: { eq: true } } } ) { - edges { - node { - fields { - starterShowcase { - slug - description - stars - name - } + nodes { + fields { + starterShowcase { + slug + description + stars + name } - childScreenshot { - screenshotFile { - childImageSharp { - fixed(width: 64, height: 64) { - ...GatsbyImageSharpFixed_noBase64 - } + } + childScreenshot { + screenshotFile { + childImageSharp { + fixed(width: 64, height: 64) { + ...GatsbyImageSharpFixed_noBase64 } } } @@ -99,13 +95,11 @@ export const ecosystemQuery = graphql` } } allNpmPackage(filter: { fields: { featured: { eq: true } } }) { - edges { - node { - slug - name - description - humanDownloadsLast30Days - } + nodes { + slug + name + description + humanDownloadsLast30Days } } } diff --git a/www/src/pages/features.js b/www/src/pages/features.js index 4fc6654f68c85..02c4493cc1d41 100644 --- a/www/src/pages/features.js +++ b/www/src/pages/features.js @@ -126,7 +126,7 @@ class FeaturesPage extends Component { }, { display: `Traditional CMS`, nodeFieldProperty: `Cms` }, ]} - data={this.props.data.allGatsbyFeaturesSpecsCsv.edges} + data={this.props.data.allGatsbyFeaturesSpecsCsv.nodes} /> @@ -142,14 +142,12 @@ export default FeaturesPage export const pageQuery = graphql` query { allGatsbyFeaturesSpecsCsv { - edges { - node { - Category - Gatsby - Jamstack - Cms - Description - } + nodes { + Category + Gatsby + Jamstack + Cms + Description } } } diff --git a/www/src/pages/features/cms.js b/www/src/pages/features/cms.js index e51ebc67ae27d..d10818db28ea3 100644 --- a/www/src/pages/features/cms.js +++ b/www/src/pages/features/cms.js @@ -31,7 +31,7 @@ const CmsFeaturesPage = ({ data, location }) => { }) const { sections, sectionHeaders } = getFeaturesData( - data.allGatsbyCmsSpecsCsv.edges + data.allGatsbyCmsSpecsCsv.nodes ) return ( @@ -98,16 +98,14 @@ export default CmsFeaturesPage export const pageQuery = graphql` query { allGatsbyCmsSpecsCsv { - edges { - node { - Category - Subcategory - Feature - Gatsby - WordPress - Drupal - Description - } + nodes { + Category + Subcategory + Feature + Gatsby + WordPress + Drupal + Description } } } diff --git a/www/src/pages/features/jamstack.js b/www/src/pages/features/jamstack.js index 549889dc4e1fe..fc2896b65a276 100644 --- a/www/src/pages/features/jamstack.js +++ b/www/src/pages/features/jamstack.js @@ -34,7 +34,7 @@ const JamstackFeaturesPage = ({ data, location }) => { }) const { sections, sectionHeaders } = getFeaturesData( - data.allGatsbyJamstackSpecsCsv.edges + data.allGatsbyJamstackSpecsCsv.nodes ) return ( @@ -99,18 +99,16 @@ export default JamstackFeaturesPage export const pageQuery = graphql` query { allGatsbyJamstackSpecsCsv { - edges { - node { - Category - Subcategory - Feature - Gatsby - Nextjs - Jekyll - Hugo - Nuxtjs - Description - } + nodes { + Category + Subcategory + Feature + Gatsby + Nextjs + Jekyll + Hugo + Nuxtjs + Description } } } diff --git a/www/src/pages/guidelines/logo.js b/www/src/pages/guidelines/logo.js index 5875e0fd04b81..a763240bd1ef2 100644 --- a/www/src/pages/guidelines/logo.js +++ b/www/src/pages/guidelines/logo.js @@ -608,7 +608,7 @@ const Logo = ({ data, location }) => { - {data.allGuidanceYaml.edges.map(({ node }, index) => ( + {data.allGuidanceYaml.nodes.map((node, index) => ( {