diff --git a/gatsby-config.js b/gatsby-config.js index 5aced78..3b62f8b 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -68,8 +68,8 @@ module.exports = { { resolve: `gatsby-source-filesystem`, options: { - name: `what-is-archive`, - path: `${__dirname}/src/content/archives`, + name: `spotlights`, + path: `${__dirname}/src/content/spotlights`, }, }, `gatsby-transformer-sharp`, diff --git a/gatsby-node.js b/gatsby-node.js index 8039556..9d119a1 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -7,7 +7,7 @@ const fs = require("fs") const requiredArticleFrontmatter = ["authors", "date"] const LAYOUT_RESOURCES = "resources" -const LAYOUT_ARCHIVES = "archives" +const LAYOUT_SPOTLIGHTS = "spotlights" const LAYOUT_REGULAR = "regular" const LAYOUT_HOME = "home" @@ -20,8 +20,8 @@ function resolveLayout(path) { return LAYOUT_RESOURCES } - if (path.match(/archives/)) { - return LAYOUT_ARCHIVES + if (path.match(/spotlights/)) { + return LAYOUT_SPOTLIGHTS } return LAYOUT_REGULAR @@ -128,12 +128,12 @@ const createResources = async ({ createPage, graphql }) => { } } -const createArchives = async ({ createPage, graphql }) => { - const archive = path.resolve(`src/templates/archive.tsx`) +const createSpotlights = async ({ createPage, graphql }) => { + const spotlights = path.resolve(`src/templates/spotlight.tsx`) const result = await graphql(` - query FetchArchives { - allFile(filter: { sourceInstanceName: { eq: "what-is-archive" } }) { + query FetchSpotlights { + allFile(filter: { sourceInstanceName: { eq: "spotlights" } }) { edges { node { relativePath @@ -150,11 +150,11 @@ const createArchives = async ({ createPage, graphql }) => { return result.data.allFile.edges.forEach(({ node }) => { createPage({ - path: path.posix.join("archives", node.relativePath), - component: archive, + path: path.posix.join("spotlights", node.relativePath), + component: spotlights, context: { file: node.relativePath, - layout: LAYOUT_ARCHIVES, + layout: LAYOUT_SPOTLIGHTS, }, }) }) @@ -163,7 +163,7 @@ const createArchives = async ({ createPage, graphql }) => { exports.onCreateNode = async ({ node, getNode, actions }) => { const { createPage, createNodeField } = actions // TODO: find a better way to avoid handling non-resources - // or better, attach authors to what-is archives + // or better, attach authors to spotlights if (node.internal.type === "Mdx" && node.frontmatter.authors) { const { frontmatter } = node const isDoc = Boolean(!frontmatter.path) @@ -197,9 +197,9 @@ exports.onCreatePage = async ({ page, actions }) => { const oldPage = { ...page } page.matchPath = `/resources/*` deletePage(oldPage) - } else if (page.path.match(/^\/archives\/404/)) { + } else if (page.path.match(/^\/spotlights\/404/)) { const oldPage = { ...page } - page.matchPath = `/archives/*` + page.matchPath = `/spotlights/*` deletePage(oldPage) } @@ -211,7 +211,7 @@ exports.createPages = ({ actions, graphql }) => { const { createPage } = actions return Promise.all([ - createArchives({ createPage, graphql }), + createSpotlights({ createPage, graphql }), createResources({ createPage, graphql }), ]) } diff --git a/generated/graphql.ts b/generated/graphql.ts index 91ad7c5..05a4180 100644 --- a/generated/graphql.ts +++ b/generated/graphql.ts @@ -2973,7 +2973,7 @@ export type Unnamed_1_QueryVariables = {}; export type Unnamed_1_Query = ( { __typename?: 'Query' } - & { archives: ( + & { spotlights: ( { __typename?: 'FileConnection' } & { edges: Array<( { __typename?: 'FileEdge' } diff --git a/src/components/Home/index.tsx b/src/components/Home/index.tsx index aa47650..3e76353 100644 --- a/src/components/Home/index.tsx +++ b/src/components/Home/index.tsx @@ -78,7 +78,7 @@ export const Home: FC = () => { faq bots resources - tech spotlights + tech spotlights join us diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index 9a9ca88..c03722b 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -44,7 +44,7 @@ export const Sidebar: FC> = (props) => { faq bots resources - tech spotlights + tech spotlights diff --git a/src/components/ArchivesSidebar/index.tsx b/src/components/SpotlightsSidebar/index.tsx similarity index 78% rename from src/components/ArchivesSidebar/index.tsx rename to src/components/SpotlightsSidebar/index.tsx index 388d70f..7e77220 100644 --- a/src/components/ArchivesSidebar/index.tsx +++ b/src/components/SpotlightsSidebar/index.tsx @@ -9,10 +9,10 @@ import { humanize } from "../../utils" import { Sidebar } from "../Sidebar" import * as SC from "./styles" -const ALL_ARCHIVES = graphql` +const ALL_SPOTLIGHTS = graphql` query { - archives: allFile( - filter: { sourceInstanceName: { eq: "what-is-archive" } } + spotlights: allFile( + filter: { sourceInstanceName: { eq: "spotlights" } } ) { edges { node { @@ -42,9 +42,9 @@ function Tree({ item }: { item: IFileOrFolder }) { ) } -export const ArchivesSidebar: FC> = (props) => { - const { archives } = useStaticQuery(ALL_ARCHIVES) - const tree = useBuildTree(archives, "/archives") +export const SpotlightsSidebar: FC> = (props) => { + const { spotlights } = useStaticQuery(ALL_SPOTLIGHTS) + const tree = useBuildTree(spotlights, "/spotlights") const sortedTree = sort((a, b) => a.title.localeCompare(b.title), tree) return ( diff --git a/src/components/ArchivesSidebar/styles.tsx b/src/components/SpotlightsSidebar/styles.tsx similarity index 100% rename from src/components/ArchivesSidebar/styles.tsx rename to src/components/SpotlightsSidebar/styles.tsx diff --git a/src/content/archives/what-is-ansible.md b/src/content/spotlights/what-is-ansible.md similarity index 100% rename from src/content/archives/what-is-ansible.md rename to src/content/spotlights/what-is-ansible.md diff --git a/src/content/archives/what-is-clojure.md b/src/content/spotlights/what-is-clojure.md similarity index 100% rename from src/content/archives/what-is-clojure.md rename to src/content/spotlights/what-is-clojure.md diff --git a/src/content/archives/what-is-deno.md b/src/content/spotlights/what-is-deno.md similarity index 100% rename from src/content/archives/what-is-deno.md rename to src/content/spotlights/what-is-deno.md diff --git a/src/content/archives/what-is-discordjs.md b/src/content/spotlights/what-is-discordjs.md similarity index 100% rename from src/content/archives/what-is-discordjs.md rename to src/content/spotlights/what-is-discordjs.md diff --git a/src/content/archives/what-is-docker.md b/src/content/spotlights/what-is-docker.md similarity index 100% rename from src/content/archives/what-is-docker.md rename to src/content/spotlights/what-is-docker.md diff --git a/src/content/archives/what-is-elixir.md b/src/content/spotlights/what-is-elixir.md similarity index 100% rename from src/content/archives/what-is-elixir.md rename to src/content/spotlights/what-is-elixir.md diff --git a/src/content/archives/what-is-emacs.md b/src/content/spotlights/what-is-emacs.md similarity index 100% rename from src/content/archives/what-is-emacs.md rename to src/content/spotlights/what-is-emacs.md diff --git a/src/content/archives/what-is-google.md b/src/content/spotlights/what-is-google.md similarity index 100% rename from src/content/archives/what-is-google.md rename to src/content/spotlights/what-is-google.md diff --git a/src/content/archives/what-is-graphql.md b/src/content/spotlights/what-is-graphql.md similarity index 100% rename from src/content/archives/what-is-graphql.md rename to src/content/spotlights/what-is-graphql.md diff --git a/src/content/archives/what-is-haskell.md b/src/content/spotlights/what-is-haskell.md similarity index 100% rename from src/content/archives/what-is-haskell.md rename to src/content/spotlights/what-is-haskell.md diff --git a/src/content/archives/what-is-julia.md b/src/content/spotlights/what-is-julia.md similarity index 100% rename from src/content/archives/what-is-julia.md rename to src/content/spotlights/what-is-julia.md diff --git a/src/content/archives/what-is-kotlin.md b/src/content/spotlights/what-is-kotlin.md similarity index 100% rename from src/content/archives/what-is-kotlin.md rename to src/content/spotlights/what-is-kotlin.md diff --git a/src/content/archives/what-is-lisp.md b/src/content/spotlights/what-is-lisp.md similarity index 100% rename from src/content/archives/what-is-lisp.md rename to src/content/spotlights/what-is-lisp.md diff --git a/src/content/archives/what-is-redis.md b/src/content/spotlights/what-is-redis.md similarity index 100% rename from src/content/archives/what-is-redis.md rename to src/content/spotlights/what-is-redis.md diff --git a/src/content/archives/what-is-rust.md b/src/content/spotlights/what-is-rust.md similarity index 100% rename from src/content/archives/what-is-rust.md rename to src/content/spotlights/what-is-rust.md diff --git a/src/content/archives/what-is-sqlite.md b/src/content/spotlights/what-is-sqlite.md similarity index 100% rename from src/content/archives/what-is-sqlite.md rename to src/content/spotlights/what-is-sqlite.md diff --git a/src/content/archives/what-is-svelte.md b/src/content/spotlights/what-is-svelte.md similarity index 100% rename from src/content/archives/what-is-svelte.md rename to src/content/spotlights/what-is-svelte.md diff --git a/src/content/archives/what-is-symfony.md b/src/content/spotlights/what-is-symfony.md similarity index 100% rename from src/content/archives/what-is-symfony.md rename to src/content/spotlights/what-is-symfony.md diff --git a/src/content/archives/what-is-vim.md b/src/content/spotlights/what-is-vim.md similarity index 100% rename from src/content/archives/what-is-vim.md rename to src/content/spotlights/what-is-vim.md diff --git a/src/content/archives/what-is-wsl.md b/src/content/spotlights/what-is-wsl.md similarity index 100% rename from src/content/archives/what-is-wsl.md rename to src/content/spotlights/what-is-wsl.md diff --git a/src/content/archives/what-is-zsh.md b/src/content/spotlights/what-is-zsh.md similarity index 100% rename from src/content/archives/what-is-zsh.md rename to src/content/spotlights/what-is-zsh.md diff --git a/src/layouts/ArchivesLayout/index.tsx b/src/layouts/ArchivesLayout/index.tsx deleted file mode 100644 index 8d047b6..0000000 --- a/src/layouts/ArchivesLayout/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import React, { FC } from "react" - -import { ArchivesSidebar } from "../../components/ArchivesSidebar" -import { ColumnLayout } from "../ColumnLayout" - -export const ArchivesLayout: FC = ({ children }) => { - return ( - - ) -} diff --git a/src/layouts/SpotlightsLayout/index.tsx b/src/layouts/SpotlightsLayout/index.tsx new file mode 100644 index 0000000..5f9813f --- /dev/null +++ b/src/layouts/SpotlightsLayout/index.tsx @@ -0,0 +1,14 @@ +import React, { FC } from "react" + +import { SpotlightsSidebar } from "../../components/SpotlightsSidebar" +import { ColumnLayout } from "../ColumnLayout" + +export const SpotlightsLayout: FC = ({ children }) => { + return ( + + ) +} diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index aa0bd2d..2e972cd 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -1,7 +1,7 @@ import { WindowLocation } from "@reach/router" import React, { FC, useMemo } from "react" import { LocationProvider } from "../LocationProvider" -import { ArchivesLayout } from "./ArchivesLayout" +import { SpotlightsLayout } from "./SpotlightsLayout" import { HomeLayout } from "./HomeLayout" import { PageLayout } from "./PageLayout" import { ResourcesLayout } from "./ResourcesLayout" @@ -21,8 +21,8 @@ const BaseLayout: FC = (props) => { switch (props.pageContext.layout) { case "resources": return ResourcesLayout - case "archives": - return ArchivesLayout + case "spotlights": + return SpotlightsLayout case "regular": return PageLayout default: diff --git a/src/pages/archives/404.tsx b/src/pages/spotlights/404.tsx similarity index 83% rename from src/pages/archives/404.tsx rename to src/pages/spotlights/404.tsx index 6e86591..a036748 100644 --- a/src/pages/archives/404.tsx +++ b/src/pages/spotlights/404.tsx @@ -14,12 +14,12 @@ const FourZeroFourPage: React.FC<{ data: { allFile: FileConnection } }> = ({ data, }: ComponentQuery<{ allFile: FileConnection }>) => ( - - + + {({ location }) => ( @@ -33,7 +33,7 @@ export default FourZeroFourPage export const query = graphql` query { - allFile(filter: { sourceInstanceName: { eq: "what-is-archive" } }) { + allFile(filter: { sourceInstanceName: { eq: "spotlights" } }) { edges { node { relativePath diff --git a/src/pages/archives/index.tsx b/src/pages/spotlights/index.tsx similarity index 53% rename from src/pages/archives/index.tsx rename to src/pages/spotlights/index.tsx index 310fb22..cb77517 100644 --- a/src/pages/archives/index.tsx +++ b/src/pages/spotlights/index.tsx @@ -5,18 +5,18 @@ import { Link } from "../../components/Link" import { PageContent } from "../../components/PageContent" import { SEO } from "../../components/SEO" -function ArchivesPage() { +function SpotlightsPage() { return ( - - + + - This regroups the archives of our occasional, temporary channels - that cover a piece of technology that might be unknown to part of - our users. You can find those on{" "} + This is a collection of our technology spotlights that have been + highlighted in our discord server. Spotlights run for one month + within the server before appearing here. You can find those on{" "} The Programmer's Hangout.

} @@ -25,4 +25,4 @@ function ArchivesPage() { ) } -export default ArchivesPage +export default SpotlightsPage diff --git a/src/templates/archive.tsx b/src/templates/spotlight.tsx similarity index 90% rename from src/templates/archive.tsx rename to src/templates/spotlight.tsx index 6c40ddf..07f0168 100644 --- a/src/templates/archive.tsx +++ b/src/templates/spotlight.tsx @@ -7,7 +7,7 @@ import { humanize } from "../utils" import { PageContent } from "../components/PageContent" // @todo maybe find alternative type for data -const Archive: FC = ({ data }) => { +const Spotlight: FC = ({ data }) => { const { relativePath } = data.file const { body, excerpt, fields, timeToRead, frontmatter } = data.file.post @@ -18,7 +18,7 @@ const Archive: FC = ({ data }) => {
= ({ data }) => { ) } -export default Archive +export default Spotlight export const query = graphql` - query Archive($file: String!) { + query Spotlight($file: String!) { file(relativePath: { eq: $file }) { relativePath post: childMdx { diff --git a/src/types/index.d.ts b/src/types/index.d.ts index cd3d248..8e3a8dd 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -32,7 +32,7 @@ export interface IFileResourceQuery { } } -export interface IFileArchiveQuery { +export interface IFileSpotlightQuery { node: { relativePath: string } @@ -50,9 +50,9 @@ export interface IAllResourcesQuery extends IAllFilesQuery { } } -export interface IAllArchivesQuery extends IAllFilesQuery { +export interface IAllSpotlightsQuery extends IAllFilesQuery { allFile: { - edges: IFileArchiveQuery[] + edges: IFileSpotlightQuery[] } }