2023-07-22 13:36:33 +04:00
|
|
|
'use client'
|
|
|
|
|
|
2022-05-11 03:08:35 +04:00
|
|
|
import {useState} from 'react'
|
2026-06-22 18:51:57 +04:00
|
|
|
import Image from 'next/image'
|
2023-07-22 13:36:33 +04:00
|
|
|
import Link from 'next/link'
|
2022-05-11 03:08:35 +04:00
|
|
|
import PropTypes from 'prop-types'
|
2023-07-22 13:36:33 +04:00
|
|
|
import Accordion from '@mui/material/Accordion'
|
|
|
|
|
import AccordionDetails from '@mui/material/AccordionDetails'
|
|
|
|
|
import AccordionSummary from '@mui/material/AccordionSummary'
|
|
|
|
|
import Box from '@mui/material/Box'
|
|
|
|
|
import Button from '@mui/material/Button'
|
|
|
|
|
import CardActionArea from '@mui/material/CardActionArea'
|
|
|
|
|
import Chip from '@mui/material/Chip'
|
|
|
|
|
import Container from '@mui/material/Container'
|
2026-04-21 19:31:26 +04:00
|
|
|
import Grid from '@mui/material/Grid'
|
2023-07-22 13:36:33 +04:00
|
|
|
import Paper from '@mui/material/Paper'
|
2022-05-11 03:08:35 +04:00
|
|
|
import Card from '@mui/material/Card'
|
|
|
|
|
import CardContent from '@mui/material/CardContent'
|
|
|
|
|
import Typography from '@mui/material/Typography'
|
|
|
|
|
import {green} from '@mui/material/colors'
|
|
|
|
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
|
|
|
|
|
import KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace'
|
2026-06-20 06:09:24 +04:00
|
|
|
import VerifiedIcon from '@mui/icons-material/Verified'
|
|
|
|
|
|
2023-07-22 13:45:08 +04:00
|
|
|
import {formatKuveti} from '../../lib/kuveti'
|
2026-06-22 18:51:57 +04:00
|
|
|
import {StreamButton} from '../streaming-buttons'
|
2022-05-11 03:08:35 +04:00
|
|
|
import AwtisBiyografi from './awtis-biyografi'
|
2023-07-22 13:45:08 +04:00
|
|
|
import MizikLyen from './mizik-lyen'
|
2022-05-11 03:08:35 +04:00
|
|
|
|
2022-05-20 02:18:16 +04:00
|
|
|
const IMAGE_URL = process.env.NEXT_PUBLIC_API_URL_ROOT || 'http://localhost:1337'
|
2026-06-22 18:51:57 +04:00
|
|
|
const BLUR_DATA_URL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNsYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
|
2022-05-11 03:08:35 +04:00
|
|
|
|
2026-04-21 19:16:11 +04:00
|
|
|
const sortTeks = paroles => paroles.sort((a, b) => a.titre.localeCompare(b.titre, 'fr', {sensitivity: 'base'}))
|
2022-05-11 03:08:35 +04:00
|
|
|
|
|
|
|
|
export default function AwtisDetay({anAwtis}) {
|
|
|
|
|
const [esByografiOuve, meteEsByografiOuve] = useState(false)
|
2026-06-20 18:37:43 +04:00
|
|
|
const {alias, biographie, paroles, photo, isOKIAwtis, titrePhare} = anAwtis
|
2026-04-21 19:16:11 +04:00
|
|
|
const sortedTeks = sortTeks(paroles)
|
2022-05-20 02:18:16 +04:00
|
|
|
const gwanBiyo = biographie && biographie.length > 100
|
|
|
|
|
const biyo = gwanBiyo ? `${biographie.slice(0, 100)}...` : biographie
|
2022-05-11 03:08:35 +04:00
|
|
|
|
2026-06-20 18:37:43 +04:00
|
|
|
const hasStreaming = isOKIAwtis && titrePhare?.streamAudio?.length > 0
|
|
|
|
|
const coverUrl = titrePhare?.couverture
|
|
|
|
|
? `${IMAGE_URL}${titrePhare.couverture.formats?.small?.url || titrePhare.couverture.formats?.thumbnail?.url || titrePhare.couverture.url}`
|
|
|
|
|
: null
|
2022-05-11 03:08:35 +04:00
|
|
|
|
2026-06-22 18:51:57 +04:00
|
|
|
const photoUrl = photo?.url
|
|
|
|
|
? `${IMAGE_URL}${photo.formats?.small?.url || photo.formats?.thumbnail?.url || photo.url}`
|
|
|
|
|
: null
|
|
|
|
|
|
2022-05-11 03:08:35 +04:00
|
|
|
return (
|
|
|
|
|
<Container>
|
2026-06-20 18:37:43 +04:00
|
|
|
<Box sx={{mt: 8, mb: 2}}>
|
2026-04-21 19:31:26 +04:00
|
|
|
<Typography sx={{textAlign: 'center'}} variant='h6' component='h1'>
|
2022-05-11 03:08:35 +04:00
|
|
|
{alias}
|
|
|
|
|
</Typography>
|
|
|
|
|
</Box>
|
2026-06-20 18:37:43 +04:00
|
|
|
|
|
|
|
|
<Box sx={{display: 'flex', justifyContent: 'center', mb: 2}}>
|
2026-06-22 18:51:57 +04:00
|
|
|
<Box sx={{
|
|
|
|
|
width: 200, height: 200,
|
|
|
|
|
borderRadius: '50%',
|
|
|
|
|
border: `2px solid ${green[500]}`,
|
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
position: 'relative',
|
|
|
|
|
flexShrink: 0,
|
|
|
|
|
}}>
|
|
|
|
|
{photoUrl ? (
|
|
|
|
|
<Image
|
|
|
|
|
src={photoUrl}
|
|
|
|
|
alt={`Photo ${alias}`}
|
|
|
|
|
width={200}
|
|
|
|
|
height={200}
|
|
|
|
|
placeholder='blur'
|
|
|
|
|
blurDataURL={BLUR_DATA_URL}
|
|
|
|
|
style={{objectFit: 'cover', width: '100%', height: '100%'}}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<Box sx={{width: '100%', height: '100%', bgcolor: 'grey.300'}} />
|
|
|
|
|
)}
|
|
|
|
|
</Box>
|
2022-05-11 03:08:35 +04:00
|
|
|
</Box>
|
2026-06-20 18:37:43 +04:00
|
|
|
|
2026-06-20 06:09:24 +04:00
|
|
|
{isOKIAwtis && (
|
|
|
|
|
<Box sx={{display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 0.75, mb: 2}}>
|
|
|
|
|
<Chip
|
|
|
|
|
icon={<VerifiedIcon sx={{fontSize: 16}} />}
|
|
|
|
|
label='Artiste OKI Exclusif'
|
|
|
|
|
size='small'
|
|
|
|
|
sx={{bgcolor: '#FFD700', color: '#000', fontWeight: 700, '& .MuiChip-icon': {color: '#000'}}}
|
|
|
|
|
/>
|
|
|
|
|
<Typography variant='caption' sx={{color: 'text.secondary', textAlign: 'center'}}>
|
2026-06-22 18:51:57 +04:00
|
|
|
Paroles publiées en exclusivité sur PAWÒL-NU, avant toute sortie sur les plateformes de streaming.
|
2026-06-20 06:09:24 +04:00
|
|
|
</Typography>
|
|
|
|
|
</Box>
|
|
|
|
|
)}
|
2026-06-20 18:37:43 +04:00
|
|
|
|
|
|
|
|
<Grid sx={{alignItems: 'center'}} container direction='column' spacing={3}>
|
2022-05-11 03:08:35 +04:00
|
|
|
{biyo && (
|
2024-10-21 10:06:16 +04:00
|
|
|
<Grid size={{xs: 12, md: 6}}>
|
2022-05-11 03:08:35 +04:00
|
|
|
<Card sx={{minWidth: 300}}>
|
2026-06-20 18:37:43 +04:00
|
|
|
<CardActionArea onClick={() => meteEsByografiOuve(true)}>
|
2022-05-11 03:08:35 +04:00
|
|
|
<CardContent>
|
|
|
|
|
<Typography gutterBottom variant='body1' component='h2'>
|
|
|
|
|
<strong>Biographie</strong>
|
|
|
|
|
</Typography>
|
2026-04-21 19:31:26 +04:00
|
|
|
<Typography textalign='justify' variant='subtitle1' component='h3'>
|
2022-05-11 03:08:35 +04:00
|
|
|
{biyo}
|
|
|
|
|
</Typography>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</CardActionArea>
|
|
|
|
|
</Card>
|
|
|
|
|
</Grid>
|
|
|
|
|
)}
|
2026-06-20 18:37:43 +04:00
|
|
|
{hasStreaming && (
|
|
|
|
|
<Grid size={{xs: 12, md: 6}}>
|
|
|
|
|
<Card sx={{overflow: 'hidden'}}>
|
|
|
|
|
<Grid container>
|
|
|
|
|
{coverUrl && (
|
|
|
|
|
<Grid size={{xs: 12, sm: 4}}>
|
2026-06-22 18:51:57 +04:00
|
|
|
<Box sx={{position: 'relative', minHeight: 140, height: '100%'}}>
|
|
|
|
|
<Image
|
|
|
|
|
src={coverUrl}
|
|
|
|
|
alt={titrePhare.titre}
|
|
|
|
|
fill
|
|
|
|
|
placeholder='blur'
|
|
|
|
|
blurDataURL={BLUR_DATA_URL}
|
|
|
|
|
sizes='200px'
|
|
|
|
|
style={{objectFit: 'cover'}}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
2026-06-20 18:37:43 +04:00
|
|
|
</Grid>
|
|
|
|
|
)}
|
|
|
|
|
<Grid size={{xs: 12, sm: coverUrl ? 8 : 12}}>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<Typography variant='subtitle1' sx={{fontWeight: 700}} gutterBottom>
|
|
|
|
|
{titrePhare.titre}
|
|
|
|
|
</Typography>
|
|
|
|
|
<Typography variant='caption' sx={{color: 'text.secondary', display: 'block', mb: 1.5}}>
|
|
|
|
|
Écouter sur
|
|
|
|
|
</Typography>
|
|
|
|
|
<Box sx={{display: 'flex', flexWrap: 'wrap', gap: 1}}>
|
|
|
|
|
{titrePhare.streamAudio.map((lyen, i) => (
|
2026-06-22 18:51:57 +04:00
|
|
|
<StreamButton key={i} lyen={lyen} />
|
2026-06-20 18:37:43 +04:00
|
|
|
))}
|
|
|
|
|
</Box>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Card>
|
|
|
|
|
</Grid>
|
|
|
|
|
)}
|
2024-10-21 10:06:16 +04:00
|
|
|
<Grid size={{xs: 12, md: 6}}>
|
2026-04-21 19:31:26 +04:00
|
|
|
<Box marginbottom={3}>
|
2026-04-21 19:31:42 +04:00
|
|
|
{paroles.length > 1 ? (
|
2022-05-11 03:08:35 +04:00
|
|
|
<Accordion>
|
|
|
|
|
<AccordionSummary
|
|
|
|
|
expandIcon={<ExpandMoreIcon />}
|
|
|
|
|
aria-controls='panel-teks-content'
|
|
|
|
|
id='panel-teks-header'
|
|
|
|
|
>
|
2026-06-20 18:37:43 +04:00
|
|
|
<Typography sx={{marginRight: 2, textAlign: 'center'}} variant='body1' component='h2'><strong>Liste des paroles</strong></Typography>
|
2026-04-21 19:31:42 +04:00
|
|
|
<Chip color='primary' label={paroles.length} size='small' variant='contained' />
|
2022-05-11 03:08:35 +04:00
|
|
|
</AccordionSummary>
|
2023-07-22 13:45:08 +04:00
|
|
|
<AccordionDetails sx={{paddingInline: 0}}>
|
|
|
|
|
{sortedTeks.map(anPawol => {
|
2026-04-21 19:31:42 +04:00
|
|
|
const {couverture} = anPawol
|
2026-06-08 01:25:58 +04:00
|
|
|
const kuvetiFormat = couverture?.formats?.thumbnail || formatKuveti(couverture)
|
2023-07-22 13:45:08 +04:00
|
|
|
return (
|
|
|
|
|
<Box key={anPawol.id} sx={{paddingBlock: 0.5}}>
|
|
|
|
|
<MizikLyen anPawol={anPawol} kuveti={kuvetiFormat} />
|
|
|
|
|
</Box>
|
|
|
|
|
)
|
|
|
|
|
})}
|
2022-05-11 03:08:35 +04:00
|
|
|
</AccordionDetails>
|
|
|
|
|
</Accordion>
|
|
|
|
|
) : (
|
2026-04-21 19:16:11 +04:00
|
|
|
paroles.length === 0 ? (
|
2023-03-19 21:35:33 +04:00
|
|
|
<Typography gutterBottom textAlign='center' variant='body1' component='h2'><strong>Aucune parole pour le moment</strong></Typography>
|
|
|
|
|
) : (
|
2023-07-22 13:45:08 +04:00
|
|
|
<Box>
|
2026-04-21 19:31:26 +04:00
|
|
|
<Typography gutterBottom textalign='center' variant='body1' component='h2'><strong>Parole</strong></Typography>
|
2023-07-22 13:45:08 +04:00
|
|
|
<Paper sx={{height: '100%', paddingBlock: 2}}>
|
2026-06-08 01:25:58 +04:00
|
|
|
<MizikLyen anPawol={paroles[0]} kuveti={paroles[0].couverture?.formats?.thumbnail || formatKuveti(paroles[0].couverture)} />
|
2023-03-19 21:35:33 +04:00
|
|
|
</Paper>
|
2023-07-22 13:45:08 +04:00
|
|
|
</Box>
|
2023-03-19 21:35:33 +04:00
|
|
|
)
|
2022-05-11 03:08:35 +04:00
|
|
|
)}
|
|
|
|
|
</Box>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
2026-06-20 18:37:43 +04:00
|
|
|
|
|
|
|
|
<Box sx={{textAlign: 'center', marginBlock: 3}}>
|
2023-07-22 13:45:08 +04:00
|
|
|
<Link passHref href='/awtis'>
|
|
|
|
|
<Button variant='outlined' startIcon={<KeyboardBackspaceIcon />}>
|
|
|
|
|
Retour aux artistes
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2022-05-11 10:59:18 +04:00
|
|
|
</Box>
|
2026-06-20 18:37:43 +04:00
|
|
|
|
2022-05-11 03:08:35 +04:00
|
|
|
{esByografiOuve && (
|
|
|
|
|
<AwtisBiyografi
|
|
|
|
|
alias={alias}
|
2026-04-21 19:16:11 +04:00
|
|
|
paroles={paroles}
|
2022-05-20 02:18:16 +04:00
|
|
|
biographie={biographie}
|
2022-05-11 03:08:35 +04:00
|
|
|
esByografiOuve={esByografiOuve}
|
|
|
|
|
meteEsByografiOuve={meteEsByografiOuve}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</Container>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AwtisDetay.propTypes = {
|
|
|
|
|
anAwtis: PropTypes.object.isRequired
|
|
|
|
|
}
|