Skip to content
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

Adjusted interception routes to be colon delimited string #79

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {graphqlClient} from "@lib/gql/gql-client"
import {notFound} from "next/navigation"

type Props = {
params: Promise<{uuid: string[]}>
params: Promise<{uuid: string}>
}

const Page = async (props: Props) => {
const params = await props.params
const [paragraphId, mediaUuid] = params.uuid
const [paragraphId, mediaUuid] = decodeURIComponent(params.uuid).split(":")

const paragraphQuery = await graphqlClient().Paragraph({uuid: paragraphId})
if (paragraphQuery.paragraph?.__typename !== "ParagraphStanfordGallery") notFound()
Expand Down Expand Up @@ -58,7 +58,7 @@ const Page = async (props: Props) => {
<li className="mr-auto">
<Link
className="text-white no-underline hocus:text-white hocus:underline"
href={`/gallery/${paragraph.id}/${paragraph.suGalleryImages?.[prevImageIndex].id}`}
href={`/gallery/${paragraph.id}:${paragraph.suGalleryImages?.[prevImageIndex].id}`}
replace={true}
scroll={false}
>
Expand All @@ -70,7 +70,7 @@ const Page = async (props: Props) => {
<li className="ml-auto">
<Link
className="text-white no-underline hocus:text-white hocus:underline"
href={`/gallery/${paragraph.id}/${paragraph.suGalleryImages?.[nextImageIndex].id}`}
href={`/gallery/${paragraph.id}:${paragraph.suGalleryImages?.[nextImageIndex].id}`}
replace={true}
scroll={false}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export const metadata = {
}

type Props = {
params: Promise<{uuid: string[]}>
params: Promise<{uuid: string}>
}

const Page = async (props: Props) => {
const params = await props.params
const [paragraphId, mediaUuid] = params.uuid
const [paragraphId, mediaUuid] = decodeURIComponent(params.uuid).split(":")

const paragraphQuery = await graphqlClient().Paragraph({uuid: paragraphId})
if (paragraphQuery.paragraph?.__typename !== "ParagraphStanfordGallery") notFound()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const GalleryImage = ({
<li {...props}>
<figure className="h-full w-full">
<Link
href={`/gallery/${galleryId}/${image.id}`}
href={`/gallery/${galleryId}:${image.id}`}
className={twMerge(
"relative block h-full w-full overflow-hidden border-5 border-white transition-colors hover:border-cardinal-red focus-visible:border-cardinal-red hocus:outline-none",
linkClasses
Expand Down