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 {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}
|
||||||
|
|||||||
@@ -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,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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