fix: icônes partage/streaming ne dépendent plus du plafond de 100
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {Suspense} from 'react'
|
||||
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 Loading from './loading'
|
||||
|
||||
@@ -49,13 +49,15 @@ async function jwennDotDone() {
|
||||
return teks
|
||||
}
|
||||
|
||||
export default async function PawolLayout({children}) {
|
||||
export default async function PawolLayout({children, params}) {
|
||||
const {slug} = await params
|
||||
const teks = await jwennDotDone()
|
||||
const parole = slug ? await jwennTeksEpiSlug(slug) : null
|
||||
|
||||
return (
|
||||
<>
|
||||
<Suspense fallback={<Loading />}>
|
||||
<TeksDrawer paroles={teks} />
|
||||
<TeksDrawer paroles={teks} parole={parole} />
|
||||
</Suspense>
|
||||
<section>
|
||||
{children}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import {useState, useEffect, forwardRef} from 'react'
|
||||
import Link from 'next/link'
|
||||
import {useParams} from 'next/navigation'
|
||||
import PropTypes from 'prop-types'
|
||||
import AppBar from '@mui/material/AppBar'
|
||||
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} />
|
||||
})
|
||||
|
||||
export default function TeksDrawer({paroles}) {
|
||||
const {slug} = useParams()
|
||||
export default function TeksDrawer({paroles, parole}) {
|
||||
const [mobileOpen, setMobileOpen] = useState(false)
|
||||
const [open, setOpen] = useState(false)
|
||||
const [error, setError] = useState('')
|
||||
const [success, setSuccess] = useState('')
|
||||
|
||||
const parole = paroles.find((parole) => parole.slug === slug)
|
||||
|
||||
useEffect(() => {
|
||||
if (error || success) {
|
||||
setOpen(true)
|
||||
@@ -161,4 +157,5 @@ export default function TeksDrawer({paroles}) {
|
||||
|
||||
TeksDrawer.propTypes = {
|
||||
paroles: PropTypes.array,
|
||||
parole: PropTypes.object,
|
||||
}
|
||||
|
||||
@@ -146,34 +146,11 @@ export async function jwennToutAwtis() {
|
||||
export async function jwennTeks() {
|
||||
const query = qs.stringify({
|
||||
populate: {
|
||||
user: {
|
||||
fields: ['username']
|
||||
},
|
||||
userAdmin: {
|
||||
fields: ['username', 'firstname']
|
||||
},
|
||||
commentaires: {
|
||||
fields: ['contenu', 'datePublication'],
|
||||
populate: {
|
||||
user: {
|
||||
fields: ['username']
|
||||
}
|
||||
}
|
||||
},
|
||||
couverture: {
|
||||
populate: '*'
|
||||
},
|
||||
artistes: {
|
||||
fields: ['alias', 'slug']
|
||||
},
|
||||
streamAudio: {
|
||||
populate: '*'
|
||||
},
|
||||
streamVideo: {
|
||||
populate: '*'
|
||||
},
|
||||
traductions: {
|
||||
populate: '*'
|
||||
}
|
||||
},
|
||||
sort: ['titre:asc'],
|
||||
|
||||
Reference in New Issue
Block a user