Compare commits
3
Commits
daa3510d73
...
96b7a601c8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96b7a601c8
|
||
|
|
a56b355493
|
||
|
|
55967bfc3c
|
@@ -1,6 +1,6 @@
|
|||||||
import {Suspense} from 'react'
|
import {Suspense} from 'react'
|
||||||
import {notFound} from 'next/navigation'
|
import {notFound} from 'next/navigation'
|
||||||
import {jwennTeks} from '../../lib/oki-api'
|
import {jwennTeks, jwennTeksEpiSlug} from '../../lib/oki-api'
|
||||||
import TeksDrawer from '../../components/teks/teks-drawer'
|
import TeksDrawer from '../../components/teks/teks-drawer'
|
||||||
import Loading from './loading'
|
import Loading from './loading'
|
||||||
|
|
||||||
@@ -49,13 +49,15 @@ async function jwennDotDone() {
|
|||||||
return teks
|
return teks
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function PawolLayout({children}) {
|
export default async function PawolLayout({children, params}) {
|
||||||
|
const {slug} = await params
|
||||||
const teks = await jwennDotDone()
|
const teks = await jwennDotDone()
|
||||||
|
const parole = slug ? await jwennTeksEpiSlug(slug) : null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Suspense fallback={<Loading />}>
|
<Suspense fallback={<Loading />}>
|
||||||
<TeksDrawer paroles={teks} />
|
<TeksDrawer paroles={teks} parole={parole} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
<section>
|
<section>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -146,23 +146,27 @@ export default function AwtisDetay({anAwtis}) {
|
|||||||
<Grid container>
|
<Grid container>
|
||||||
{coverUrl && (
|
{coverUrl && (
|
||||||
<Grid size={{xs: 12, sm: 4}}>
|
<Grid size={{xs: 12, sm: 4}}>
|
||||||
<Box sx={{position: 'relative', minHeight: 130, height: '100%'}}>
|
<Link href={`/paroles/${titrePhare.slug}`} style={{display: 'block', height: '100%'}}>
|
||||||
<Image
|
<Box sx={{position: 'relative', minHeight: 130, height: '100%'}}>
|
||||||
src={coverUrl}
|
<Image
|
||||||
alt={titrePhare.titre}
|
src={coverUrl}
|
||||||
fill
|
alt={titrePhare.titre}
|
||||||
placeholder='blur'
|
fill
|
||||||
blurDataURL={BLUR_DATA_URL}
|
placeholder='blur'
|
||||||
sizes='200px'
|
blurDataURL={BLUR_DATA_URL}
|
||||||
style={{objectFit: 'cover'}}
|
sizes='200px'
|
||||||
/>
|
style={{objectFit: 'cover'}}
|
||||||
</Box>
|
/>
|
||||||
|
</Box>
|
||||||
|
</Link>
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
<Grid size={{xs: 12, sm: coverUrl ? 8 : 12}}>
|
<Grid size={{xs: 12, sm: coverUrl ? 8 : 12}}>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Typography variant='subtitle1' sx={{fontWeight: 700}} gutterBottom>
|
<Typography variant='subtitle1' sx={{fontWeight: 700}} gutterBottom>
|
||||||
{titrePhare.titre}
|
<Link href={`/paroles/${titrePhare.slug}`} style={{color: 'inherit', textDecoration: 'none'}}>
|
||||||
|
{titrePhare.titre}
|
||||||
|
</Link>
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant='caption' sx={{color: 'text.secondary', display: 'block', mb: 1}}>
|
<Typography variant='caption' sx={{color: 'text.secondary', display: 'block', mb: 1}}>
|
||||||
Écouter sur
|
Écouter sur
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const PLATFORM_ICON = {
|
|||||||
kDrive: CloudDownloadIcon,
|
kDrive: CloudDownloadIcon,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function StemsDialog({stems}) {
|
export default function KitsDialog({kits}) {
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
const fullScreen = useMediaQuery(theme.breakpoints.down('md'))
|
const fullScreen = useMediaQuery(theme.breakpoints.down('md'))
|
||||||
@@ -37,26 +37,26 @@ export default function StemsDialog({stems}) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button endIcon={<CloudDownloadIcon />} sx={{marginBottom: 2}} variant='outlined' onClick={handleClickOpen}>
|
<Button endIcon={<CloudDownloadIcon />} sx={{marginBottom: 2}} variant='outlined' onClick={handleClickOpen}>
|
||||||
Stems
|
Kits
|
||||||
</Button>
|
</Button>
|
||||||
<Dialog
|
<Dialog
|
||||||
fullScreen={fullScreen}
|
fullScreen={fullScreen}
|
||||||
open={open}
|
open={open}
|
||||||
aria-labelledby='StemsDialog'
|
aria-labelledby='KitsDialog'
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
>
|
>
|
||||||
<DialogTitle>Télécharger les stems</DialogTitle>
|
<DialogTitle>Télécharger un kit</DialogTitle>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<List>
|
<List>
|
||||||
{stems.map((stem, index) => {
|
{kits.map((kit, index) => {
|
||||||
const PlatformIcon = PLATFORM_ICON[stem.plateforme] ?? CloudDownloadIcon
|
const PlatformIcon = PLATFORM_ICON[kit.plateforme] ?? CloudDownloadIcon
|
||||||
return (
|
return (
|
||||||
<ListItem key={index} disablePadding>
|
<ListItem key={index} disablePadding>
|
||||||
<ListItemButton component='a' href={stem.url} target='_blank' rel='noopener noreferrer'>
|
<ListItemButton component='a' href={kit.url} target='_blank' rel='noopener noreferrer'>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<PlatformIcon />
|
<PlatformIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={stem.plateforme} />
|
<ListItemText primary={kit.type} secondary={kit.plateforme} />
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
)
|
)
|
||||||
@@ -73,6 +73,6 @@ export default function StemsDialog({stems}) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
StemsDialog.propTypes = {
|
KitsDialog.propTypes = {
|
||||||
stems: PropTypes.array.isRequired
|
kits: PropTypes.array.isRequired
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import {useState, useEffect, forwardRef} from 'react'
|
import {useState, useEffect, forwardRef} from 'react'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import {useParams} from 'next/navigation'
|
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import AppBar from '@mui/material/AppBar'
|
import AppBar from '@mui/material/AppBar'
|
||||||
import Box from '@mui/material/Box'
|
import Box from '@mui/material/Box'
|
||||||
@@ -26,15 +25,12 @@ const Alert = forwardRef(function Alert(props, ref) {
|
|||||||
return <MuiAlert ref={ref} elevation={6} variant='filled' {...props} />
|
return <MuiAlert ref={ref} elevation={6} variant='filled' {...props} />
|
||||||
})
|
})
|
||||||
|
|
||||||
export default function TeksDrawer({paroles}) {
|
export default function TeksDrawer({paroles, parole}) {
|
||||||
const {slug} = useParams()
|
|
||||||
const [mobileOpen, setMobileOpen] = useState(false)
|
const [mobileOpen, setMobileOpen] = useState(false)
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
const [success, setSuccess] = useState('')
|
const [success, setSuccess] = useState('')
|
||||||
|
|
||||||
const parole = paroles.find((parole) => parole.slug === slug)
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (error || success) {
|
if (error || success) {
|
||||||
setOpen(true)
|
setOpen(true)
|
||||||
@@ -161,4 +157,5 @@ export default function TeksDrawer({paroles}) {
|
|||||||
|
|
||||||
TeksDrawer.propTypes = {
|
TeksDrawer.propTypes = {
|
||||||
paroles: PropTypes.array,
|
paroles: PropTypes.array,
|
||||||
|
parole: PropTypes.object,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {formatKuveti} from '../../lib/kuveti'
|
|||||||
|
|
||||||
import LicenseModal from '../cc/license-modal'
|
import LicenseModal from '../cc/license-modal'
|
||||||
import FilesDialog from '../files/files-dialog'
|
import FilesDialog from '../files/files-dialog'
|
||||||
import StemsDialog from '../files/stems-dialog'
|
import KitsDialog from '../files/kits-dialog'
|
||||||
import {StreamButton} from '../streaming-buttons'
|
import {StreamButton} from '../streaming-buttons'
|
||||||
import EntegreMizik from './entegre-mizik'
|
import EntegreMizik from './entegre-mizik'
|
||||||
import OkiMizik from './oki-mizik'
|
import OkiMizik from './oki-mizik'
|
||||||
@@ -185,13 +185,13 @@ export default function Teks({parole}) {
|
|||||||
<LicenseModal license={parole.creativeCommons.toLowerCase()} sourceOriginale={parole.sourceOriginale ?? null} remixes={parole.remixes?.length ? parole.remixes : null} />
|
<LicenseModal license={parole.creativeCommons.toLowerCase()} sourceOriginale={parole.sourceOriginale ?? null} remixes={parole.remixes?.length ? parole.remixes : null} />
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
{(parole?.files || (parole.creativeCommons && parole.stems?.length > 0)) && (
|
{(parole?.files || (parole.creativeCommons && parole.kits?.length > 0)) && (
|
||||||
<Box sx={{display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: 1}}>
|
<Box sx={{display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: 1}}>
|
||||||
{parole?.files && (
|
{parole?.files && (
|
||||||
<FilesDialog files={parole.files} />
|
<FilesDialog files={parole.files} />
|
||||||
)}
|
)}
|
||||||
{parole.creativeCommons && parole.stems?.length > 0 && (
|
{parole.creativeCommons && parole.kits?.length > 0 && (
|
||||||
<StemsDialog stems={parole.stems} />
|
<KitsDialog kits={parole.kits} />
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|||||||
+1
-24
@@ -54,7 +54,7 @@ export async function jwennTeksEpiSlug(slug) {
|
|||||||
streamVideo: {
|
streamVideo: {
|
||||||
populate: '*'
|
populate: '*'
|
||||||
},
|
},
|
||||||
stems: {
|
kits: {
|
||||||
populate: '*'
|
populate: '*'
|
||||||
},
|
},
|
||||||
traductions: {
|
traductions: {
|
||||||
@@ -146,34 +146,11 @@ export async function jwennToutAwtis() {
|
|||||||
export async function jwennTeks() {
|
export async function jwennTeks() {
|
||||||
const query = qs.stringify({
|
const query = qs.stringify({
|
||||||
populate: {
|
populate: {
|
||||||
user: {
|
|
||||||
fields: ['username']
|
|
||||||
},
|
|
||||||
userAdmin: {
|
|
||||||
fields: ['username', 'firstname']
|
|
||||||
},
|
|
||||||
commentaires: {
|
|
||||||
fields: ['contenu', 'datePublication'],
|
|
||||||
populate: {
|
|
||||||
user: {
|
|
||||||
fields: ['username']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
couverture: {
|
couverture: {
|
||||||
populate: '*'
|
populate: '*'
|
||||||
},
|
},
|
||||||
artistes: {
|
artistes: {
|
||||||
fields: ['alias', 'slug']
|
fields: ['alias', 'slug']
|
||||||
},
|
|
||||||
streamAudio: {
|
|
||||||
populate: '*'
|
|
||||||
},
|
|
||||||
streamVideo: {
|
|
||||||
populate: '*'
|
|
||||||
},
|
|
||||||
traductions: {
|
|
||||||
populate: '*'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sort: ['titre:asc'],
|
sort: ['titre:asc'],
|
||||||
|
|||||||
Reference in New Issue
Block a user