2023-07-22 13:36:33 +04:00
|
|
|
'use client'
|
|
|
|
|
|
|
|
|
|
import {useEffect} from 'react'
|
2022-01-24 21:06:52 +04:00
|
|
|
import PropTypes from 'prop-types'
|
2023-07-22 13:36:33 +04:00
|
|
|
import Box from '@mui/material/Box'
|
2026-04-21 19:31:26 +04:00
|
|
|
import Grid from '@mui/material/Grid'
|
2023-07-22 13:36:33 +04:00
|
|
|
import Typography from '@mui/material/Typography'
|
|
|
|
|
import Tooltip from '@mui/material/Tooltip'
|
|
|
|
|
import {useMediaQuery} from '@mui/material'
|
2023-07-30 00:26:54 +04:00
|
|
|
import Link from 'next/link'
|
|
|
|
|
import slugify from 'slugify'
|
2023-07-22 13:36:33 +04:00
|
|
|
|
2022-01-24 21:06:52 +04:00
|
|
|
import {styled} from '@mui/material/styles'
|
|
|
|
|
import ExplicitIcon from '@mui/icons-material/Explicit'
|
|
|
|
|
|
2026-06-08 01:19:30 +04:00
|
|
|
import Image from 'next/image'
|
|
|
|
|
|
2022-05-22 00:17:28 +04:00
|
|
|
import {formatJsonString, getAlias} from '../../lib/utils/format'
|
2026-06-08 01:19:30 +04:00
|
|
|
import {formatKuveti} from '../../lib/kuveti'
|
2022-01-24 21:06:52 +04:00
|
|
|
|
2024-04-14 07:06:31 +04:00
|
|
|
import LicenseModal from '../cc/license-modal'
|
2024-04-17 06:58:50 +04:00
|
|
|
import FilesDialog from '../files/files-dialog'
|
2026-06-22 13:12:14 +04:00
|
|
|
import {StreamButtonComponent} from '../streaming-buttons'
|
2022-01-24 21:06:52 +04:00
|
|
|
import EntegreMizik from './entegre-mizik'
|
|
|
|
|
import OkiMizik from './oki-mizik'
|
2022-12-12 22:31:05 +04:00
|
|
|
import DiferansDialog from './diferans-dialog'
|
2022-01-24 21:06:52 +04:00
|
|
|
|
2026-06-08 01:19:30 +04:00
|
|
|
const IMAGE_URL = process.env.NEXT_PUBLIC_API_URL_ROOT || 'http://localhost:1337'
|
|
|
|
|
|
2022-01-24 21:06:52 +04:00
|
|
|
const PREFIX = 'teks'
|
|
|
|
|
|
|
|
|
|
const classes = {
|
2023-07-22 13:56:18 +04:00
|
|
|
container: `${PREFIX}-container`,
|
2022-01-24 21:06:52 +04:00
|
|
|
tooltip: `${PREFIX}-tooltip`,
|
|
|
|
|
text: `${PREFIX}-text`,
|
|
|
|
|
gridText: `${PREFIX}-gridText`,
|
|
|
|
|
grid: `${PREFIX}-grid`,
|
|
|
|
|
koute: `${PREFIX}-koute`,
|
|
|
|
|
vwe: `${PREFIX}-vwe`,
|
2023-07-30 00:26:54 +04:00
|
|
|
pataje: `${PREFIX}-pataje`,
|
|
|
|
|
separation: `${PREFIX}-separation`
|
2022-01-24 21:06:52 +04:00
|
|
|
}
|
|
|
|
|
|
2023-07-30 00:26:54 +04:00
|
|
|
const Root = styled('div')((
|
|
|
|
|
{
|
|
|
|
|
theme
|
|
|
|
|
}
|
|
|
|
|
) => ({
|
2023-07-22 13:56:18 +04:00
|
|
|
[`&.${classes.container}`]: {
|
|
|
|
|
marginTop: '3em',
|
2022-01-24 21:06:52 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`& .${classes.gridText}`]: {
|
|
|
|
|
border: '2px solid grey',
|
|
|
|
|
borderRadius: '5px',
|
|
|
|
|
marginTop: '2em',
|
|
|
|
|
padding: '1em'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`& .${classes.pataje}`]: {
|
2023-07-22 13:56:18 +04:00
|
|
|
position: 'absolute',
|
|
|
|
|
zIndex: 9999
|
2023-07-22 23:39:16 +04:00
|
|
|
},
|
|
|
|
|
|
2023-07-30 00:26:54 +04:00
|
|
|
[`& .${classes.separation}`]: {
|
|
|
|
|
color: 'black',
|
2024-10-21 15:22:39 +04:00
|
|
|
...theme.applyStyles('dark', {
|
2023-07-30 00:26:54 +04:00
|
|
|
color: 'white'
|
2024-10-21 15:22:39 +04:00
|
|
|
})
|
2023-07-30 00:26:54 +04:00
|
|
|
},
|
|
|
|
|
|
2023-07-22 23:39:16 +04:00
|
|
|
'@media (max-width: 600px)': {
|
|
|
|
|
marginLeft: '0',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'@media (min-width: 600px)': {
|
|
|
|
|
marginLeft: '240px',
|
|
|
|
|
},
|
2022-01-24 21:06:52 +04:00
|
|
|
}))
|
|
|
|
|
|
2026-06-12 14:14:29 +04:00
|
|
|
const LANG_NAMES = {fr: 'Français', en: 'English', es: 'Español', de: 'Deutsch', it: 'Italiano'}
|
|
|
|
|
|
2022-05-20 02:15:56 +04:00
|
|
|
const langToArray = parole => {
|
2022-01-24 21:06:52 +04:00
|
|
|
const langArray = []
|
|
|
|
|
|
2022-05-20 02:15:56 +04:00
|
|
|
if (parole && parole.traductions) {
|
|
|
|
|
const {francais, anglais, espagnol, allemand, italien} = parole.traductions
|
2022-01-24 21:06:52 +04:00
|
|
|
|
2022-05-20 02:15:56 +04:00
|
|
|
if (anglais) {
|
2026-06-12 14:14:29 +04:00
|
|
|
langArray.push({title: 'English', lang: anglais})
|
2022-01-24 21:06:52 +04:00
|
|
|
}
|
|
|
|
|
|
2026-06-11 17:56:01 +04:00
|
|
|
if (francais) {
|
2026-06-12 14:14:29 +04:00
|
|
|
langArray.push({title: 'Français', lang: francais})
|
2026-06-11 17:56:01 +04:00
|
|
|
}
|
|
|
|
|
|
2022-01-24 21:06:52 +04:00
|
|
|
if (espagnol) {
|
2026-06-12 14:14:29 +04:00
|
|
|
langArray.push({title: 'Español', lang: espagnol})
|
2022-01-24 21:06:52 +04:00
|
|
|
}
|
2022-03-22 07:21:45 +04:00
|
|
|
|
2022-05-20 02:15:56 +04:00
|
|
|
if (allemand) {
|
2026-06-12 14:14:29 +04:00
|
|
|
langArray.push({title: 'Deutsch', lang: allemand})
|
2022-03-22 07:21:45 +04:00
|
|
|
}
|
|
|
|
|
|
2022-05-20 02:15:56 +04:00
|
|
|
if (italien) {
|
2026-06-12 14:14:29 +04:00
|
|
|
langArray.push({title: 'Italiano', lang: italien})
|
2022-03-22 07:21:45 +04:00
|
|
|
}
|
2022-01-24 21:06:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return langArray
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const alignTeks = (langArray, isMobile) => {
|
|
|
|
|
if (langArray.length > 0 && !isMobile) {
|
|
|
|
|
return 'justify'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (langArray.length > 0 && isMobile) {
|
|
|
|
|
return 'justify'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (langArray.length === 0 && isMobile) {
|
|
|
|
|
return 'justify'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (langArray.length === 0 && !isMobile) {
|
|
|
|
|
return 'center'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ExplicitTooltip = Tooltip
|
|
|
|
|
|
2023-07-22 13:56:18 +04:00
|
|
|
export default function Teks({parole}) {
|
|
|
|
|
const isMobile = useMediaQuery('(max-width:600px)')
|
2022-05-20 02:15:56 +04:00
|
|
|
const langArray = langToArray(parole)
|
2023-07-30 00:26:54 +04:00
|
|
|
const enhancedAliases = getAlias(parole.artistes, parole.prioriteArtistes, true)
|
2026-06-08 01:19:30 +04:00
|
|
|
const coverFmt = formatKuveti(parole.couverture)
|
2022-01-24 21:06:52 +04:00
|
|
|
|
2023-07-22 13:56:18 +04:00
|
|
|
useEffect(() => {
|
|
|
|
|
const isBrowser = () => typeof window !== 'undefined'
|
|
|
|
|
if (!isBrowser()) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.scrollTo({top: 0, behavior: 'smooth'})
|
|
|
|
|
}, [])
|
|
|
|
|
|
2022-01-24 21:06:52 +04:00
|
|
|
return (
|
2023-07-22 23:39:16 +04:00
|
|
|
<Root className={classes.container}>
|
2026-04-21 19:31:26 +04:00
|
|
|
<Box sx={{textAlign: 'center', marginTop: 12}}>
|
|
|
|
|
<Typography variant='h4' component='div' display='block' marginbottom={2}>
|
2023-07-30 00:26:54 +04:00
|
|
|
<Typography gutterBottom color='primary' variant='h6' component='div'>
|
|
|
|
|
{enhancedAliases.map(({type, value}) => {
|
|
|
|
|
if (type === 'element') {
|
|
|
|
|
return (
|
2024-01-23 04:38:02 +04:00
|
|
|
<Link key={value} style={{textDecoration: 'none', color: 'inherit'}} href={`/awtis/${slugify(value, {lower: true, remove: /[*#+~.()'"!:@]/g})}`}>{value}</Link>
|
2023-07-30 00:26:54 +04:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <span key={value} className={classes.separation}>{value}</span>
|
|
|
|
|
})}
|
2022-01-24 21:06:52 +04:00
|
|
|
</Typography>
|
2026-04-21 19:31:26 +04:00
|
|
|
<Box display='flex' justifycontent='center' alignitems='center'>
|
2024-04-14 07:13:51 +04:00
|
|
|
<Typography variant='h5' component='div'>
|
|
|
|
|
{parole.titre} <small>({parole?.annee})</small>
|
|
|
|
|
</Typography>
|
|
|
|
|
{parole.explicitLyrics && (
|
2022-01-24 21:06:52 +04:00
|
|
|
<ExplicitTooltip
|
|
|
|
|
title='Explicit Lyrics'
|
|
|
|
|
placement='bottom'
|
|
|
|
|
classes={{
|
|
|
|
|
tooltip: classes.tooltip
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-04-14 07:13:51 +04:00
|
|
|
<ExplicitIcon style={{marginLeft: 10}} color='error' />
|
2022-01-24 21:06:52 +04:00
|
|
|
</ExplicitTooltip>
|
|
|
|
|
)}
|
2024-04-14 07:13:51 +04:00
|
|
|
</Box>
|
2022-01-24 21:06:52 +04:00
|
|
|
</Typography>
|
2022-12-12 23:17:59 +04:00
|
|
|
|
2026-06-08 01:19:30 +04:00
|
|
|
{coverFmt?.url && (
|
|
|
|
|
<Box sx={{display: 'flex', justifyContent: 'center', mb: 2}}>
|
|
|
|
|
<Image
|
|
|
|
|
src={new URL(coverFmt.url, IMAGE_URL).toString()}
|
|
|
|
|
alt={parole.titre}
|
|
|
|
|
width={coverFmt.width || 300}
|
|
|
|
|
height={coverFmt.height || 300}
|
|
|
|
|
style={{maxWidth: '100%', maxHeight: 320, width: 'auto', height: 'auto', borderRadius: 8}}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
|
|
|
|
)}
|
2026-04-21 19:16:11 +04:00
|
|
|
{parole?.user && (
|
2022-01-24 21:06:52 +04:00
|
|
|
<Typography style={{marginBottom: '1.5em'}} display='block' variant='caption'>
|
2026-04-21 19:16:11 +04:00
|
|
|
<i>parole soumise par {parole.user.username}</i>
|
2022-01-24 21:06:52 +04:00
|
|
|
</Typography>
|
|
|
|
|
)}
|
2026-04-21 19:16:11 +04:00
|
|
|
{parole?.userAdmin&& !parole.user && (
|
2022-05-08 05:26:23 +04:00
|
|
|
<Typography style={{marginBottom: '1.5em'}} display='block' variant='caption'>
|
2026-04-21 19:16:11 +04:00
|
|
|
<i>parole soumise par {parole.userAdmin.firstname}</i>
|
2022-05-08 05:26:23 +04:00
|
|
|
</Typography>
|
|
|
|
|
)}
|
2024-04-14 07:08:24 +04:00
|
|
|
{parole.creativeCommons && (
|
|
|
|
|
<Box sx={{maxWidth: 220, margin: '0 auto', textAlign: 'center'}}>
|
2026-06-12 14:14:29 +04:00
|
|
|
<LicenseModal license={parole.creativeCommons.toLowerCase()} sourceOriginale={parole.sourceOriginale ?? null} remixes={parole.remixes?.length ? parole.remixes : null} />
|
2024-04-14 07:08:24 +04:00
|
|
|
</Box>
|
|
|
|
|
)}
|
2026-04-21 19:16:11 +04:00
|
|
|
{parole?.files && (
|
|
|
|
|
<FilesDialog files={parole.files} />
|
2024-04-17 06:58:50 +04:00
|
|
|
)}
|
2023-03-09 10:39:44 +04:00
|
|
|
{(parole.okiMizikID || parole.streamAudio.length > 0 || parole.gadeEmbed) && (
|
2022-12-12 23:17:59 +04:00
|
|
|
<Box sx={{textAlign: 'center'}}>
|
|
|
|
|
<EntegreMizik parole={parole} isMobile={isMobile} />
|
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
{parole.okiMizikID && (
|
|
|
|
|
<OkiMizik id={parole.okiMizikID} parole={parole} />
|
|
|
|
|
)}
|
|
|
|
|
{parole?.difference?.length > 0 && (
|
|
|
|
|
<DiferansDialog difference={parole.difference} />
|
|
|
|
|
)}
|
2026-06-22 12:56:29 +04:00
|
|
|
{parole.streamAudio?.length > 0 && (
|
|
|
|
|
<Box sx={{mt: 2, mb: 1}}>
|
|
|
|
|
<Typography variant='overline' sx={{color: 'text.secondary', display: 'block', mb: 1}}>
|
|
|
|
|
Écouter sur
|
|
|
|
|
</Typography>
|
|
|
|
|
<Box sx={{display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: 1}}>
|
|
|
|
|
{parole.streamAudio.map((lyen, i) => (
|
2026-06-22 13:12:14 +04:00
|
|
|
<StreamButtonComponent key={i} lyen={lyen} />
|
2026-06-22 12:56:29 +04:00
|
|
|
))}
|
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
)}
|
2022-01-24 21:06:52 +04:00
|
|
|
</Box>
|
2026-04-21 19:31:26 +04:00
|
|
|
<Grid container justifycontent='center' spacing={1}>
|
2024-10-21 10:06:16 +04:00
|
|
|
<Grid size={{xs: 12, md: langArray.length > 0 ? 6 : null}}>
|
2023-07-22 13:56:18 +04:00
|
|
|
<Box className={classes.gridText}>
|
|
|
|
|
<Typography align='center' sx={{marginBottom: '0.5em'}} variant='h4'>
|
2022-01-24 21:06:52 +04:00
|
|
|
Transcription
|
2026-06-12 14:14:29 +04:00
|
|
|
{parole.langueSource && parole.langueSource !== 'ka' && (
|
|
|
|
|
<Typography component='span' variant='body2' color='text.secondary' sx={{ml: 1}}>
|
|
|
|
|
({LANG_NAMES[parole.langueSource]})
|
|
|
|
|
</Typography>
|
|
|
|
|
)}
|
2022-01-24 21:06:52 +04:00
|
|
|
</Typography>
|
2026-04-21 19:31:26 +04:00
|
|
|
<Typography paragraph='true' align={alignTeks(langArray, isMobile)} component='span'>
|
2022-05-20 02:15:56 +04:00
|
|
|
{formatJsonString(parole.transcription)}
|
2022-01-24 21:06:52 +04:00
|
|
|
</Typography>
|
2023-07-22 13:56:18 +04:00
|
|
|
</Box>
|
2022-01-24 21:06:52 +04:00
|
|
|
</Grid>
|
2026-06-12 14:14:29 +04:00
|
|
|
{langArray.map(({title, lang}) => (
|
2024-10-21 10:06:16 +04:00
|
|
|
<Grid key={title} size={{xs: 12, md: 6}}>
|
2023-07-22 13:56:18 +04:00
|
|
|
<Box className={classes.gridText}>
|
|
|
|
|
<Typography align='center' sx={{marginBottom: '0.5em'}} variant='h4'>
|
2026-06-12 14:14:29 +04:00
|
|
|
{title}
|
2022-01-24 21:06:52 +04:00
|
|
|
</Typography>
|
2026-04-21 19:31:26 +04:00
|
|
|
<Typography paragraph='true' align='justify' component='span'>
|
2022-01-24 21:06:52 +04:00
|
|
|
{formatJsonString(lang)}
|
|
|
|
|
</Typography>
|
2023-07-22 13:56:18 +04:00
|
|
|
</Box>
|
2022-01-24 21:06:52 +04:00
|
|
|
</Grid>
|
|
|
|
|
))}
|
|
|
|
|
</Grid>
|
|
|
|
|
</Root>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Teks.propTypes = {
|
2022-05-20 02:15:56 +04:00
|
|
|
parole: PropTypes.object.isRequired,
|
2022-01-24 21:06:52 +04:00
|
|
|
}
|