mirror of
https://github.com/LukeHagar/unicorn-utterances.git
synced 2025-12-10 12:57:46 +00:00
Migrate to new schema for users
This commit is contained in:
@@ -239,7 +239,7 @@ module.exports = {
|
|||||||
`gatsby-plugin-sitemap`
|
`gatsby-plugin-sitemap`
|
||||||
],
|
],
|
||||||
mapping: {
|
mapping: {
|
||||||
"MarkdownRemark.frontmatter.author": `AuthorsJson`,
|
"MarkdownRemark.frontmatter.author": `UsersJson`,
|
||||||
"AuthorsJson.pronouns": `PronounsJson`,
|
"UsersJson.pronouns": `PronounsJson`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ exports.createPages = ({ graphql, actions }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allAuthorsJson(limit: 100) {
|
allUsersJson(limit: 100) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
@@ -42,7 +42,7 @@ exports.createPages = ({ graphql, actions }) => {
|
|||||||
|
|
||||||
// Create blog posts pages.
|
// Create blog posts pages.
|
||||||
const posts = result.data.allMarkdownRemark.edges
|
const posts = result.data.allMarkdownRemark.edges
|
||||||
const authors = result.data.allAuthorsJson.edges
|
const authors = result.data.allUsersJson.edges
|
||||||
|
|
||||||
posts.forEach((post, index, arr) => {
|
posts.forEach((post, index, arr) => {
|
||||||
const previous = index === arr.length - 1 ? null : arr[index + 1].node
|
const previous = index === arr.length - 1 ? null : arr[index + 1].node
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const Layout = ({ location, children }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const authorFragmentQuery = graphql`
|
export const authorFragmentQuery = graphql`
|
||||||
fragment AuthorInfo on AuthorsJson {
|
fragment UserInfo on UsersJson {
|
||||||
name
|
name
|
||||||
blurbet
|
blurbet
|
||||||
id
|
id
|
||||||
@@ -73,7 +73,7 @@ export const postFragmentQuery = graphql`
|
|||||||
tags
|
tags
|
||||||
description
|
description
|
||||||
author {
|
author {
|
||||||
...AuthorInfo
|
...UserInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fields {
|
fields {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const SocialBtn = ({icon, text, url, name}) => {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param image
|
* @param image
|
||||||
* @param socials - Match the object of the authorsJson socials
|
* @param socials - Match the object of the usersJson socials
|
||||||
* @param title
|
* @param title
|
||||||
* @param description
|
* @param description
|
||||||
* @param author - Is an author pic?
|
* @param author - Is an author pic?
|
||||||
|
|||||||
@@ -3,11 +3,7 @@ import listStyle from "./post-card-list.module.scss"
|
|||||||
import { PostCard } from "../post-card"
|
import { PostCard } from "../post-card"
|
||||||
import { FilterSearchBar } from "../filter-search-bar"
|
import { FilterSearchBar } from "../filter-search-bar"
|
||||||
|
|
||||||
/**
|
export const PostList = ({ posts = [], showWordCount = false, numberOfArticles, wordCount, tags }) => {
|
||||||
* overwriteAuthorInfo is a needed evil for now:
|
|
||||||
* @see https://github.com/gatsbyjs/gatsby/issues/14827
|
|
||||||
*/
|
|
||||||
export const PostList = ({ posts = [], showWordCount = false, overwriteAuthorInfo, numberOfArticles, wordCount, tags }) => {
|
|
||||||
// FIXME: This will not suffice with pagination added
|
// FIXME: This will not suffice with pagination added
|
||||||
const [filtered, setFiltered] = useState(null)
|
const [filtered, setFiltered] = useState(null)
|
||||||
const [searched, setSearched] = useState(null)
|
const [searched, setSearched] = useState(null)
|
||||||
@@ -38,7 +34,7 @@ export const PostList = ({ posts = [], showWordCount = false, overwriteAuthorInf
|
|||||||
key={node.fields.slug}
|
key={node.fields.slug}
|
||||||
excerpt={node.excerpt}
|
excerpt={node.excerpt}
|
||||||
title={title}
|
title={title}
|
||||||
author={overwriteAuthorInfo || node.frontmatter.author}
|
author={node.frontmatter.author}
|
||||||
published={node.frontmatter.published}
|
published={node.frontmatter.published}
|
||||||
tags={node.frontmatter.tags}
|
tags={node.frontmatter.tags}
|
||||||
description={node.frontmatter.description}
|
description={node.frontmatter.description}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import style from "./about.module.scss"
|
|||||||
const AboutUs = (props) => {
|
const AboutUs = (props) => {
|
||||||
const { data: { markdownRemark } } = props
|
const { data: { markdownRemark } } = props
|
||||||
|
|
||||||
const { file, markdownRemark: post, site } = useStaticQuery(graphql`
|
const { file, markdownRemark: post, site, allUsersJson: authors } = useStaticQuery(graphql`
|
||||||
query AboutUsQuery {
|
query AboutUsQuery {
|
||||||
site {
|
site {
|
||||||
siteMetadata {
|
siteMetadata {
|
||||||
@@ -31,13 +31,19 @@ const AboutUs = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
allUsersJson {
|
||||||
|
nodes {
|
||||||
|
...UserInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
const { siteMetadata: { title: siteTitle } } = site
|
const { siteMetadata: { title: siteTitle } } = site
|
||||||
|
const { nodes: authorArr } = authors
|
||||||
const { childImageSharp: { fixed: imageFixed } } = file
|
const { childImageSharp: { fixed: imageFixed } } = file
|
||||||
|
|
||||||
console.log(post)
|
console.log(authorArr)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout location={props.location} title={siteTitle}>
|
<Layout location={props.location} title={siteTitle}>
|
||||||
@@ -53,8 +59,16 @@ const AboutUs = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={`${style.aboutBody} post-body`}
|
className={`${style.aboutBody} post-body`}
|
||||||
dangerouslySetInnerHTML={{ __html: markdownRemark.html }}
|
>
|
||||||
/>
|
<div dangerouslySetInnerHTML={{ __html: markdownRemark.html }}/>
|
||||||
|
{
|
||||||
|
authorArr.map(authorInfo => (
|
||||||
|
<div key={authorInfo.id}>
|
||||||
|
<p>{authorInfo.name}</p>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.headerTitle {
|
.headerTitle {
|
||||||
|
flex-wrap: wrap;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { PicTitleHeader } from "../components/pic-title-header"
|
|||||||
const BlogAuthor = (props) => {
|
const BlogAuthor = (props) => {
|
||||||
const siteTitle = props.data.site.siteMetadata.title
|
const siteTitle = props.data.site.siteMetadata.title
|
||||||
const slugData = props.data
|
const slugData = props.data
|
||||||
const authorData = slugData.authorsJson
|
const authorData = slugData.usersJson
|
||||||
const posts = slugData.allMarkdownRemark.edges
|
const posts = slugData.allMarkdownRemark.edges
|
||||||
|
|
||||||
// FIXME: This logic will break with pagination
|
// FIXME: This logic will break with pagination
|
||||||
@@ -44,7 +44,6 @@ const BlogAuthor = (props) => {
|
|||||||
wordCount={wordCount}
|
wordCount={wordCount}
|
||||||
posts={posts}
|
posts={posts}
|
||||||
tags={postTags}
|
tags={postTags}
|
||||||
overwriteAuthorInfo={authorData}
|
|
||||||
showWordCount={true}
|
showWordCount={true}
|
||||||
/>
|
/>
|
||||||
</Layout>
|
</Layout>
|
||||||
@@ -60,8 +59,8 @@ export const pageQuery = graphql`
|
|||||||
title
|
title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
authorsJson(id: { eq: $slug }) {
|
usersJson(id: { eq: $slug }) {
|
||||||
...AuthorInfo
|
...UserInfo
|
||||||
}
|
}
|
||||||
allMarkdownRemark(
|
allMarkdownRemark(
|
||||||
filter: {
|
filter: {
|
||||||
|
|||||||
Reference in New Issue
Block a user