-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84fa9ff
commit 9bd5a9f
Showing
4 changed files
with
68 additions
and
28 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
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 |
---|---|---|
@@ -1,41 +1,29 @@ | ||
import { getSlideshowsQuery, pagesSlugs } from '@/sanity/lib/queries' | ||
import Slideshow from '@/components/sections/Slideshow' | ||
import { sanityFetch } from '@/sanity/lib/live' | ||
import isSlideActive from '@/common/helpers/isSlideActive' | ||
|
||
type Props = { | ||
params: Promise<{ slug: string }> | ||
} | ||
import Slideshow from '@/components/sections/Slideshow' | ||
|
||
export const revalidate = 60 | ||
export const dynamicParams = true | ||
|
||
export async function generateStaticParams() { | ||
/** Fetching all locations to create separate route for each */ | ||
const { data } = await sanityFetch({ | ||
query: pagesSlugs, | ||
// // Use the published perspective in generateStaticParams | ||
perspective: 'published', | ||
stega: false, | ||
}) | ||
|
||
return data | ||
} | ||
|
||
export default async function Page(props: Props) { | ||
const params = await props.params | ||
const { data: slideshows } = await sanityFetch({ query: getSlideshowsQuery, params }) | ||
|
||
const filteredSlideshows = slideshows.map((show: any) => { | ||
return { | ||
...show, | ||
slides: show.slides?.filter(isSlideActive) || [], | ||
} | ||
export default async function Page({ params }: { params: { slug: string } }) { | ||
const { data: slideshows } = await sanityFetch({ | ||
query: getSlideshowsQuery, | ||
params, | ||
}) | ||
|
||
return ( | ||
<div className="h-full w-full"> | ||
<Slideshow slideshows={filteredSlideshows} /> | ||
<Slideshow slideshows={slideshows} /> | ||
</div> | ||
) | ||
} |
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
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