Skip to content

Commit

Permalink
chore(prettier): 🤖 ✨ (#338)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
ecospark[bot] and github-actions[bot] authored Aug 9, 2023
1 parent 00f509d commit 12a56f7
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion components/BlogHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function BlogHeader({
throw new Error(
`Invalid level: ${
JSON.stringify(level) || typeof level
}, only 1 or 2 are allowed`
}, only 1 or 2 are allowed`,
)
}
}
2 changes: 1 addition & 1 deletion components/HeroPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function HeroPost(
props: Pick<
Post,
'title' | 'coverImage' | 'date' | 'excerpt' | 'author' | 'slug'
>
>,
) {
const { title, coverImage, date, excerpt, author, slug } = props
return (
Expand Down
2 changes: 1 addition & 1 deletion components/PostHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PostTitle from 'components/PostTitle'
import type { Post } from 'lib/sanity.queries'

export default function PostHeader(
props: Pick<Post, 'title' | 'coverImage' | 'date' | 'author' | 'slug'>
props: Pick<Post, 'title' | 'coverImage' | 'date' | 'author' | 'slug'>,
) {
const { title, coverImage, date, author, slug } = props
return (
Expand Down
2 changes: 1 addition & 1 deletion components/PreviewIndexPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function PreviewIndexPage(props: IndexPageProps) {
const [posts, loadingPosts] = useLiveQuery<Post[]>(props.posts, indexQuery)
const [settings, loadingSettings] = useLiveQuery<Settings>(
props.settings,
settingsQuery
settingsQuery,
)

return (
Expand Down
4 changes: 2 additions & 2 deletions components/PreviewPostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export default function PreviewPostPage(props: PostPageProps) {
postAndMoreStoriesQuery,
{
slug: props.post.slug,
}
},
)
const [settings, loadingSettings] = useLiveQuery<Settings>(
props.settings,
settingsQuery
settingsQuery,
)

return (
Expand Down
2 changes: 1 addition & 1 deletion intro-template/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default memo(function IntroTemplate() {
if (typeof window !== 'undefined') {
setStudioURL(`${window.location.origin}/studio`)
setCreatePostURL(
`${window.location.origin}/studio/intent/create/template=post;type=post/`
`${window.location.origin}/studio/intent/create/template=post;type=post/`,
)
setIsLocalhost(window.location.hostname === 'localhost')
setHasUTMtags(window.location.search.includes('utm'))
Expand Down
4 changes: 2 additions & 2 deletions lib/sanity.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ export async function getAllPostsSlugs(): Promise<Pick<Post, 'slug'>[]> {

export async function getPostBySlug(
client: SanityClient,
slug: string
slug: string,
): Promise<Post> {
return (await client.fetch(postBySlugQuery, { slug })) || ({} as any)
}

export async function getPostAndMoreStories(
client: SanityClient,
slug: string
slug: string,
): Promise<{ post: Post; morePosts: Post[] }> {
return await client.fetch(postAndMoreStoriesQuery, { slug })
}
2 changes: 1 addition & 1 deletion pages/api/disable-draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { NextApiRequest, NextApiResponse } from 'next'

export default function exit(
_req: NextApiRequest,
res: NextApiResponse<void>
res: NextApiResponse<void>,
): void {
// Exit the current user from "Draft Mode".
res.setDraftMode({ enable: false })
Expand Down
4 changes: 2 additions & 2 deletions pages/api/og.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Settings, settingsQuery } from 'lib/sanity.queries'

export default async function og(req: NextRequest, res: NextResponse) {
const font = fetch(new URL('public/Inter-Bold.woff', import.meta.url)).then(
(res) => res.arrayBuffer()
(res) => res.arrayBuffer(),
)
const { searchParams } = new URL(req.url)

Expand Down Expand Up @@ -41,6 +41,6 @@ export default async function og(req: NextRequest, res: NextResponse) {
weight: 700,
},
],
}
},
)
}
20 changes: 10 additions & 10 deletions pages/api/revalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export { config } from 'next-sanity/webhook'

export default async function revalidate(
req: NextApiRequest,
res: NextApiResponse
res: NextApiResponse,
) {
try {
const { body, isValidSignature } = await parseBody(
req,
process.env.SANITY_REVALIDATE_SECRET
process.env.SANITY_REVALIDATE_SECRET,
)
if (isValidSignature === false) {
const message = 'Invalid signature'
Expand Down Expand Up @@ -65,7 +65,7 @@ export default async function revalidate(
type StaleRoute = '/' | `/posts/${string}`

async function queryStaleRoutes(
body: Pick<ParseBody['body'], '_type' | '_id' | 'date' | 'slug'>
body: Pick<ParseBody['body'], '_type' | '_id' | 'date' | 'slug'>,
): Promise<StaleRoute[]> {
const client = createClient({ projectId, dataset, apiVersion, useCdn: false })

Expand All @@ -82,7 +82,7 @@ async function queryStaleRoutes(
groq`count(
*[_type == "post"] | order(date desc, _updatedAt desc) [0...3] [dateTime(date) > dateTime($date)]
)`,
{ date: body.date }
{ date: body.date },
)
// If there's less than 3 posts with a newer date, we need to revalidate everything
if (moreStories < 3) {
Expand Down Expand Up @@ -116,10 +116,10 @@ async function queryAllRoutes(client: SanityClient): Promise<StaleRoute[]> {

async function mergeWithMoreStories(
client,
slugs: string[]
slugs: string[],
): Promise<string[]> {
const moreStories = await client.fetch(
groq`*[_type == "post"] | order(date desc, _updatedAt desc) [0...3].slug.current`
groq`*[_type == "post"] | order(date desc, _updatedAt desc) [0...3].slug.current`,
)
if (slugs.some((slug) => moreStories.includes(slug))) {
const allSlugs = await _queryAllRoutes(client)
Expand All @@ -131,13 +131,13 @@ async function mergeWithMoreStories(

async function queryStaleAuthorRoutes(
client: SanityClient,
id: string
id: string,
): Promise<StaleRoute[]> {
let slugs = await client.fetch(
groq`*[_type == "author" && _id == $id] {
"slug": *[_type == "post" && references(^._id)].slug.current
}["slug"][]`,
{ id }
{ id },
)

if (slugs.length > 0) {
Expand All @@ -150,11 +150,11 @@ async function queryStaleAuthorRoutes(

async function queryStalePostRoutes(
client: SanityClient,
id: string
id: string,
): Promise<StaleRoute[]> {
let slugs = await client.fetch(
groq`*[_type == "post" && _id == $id].slug.current`,
{ id }
{ id },
)

slugs = await mergeWithMoreStories(client, slugs)
Expand Down
2 changes: 1 addition & 1 deletion plugins/previewPane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const urlResolver = defineUrlResolver({
const iframeOptions = {
url: urlResolver,
urlSecretId: previewSecretId,
reload: {button: true},
reload: { button: true },
} satisfies IframeOptions

export const previewDocumentNode = (): DefaultDocumentNodeResolver => {
Expand Down

2 comments on commit 12a56f7

@vercel
Copy link

@vercel vercel bot commented on 12a56f7 Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 12a56f7 Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextjs-blog-cms-sanity-v3-without-csm – ./

nextjs-blog-cms-sanity-v3-without-csm-git-main.sanity.build
nextjs-blog-cms-sanity-v3-without-csm.sanity.build

Please sign in to comment.