fix(messaging): only show date if date changes

This commit is contained in:
Paul
2021-12-24 14:41:33 +00:00
parent 153493e4dc
commit ac832bfe42
2 changed files with 12 additions and 8 deletions

View File

@@ -104,6 +104,7 @@ export default observer(({ last_id, renderer, highlight }: Props) => {
prevAuthor: string,
previousMasq: Nullable<Masquerade>,
) {
head = false;
const atime = decodeTime(current),
adate = new Date(atime),
btime = decodeTime(previous),
@@ -115,14 +116,17 @@ export default observer(({ last_id, renderer, highlight }: Props) => {
divided = true;
}
head = false;
let date;
if (
unread ||
adate.getFullYear() !== bdate.getFullYear() ||
adate.getMonth() !== bdate.getMonth() ||
adate.getDate() !== bdate.getDate()
) {
render.push(<DateDivider date={adate} unread={unread} />);
date = adate;
}
if (unread || date) {
render.push(<DateDivider date={date} unread={unread} />);
head = true;
}