-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0498cc
commit 9abd337
Showing
14 changed files
with
285 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
--- | ||
name: UnsignedArduino | ||
link: "https://github.com/UnsignedArduino" | ||
bio: "Hi there \U0001F44B\n\nI'm the creator of Awesome Arcade - thanks for visiting my site!\n" | ||
avatarURL: "https://avatars.githubusercontent.com/u/38868705?s=400&v=4" | ||
--- | ||
|
||
Hi there 👋 | ||
|
||
I'm the creator of Awesome Arcade - thanks for visiting my site! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from "react"; | ||
import { AuthorsQuery } from "../../../../tina/__generated__/types"; | ||
import { | ||
AvatarImageRenderer, | ||
RichTextSectionRenderer, | ||
} from "@/components/Blog/Elements"; | ||
|
||
export default function BlogAuthor({ | ||
data, | ||
}: { | ||
data: AuthorsQuery; | ||
}): React.ReactNode { | ||
return ( | ||
<> | ||
<h1> | ||
<AvatarImageRenderer | ||
url={data.authors.avatarURL as string} | ||
name={data.authors.name} | ||
/>{" "} | ||
{data.authors.name} | ||
</h1> | ||
{data.authors.link ? ( | ||
<p> | ||
Visit on{" "} | ||
<a href={data.authors.link} target="_blank" rel="noopener noreferrer"> | ||
{new URL(data.authors.link).hostname} | ||
</a> | ||
</p> | ||
) : null} | ||
<RichTextSectionRenderer content={data.authors.bio} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from "react"; | ||
import Link from "next/link"; | ||
import { AvatarImageRenderer } from "@/components/Blog/Elements"; | ||
|
||
export type BlogAuthorPreview = { | ||
name: string; | ||
link: string; | ||
avatarURL: string | null | undefined; | ||
}; | ||
|
||
export default function BlogAuthorPreviewRenderer({ | ||
preview, | ||
}: { | ||
preview: BlogAuthorPreview; | ||
}): React.ReactNode { | ||
return ( | ||
<> | ||
<div className="card mb-2"> | ||
<div className="card-body"> | ||
<h5 className="card-title"> | ||
<AvatarImageRenderer | ||
url={preview.avatarURL as string} | ||
name={preview.name} | ||
/>{" "} | ||
{preview.name} | ||
</h5> | ||
{preview.link ? ( | ||
<h6 className="card-subtitle mb-2 text-body-secondary"> | ||
Visit on{" "} | ||
<a href={preview.link} target="_blank" rel="noopener noreferrer"> | ||
{new URL(preview.link).hostname} | ||
</a> | ||
</h6> | ||
) : null} | ||
<Link href={`/blog/authors/${preview.name}`} className="card-link"> | ||
View profile | ||
</Link> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { useTina } from "tinacms/dist/react"; | ||
import client from "../../../../tina/__generated__/client"; | ||
import getAppProps, { AppProps } from "@/components/WithAppProps"; | ||
import { GetStaticPathsResult } from "next"; | ||
import Layout from "@/components/Layout"; | ||
import { AuthorsQuery } from "../../../../tina/__generated__/types"; | ||
import React from "react"; | ||
import { createBreadCrumbSegment } from "@/components/Layout/layout"; | ||
import BlogAuthor from "@/components/Blog/Author/Author"; | ||
|
||
type BlogAuthorProps = { | ||
variables: { relativePath: string }; | ||
filename: string; | ||
data: AuthorsQuery; | ||
query: string; | ||
appProps: AppProps; | ||
}; | ||
|
||
type BlogAuthorParams = { author: string }; | ||
|
||
export default function BlogAuthorPage(props: BlogAuthorProps) { | ||
const { data } = useTina({ | ||
query: props.query, | ||
variables: props.variables, | ||
data: props.data, | ||
}); | ||
|
||
const pageName = `${data.authors.name} | Blog`; | ||
|
||
return ( | ||
<Layout | ||
title={pageName} | ||
currentPage={pageName} | ||
appProps={props.appProps} | ||
description={`${data.authors.name} on Awesome Arcade's blog!`} | ||
keywords={`Game development, Awesome, Modules, Libraries, Extensions, Tools, Curated, Arcade, Useful, Curated list, MakeCode, Awesome extensions, Useful extensions, MakeCode Arcade, MakeCode Arcade Extensions, Arcade Extensions, Awesome tools, Useful tools, MakeCode Arcade, MakeCode Arcade tools, Arcade tools, Blog, Awesome Arcade blog, Blog post, Awesome Arcade blog post, ${data.authors.name}, ${data.authors.name} blog posts`} | ||
breadCrumbs={[ | ||
createBreadCrumbSegment("Blog", "/blog"), | ||
createBreadCrumbSegment("Authors", "/blog/authors"), | ||
createBreadCrumbSegment( | ||
data.authors.name, | ||
`/blog/authors/${props.filename}`, | ||
), | ||
]} | ||
> | ||
{/*<code>{JSON.stringify(data, null, 2)}</code>*/} | ||
<BlogAuthor data={data} /> | ||
</Layout> | ||
); | ||
} | ||
|
||
export async function getStaticProps({ | ||
params, | ||
}: { | ||
params: BlogAuthorParams; | ||
}): Promise<{ | ||
props: BlogAuthorProps; | ||
}> { | ||
let variables = { relativePath: `${params.author}.md` }; | ||
|
||
const res = await client.queries.authors(variables); | ||
const query = res.query; | ||
const data = res.data; | ||
variables = res.variables; | ||
|
||
return { | ||
props: { | ||
variables, | ||
filename: params.author, | ||
data, | ||
query, | ||
appProps: await getAppProps(), | ||
}, | ||
}; | ||
} | ||
|
||
export async function getStaticPaths(): Promise< | ||
GetStaticPathsResult<BlogAuthorParams> | ||
> { | ||
const postsListData = await client.queries.authorsConnection(); | ||
|
||
return { | ||
paths: postsListData.data.authorsConnection.edges!.map((author) => ({ | ||
params: { author: author!.node!._sys.filename }, | ||
})), | ||
fallback: false, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import client from "../../../../tina/__generated__/client"; | ||
import getAppProps, { AppProps } from "@/components/WithAppProps"; | ||
import Layout from "@/components/Layout"; | ||
import { Authors } from "../../../../tina/__generated__/types"; | ||
import React from "react"; | ||
import { createBreadCrumbSegment } from "@/components/Layout/layout"; | ||
import BlogAuthorPreviewRenderer, { | ||
BlogAuthorPreview, | ||
} from "@/components/Blog/Author/Preview"; | ||
|
||
type BlogAuthorProps = { | ||
blogAuthorPreviews: BlogAuthorPreview[]; | ||
appProps: AppProps; | ||
}; | ||
|
||
const pageName = `All authors | Blog`; | ||
|
||
export default function AllBlogAuthors(props: BlogAuthorProps) { | ||
return ( | ||
<Layout | ||
title={pageName} | ||
currentPage={pageName} | ||
appProps={props.appProps} | ||
description="All of Awesome Arcade's blog authors!" | ||
keywords="Game development, Awesome, Modules, Libraries, Extensions, Tools, Curated, Arcade, Useful, Curated list, MakeCode, Awesome extensions, Useful extensions, MakeCode Arcade, MakeCode Arcade Extensions, Arcade Extensions, Awesome tools, Useful tools, MakeCode Arcade, MakeCode Arcade tools, Arcade tools, Blog, Awesome Arcade blog, Blog authors, Awesome Arcade blog authors, All blog authors, All Awesome Arcade blog authors" | ||
breadCrumbs={[ | ||
createBreadCrumbSegment("Blog", "/blog"), | ||
createBreadCrumbSegment("Authors", "/blog/authors"), | ||
]} | ||
> | ||
<h1>All blog authors</h1> | ||
<p>Here is a list of all blog authors on Awesome Arcade.</p> | ||
{ | ||
<> | ||
{props.blogAuthorPreviews.map((preview) => { | ||
return ( | ||
<BlogAuthorPreviewRenderer preview={preview} key={preview.name} /> | ||
); | ||
})} | ||
</> | ||
} | ||
</Layout> | ||
); | ||
} | ||
|
||
export async function getStaticProps(): Promise<{ | ||
props: BlogAuthorProps; | ||
}> { | ||
const authorsListData = await client.queries.authorsConnection(); | ||
|
||
const previews: BlogAuthorPreview[] = []; | ||
|
||
for (const edge of authorsListData.data.authorsConnection.edges ?? []) { | ||
if (!edge || !edge.node) { | ||
continue; | ||
} | ||
const author = edge.node; | ||
previews.push({ | ||
name: author.name, | ||
link: author.link, | ||
avatarURL: author.avatarURL, | ||
}); | ||
} | ||
|
||
return { | ||
props: { | ||
blogAuthorPreviews: previews, | ||
appProps: await getAppProps(), | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.