Use VweKomante & add Dekoneksyon

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2021-06-26 12:32:44 +02:00
parent 40f76779f7
commit 621ddbeda3
+19 -6
View File
@@ -1,6 +1,8 @@
import {useEffect, useState} from 'react' import {useEffect, useState} from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Link from 'next/link' import Link from 'next/link'
import {useRouter} from 'next/router'
import {useSession} from 'next-auth/client'
import { import {
Grid, Grid,
@@ -25,6 +27,9 @@ import {makeStyles, useTheme} from '@material-ui/core/styles'
import {formatJsonString} from '../../lib/utils/format' import {formatJsonString} from '../../lib/utils/format'
import VweKomante from '../komante/vwe-komante'
import Dekoneksyon from '../sesyon/dekoneksyon'
import DrawerBar from './drawer-bar' import DrawerBar from './drawer-bar'
import DenyeTeks from './denye-teks' import DenyeTeks from './denye-teks'
import VweKouteAchte from './vwe-koute-achte' import VweKouteAchte from './vwe-koute-achte'
@@ -160,7 +165,10 @@ const alignTeks = (langArray, isMobile) => {
} }
} }
export default function TeksDrawer({teks, anTeks}) { export default function TeksDrawer({teks, anTeks, komante}) {
const [session] = useSession()
const router = useRouter()
const isMobile = useMediaQuery('(max-width:800px)') const isMobile = useMediaQuery('(max-width:800px)')
const langArray = langToArray(anTeks) const langArray = langToArray(anTeks)
const classes = useStyles() const classes = useStyles()
@@ -270,9 +278,12 @@ export default function TeksDrawer({teks, anTeks}) {
{anTeks.eksplisit && ( {anTeks.eksplisit && (
<ExplicitIcon style={{marginLeft: 10}} color='secondary' /> <ExplicitIcon style={{marginLeft: 10}} color='secondary' />
)} )}
<div className={classes.pataje}> {komante && (
<Pataje teks={anTeks} setError={setError} setSuccess={setSuccess} /> <VweKomante komante={komante} teks={anTeks} />
</div> )}
{session && (
<Dekoneksyon chimen={router.asPath} tooltipPlacement='bottom' />
)}
</Typography> </Typography>
<Typography variant='caption'> <Typography variant='caption'>
{anTeks.user && ( {anTeks.user && (
@@ -332,9 +343,11 @@ export default function TeksDrawer({teks, anTeks}) {
TeksDrawer.propTypes = { TeksDrawer.propTypes = {
teks: PropTypes.array.isRequired, teks: PropTypes.array.isRequired,
anTeks: PropTypes.object anTeks: PropTypes.object,
komante: PropTypes.array
} }
TeksDrawer.defaultProps = { TeksDrawer.defaultProps = {
anTeks: null anTeks: null,
komante: null
} }