Skip to content

Commit

Permalink
fix(completeValidation): display alert even if no required completions
Browse files Browse the repository at this point in the history
  • Loading branch information
Clm-Roig committed Jun 13, 2022
1 parent 35d6e6b commit 5739941
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/components/TrackerValidationDialog/CompleteValidationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ const CompleteValidationDialog: FC<Props> = ({ dialogProps, onValidation, tracke
{'Tracker : '}
<b>{name}</b>
</DialogTitle>
{requiredCompletions.length > 0 && (
<DialogContent sx={{ pb: 0 }}>
<DialogContentText>Valider avec :</DialogContentText>
<CompletionChipList boxProps={{ sx: { mb: 1 } }} completions={requiredCompletions} />
{!isToday(selectedDate) && (
<Alert icon={false} severity="warning">
Vous validez ce tracker pour le <b>{formatDate(selectedDate)}</b>.
</Alert>
)}
</DialogContent>
)}
<DialogContent sx={{ pb: 0 }}>
{requiredCompletions.length > 0 && (
<>
<DialogContentText>Valider avec :</DialogContentText>
<CompletionChipList boxProps={{ sx: { mb: 1 } }} completions={requiredCompletions} />
</>
)}
{!isToday(selectedDate) && (
<Alert icon={false} severity="warning">
Vous validez ce tracker pour le <b>{formatDate(selectedDate)}</b>.
</Alert>
)}
</DialogContent>

<DialogActions>
<Button onClick={onValidation} autoFocus>
Expand Down

0 comments on commit 5739941

Please sign in to comment.