-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #482 from hifrontendcafe/fix/recover-cmyk-page
fix: recover cmyk pages
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
367ee76
There was a problem hiding this comment.
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:
website – ./
website-git-main-hifrontendcafe.vercel.app
website-hifrontendcafe.vercel.app
beta-fec.vercel.app
frontend.cafe