feat: simplifie la vue timeline
This commit is contained in:
@@ -35,7 +35,8 @@ export default function VersionComparison({versionData, versionCompare, voteRefr
|
||||
|
||||
const createdAt = new Date(versionData.date_created)
|
||||
const threeDaysAgo = new Date(Date.now() - (3 * 24 * 60 * 60 * 1000))
|
||||
const isVoteDisabled = createdAt < threeDaysAgo
|
||||
const isExpired = createdAt < threeDaysAgo
|
||||
const isVoteDisabled = isExpired || outdated
|
||||
|
||||
return (
|
||||
<Box sx={{padding: 3}}>
|
||||
@@ -106,31 +107,29 @@ export default function VersionComparison({versionData, versionCompare, voteRefr
|
||||
@{versionData.user_created?.split('-')[0] || 'Système'}
|
||||
</Typography>
|
||||
</Box>
|
||||
{!outdated && (
|
||||
<Box sx={{
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'space-between', mt: 1
|
||||
}}
|
||||
>
|
||||
<Box sx={{display: 'flex', alignItems: 'center', gap: 1}}>
|
||||
{versionData && (
|
||||
<Typography sx={{fontWeight: 'bold'}} color={isVoteDisabled ? 'error' : 'primary'}>
|
||||
{formatDate(versionData.date_created)}
|
||||
</Typography>
|
||||
)}
|
||||
<CopyButton
|
||||
content={current.contenu || ''}
|
||||
label='Copier cette version'
|
||||
hasSnackbarVisible={false}
|
||||
/>
|
||||
</Box>
|
||||
<VoteButtons
|
||||
key={`vote-comparison-${voteRefreshKey}`}
|
||||
versionId={versionCompare.versionId}
|
||||
isDisabled={isVoteDisabled}
|
||||
onVoteResult={handleVoteResult}
|
||||
<Box sx={{
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'space-between', mt: 1
|
||||
}}
|
||||
>
|
||||
<Box sx={{display: 'flex', alignItems: 'center', gap: 1}}>
|
||||
{versionData && (
|
||||
<Typography sx={{fontWeight: 'bold'}} color={isVoteDisabled ? 'error' : 'primary'}>
|
||||
{formatDate(versionData.date_created)}
|
||||
</Typography>
|
||||
)}
|
||||
<CopyButton
|
||||
content={current.contenu || ''}
|
||||
label='Copier cette version'
|
||||
hasSnackbarVisible={false}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
<VoteButtons
|
||||
key={`vote-comparison-${voteRefreshKey}`}
|
||||
versionId={versionCompare.versionId}
|
||||
isDisabled={isVoteDisabled}
|
||||
onVoteResult={handleVoteResult}
|
||||
/>
|
||||
</Box>
|
||||
</Paper>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user