diff --git a/schema.graphql b/schema.graphql index 4851fb14..76baee8a 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1421,7 +1421,7 @@ input CustomerStoryModelContentFieldFilter { blocks: CustomerStoryModelContentFieldBlocksFilter } -union CustomerStoryModelContentLinksField = BlogPostRecord | ChangelogEntryRecord | WebinarRecord +union CustomerStoryModelContentLinksField = BlogPostRecord | ChangelogEntryRecord type CustomerStoryModelExcerptField { blocks: [String!]! diff --git a/src/lib/datocms/graphql-env.d.ts b/src/lib/datocms/graphql-env.d.ts index 55a4fc12..45bb040d 100644 --- a/src/lib/datocms/graphql-env.d.ts +++ b/src/lib/datocms/graphql-env.d.ts @@ -14,7 +14,7 @@ export type introspection_types = { 'AcademyCourseModelOrderBy': { name: 'AcademyCourseModelOrderBy'; enumValues: '_createdAt_ASC' | '_createdAt_DESC' | 'createdAt_ASC' | 'createdAt_DESC' | 'id_ASC' | 'id_DESC' | '_firstPublishedAt_ASC' | '_firstPublishedAt_DESC' | 'position_ASC' | 'position_DESC' | '_publicationScheduledAt_ASC' | '_publicationScheduledAt_DESC' | '_unpublishingScheduledAt_ASC' | '_unpublishingScheduledAt_DESC' | '_publishedAt_ASC' | '_publishedAt_DESC' | '_status_ASC' | '_status_DESC' | '_updatedAt_ASC' | '_updatedAt_DESC' | 'updatedAt_ASC' | 'updatedAt_DESC' | '_isValid_ASC' | '_isValid_DESC' | 'illustration_ASC' | 'illustration_DESC' | 'name_ASC' | 'name_DESC'; }; 'AcademyCourseRecord': { kind: 'OBJECT'; name: 'AcademyCourseRecord'; fields: { '_createdAt': { name: '_createdAt'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; '_editingUrl': { name: '_editingUrl'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; '_firstPublishedAt': { name: '_firstPublishedAt'; type: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; } }; '_isValid': { name: '_isValid'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; } }; '_modelApiKey': { name: '_modelApiKey'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; '_publicationScheduledAt': { name: '_publicationScheduledAt'; type: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; } }; '_publishedAt': { name: '_publishedAt'; type: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; } }; '_seoMetaTags': { name: '_seoMetaTags'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Tag'; ofType: null; }; }; }; } }; '_status': { name: '_status'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'ItemStatus'; ofType: null; }; } }; '_unpublishingScheduledAt': { name: '_unpublishingScheduledAt'; type: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; } }; '_updatedAt': { name: '_updatedAt'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'chapters': { name: 'chapters'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'AcademyChapterRecord'; ofType: null; }; }; }; } }; 'createdAt': { name: 'createdAt'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ItemId'; ofType: null; }; } }; 'illustration': { name: 'illustration'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'introduction': { name: 'introduction'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'AcademyCourseModelIntroductionField'; ofType: null; }; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'position': { name: 'position'; type: { kind: 'SCALAR'; name: 'IntType'; ofType: null; } }; 'slug': { name: 'slug'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'updatedAt': { name: 'updatedAt'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; }; }; 'AcademyPageRecord': { kind: 'OBJECT'; name: 'AcademyPageRecord'; fields: { '_createdAt': { name: '_createdAt'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; '_editingUrl': { name: '_editingUrl'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; '_firstPublishedAt': { name: '_firstPublishedAt'; type: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; } }; '_isValid': { name: '_isValid'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; } }; '_modelApiKey': { name: '_modelApiKey'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; '_publicationScheduledAt': { name: '_publicationScheduledAt'; type: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; } }; '_publishedAt': { name: '_publishedAt'; type: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; } }; '_seoMetaTags': { name: '_seoMetaTags'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Tag'; ofType: null; }; }; }; } }; '_status': { name: '_status'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'ItemStatus'; ofType: null; }; } }; '_unpublishingScheduledAt': { name: '_unpublishingScheduledAt'; type: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; } }; '_updatedAt': { name: '_updatedAt'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'createdAt': { name: 'createdAt'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; 'id': { name: 'id'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'ItemId'; ofType: null; }; } }; 'seo': { name: 'seo'; type: { kind: 'OBJECT'; name: 'SeoField'; ofType: null; } }; 'updatedAt': { name: 'updatedAt'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'DateTime'; ofType: null; }; } }; }; }; - 'AgencyProgramWorkflowStage': { name: 'AgencyProgramWorkflowStage'; enumValues: 'readyForPublication' | 'editMode' | 'reviewRequested'; }; + 'AgencyProgramWorkflowStage': { name: 'AgencyProgramWorkflowStage'; enumValues: 'editMode' | 'reviewRequested' | 'readyForPublication'; }; 'AgencyProgramWorkflowStageFilter': { kind: 'INPUT_OBJECT'; name: 'AgencyProgramWorkflowStageFilter'; isOneOf: false; inputFields: [{ name: 'eq'; type: { kind: 'ENUM'; name: 'AgencyProgramWorkflowStage'; ofType: null; }; defaultValue: null }, { name: 'neq'; type: { kind: 'ENUM'; name: 'AgencyProgramWorkflowStage'; ofType: null; }; defaultValue: null }, { name: 'in'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'AgencyProgramWorkflowStage'; ofType: null; }; }; }; defaultValue: null }, { name: 'notIn'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'AgencyProgramWorkflowStage'; ofType: null; }; }; }; defaultValue: null }]; }; 'AuthorModelFilter': { kind: 'INPUT_OBJECT'; name: 'AuthorModelFilter'; isOneOf: false; inputFields: [{ name: '_createdAt'; type: { kind: 'INPUT_OBJECT'; name: 'CreatedAtFilter'; ofType: null; }; defaultValue: null }, { name: 'createdAt'; type: { kind: 'INPUT_OBJECT'; name: 'CreatedAtFilter'; ofType: null; }; defaultValue: null }, { name: 'id'; type: { kind: 'INPUT_OBJECT'; name: 'ItemIdFilter'; ofType: null; }; defaultValue: null }, { name: '_firstPublishedAt'; type: { kind: 'INPUT_OBJECT'; name: 'PublishedAtFilter'; ofType: null; }; defaultValue: null }, { name: '_publicationScheduledAt'; type: { kind: 'INPUT_OBJECT'; name: 'PublishedAtFilter'; ofType: null; }; defaultValue: null }, { name: '_unpublishingScheduledAt'; type: { kind: 'INPUT_OBJECT'; name: 'PublishedAtFilter'; ofType: null; }; defaultValue: null }, { name: '_publishedAt'; type: { kind: 'INPUT_OBJECT'; name: 'PublishedAtFilter'; ofType: null; }; defaultValue: null }, { name: '_status'; type: { kind: 'INPUT_OBJECT'; name: 'StatusFilter'; ofType: null; }; defaultValue: null }, { name: '_updatedAt'; type: { kind: 'INPUT_OBJECT'; name: 'UpdatedAtFilter'; ofType: null; }; defaultValue: null }, { name: 'updatedAt'; type: { kind: 'INPUT_OBJECT'; name: 'UpdatedAtFilter'; ofType: null; }; defaultValue: null }, { name: '_isValid'; type: { kind: 'INPUT_OBJECT'; name: 'BooleanFilter'; ofType: null; }; defaultValue: null }, { name: 'avatar'; type: { kind: 'INPUT_OBJECT'; name: 'FileFilter'; ofType: null; }; defaultValue: null }, { name: 'name'; type: { kind: 'INPUT_OBJECT'; name: 'StringFilter'; ofType: null; }; defaultValue: null }, { name: 'slug'; type: { kind: 'INPUT_OBJECT'; name: 'SlugFilter'; ofType: null; }; defaultValue: null }, { name: 'OR'; type: { kind: 'LIST'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'AuthorModelFilter'; ofType: null; }; }; defaultValue: null }, { name: 'AND'; type: { kind: 'LIST'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'AuthorModelFilter'; ofType: null; }; }; defaultValue: null }]; }; 'AuthorModelOrderBy': { name: 'AuthorModelOrderBy'; enumValues: '_createdAt_ASC' | '_createdAt_DESC' | 'createdAt_ASC' | 'createdAt_DESC' | 'id_ASC' | 'id_DESC' | '_firstPublishedAt_ASC' | '_firstPublishedAt_DESC' | '_publicationScheduledAt_ASC' | '_publicationScheduledAt_DESC' | '_unpublishingScheduledAt_ASC' | '_unpublishingScheduledAt_DESC' | '_publishedAt_ASC' | '_publishedAt_DESC' | '_status_ASC' | '_status_DESC' | '_updatedAt_ASC' | '_updatedAt_DESC' | 'updatedAt_ASC' | 'updatedAt_DESC' | '_isValid_ASC' | '_isValid_DESC' | 'name_ASC' | 'name_DESC'; }; @@ -81,7 +81,7 @@ export type introspection_types = { 'CustomerStoryModelContentFieldBlocksFilter': { kind: 'INPUT_OBJECT'; name: 'CustomerStoryModelContentFieldBlocksFilter'; isOneOf: false; inputFields: [{ name: 'any'; type: { kind: 'INPUT_OBJECT'; name: 'CustomerStoryModelContentFieldBlocksConditions'; ofType: null; }; defaultValue: null }, { name: 'exists'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'containsAny'; type: { kind: 'INPUT_OBJECT'; name: 'CustomerStoryModelContentFieldBlocksPresence'; ofType: null; }; defaultValue: null }]; }; 'CustomerStoryModelContentFieldBlocksPresence': { kind: 'INPUT_OBJECT'; name: 'CustomerStoryModelContentFieldBlocksPresence'; isOneOf: false; inputFields: [{ name: 'demo'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'image'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'questionAnswer'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'multipleDemosBlock'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'internalVideo'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'video'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'codesandboxEmbedBlock'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'ctaButton'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'tutorialVideo'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'showcaseProjectBlock'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }, { name: 'table'; type: { kind: 'SCALAR'; name: 'BooleanType'; ofType: null; }; defaultValue: null }]; }; 'CustomerStoryModelContentFieldFilter': { kind: 'INPUT_OBJECT'; name: 'CustomerStoryModelContentFieldFilter'; isOneOf: false; inputFields: [{ name: 'value'; type: { kind: 'INPUT_OBJECT'; name: 'StructuredTextFilter'; ofType: null; }; defaultValue: null }, { name: 'blocks'; type: { kind: 'INPUT_OBJECT'; name: 'CustomerStoryModelContentFieldBlocksFilter'; ofType: null; }; defaultValue: null }]; }; - 'CustomerStoryModelContentLinksField': { kind: 'UNION'; name: 'CustomerStoryModelContentLinksField'; fields: {}; possibleTypes: 'BlogPostRecord' | 'ChangelogEntryRecord' | 'WebinarRecord'; }; + 'CustomerStoryModelContentLinksField': { kind: 'UNION'; name: 'CustomerStoryModelContentLinksField'; fields: {}; possibleTypes: 'BlogPostRecord' | 'ChangelogEntryRecord'; }; 'CustomerStoryModelExcerptField': { kind: 'OBJECT'; name: 'CustomerStoryModelExcerptField'; fields: { 'blocks': { name: 'blocks'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; } }; 'links': { name: 'links'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; } }; 'value': { name: 'value'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'JsonField'; ofType: null; }; } }; }; }; 'CustomerStoryModelFieldsReferencingShowcaseProjectModel': { name: 'CustomerStoryModelFieldsReferencingShowcaseProjectModel'; enumValues: 'customerStory_content' | 'customerStory_content__showcaseProjectBlock_showcaseProjects'; }; 'CustomerStoryModelFieldsReferencingUserGuidesVideoModel': { name: 'CustomerStoryModelFieldsReferencingUserGuidesVideoModel'; enumValues: 'customerStory_content' | 'customerStory_content__tutorialVideo_tutorials'; }; @@ -597,6 +597,6 @@ import * as gqlTada from 'gql.tada'; declare module 'gql.tada' { interface setupSchema { - introspection: introspection; + introspection: introspection } -} +} \ No newline at end of file diff --git a/src/pages/customer-stories/[slug]/index.astro b/src/pages/customer-stories/[slug]/index.astro index 366e75ec..ed0f159c 100644 --- a/src/pages/customer-stories/[slug]/index.astro +++ b/src/pages/customer-stories/[slug]/index.astro @@ -3,6 +3,10 @@ import { render as toPlainText, type StructuredTextDocument, } from 'datocms-structured-text-to-plain-text'; +import { BlogPostInline } from '~/components/inlineRecords/BlogPostInline'; +import { BlogPostLink } from '~/components/linkToRecords/BlogPostLink'; +import { ChangelogEntryInline } from '~/components/inlineRecords/ChangelogEntryInline'; +import { ChangelogEntryLink } from '~/components/linkToRecords/ChangelogEntryLink'; import { CodesandboxEmbedBlock } from '~/components/blocks/CodesandboxEmbedBlock'; import { CtaButton } from '~/components/blocks/CtaButton'; import { Demo } from '~/components/blocks/Demo'; @@ -23,6 +27,7 @@ import { Wrapper } from '~/components/Wrapper'; import { avoidAstroTypeCheckBug, notFoundResponse } from '~/lib/notFoundResponse'; import { executeQuery } from '~/lib/datocms/executeQuery'; import { filterNodes } from '~/lib/datocms/filterNodes'; +import { intersperse } from '~/lib/intersperse'; import { isHeading } from 'datocms-structured-text-utils'; import { query } from './_graphql'; import { slugify } from '~/lib/slugify'; @@ -78,12 +83,15 @@ const tocItems = filterNodes(
In conversation with { - post.people.map((person, i) => ( - - {person.name} ({person.title}) - {i < post.people.length - 2 ? ', ' : i === post.people.length - 2 ? ' and ' : ''} - - )) + intersperse( + post.people.map((person) => ( + + {person.name} ({person.title}) + + )), + ', ', + ' and ', + ) }
@@ -105,6 +113,14 @@ const tocItems = filterNodes( CtaButtonRecord: CtaButton, QuestionAnswerRecord: QuestionAnswer, })} + inlineRecordComponents={withAllComponents(post.content.links, { + BlogPostRecord: BlogPostInline, + ChangelogEntryRecord: ChangelogEntryInline, + })} + linkToRecordComponents={withAllComponents(post.content.links, { + BlogPostRecord: BlogPostLink, + ChangelogEntryRecord: ChangelogEntryLink, + })} /> diff --git a/src/pages/customer-stories/p/[pageIndex]/index.astro b/src/pages/customer-stories/p/[pageIndex]/index.astro index a63ce7be..7d203e9b 100644 --- a/src/pages/customer-stories/p/[pageIndex]/index.astro +++ b/src/pages/customer-stories/p/[pageIndex]/index.astro @@ -7,6 +7,7 @@ import { Space } from '~/components/Space'; import { Wrapper } from '~/components/Wrapper'; import { buildUrlForCustomerStory } from '~/lib/datocms/gqlUrlBuilder/customerStory'; import { executeQuery } from '~/lib/datocms/executeQuery'; +import { intersperse } from '~/lib/intersperse'; import { notFoundResponse, avoidAstroTypeCheckBug } from '~/lib/notFoundResponse'; import { perPage, query } from './_graphql'; import { render as toPlainText } from 'datocms-structured-text-to-plain-text'; @@ -42,8 +43,8 @@ if (!page || posts.length === 0) {- With{' '} - {post.people.map((person, i) => ( - - {person.name} - {i < post.people.length - 2 - ? ', ' - : i === post.people.length - 2 - ? ' and ' - : ''} - - ))} + With + {intersperse( + post.people.map((person) => {person.name}), + ', ', + ' and ', + )}