UX: Tweak last-visit/date separators (#20601)

1. Restore the left margin on both (which reflects the right margin of the scroll bar space)
2. Fix the center alignment of scroll-to-bottom icon
3. Fix the spacing of the `-` character between a date label and "last visit" label
4. Fix the incorrect display the border on date label when at the bottom of viewport
This commit is contained in:
Jarek Radosz 2023-03-09 13:44:02 +01:00 committed by GitHub
parent a99218677f
commit 3c4bfb6a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 13 deletions

View File

@ -14,7 +14,7 @@
{{#if @message.newest}} {{#if @message.newest}}
<span class="chat-message-separator__last-visit"> <span class="chat-message-separator__last-visit">
- <span class="chat-message-separator__last-visit-separator">-</span>
{{i18n "chat.last_visit"}} {{i18n "chat.last_visit"}}
</span> </span>
{{/if}} {{/if}}

View File

@ -16,11 +16,15 @@ export default class ChatTrackMessageSeparatorDate extends Modifier {
modify(element) { modify(element) {
this.intersectionObserver = new IntersectionObserver( this.intersectionObserver = new IntersectionObserver(
([event]) => { ([entry]) => {
if (event.isIntersecting && event.intersectionRatio < 1) { if (
event.target.classList.add(IS_PINNED_CLASS); entry.isIntersecting &&
entry.intersectionRatio < 1 &&
entry.boundingClientRect.y < entry.intersectionRect.y
) {
entry.target.classList.add(IS_PINNED_CLASS);
} else { } else {
event.target.classList.remove(IS_PINNED_CLASS); entry.target.classList.remove(IS_PINNED_CLASS);
} }
}, },
{ threshold: [0, 1] } { threshold: [0, 1] }

View File

@ -3,14 +3,15 @@
display: flex; display: flex;
&-new { &-new {
display: flex;
justify-content: center;
padding: 20px 0 20px 1em;
position: relative; position: relative;
padding: 20px 0;
.chat-message-separator__text-container { .chat-message-separator__text-container {
text-align: center; text-align: center;
position: absolute; position: absolute;
height: 40px; height: 40px;
width: 100%;
box-sizing: border-box; box-sizing: border-box;
z-index: 1; z-index: 1;
top: 0; top: 0;
@ -28,20 +29,22 @@
.chat-message-separator__line-container { .chat-message-separator__line-container {
width: 100%; width: 100%;
}
.chat-message-separator__line { .chat-message-separator__line {
border-top: 1px solid var(--danger-medium); border-top: 1px solid var(--danger-medium);
}
} }
} }
&-date { &-date {
box-sizing: border-box;
position: absolute; position: absolute;
width: 100%; width: 100%;
z-index: 2; z-index: 2;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
justify-content: center; justify-content: center;
padding-left: 1rem;
pointer-events: none; pointer-events: none;
&.with-last-visit { &.with-last-visit {
@ -60,7 +63,7 @@
&.is-pinned, &.is-pinned,
&.is-force-pinned { &.is-force-pinned {
.chat-message-separator__text { .chat-message-separator__text {
border: 1px solid var(--primary-medium); border: 1px solid var(--secondary-high);
border-radius: 3px; border-radius: 3px;
} }
@ -70,6 +73,14 @@
} }
} }
.chat-message-separator__last-visit {
display: flex;
}
.chat-message-separator__last-visit-separator {
margin: 0 0.25rem;
}
.chat-message-separator__text { .chat-message-separator__text {
@include unselectable; @include unselectable;
background-color: var(--secondary); background-color: var(--secondary);
@ -82,7 +93,7 @@
} }
& + .chat-message-separator__line-container { & + .chat-message-separator__line-container {
padding: 20px 0; padding: 20px 0 20px 1em;
box-sizing: border-box; box-sizing: border-box;
.chat-message-separator__line { .chat-message-separator__line {

View File

@ -326,11 +326,13 @@ $float-height: 530px;
} }
.scroll-stick-wrap { .scroll-stick-wrap {
display: flex;
justify-content: center;
margin: 0 1rem;
position: relative; position: relative;
} }
.chat-scroll-to-bottom { .chat-scroll-to-bottom {
left: calc(50% - calc(32px / 2));
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: absolute; position: absolute;