78 lines
2.4 KiB
JavaScript
78 lines
2.4 KiB
JavaScript
import {notFound} from 'next/navigation'
|
|
import Box from '@mui/material/Box'
|
|
import Container from '@mui/material/Container'
|
|
import Grid from '@mui/material/Unstable_Grid2'
|
|
|
|
import ChecheAwtis from '../../components/awtis/cheche-awtis'
|
|
import AwtisKat from '../../components/awtis/awtis-kat'
|
|
import Pajinasyon from '../../components/awtis/pajinasyon'
|
|
|
|
import {jwennAwtisPajinasyon} from '../../lib/oki-api'
|
|
import Footer from '../../components/footer'
|
|
|
|
export const metadata = {
|
|
title: 'OKI | Awtis - Liste des artistes',
|
|
description: 'Liste des artistes ayant une ou plusieurs œuvres présentes sur le site.',
|
|
openGraph: {
|
|
title: 'OKI | Awtis - Liste des artistes',
|
|
description: 'Liste des artistes ayant une ou plusieurs œuvres présentes sur le site.',
|
|
url: 'https://oki.re/sipote',
|
|
siteName: 'OKI | ORGANISATION KA INTERNATIONALE. Paroles et traductions.',
|
|
images: [
|
|
{
|
|
url: 'https://oki.re/logo-512x512.png',
|
|
width: 512,
|
|
height: 512
|
|
}
|
|
],
|
|
locale: 'fr_FR',
|
|
type: 'website'
|
|
},
|
|
twitter: {
|
|
site: '@OrganisationKA',
|
|
card: 'summary_large_image',
|
|
title: 'OKI | Awtis - Liste des artistes',
|
|
description: 'Liste des artistes ayant une ou plusieurs œuvres présentes sur le site.',
|
|
creator: '@OrganisationKA',
|
|
images: {
|
|
url: 'https://oki.re/logo-512x512.png',
|
|
alt: 'OKI Logo',
|
|
}
|
|
}
|
|
}
|
|
|
|
async function jwennDone(paj) {
|
|
const pajParsed = Array.isArray(paj) ? Number.parseInt(paj[1], 10) : Number.parseInt(paj, 10)
|
|
|
|
if (Number.isNaN(pajParsed)) {
|
|
notFound()
|
|
}
|
|
|
|
const awtisPouChakPaj = await jwennAwtisPajinasyon(pajParsed)
|
|
const pajTotal = Math.ceil(awtisPouChakPaj.meta.pagination.total / awtisPouChakPaj.meta.pagination.limit)
|
|
|
|
if (pajParsed > pajTotal || pajParsed < 1) {
|
|
notFound()
|
|
}
|
|
|
|
return {pajTotal, awtisPouChakPaj, pajParsed}
|
|
}
|
|
|
|
export default async function AwitsPaj({searchParams}) {
|
|
const {paj} = searchParams
|
|
const {pajTotal, awtisPouChakPaj, pajParsed} = await jwennDone(paj || 1)
|
|
|
|
return (
|
|
<Box sx={{display: 'flex', flexDirection: 'column', minHeight: '100vh'}}>
|
|
<Pajinasyon pajTotal={pajTotal} paj={pajParsed} />
|
|
<ChecheAwtis />
|
|
<Container sx={{marginBottom: 5, flexGrow: 100}}>
|
|
<Grid container spacing={{xs: 2, md: 3}}>
|
|
{awtisPouChakPaj.data.map(artiste => <AwtisKat key={artiste.id} artiste={artiste.attributes} />)}
|
|
</Grid>
|
|
</Container>
|
|
<Footer />
|
|
</Box>
|
|
)
|
|
}
|