-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: individual gallery page #650
base: feat-gallery
Are you sure you want to change the base?
Conversation
export async function generateStaticParams({ | ||
params: { locale, gallery }, | ||
}: GalleryProps) { | ||
return getRecentAssets(locale, gallery); |
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.
generates for all assets right now, can be modified if this adds too much to build time
|
||
export const dynamicParams = false; | ||
|
||
export async function generateStaticParams({ |
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.
generates pages for all gallery entries
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.
proxy downloader that uses the directUrlOriginal
to fetch the file from Canto, cache to Next, and serve the file again with an attachment
content type so that browsers download instead of navigating
@@ -49,6 +50,15 @@ const indexNow = async (uri: string) => { | |||
console.info(`${status}: ${indexNowStatusText[status]}`); | |||
}; | |||
|
|||
const revalidateChildren = (parts: Array<string>): "layout" | "page" => { |
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.
since the assets in galleries are not represented in Craft, they need a new revalidation pipeline. Next has two types of revalidation: page
which revalidates only the specified URL and layout
which revalidates the URL + it's children.
In this exception, we want to use layout
so that when the gallery entry is saved (either manually or by webhook), the assets are also revalidated to pick up any changes
|
||
loadEnvConfig(process.cwd()); | ||
|
||
const config: CodegenConfig = { |
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.
set up codegen so we can get typings for GQL responses
@@ -121,8 +121,7 @@ export const Title = styled.div` | |||
transition: backgroud-color 0.2s; | |||
|
|||
@media (max-width: ${BREAK_PHABLET}) { | |||
align-self: center; | |||
justify-self: left; | |||
place-self: center left; |
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.
linter got mad at this, no clue why
const [, , scheme, contentId, directUrlOriginalHash] = pathname.split("/"); | ||
|
||
return ( | ||
<Buttonish |
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.
constructs a new download button that goes to our Next proxy
lib/api/galleries/schema.ts
Outdated
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.
since the Canto plugin does not have it's interfaces hooked up, I am using zod to create and validate schemas. This is useful even if the interfaces get hooked up since it acts as runtime validation.
Individual pages for images and videos in galleries.
Includes: