Skip to content

Commit

Permalink
Add DayChangeMarker where suitable before unconfirmed messages (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Jan 14, 2021
1 parent 9ec27dd commit 9859444
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/website/public/components/MessagesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ function MessagesList() {
continue;
} else if (message.kind === "unconfirmed") {
const now = new Date();
const dayString = now.toDateString();
if (lastSeenDayString === null || lastSeenDayString !== dayString) {
children.push(<DayChangeMarker key={dayString} date={now} />);
}

const mergeWithPrevious: boolean =
lastSeenDate !== null &&
Expand All @@ -49,12 +53,14 @@ function MessagesList() {
mergeWithPrevious
};
children.push(<UnconfirmedMessage key={"u-" + i} {...props} />);
prevMessageSender = myUserId;

lastSeenDate = now;
lastSeenDayString = dayString;
prevMessageSender = myUserId;
} else {
const dayString = message.date.toDateString();
if (lastSeenDayString === null || lastSeenDayString !== dayString) {
children.push(<DayChangeMarker key={dayString} date={message.date}/>);
children.push(<DayChangeMarker key={dayString} date={message.date} />);
}

const mergeWithPrevious: boolean =
Expand Down

0 comments on commit 9859444

Please sign in to comment.