Skip to content

Commit

Permalink
Merge pull request #482 from hifrontendcafe/fix/recover-cmyk-page
Browse files Browse the repository at this point in the history
fix: recover cmyk pages
  • Loading branch information
TonyMckes authored Oct 21, 2023
2 parents 6f72006 + 9801e90 commit 367ee76
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/app/(website)/cmyk/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import SectionHero from '@/components/SectionHero';
import { getPageByName } from '@/lib/api.server';

export default async function CMYKLayout({
children,
}: {
children: React.ReactNode;
}) {
const page = await getPageByName({
name: 'CMYK',
next: {
revalidate: 60,
},
});

return (
<main>
<SectionHero
title={page.title}
paragraph={page.description}
cta={page.doc}
/>

{children}
</main>
);
}
35 changes: 35 additions & 0 deletions src/app/(website)/cmyk/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import CMYKEdition from '@/components/CMYKEditions';
import CMYKEditionsSkeleton from '@/components/CMYKEditions/CMYKEditionsSkeleton';
import { cmykVersions } from '@/components/CMYKEditions/cmykVersions';
import { getAllCMYKVersionsOrderedFromLatest } from '@/lib/api.server';
import { getPageMetadata } from '@/lib/seo';
import type { AppPage } from '@/lib/types';
import { notFound } from 'next/navigation';
import { Suspense } from 'react';

export const generateMetadata = () => {
return getPageMetadata('CMYK');
};

const CMYKPage: AppPage = async () => {
const versions = await getAllCMYKVersionsOrderedFromLatest({
next: { revalidate: 3600 },
});

const current = cmykVersions.find(
(cmykVersion) => cmykVersion.version === versions[0],
);

if (!current) {
console.warn(`No current CMYK version found for ${versions[0]}`);
notFound();
}

return (
<Suspense fallback={<CMYKEditionsSkeleton />}>
<CMYKEdition edition={current.edition} />
</Suspense>
);
};

export default CMYKPage;

1 comment on commit 367ee76

@vercel
Copy link

@vercel vercel bot commented on 367ee76 Oct 21, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.