diff --git a/next/app/editions/page.js b/next/app/editions/page.js index 78abd54..64b3b27 100644 --- a/next/app/editions/page.js +++ b/next/app/editions/page.js @@ -1,24 +1,24 @@ -import getData from "@/api"; -import styles from "./style.module.scss"; -import EditionElement from "@/components/editionElement"; -import Empty from "@/components/empty"; -export const dynamic = "force-dynamic"; +import getData from '@/api'; +import EditionElement from '@/components/editionElement'; +import Empty from '@/components/empty'; +import styles from './style.module.scss'; +export const dynamic = 'force-dynamic'; export async function generateMetadata() { - const site = await getData("site", { - fields: ["description", "author"], + const site = await getData('site', { + fields: ['description', 'author'], }); - const data = await getData("editions", { + const data = await getData('editions', { populate: { gallery: { - fields: ["name", "url", "alternativeText"], + fields: ['name', 'url', 'alternativeText'], }, statistics: { - fields: ["name", "value"], + fields: ['name', 'value'], }, flyer: { - fields: ["name", "url", "alternativeText", "width", "height"], + fields: ['name', 'url', 'alternativeText', 'width', 'height'], }, }, }); @@ -27,13 +27,13 @@ export async function generateMetadata() { return site.data ? { metadataBase: `${process.env.NEXT_PUBLIC_ORIGIN}`, - title: "Editions précédentes — Le Fefan", + title: 'Editions précédentes — Le Fefan', description: site.data.attributes.description, alternates: { - canonical: "/editions", + canonical: '/editions', }, openGraph: { - title: "Editions précédentes — Le Fefan", + title: 'Editions précédentes — Le Fefan', url: `${process.env.NEXT_PUBLIC_ORIGIN}/prog/city-wide`, description: site.data.attributes.description, images: editions.map(({ attributes: attr }) => ({ @@ -43,41 +43,42 @@ export async function generateMetadata() { url: attr.flyer.data.attributes.url, })), authors: [site.data.attributes.author], - type: "website", - locale: "fr_FR", - siteName: "Le Fefan - Festival de Fanfares", + type: 'website', + locale: 'fr_FR', + siteName: 'Le Fefan - Festival de Fanfares', }, } : {}; } export default async function Editions() { - const site = await getData("site", { - fields: ["id"], + const site = await getData('site', { + fields: ['id'], populate: { edition: { - fields: ["id"], + fields: ['id'], }, }, }); - const data = await getData("editions", { + const data = await getData('editions', { populate: { gallery: { - fields: ["name", "url", "alternativeText"], + fields: ['name', 'url', 'alternativeText'], }, statistics: { - fields: ["name", "value"], + fields: ['name', 'value'], }, flyer: { - fields: ["name", "url", "alternativeText"], + fields: ['name', 'url', 'alternativeText'], }, - fields: ["movie"], + fields: ['movie'], }, + sort: ['title:desc'], }); const editions = (data.data ?? []).filter( - (e) => e.id !== site.data?.attributes.edition.data?.id + (e) => e.id !== site.data?.attributes.edition.data?.id, ); return ( @@ -86,24 +87,24 @@ export default async function Editions() { editions.map(({ id, attributes: attr }) => { const stats = attr.statistics.data.map(({ id, attributes }) => ({ id, - type: "stat", + type: 'stat', title: attributes.name, value: attributes.value, })); const images = attr.gallery.data.map(({ id, attributes }) => ({ id, - type: "image", + type: 'image', title: attributes.alternativeText, value: `${process.env.NEXT_PUBLIC_IMG_URI}${attributes.url}`, })); const movie = attr.movie ? [ { - id: "movie", - type: "video", + id: 'movie', + type: 'video', title: `Aftermovie ${attr.title}`, value: attr.movie, - mode: "thumbnail", + mode: 'thumbnail', }, ] : null;