further optimize message rendering
This commit is contained in:
parent
595b6ac1f2
commit
80ab321103
2 changed files with 4 additions and 4 deletions
|
@ -84,9 +84,9 @@
|
|||
|
||||
<div class="messages-container" on:scroll={ onScroll } bind:this={ scrollTarget }>
|
||||
{#each $messages as message (message.id)}
|
||||
{#if message._showDateMarkerAbove}
|
||||
{#if message._aboveDateMarker}
|
||||
<div class="time-separator">
|
||||
<span>{ new Intl.DateTimeFormat(getItem("ui:locale"), { month: "long", day: "numeric", year: "numeric" }).format(message._createdAtDate) }</span>
|
||||
<span>{ message._aboveDateMarker }</span>
|
||||
</div>
|
||||
{/if}
|
||||
<Message message={message} />
|
||||
|
|
|
@ -152,7 +152,7 @@ class MessageStore extends Store {
|
|||
message._mentions = false;
|
||||
message._editable = false;
|
||||
message._clumped = false;
|
||||
message._showDateMarkerAbove = false;
|
||||
message._aboveDateMarker = null;
|
||||
if (userInfoStore.value && message.content.includes("@" + userInfoStore.value.username)) {
|
||||
message._mentions = true;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ class MessageStore extends Store {
|
|||
message._clumped = true;
|
||||
}
|
||||
if (previous && (previous._createdAtDateString !== message._createdAtDateString)) {
|
||||
message._showDateMarkerAbove = true;
|
||||
message._aboveDateMarker = new Intl.DateTimeFormat(getItem("ui:locale"), { month: "long", day: "numeric", year: "numeric" }).format(message._createdAtDate);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue