Skip to content

Commit e3fff67

Browse files
chore(prettier): 🤖 ✨
1 parent 3bb6d0f commit e3fff67

File tree

3 files changed

+154
-92
lines changed

3 files changed

+154
-92
lines changed

‎nextjs-app/app/components/PageBuilder.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type PageData = {
3030

3131
function renderSections(
3232
pageBuilderSections: PageBuilderSection[],
33-
page: GetPageQueryResult
33+
page: GetPageQueryResult,
3434
) {
3535
if (!page) {
3636
return null;
@@ -100,7 +100,7 @@ export default function PageBuilder({ page }: PageBuilderPageProps) {
100100
// Reconcile References. https://www.sanity.io/docs/enabling-drag-and-drop#ffe728eea8c1
101101
return action.document.pageBuilder.map(
102102
(section) =>
103-
currentSections?.find((s) => s._key === section?._key) || section
103+
currentSections?.find((s) => s._key === section?._key) || section,
104104
);
105105
}
106106

‎nextjs-app/app/posts/[slug]/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function generateStaticParams() {
3535
*/
3636
export async function generateMetadata(
3737
props: Props,
38-
parent: ResolvingMetadata
38+
parent: ResolvingMetadata,
3939
): Promise<Metadata> {
4040
const params = await props.params;
4141
const { data: post } = await sanityFetch({

‎nextjs-app/sanity.types.ts

+151-89
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,14 @@ export type Page = {
176176
slug: Slug;
177177
heading: string;
178178
subheading?: string;
179-
pageBuilder?: Array<{
180-
_key: string;
181-
} & CallToAction | {
182-
_key: string;
183-
} & InfoSection>;
179+
pageBuilder?: Array<
180+
| ({
181+
_key: string;
182+
} & CallToAction)
183+
| ({
184+
_key: string;
185+
} & InfoSection)
186+
>;
184187
};
185188

186189
export type Post = {
@@ -350,17 +353,21 @@ export type SanityAssistInstructionTask = {
350353

351354
export type SanityAssistTaskStatus = {
352355
_type: "sanity.assist.task.status";
353-
tasks?: Array<{
354-
_key: string;
355-
} & SanityAssistInstructionTask>;
356+
tasks?: Array<
357+
{
358+
_key: string;
359+
} & SanityAssistInstructionTask
360+
>;
356361
};
357362

358363
export type SanityAssistSchemaTypeAnnotations = {
359364
_type: "sanity.assist.schemaType.annotations";
360365
title?: string;
361-
fields?: Array<{
362-
_key: string;
363-
} & SanityAssistSchemaTypeField>;
366+
fields?: Array<
367+
{
368+
_key: string;
369+
} & SanityAssistSchemaTypeField
370+
>;
364371
};
365372

366373
export type SanityAssistOutputType = {
@@ -413,18 +420,23 @@ export type SanityAssistInstructionUserInput = {
413420
};
414421

415422
export type SanityAssistInstructionPrompt = Array<{
416-
children?: Array<{
417-
marks?: Array<string>;
418-
text?: string;
419-
_type: "span";
420-
_key: string;
421-
} | {
422-
_key: string;
423-
} & SanityAssistInstructionFieldRef | {
424-
_key: string;
425-
} & SanityAssistInstructionContext | {
426-
_key: string;
427-
} & SanityAssistInstructionUserInput>;
423+
children?: Array<
424+
| {
425+
marks?: Array<string>;
426+
text?: string;
427+
_type: "span";
428+
_key: string;
429+
}
430+
| ({
431+
_key: string;
432+
} & SanityAssistInstructionFieldRef)
433+
| ({
434+
_key: string;
435+
} & SanityAssistInstructionContext)
436+
| ({
437+
_key: string;
438+
} & SanityAssistInstructionUserInput)
439+
>;
428440
style?: "normal";
429441
listItem?: never;
430442
markDefs?: null;
@@ -445,22 +457,58 @@ export type SanityAssistInstruction = {
445457
title?: string;
446458
userId?: string;
447459
createdById?: string;
448-
output?: Array<{
449-
_key: string;
450-
} & SanityAssistOutputField | {
451-
_key: string;
452-
} & SanityAssistOutputType>;
460+
output?: Array<
461+
| ({
462+
_key: string;
463+
} & SanityAssistOutputField)
464+
| ({
465+
_key: string;
466+
} & SanityAssistOutputType)
467+
>;
453468
};
454469

455470
export type SanityAssistSchemaTypeField = {
456471
_type: "sanity.assist.schemaType.field";
457472
path?: string;
458-
instructions?: Array<{
459-
_key: string;
460-
} & SanityAssistInstruction>;
473+
instructions?: Array<
474+
{
475+
_key: string;
476+
} & SanityAssistInstruction
477+
>;
461478
};
462479

463-
export type AllSanitySchemaTypes = SanityImagePaletteSwatch | SanityImagePalette | SanityImageDimensions | SanityFileAsset | Geopoint | CallToAction | Link | InfoSection | BlockContent | Page | Post | Person | Slug | Settings | SanityImageCrop | SanityImageHotspot | SanityImageAsset | SanityAssetSourceData | SanityImageMetadata | SanityAssistInstructionTask | SanityAssistTaskStatus | SanityAssistSchemaTypeAnnotations | SanityAssistOutputType | SanityAssistOutputField | SanityAssistInstructionContext | AssistInstructionContext | SanityAssistInstructionUserInput | SanityAssistInstructionPrompt | SanityAssistInstructionFieldRef | SanityAssistInstruction | SanityAssistSchemaTypeField;
480+
export type AllSanitySchemaTypes =
481+
| SanityImagePaletteSwatch
482+
| SanityImagePalette
483+
| SanityImageDimensions
484+
| SanityFileAsset
485+
| Geopoint
486+
| CallToAction
487+
| Link
488+
| InfoSection
489+
| BlockContent
490+
| Page
491+
| Post
492+
| Person
493+
| Slug
494+
| Settings
495+
| SanityImageCrop
496+
| SanityImageHotspot
497+
| SanityImageAsset
498+
| SanityAssetSourceData
499+
| SanityImageMetadata
500+
| SanityAssistInstructionTask
501+
| SanityAssistTaskStatus
502+
| SanityAssistSchemaTypeAnnotations
503+
| SanityAssistOutputType
504+
| SanityAssistOutputField
505+
| SanityAssistInstructionContext
506+
| AssistInstructionContext
507+
| SanityAssistInstructionUserInput
508+
| SanityAssistInstructionPrompt
509+
| SanityAssistInstructionFieldRef
510+
| SanityAssistInstruction
511+
| SanityAssistSchemaTypeField;
464512
export declare const internalGroqTypeReferenceTo: unique symbol;
465513
// Source: ./sanity/lib/queries.ts
466514
// Variable: settingsQuery
@@ -513,60 +561,74 @@ export type GetPageQueryResult = {
513561
slug: Slug;
514562
heading: string;
515563
subheading: string | null;
516-
pageBuilder: Array<{
517-
_key: string;
518-
_type: "callToAction";
519-
heading: string;
520-
text?: string;
521-
buttonText?: string;
522-
link: {
523-
_type: "link";
524-
linkType?: "href" | "page" | "post";
525-
href?: string;
526-
page: string | null;
527-
post: string | null;
528-
openInNewTab?: boolean;
529-
} | null;
530-
} | {
531-
_key: string;
532-
_type: "infoSection";
533-
heading?: string;
534-
subheading?: string;
535-
content: Array<{
536-
children?: Array<{
537-
marks?: Array<string>;
538-
text?: string;
539-
_type: "span";
564+
pageBuilder: Array<
565+
| {
540566
_key: string;
541-
}>;
542-
style?: "blockquote" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "normal";
543-
listItem?: "bullet" | "number";
544-
markDefs: Array<{
545-
linkType?: "href" | "page" | "post";
546-
href?: string;
547-
page: string | null;
548-
post: string | null;
549-
openInNewTab?: boolean;
550-
_type: "link";
567+
_type: "callToAction";
568+
heading: string;
569+
text?: string;
570+
buttonText?: string;
571+
link: {
572+
_type: "link";
573+
linkType?: "href" | "page" | "post";
574+
href?: string;
575+
page: string | null;
576+
post: string | null;
577+
openInNewTab?: boolean;
578+
} | null;
579+
}
580+
| {
551581
_key: string;
552-
}> | null;
553-
level?: number;
554-
_type: "block";
555-
_key: string;
556-
}> | null;
557-
}> | null;
582+
_type: "infoSection";
583+
heading?: string;
584+
subheading?: string;
585+
content: Array<{
586+
children?: Array<{
587+
marks?: Array<string>;
588+
text?: string;
589+
_type: "span";
590+
_key: string;
591+
}>;
592+
style?:
593+
| "blockquote"
594+
| "h1"
595+
| "h2"
596+
| "h3"
597+
| "h4"
598+
| "h5"
599+
| "h6"
600+
| "normal";
601+
listItem?: "bullet" | "number";
602+
markDefs: Array<{
603+
linkType?: "href" | "page" | "post";
604+
href?: string;
605+
page: string | null;
606+
post: string | null;
607+
openInNewTab?: boolean;
608+
_type: "link";
609+
_key: string;
610+
}> | null;
611+
level?: number;
612+
_type: "block";
613+
_key: string;
614+
}> | null;
615+
}
616+
> | null;
558617
} | null;
559618
// Variable: sitemapData
560619
// Query: *[_type == "page" || _type == "post" && defined(slug.current)] | order(_type asc) { "slug": slug.current, _type, _updatedAt, }
561-
export type SitemapDataResult = Array<{
562-
slug: string;
563-
_type: "page";
564-
_updatedAt: string;
565-
} | {
566-
slug: string;
567-
_type: "post";
568-
_updatedAt: string;
569-
}>;
620+
export type SitemapDataResult = Array<
621+
| {
622+
slug: string;
623+
_type: "page";
624+
_updatedAt: string;
625+
}
626+
| {
627+
slug: string;
628+
_type: "post";
629+
_updatedAt: string;
630+
}
631+
>;
570632
// Variable: allPostsQuery
571633
// Query: *[_type == "post" && defined(slug.current)] | order(date desc, _updatedAt desc) { _id, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _updatedAt), "author": author->{firstName, lastName, picture}, }
572634
export type AllPostsQueryResult = Array<{
@@ -718,13 +780,13 @@ export type PagesSlugsResult = Array<{
718780
import "@sanity/client";
719781
declare module "@sanity/client" {
720782
interface SanityQueries {
721-
"*[_type == \"settings\"][0]": SettingsQueryResult;
722-
"\n *[_type == 'page' && slug.current == $slug][0]{\n _id,\n _type,\n name,\n slug,\n heading,\n subheading,\n \"pageBuilder\": pageBuilder[]{\n ...,\n _type == \"callToAction\" => {\n ...,\n \n link {\n ...,\n \n _type == \"link\" => {\n \"page\": page->slug.current,\n \"post\": post->slug.current\n }\n\n }\n,\n }\n },\n }\n": GetPageQueryResult;
723-
"\n *[_type == \"page\" || _type == \"post\" && defined(slug.current)] | order(_type asc) {\n \"slug\": slug.current,\n _type,\n _updatedAt,\n }\n": SitemapDataResult;
724-
"\n *[_type == \"post\" && defined(slug.current)] | order(date desc, _updatedAt desc) {\n \n _id,\n \"status\": select(_originalId in path(\"drafts.**\") => \"draft\", \"published\"),\n \"title\": coalesce(title, \"Untitled\"),\n \"slug\": slug.current,\n excerpt,\n coverImage,\n \"date\": coalesce(date, _updatedAt),\n \"author\": author->{firstName, lastName, picture},\n\n }\n": AllPostsQueryResult;
725-
"\n *[_type == \"post\" && _id != $skip && defined(slug.current)] | order(date desc, _updatedAt desc) [0...$limit] {\n \n _id,\n \"status\": select(_originalId in path(\"drafts.**\") => \"draft\", \"published\"),\n \"title\": coalesce(title, \"Untitled\"),\n \"slug\": slug.current,\n excerpt,\n coverImage,\n \"date\": coalesce(date, _updatedAt),\n \"author\": author->{firstName, lastName, picture},\n\n }\n": MorePostsQueryResult;
726-
"\n *[_type == \"post\" && slug.current == $slug] [0] {\n content[]{\n ...,\n markDefs[]{\n ...,\n \n _type == \"link\" => {\n \"page\": page->slug.current,\n \"post\": post->slug.current\n }\n\n }\n },\n \n _id,\n \"status\": select(_originalId in path(\"drafts.**\") => \"draft\", \"published\"),\n \"title\": coalesce(title, \"Untitled\"),\n \"slug\": slug.current,\n excerpt,\n coverImage,\n \"date\": coalesce(date, _updatedAt),\n \"author\": author->{firstName, lastName, picture},\n\n }\n": PostQueryResult;
727-
"\n *[_type == \"post\" && defined(slug.current)]\n {\"slug\": slug.current}\n": PostPagesSlugsResult;
728-
"\n *[_type == \"page\" && defined(slug.current)]\n {\"slug\": slug.current}\n": PagesSlugsResult;
783+
'*[_type == "settings"][0]': SettingsQueryResult;
784+
'\n *[_type == \'page\' && slug.current == $slug][0]{\n _id,\n _type,\n name,\n slug,\n heading,\n subheading,\n "pageBuilder": pageBuilder[]{\n ...,\n _type == "callToAction" => {\n ...,\n \n link {\n ...,\n \n _type == "link" => {\n "page": page->slug.current,\n "post": post->slug.current\n }\n\n }\n,\n }\n },\n }\n': GetPageQueryResult;
785+
'\n *[_type == "page" || _type == "post" && defined(slug.current)] | order(_type asc) {\n "slug": slug.current,\n _type,\n _updatedAt,\n }\n': SitemapDataResult;
786+
'\n *[_type == "post" && defined(slug.current)] | order(date desc, _updatedAt desc) {\n \n _id,\n "status": select(_originalId in path("drafts.**") => "draft", "published"),\n "title": coalesce(title, "Untitled"),\n "slug": slug.current,\n excerpt,\n coverImage,\n "date": coalesce(date, _updatedAt),\n "author": author->{firstName, lastName, picture},\n\n }\n': AllPostsQueryResult;
787+
'\n *[_type == "post" && _id != $skip && defined(slug.current)] | order(date desc, _updatedAt desc) [0...$limit] {\n \n _id,\n "status": select(_originalId in path("drafts.**") => "draft", "published"),\n "title": coalesce(title, "Untitled"),\n "slug": slug.current,\n excerpt,\n coverImage,\n "date": coalesce(date, _updatedAt),\n "author": author->{firstName, lastName, picture},\n\n }\n': MorePostsQueryResult;
788+
'\n *[_type == "post" && slug.current == $slug] [0] {\n content[]{\n ...,\n markDefs[]{\n ...,\n \n _type == "link" => {\n "page": page->slug.current,\n "post": post->slug.current\n }\n\n }\n },\n \n _id,\n "status": select(_originalId in path("drafts.**") => "draft", "published"),\n "title": coalesce(title, "Untitled"),\n "slug": slug.current,\n excerpt,\n coverImage,\n "date": coalesce(date, _updatedAt),\n "author": author->{firstName, lastName, picture},\n\n }\n': PostQueryResult;
789+
'\n *[_type == "post" && defined(slug.current)]\n {"slug": slug.current}\n': PostPagesSlugsResult;
790+
'\n *[_type == "page" && defined(slug.current)]\n {"slug": slug.current}\n': PagesSlugsResult;
729791
}
730792
}

0 commit comments

Comments
 (0)