Changement de couleur de la date de version en fonction du statut du vote

This commit is contained in:
2024-12-17 19:04:10 +04:00
parent af53eafc2d
commit 0860132763
+5 -1
View File
@@ -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>
)}