Changement de couleur de la date de version en fonction du statut du vote
This commit is contained in:
@@ -65,6 +65,10 @@ export default function VersionComparison({versionData, versionCompare}) {
|
||||
setSnackbar(prev => ({...prev, open: false}))
|
||||
}
|
||||
|
||||
const createdAt = new Date(versionData.date_created)
|
||||
const threeDaysAgo = new Date(Date.now() - (3 * 24 * 60 * 60 * 1000))
|
||||
const isVoteDisabled = createdAt < threeDaysAgo
|
||||
|
||||
return (
|
||||
<Box sx={{padding: 3}}>
|
||||
<Grid container spacing={2}>
|
||||
@@ -91,7 +95,7 @@ export default function VersionComparison({versionData, versionCompare}) {
|
||||
>
|
||||
<Box>
|
||||
{versionData && (
|
||||
<Typography sx={{fontWeight: 'bold'}} color='primary'>
|
||||
<Typography sx={{fontWeight: 'bold'}} color={isVoteDisabled ? 'error' : 'primary'}>
|
||||
{formatDate(versionData.date_created)}
|
||||
</Typography>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user