Skip to content

Commit c9c2a73

Browse files
authored
UX: thread list design changes (#23348)
1 parent dac4f97 commit c9c2a73

File tree

4 files changed

+39
-46
lines changed

4 files changed

+39
-46
lines changed

plugins/chat/assets/javascripts/discourse/components/chat/thread-list/item.hbs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
{{on "click" (fn this.openThread @thread) passive=true}}
1515
>
1616
<div class="chat-thread-list-item__header">
17-
<div class="chat-thread-list-item__om-user-avatar">
18-
<Chat::UserAvatar @user={{@thread.originalMessage.user}} />
19-
</div>
2017
<div class="chat-thread-list-item__title">
2118
{{#if this.title}}
2219
{{replace-emoji this.title}}
@@ -31,29 +28,31 @@
3128

3229
<div class="chat-thread-list-item__body">
3330
<span class="chat-thread-list-item__last-reply-author">
34-
{{@thread.preview.lastReplyUser.username}}:
31+
@{{@thread.preview.lastReplyUser.username}}:
3532
</span>
3633
<span class="chat-thread-list-item__last-reply-excerpt">
3734
{{replace-emoji (html-safe @thread.preview.lastReplyExcerpt)}}
3835
</span>
3936
</div>
4037

4138
<div class="chat-thread-list-item__metadata">
42-
<Chat::Thread::Participants
43-
@thread={{@thread}}
44-
@includeOriginalMessageUser={{false}}
45-
class="chat-thread-list-item__participants"
46-
/>
47-
<span class="chat-thread-list-item__replies-count">
48-
{{i18n "chat.thread.replies" count=@thread.preview.replyCount}}
49-
</span>
50-
<span class="chat-thread-list-item__metadata__separator">·</span>
39+
5140
<div class="chat-thread-list-item__last-reply-timestamp">
5241
{{#if @thread.preview.lastReplyCreatedAt}}
5342
<span>{{i18n "chat.thread.last_reply"}}</span>
5443
{{format-date @thread.preview.lastReplyCreatedAt leaveAgo="true"}}
5544
{{/if}}
5645
</div>
46+
47+
<Chat::UserAvatar
48+
@user={{@thread.originalMessage.user}}
49+
@showPresence={{false}}
50+
/>
51+
<Chat::Thread::Participants
52+
@thread={{@thread}}
53+
@includeOriginalMessageUser={{false}}
54+
class="chat-thread-list-item__participants"
55+
/>
5756
</div>
5857
</div>
5958
</div>

plugins/chat/assets/stylesheets/common/chat-thread-list-item.scss

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
.chat-thread-list-item {
1111
@include thread-list-item;
1212
cursor: pointer;
13-
margin: 0.25rem;
13+
margin: 0.75rem;
1414

1515
& + .chat-thread-list-item {
1616
margin-top: 0;
@@ -44,7 +44,10 @@
4444
&__body {
4545
padding-bottom: 0.25rem;
4646
word-break: break-word;
47-
margin: 0.5rem 0rem;
47+
overflow: hidden;
48+
display: -webkit-box;
49+
-webkit-box-orient: vertical;
50+
-webkit-line-clamp: 2;
4851

4952
> * {
5053
pointer-events: none;
@@ -53,34 +56,35 @@
5356

5457
&__last-reply-author {
5558
font-weight: 700;
59+
font-size: var(--font-down-1);
60+
color: var(--primary-high);
5661
}
5762

5863
&__metadata {
5964
display: flex;
6065
align-items: center;
61-
justify-content: space-between;
62-
}
66+
justify-content: flex-end;
6367

64-
&__metadata__separator {
65-
padding-inline: 0.5rem;
66-
font-weight: 700;
67-
font-size: 20px;
68-
text-align: center;
68+
.chat-user-avatar {
69+
.avatar {
70+
border: 1px solid var(--primary-very-low);
71+
}
72+
73+
&:not(:last-child) {
74+
margin-right: -8px;
75+
}
76+
}
6977
}
7078

7179
&__participants {
7280
margin-right: 0.25rem;
7381
}
7482

75-
&__replies-count {
76-
margin-left: auto;
77-
}
78-
79-
&__last-reply-timestamp,
80-
&__replies-count {
81-
color: var(--secondary-low);
82-
font-size: var(--font-down-1);
83+
&__last-reply-timestamp {
84+
color: var(--primary-medium);
85+
font-size: var(--font-down-2);
8386
@include ellipsis;
87+
margin-right: auto;
8488
}
8589

8690
&__header {
@@ -92,13 +96,12 @@
9296

9397
&__title {
9498
flex: 1 1 auto;
95-
font-weight: 500;
96-
font-size: var(--font-up-1);
99+
font-weight: bold;
97100
@include ellipsis;
98101
}
99102

100103
&__last-reply-excerpt {
101-
font-size: var(--font-0);
104+
font-size: var(--font-down-1);
102105
}
103106

104107
&__unread-indicator {
@@ -118,7 +121,7 @@
118121
}
119122

120123
&__om-user-avatar {
121-
margin-right: 0.25rem;
124+
margin-right: 0.5rem;
122125
flex: 0 0 auto;
123126
}
124127
}

plugins/chat/assets/stylesheets/common/chat-thread-participants.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
font-size: var(--font-down-2);
44
color: var(--primary-high);
55
white-space: nowrap;
6+
margin-left: 0.25rem;
67
}
78

89
&__avatar-group {

plugins/chat/spec/system/thread_list/full_page_spec.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@
108108
)
109109
end
110110

111-
it "shows the thread original message user avatar" do
111+
it "doesn’t show the thread original message user avatar" do
112112
chat_page.visit_channel(channel)
113113
channel_page.open_thread_list
114-
expect(thread_list_page.item_by_id(thread_1.id)).to have_css(
114+
expect(thread_list_page.item_by_id(thread_1.id)).to have_no_css(
115115
thread_list_page.avatar_selector(thread_1.original_message.user),
116116
)
117117
end
@@ -126,16 +126,6 @@
126126
)
127127
end
128128

129-
it "shows replies count" do
130-
chat_page.visit_channel(channel)
131-
channel_page.open_thread_list
132-
133-
expect(thread_list_page.item_by_id(thread_1.id)).to have_css(
134-
".chat-thread-list-item__replies-count",
135-
text: I18n.t("js.chat.thread.replies", count: thread_1.replies_count_cache),
136-
)
137-
end
138-
139129
it "shows participants" do
140130
chat_page.visit_channel(channel)
141131
channel_page.open_thread_list

0 commit comments

Comments
 (0)