Files
pawol.nu/app/awtis/page.js
T

79 lines
2.4 KiB
JavaScript
Raw Normal View History

2023-07-22 13:11:56 +04:00
import {notFound} from 'next/navigation'
import Box from '@mui/material/Box'
import Container from '@mui/material/Container'
import Grid from '@mui/material/Grid'
2023-07-22 13:11:56 +04:00
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'
2023-07-23 10:28:43 +04:00
import Footer from '../../components/footer'
2023-07-22 13:11:56 +04:00
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.',
2026-05-12 16:43:39 +04:00
url: 'https://pawol.nu/sipote',
2024-06-01 20:23:46 +04:00
siteName: 'OKI | ORGANISATION KA INTERNATIONALE. Paroles et traductions.',
2023-07-22 13:11:56 +04:00
images: [
{
2026-05-12 16:43:39 +04:00
url: 'https://pawol.nu/logo-512x512.png',
2023-07-22 13:11:56 +04:00
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: {
2026-05-12 16:43:39 +04:00
url: 'https://pawol.nu/logo-512x512.png',
2023-07-22 13:11:56 +04:00
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()
}
2026-04-21 19:16:11 +04:00
const {data, meta} = await jwennAwtisPajinasyon(pajParsed)
const pajTotal = Math.ceil(meta.pagination.total / meta.pagination.limit)
2023-07-22 13:11:56 +04:00
if (pajParsed > pajTotal || pajParsed < 1) {
notFound()
}
2026-04-21 19:16:11 +04:00
return {pajTotal, awtisPouChakPaj: data, pajParsed}
2023-07-22 13:11:56 +04:00
}
2026-04-16 12:52:51 +04:00
export default async function AwitsPaj(props) {
const searchParams = await props.searchParams;
2023-07-22 13:11:56 +04:00
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}}>
2026-04-21 19:16:11 +04:00
{awtisPouChakPaj.map(artiste => <AwtisKat key={artiste.id} artiste={artiste} />)}
2023-07-22 13:11:56 +04:00
</Grid>
</Container>
2023-07-23 10:28:43 +04:00
<Footer />
2023-07-22 13:11:56 +04:00
</Box>
)
}