fix: update dynamic routes for Next.js 16 async params API
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
This commit is contained in:
parent
e68486ddd2
commit
d4f6f60df6
8 changed files with 36 additions and 25 deletions
|
|
@ -6,7 +6,7 @@ import { VERTICALS } from "@/config/verticals"
|
||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
params: { vertical: string }
|
params: Promise<{ vertical: string }>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateStaticParams() {
|
export function generateStaticParams() {
|
||||||
|
|
@ -19,8 +19,9 @@ export function generateStaticParams() {
|
||||||
const currentYear = new Date().getFullYear()
|
const currentYear = new Date().getFullYear()
|
||||||
const years = Array.from({ length: 50 }, (_, i) => currentYear - i)
|
const years = Array.from({ length: 50 }, (_, i) => currentYear - i)
|
||||||
|
|
||||||
export default function VerticalArchivePage({ params }: Props) {
|
export default async function VerticalArchivePage({ params }: Props) {
|
||||||
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
|
const { vertical: verticalSlug } = await params
|
||||||
|
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
|
||||||
|
|
||||||
if (!vertical) {
|
if (!vertical) {
|
||||||
notFound()
|
notFound()
|
||||||
|
|
@ -32,7 +33,7 @@ export default function VerticalArchivePage({ params }: Props) {
|
||||||
<p className="text-muted-foreground">Browse shows by year.</p>
|
<p className="text-muted-foreground">Browse shows by year.</p>
|
||||||
<div className="grid gap-4 md:grid-cols-3 lg:grid-cols-4">
|
<div className="grid gap-4 md:grid-cols-3 lg:grid-cols-4">
|
||||||
{years.map((year) => (
|
{years.map((year) => (
|
||||||
<Link key={year} href={`/${params.vertical}/shows?year=${year}`}>
|
<Link key={year} href={`/${verticalSlug}/shows?year=${year}`}>
|
||||||
<Card className="hover:bg-accent/50 transition-colors cursor-pointer text-center py-6">
|
<Card className="hover:bg-accent/50 transition-colors cursor-pointer text-center py-6">
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="text-4xl font-bold text-primary">{year}</div>
|
<div className="text-4xl font-bold text-primary">{year}</div>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { notFound } from "next/navigation"
|
||||||
import { VERTICALS } from "@/config/verticals"
|
import { VERTICALS } from "@/config/verticals"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
params: { vertical: string }
|
params: Promise<{ vertical: string }>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateStaticParams() {
|
export function generateStaticParams() {
|
||||||
|
|
@ -11,8 +11,9 @@ export function generateStaticParams() {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function VerticalPage({ params }: Props) {
|
export default async function VerticalPage({ params }: Props) {
|
||||||
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
|
const { vertical: verticalSlug } = await params
|
||||||
|
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
|
||||||
|
|
||||||
if (!vertical) {
|
if (!vertical) {
|
||||||
notFound()
|
notFound()
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { notFound } from "next/navigation"
|
||||||
import { getApiUrl } from "@/lib/api-config"
|
import { getApiUrl } from "@/lib/api-config"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
params: { vertical: string }
|
params: Promise<{ vertical: string }>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateStaticParams() {
|
export function generateStaticParams() {
|
||||||
|
|
@ -25,7 +25,8 @@ async function getShows(verticalSlug: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function ShowsPage({ params }: Props) {
|
export default async function ShowsPage({ params }: Props) {
|
||||||
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
|
const { vertical: verticalSlug } = await params
|
||||||
|
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
|
||||||
|
|
||||||
if (!vertical) {
|
if (!vertical) {
|
||||||
notFound()
|
notFound()
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { notFound } from "next/navigation"
|
||||||
import { getApiUrl } from "@/lib/api-config"
|
import { getApiUrl } from "@/lib/api-config"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
params: { vertical: string }
|
params: Promise<{ vertical: string }>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateStaticParams() {
|
export function generateStaticParams() {
|
||||||
|
|
@ -25,7 +25,8 @@ async function getSongs(verticalSlug: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function SongsPage({ params }: Props) {
|
export default async function SongsPage({ params }: Props) {
|
||||||
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
|
const { vertical: verticalSlug } = await params
|
||||||
|
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
|
||||||
|
|
||||||
if (!vertical) {
|
if (!vertical) {
|
||||||
notFound()
|
notFound()
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { notFound } from "next/navigation"
|
||||||
import { getApiUrl } from "@/lib/api-config"
|
import { getApiUrl } from "@/lib/api-config"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
params: { vertical: string }
|
params: Promise<{ vertical: string }>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateStaticParams() {
|
export function generateStaticParams() {
|
||||||
|
|
@ -25,7 +25,8 @@ async function getVenues(verticalSlug: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function VenuesPage({ params }: Props) {
|
export default async function VenuesPage({ params }: Props) {
|
||||||
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
|
const { vertical: verticalSlug } = await params
|
||||||
|
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
|
||||||
|
|
||||||
if (!vertical) {
|
if (!vertical) {
|
||||||
notFound()
|
notFound()
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ import { Separator } from "@/components/ui/separator"
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
|
|
||||||
interface ArtistPageProps {
|
interface ArtistPageProps {
|
||||||
params: {
|
params: Promise<{
|
||||||
slug: string
|
slug: string
|
||||||
}
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getArtist(slug: string) {
|
async function getArtist(slug: string) {
|
||||||
|
|
@ -26,7 +26,8 @@ async function getArtist(slug: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateMetadata({ params }: ArtistPageProps): Promise<Metadata> {
|
export async function generateMetadata({ params }: ArtistPageProps): Promise<Metadata> {
|
||||||
const data = await getArtist(params.slug)
|
const { slug } = await params
|
||||||
|
const data = await getArtist(slug)
|
||||||
if (!data) return { title: "Artist Not Found" }
|
if (!data) return { title: "Artist Not Found" }
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -36,7 +37,8 @@ export async function generateMetadata({ params }: ArtistPageProps): Promise<Met
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function ArtistPage({ params }: ArtistPageProps) {
|
export default async function ArtistPage({ params }: ArtistPageProps) {
|
||||||
const data = await getArtist(params.slug)
|
const { slug } = await params
|
||||||
|
const data = await getArtist(slug)
|
||||||
if (!data) return notFound()
|
if (!data) return notFound()
|
||||||
|
|
||||||
const { artist, covers, guest_appearances } = data
|
const { artist, covers, guest_appearances } = data
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ import Link from "next/link"
|
||||||
import { Music, Calendar, MapPin, Users, ExternalLink, Globe } from "lucide-react"
|
import { Music, Calendar, MapPin, Users, ExternalLink, Globe } from "lucide-react"
|
||||||
|
|
||||||
interface BandPageProps {
|
interface BandPageProps {
|
||||||
params: {
|
params: Promise<{
|
||||||
slug: string
|
slug: string
|
||||||
}
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getBand(slug: string) {
|
async function getBand(slug: string) {
|
||||||
|
|
@ -27,7 +27,8 @@ async function getBand(slug: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateMetadata({ params }: BandPageProps): Promise<Metadata> {
|
export async function generateMetadata({ params }: BandPageProps): Promise<Metadata> {
|
||||||
const data = await getBand(params.slug)
|
const { slug } = await params
|
||||||
|
const data = await getBand(slug)
|
||||||
if (!data) return { title: "Band Not Found" }
|
if (!data) return { title: "Band Not Found" }
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -37,7 +38,8 @@ export async function generateMetadata({ params }: BandPageProps): Promise<Metad
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function BandPage({ params }: BandPageProps) {
|
export default async function BandPage({ params }: BandPageProps) {
|
||||||
const data = await getBand(params.slug)
|
const { slug } = await params
|
||||||
|
const data = await getBand(slug)
|
||||||
if (!data) return notFound()
|
if (!data) return notFound()
|
||||||
|
|
||||||
const { band, current_members, past_members, stats } = data
|
const { band, current_members, past_members, stats } = data
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ import Link from "next/link"
|
||||||
import { Music, Calendar, MapPin, Users, ExternalLink, Globe, Instagram } from "lucide-react"
|
import { Music, Calendar, MapPin, Users, ExternalLink, Globe, Instagram } from "lucide-react"
|
||||||
|
|
||||||
interface MusicianPageProps {
|
interface MusicianPageProps {
|
||||||
params: {
|
params: Promise<{
|
||||||
slug: string
|
slug: string
|
||||||
}
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getMusician(slug: string) {
|
async function getMusician(slug: string) {
|
||||||
|
|
@ -26,7 +26,8 @@ async function getMusician(slug: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateMetadata({ params }: MusicianPageProps): Promise<Metadata> {
|
export async function generateMetadata({ params }: MusicianPageProps): Promise<Metadata> {
|
||||||
const data = await getMusician(params.slug)
|
const { slug } = await params
|
||||||
|
const data = await getMusician(slug)
|
||||||
if (!data) return { title: "Musician Not Found" }
|
if (!data) return { title: "Musician Not Found" }
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -36,7 +37,8 @@ export async function generateMetadata({ params }: MusicianPageProps): Promise<M
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function MusicianPage({ params }: MusicianPageProps) {
|
export default async function MusicianPage({ params }: MusicianPageProps) {
|
||||||
const data = await getMusician(params.slug)
|
const { slug } = await params
|
||||||
|
const data = await getMusician(slug)
|
||||||
if (!data) return notFound()
|
if (!data) return notFound()
|
||||||
|
|
||||||
const { musician, bands, guest_appearances, sit_in_summary, stats } = data
|
const { musician, bands, guest_appearances, sit_in_summary, stats } = data
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue