From ca9ba4cb10b7682d2d2144a3af20614e30319140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Mon, 8 Jun 2026 21:46:18 +0400 Subject: [PATCH] feat: add AnVedette component --- app/page.js | 10 +++--- components/akey/an-vedette.js | 67 +++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 components/akey/an-vedette.js diff --git a/app/page.js b/app/page.js index 261451d..2695830 100644 --- a/app/page.js +++ b/app/page.js @@ -1,32 +1,34 @@ import Box from '@mui/material/Box' import Container from '@mui/material/Container' import {notFound} from 'next/navigation' -import {jwennStats} from '../lib/oki-api' +import {jwennStats, jwennDenyeTeks} from '../lib/oki-api' import Statistik from '../components/akey/statistik' import Akey from '../components/akey' +import AnVedette from '../components/akey/an-vedette' import okiLogo from '../public/logo-512x512.png' import Footer from '../components/footer' import Aso from '../components/akey/aso' async function jwennDone() { - const statistik = await jwennStats() + const [statistik, denyeTeks] = await Promise.all([jwennStats(), jwennDenyeTeks()]) if (!statistik) { notFound() } - return statistik + return {statistik, dernierTeks: denyeTeks?.[0]} } export default async function Page() { - const statistik = await jwennDone() + const {statistik, dernierTeks} = await jwennDone() return ( + {dernierTeks && } diff --git a/components/akey/an-vedette.js b/components/akey/an-vedette.js new file mode 100644 index 0000000..e850472 --- /dev/null +++ b/components/akey/an-vedette.js @@ -0,0 +1,67 @@ +'use client' + +import PropTypes from 'prop-types' +import Card from '@mui/material/Card' +import CardActionArea from '@mui/material/CardActionArea' +import CardContent from '@mui/material/CardContent' +import CardMedia from '@mui/material/CardMedia' +import Typography from '@mui/material/Typography' +import Box from '@mui/material/Box' +import Chip from '@mui/material/Chip' +import Link from 'next/link' + +import {getAlias} from '../../lib/utils/format' +import {formatKuveti} from '../../lib/kuveti' + +const IMAGE_URL = process.env.NEXT_PUBLIC_API_URL_ROOT || 'http://localhost:1337' +const noImageUrl = 'https://place-hold.it/600x600?text=Indisponible' + +export default function AnVedette({teks}) { + const {titre, artistes, annee, couverture, slug} = teks + const aliases = getAlias(artistes, teks.prioriteArtistes) + const fmt = formatKuveti(couverture) + const imageUrl = fmt?.url ? `${IMAGE_URL}${fmt.url}` : noImageUrl + + return ( + + + + + + + + {titre} + + + {aliases} + + {annee && ( + + {annee} + + )} + + + + + ) +} + +AnVedette.propTypes = { + teks: PropTypes.object.isRequired +}