fix: corrige rendu markdown dans comparaison versions

This commit is contained in:
2025-07-23 12:22:21 +04:00
parent 09d17dafaa
commit acabbae951
+21 -4
View File
@@ -10,6 +10,7 @@ import {useState, useEffect} from 'react'
import {useSession} from 'next-auth/react' import {useSession} from 'next-auth/react'
import Snackbar from '@mui/material/Snackbar' import Snackbar from '@mui/material/Snackbar'
import Alert from '@mui/material/Alert' import Alert from '@mui/material/Alert'
import MarkdownRenderer from '../markdown-renderer/index.js'
import {handleVote, getUserVote} from '../../lib/directus.js' import {handleVote, getUserVote} from '../../lib/directus.js'
import {formatDate} from '@/lib/format.js' import {formatDate} from '@/lib/format.js'
@@ -74,16 +75,32 @@ export default function VersionComparison({versionData, versionCompare}) {
<Grid container spacing={2}> <Grid container spacing={2}>
<Grid xs={6}> <Grid xs={6}>
<Paper sx={{padding: 1, backgroundColor: '#E8F5E9'}}> <Paper sx={{padding: 1, backgroundColor: '#E8F5E9'}}>
<Typography variant='body1' sx={{color: '#388E3C', fontWeight: 'bold'}}> <Box sx={{color: '#388E3C', fontWeight: 'bold'}}>
{main.contenu} <MarkdownRenderer
content={main.contenu}
color='#388E3C'
fallbackComponent={({children, ...props}) => (
<Typography variant='body1' sx={{color: '#388E3C', fontWeight: 'bold'}} {...props}>
{children}
</Typography> </Typography>
)}
/>
</Box>
</Paper> </Paper>
</Grid> </Grid>
<Grid xs={6}> <Grid xs={6}>
<Paper sx={{padding: 1, backgroundColor: outdated ? '#F9E8E8' : '#E3F2FD'}}> <Paper sx={{padding: 1, backgroundColor: outdated ? '#F9E8E8' : '#E3F2FD'}}>
<Typography variant='body1' sx={{color: outdated ? '#D32F2F' : '#1976D2', fontWeight: 'bold'}}> <Box sx={{color: outdated ? '#D32F2F' : '#1976D2', fontWeight: 'bold'}}>
{current.contenu} <MarkdownRenderer
content={current.contenu}
color={outdated ? '#D32F2F' : '#1976D2'}
fallbackComponent={({children, ...props}) => (
<Typography variant='body1' sx={{color: outdated ? '#D32F2F' : '#1976D2', fontWeight: 'bold'}} {...props}>
{children}
</Typography> </Typography>
)}
/>
</Box>
{!outdated && session?.user && ( {!outdated && session?.user && (
<> <>
<Box> <Box>