2023-07-22 13:36:33 +04:00
|
|
|
'use client'
|
|
|
|
|
|
2022-05-11 03:08:35 +04:00
|
|
|
import {useState} from 'react'
|
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'
|
2026-06-20 18:37:43 +04:00
|
|
|
import CardMedia from '@mui/material/CardMedia'
|
2023-07-22 13:36:33 +04:00
|
|
|
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 Avatar from '@mui/material/Avatar'
|
|
|
|
|
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 12:56:29 +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'
|
|
|
|
|
const noImageUrl = 'https://place-hold.it/140x140?text=Indisponible'
|
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
|
|
|
|
2026-06-20 18:37:43 +04:00
|
|
|
function StreamButton({lyen}) {
|
|
|
|
|
const config = PLATFORM_CONFIG[lyen.plateforme] || {label: lyen.plateforme, bg: '#555', color: '#fff', Icon: null}
|
|
|
|
|
const PlatformIcon = config.Icon
|
|
|
|
|
return (
|
|
|
|
|
<Button
|
|
|
|
|
href={lyen.url}
|
|
|
|
|
target='_blank'
|
|
|
|
|
rel='noopener noreferrer'
|
|
|
|
|
size='small'
|
|
|
|
|
startIcon={PlatformIcon ? <PlatformIcon size={16} color={config.color} /> : null}
|
|
|
|
|
endIcon={<OpenInNewIcon sx={{fontSize: 11}} />}
|
|
|
|
|
sx={{
|
|
|
|
|
bgcolor: config.bg,
|
|
|
|
|
color: config.color,
|
|
|
|
|
fontWeight: 700,
|
|
|
|
|
fontSize: '0.72rem',
|
|
|
|
|
textTransform: 'none',
|
|
|
|
|
'&:hover': {bgcolor: config.bg, opacity: 0.85},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{config.label}
|
|
|
|
|
</Button>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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}}>
|
2022-05-11 03:08:35 +04:00
|
|
|
<Avatar
|
2026-06-08 01:25:58 +04:00
|
|
|
src={photo?.url ? `${IMAGE_URL}${photo?.formats?.small?.url || photo?.formats?.thumbnail?.url || photo?.url}` : noImageUrl}
|
2022-05-11 03:08:35 +04:00
|
|
|
alt={`Photo ${alias}`}
|
|
|
|
|
sx={{width: 200, height: 200, border: `2px solid ${green[500]}`}}
|
|
|
|
|
/>
|
|
|
|
|
</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'}}>
|
|
|
|
|
Paroles publiées en exclusivité sur PAWÒL-NU, avant toute sortie sur les plateformes de streaming.
|
|
|
|
|
</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}}>
|
|
|
|
|
<CardMedia
|
|
|
|
|
component='img'
|
|
|
|
|
image={coverUrl}
|
|
|
|
|
alt={titrePhare.titre}
|
|
|
|
|
sx={{height: '100%', minHeight: 140, objectFit: 'cover'}}
|
|
|
|
|
/>
|
|
|
|
|
</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) => (
|
|
|
|
|
<StreamButton key={i} lyen={lyen} />
|
|
|
|
|
))}
|
|
|
|
|
</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
|
|
|
|
|
}
|