Skip to content

Commit

Permalink
TripCard: don't show footer if no notes
Browse files Browse the repository at this point in the history
On trips with no notes/additions, an empty <View> was being rendered (causing a 10px gap due to padding)
If there were no notes, `timelineNotesMap[trip._id.$oid]` would be `undefined`, which does not equal 0.
We should only show notes if it is defined AND the length is not 0, so we can just say `timelineNotesMap[trip._id.$oid]?.length`.
  • Loading branch information
JGreenlee committed Oct 30, 2023
1 parent 49ff385 commit a34c219
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion www/js/diary/cards/TripCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const TripCard = ({ trip }: Props) => {
}
</View>
</View>
{timelineNotesMap[trip._id.$oid]?.length != 0 &&
{timelineNotesMap[trip._id.$oid]?.length &&
<View style={cardStyles.cardFooter}>
<AddedNotesList timelineEntry={trip} additionEntries={timelineNotesMap[trip._id.$oid]} />
</View>
Expand Down

0 comments on commit a34c219

Please sign in to comment.