diff --git a/app/company/[filename]/index.tsx b/app/company/[filename]/index.tsx index 0a0d93c5d..c40a21a3f 100644 --- a/app/company/[filename]/index.tsx +++ b/app/company/[filename]/index.tsx @@ -25,7 +25,7 @@ export default function CompanyPage({ tinaProps, props }) { {data.company.seo?.showBreadcrumb === null || (data.company.seo?.showBreadcrumb && ( -
+
; + return ; } diff --git a/app/company/clients/[filename]/index.tsx b/app/company/clients/[filename]/index.tsx new file mode 100644 index 000000000..654d7b49b --- /dev/null +++ b/app/company/clients/[filename]/index.tsx @@ -0,0 +1,61 @@ +"use client"; + +import { BuiltOnAzure } from "@/components/blocks"; +import { Blocks } from "@/components/blocks-renderer"; +import { componentRenderer } from "@/components/blocks/mdxComponentRenderer"; +import { TechUpgrade } from "@/components/blocks/techUpgrade"; +import { Section } from "@/components/util/section"; +import { removeExtension } from "@/services/client/utils.service"; +import { Breadcrumbs } from "app/components/breadcrumb"; +import { tinaField } from "tinacms/dist/react"; +import { TinaMarkdown } from "tinacms/dist/rich-text"; + +export default function CompanyPage({ tinaProps, props }) { + const { data } = tinaProps; + + return ( + <> + {data.caseStudy.seo?.showBreadcrumb === null || + (data.caseStudy.seo?.showBreadcrumb && ( +
+ +
+ ))} +
+
+

+ {data.caseStudy.heading} +

+

+ {data.caseStudy.subHeading} +

+
+
+ +
+ +
+
+ +
+
+ +
+ + ); +} diff --git a/app/company/clients/[filename]/page.tsx b/app/company/clients/[filename]/page.tsx new file mode 100644 index 000000000..5cd098bea --- /dev/null +++ b/app/company/clients/[filename]/page.tsx @@ -0,0 +1,85 @@ +import client from "@/tina/client"; +import { TODAY } from "hooks/useFetchEvents"; +import { useSEO } from "hooks/useSeo"; +import { Metadata } from "next"; +import { TinaClient } from "../../../tina-client"; +import CaseStudies from "./index"; + +export const dynamicParams = false; + +export async function generateStaticParams() { + let pageListData = await client.queries.caseStudyConnection(); + const allPagesListData = pageListData; + + while (pageListData.data.caseStudyConnection.pageInfo.hasNextPage) { + const lastCursor = pageListData.data.caseStudyConnection.pageInfo.endCursor; + pageListData = await client.queries.caseStudyConnection({ + after: lastCursor, + }); + + allPagesListData.data.caseStudyConnection.edges.push( + ...pageListData.data.caseStudyConnection.edges + ); + } + + const pages = allPagesListData.data.caseStudyConnection.edges.map((page) => ({ + filename: page.node._sys.filename, + })); + + return pages; +} + +const getData = async (filename: string) => { + const tinaProps = await client.queries.caseStudyContentQuery({ + relativePath: `${filename}.mdx`, + date: TODAY.toISOString(), + }); + + const seo = tinaProps.data.caseStudy.seo; + + return { + props: { + data: tinaProps.data, + query: tinaProps.query, + variables: tinaProps.variables, + header: { + url: tinaProps.data.global.header.url, + }, + seo, + ...tinaProps, + }, + }; +}; + +type GenerateMetaDataProps = { + params: { filename: string }; + searchParams: { [key: string]: string | string[] | undefined }; +}; + +export async function generateMetadata({ + params, +}: GenerateMetaDataProps): Promise { + const tinaProps = await getData(params.filename); + + const seo = tinaProps.props.seo; + if (seo && !seo.canonical) { + seo.canonical = `${tinaProps.props.header.url}company/clients/${params.filename}`; + } + + // eslint-disable-next-line react-hooks/rules-of-hooks + const { seoProps } = useSEO(seo); + + return { ...seoProps }; +} + +export default async function Consulting({ + params, +}: { + params: { filename: string }; +}) { + const { filename } = params; + + const { props } = await getData(filename); + + return ; +} diff --git a/content/company/case-study/fpe.mdx b/content/company/case-study/fpe.mdx index 4a4f87962..7514f98c4 100644 --- a/content/company/case-study/fpe.mdx +++ b/content/company/case-study/fpe.mdx @@ -4,6 +4,7 @@ seo: description: >- Explore the journey of French Payroll Expert (FPE) - How integrating an AI-powered chatbot has revolutionized their customer service. + showBreadcrumb: true heading: French Payroll Expert (FPE) subHeading: >- Discover how integrating an AI-powered chatbot has revolutionized their diff --git a/pages/company/clients/[filename].tsx b/pages/company/clients/[filename].tsx deleted file mode 100644 index ed5bff16e..000000000 --- a/pages/company/clients/[filename].tsx +++ /dev/null @@ -1,123 +0,0 @@ -import client from "@/tina/client"; -import { TODAY } from "hooks/useFetchEvents"; -import { InferGetStaticPropsType } from "next"; -import { tinaField, useTina } from "tinacms/dist/react"; -import { TinaMarkdown } from "tinacms/dist/rich-text"; -import { BuiltOnAzure } from "../../../components/blocks"; -import { Blocks } from "../../../components/blocks-renderer"; -import { Breadcrumbs } from "../../../components/blocks/breadcrumbs"; -import { componentRenderer } from "../../../components/blocks/mdxComponentRenderer"; -import { TechUpgrade } from "../../../components/blocks/techUpgrade"; -import { Layout } from "../../../components/layout"; -import { Section } from "../../../components/util/section"; -import { SEO } from "../../../components/util/seo"; -import { RecaptchaContext } from "../../../context/RecaptchaContext"; -import { removeExtension } from "../../../services/client/utils.service"; - -export default function CompanyPage( - props: InferGetStaticPropsType -) { - const { data } = useTina({ - data: props.data, - query: props.query, - variables: props.variables, - }); - - return ( - - - - {data.caseStudy.seo?.showBreadcrumb === null || - (data.caseStudy.seo?.showBreadcrumb && ( -
- -
- ))} -
-
-

- {data.caseStudy.heading} -

-

- {data.caseStudy.subHeading} -

-
-
- -
- -
-
- -
-
- -
-
-
- ); -} - -export const getStaticProps = async ({ params }) => { - const tinaProps = await client.queries.caseStudyContentQuery({ - relativePath: `${params.filename}.mdx`, - date: TODAY.toISOString(), - }); - - const seo = tinaProps.data.caseStudy.seo; - if (seo && (seo?.canonical === null || seo?.canonical === "")) { - seo.canonical = `${tinaProps.data.global.header.url}company/clients/${params.filename}`; - } - - return { - props: { - data: tinaProps.data, - query: tinaProps.query, - variables: tinaProps.variables, - env: { - GOOGLE_RECAPTCHA_SITE_KEY: - process.env.GOOGLE_RECAPTCHA_SITE_KEY || null, - }, - seo, - }, - }; -}; -export const getStaticPaths = async () => { - let pageListData = await client.queries.caseStudyConnection(); - const allPagesListData = pageListData; - - while (pageListData.data.caseStudyConnection.pageInfo.hasNextPage) { - const lastCursor = pageListData.data.caseStudyConnection.pageInfo.endCursor; - pageListData = await client.queries.caseStudyConnection({ - after: lastCursor, - }); - - allPagesListData.data.caseStudyConnection.edges.push( - ...pageListData.data.caseStudyConnection.edges - ); - } - - return { - paths: allPagesListData.data.caseStudyConnection.edges.map((page) => ({ - params: { filename: page.node._sys.filename }, - })), - fallback: false, - }; -};