Skip to content

Commit

Permalink
Adjusted interception routes to be colon delimited string (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish authored Nov 26, 2024
1 parent 0750f60 commit 0b8f996
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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

0 comments on commit 0b8f996

Please sign in to comment.