Skip to content

Commit 45d4fcd

Browse files
authored
Multiple fixes (#47)
* Invert colors for the read vs unread partially read threads overview Signed-off-by: Kai Wagner <kai.wagner@percona.com> * aligned desktop thread titles by reserving a fixed icon column width Signed-off-by: Kai Wagner <kai.wagner@percona.com> * fixed z-index for hover over icon in mobile view Signed-off-by: Kai Wagner <kai.wagner@percona.com> * add button to thread view that allows you to jump to the first unread message directly Signed-off-by: Kai Wagner <kai.wagner@percona.com> * topic titles break instead of showing a scrollbar Signed-off-by: Kai Wagner <kai.wagner@percona.com> * removed unnecessary checks, as reading means we do have at least one unread message Signed-off-by: Kai Wagner <kai.wagner@percona.com> --------- Signed-off-by: Kai Wagner <kai.wagner@percona.com>
1 parent 866c1b9 commit 45d4fcd

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed

app/assets/stylesheets/components/topics.css

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ a.topic-icon {
239239
gap: var(--spacing-2);
240240
}
241241

242+
.topic-title-icons {
243+
min-width: 0;
244+
}
245+
242246
.topic-icon {
243247
padding: 2px;
244248
margin-right: 0;
@@ -303,6 +307,14 @@ a.topic-icon {
303307
}
304308
}
305309

310+
.topic-row.topic-reading.has-new-replies {
311+
background: var(--color-bg-unread);
312+
313+
&:hover {
314+
background: var(--color-bg-unread-hover);
315+
}
316+
}
317+
306318
.topic-row.topic-read {
307319
color: var(--color-text-muted);
308320
background: var(--color-bg-read);
@@ -320,6 +332,8 @@ a.topic-icon {
320332
padding: var(--spacing-2) var(--spacing-4) var(--spacing-2) var(--spacing-2);
321333
align-self: stretch;
322334
height: 100%;
335+
min-width: var(--topic-title-icons-width, 190px);
336+
flex-shrink: 0;
323337
}
324338

325339
.status-border.has-new-replies::before {
@@ -329,7 +343,7 @@ a.topic-icon {
329343
top: 0;
330344
bottom: 0;
331345
width: var(--topic-new-replies-strip-width, 260px);
332-
background: var(--color-bg-unread);
346+
background: var(--color-bg-read);
333347
clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
334348
z-index: 0;
335349
}
@@ -429,8 +443,7 @@ a.topic-icon {
429443

430444
.topic-title-main {
431445
display: grid;
432-
grid-auto-flow: column;
433-
grid-auto-columns: max-content;
446+
grid-template-columns: max-content minmax(0, 1fr);
434447
align-items: stretch;
435448
gap: var(--spacing-2);
436449
height: 100%;
@@ -511,6 +524,7 @@ a.topic-icon {
511524

512525
.topic-title-mobile {
513526
display: flex;
527+
z-index: auto;
514528
}
515529

516530
.topic-row-footer {
@@ -531,6 +545,9 @@ a.topic-icon {
531545
font-size: var(--font-size-2xs);
532546
}
533547

548+
.topic-icon-hover {
549+
z-index: 200;
550+
}
534551
}
535552

536553
.topic-link {
@@ -539,6 +556,9 @@ a.topic-icon {
539556
font-weight: var(--font-weight-semibold);
540557
font-size: var(--font-size-lg);
541558
line-height: var(--line-height-relaxed);
559+
min-width: 0;
560+
white-space: normal;
561+
overflow-wrap: anywhere;
542562

543563
&:hover {
544564
color: var(--color-text-link-hover);

app/views/topics/_status_cell.html.slim

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@
55
- total_count = topic.message_count
66
- reading_unread_count = [total_count - read_count, 0].max
77
- status_class = "status-#{status}"
8-
- status_class = "#{status_class} has-new-replies" if status.to_s == "reading" && reading_unread_count.to_i.positive?
8+
- status_class = "#{status_class} has-new-replies" if status.to_s == "reading"
99
- star_data = star_data || {}
1010
td.topic-title.status-border class=status_class id=dom_id(topic, "status_cell") data-label="Topic"
1111
- creator = topic.creator_display_alias
1212
- last_sender = topic.last_sender_person&.default_alias
1313
.topic-title-main
1414
.topic-title-icons
1515
- if status.to_s == "reading"
16-
- if reading_unread_count.to_i.positive?
17-
= link_to topic_path(topic, anchor: "first-unread"), class: "topic-icon topic-icon-reading", title: "Jump to first unread message (#{reading_unread_count} unread)" do
18-
i.fa-solid.fa-envelope
19-
span.topic-icon-badge.topic-icon-badge-sup = reading_unread_count
20-
- else
21-
.topic-icon.topic-icon-reading title="All messages read"
22-
i.fa-solid.fa-envelope
16+
= link_to topic_path(topic, anchor: "first-unread"), class: "topic-icon topic-icon-reading", title: "Jump to first unread message (#{reading_unread_count} unread)" do
17+
i.fa-solid.fa-envelope
18+
span.topic-icon-badge.topic-icon-badge-sup = reading_unread_count
2319
= render partial: "topics/star_icon", locals: { topic: topic, star_data: star_data }
2420
= render partial: "topics/note_icon", locals: { topic: topic, count: note_count.to_i }
2521
= render partial: "topics/team_readers_icon", locals: { topic: topic, readers: team_readers }
@@ -47,13 +43,9 @@ td.topic-title.status-border class=status_class id=dom_id(topic, "status_cell")
4743
.topic-icons
4844
.topic-title-icons
4945
- if status.to_s == "reading"
50-
- if reading_unread_count.to_i.positive?
51-
= link_to topic_path(topic, anchor: "first-unread"), class: "topic-icon topic-icon-reading", title: "Jump to first unread message (#{reading_unread_count} unread)" do
52-
i.fa-solid.fa-envelope
53-
span.topic-icon-badge.topic-icon-badge-sup = reading_unread_count
54-
- else
55-
.topic-icon.topic-icon-reading title="All messages read"
56-
i.fa-solid.fa-envelope
46+
= link_to topic_path(topic, anchor: "first-unread"), class: "topic-icon topic-icon-reading", title: "Jump to first unread message (#{reading_unread_count} unread)" do
47+
i.fa-solid.fa-envelope
48+
span.topic-icon-badge.topic-icon-badge-sup = reading_unread_count
5749
= render partial: "topics/star_icon", locals: { topic: topic, star_data: star_data }
5850
= render partial: "topics/note_icon", locals: { topic: topic, count: note_count.to_i }
5951
= render partial: "topics/team_readers_icon", locals: { topic: topic, readers: team_readers }

app/views/topics/_topic_row_user.html.slim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
- participation = participation || {}
44
- team_readers = team_readers || []
55
- star_data = star_data || {}
6+
- status = state[:status] || "new"
7+
- row_class = ["topic-row", "topic-#{status}"]
8+
- row_class << "has-new-replies" if status.to_s == "reading"
69
- topic_participants_map ||= @topic_participants_map || {}
710
- tp_data = topic_participants_map[topic.id] || {}
811
- top_participants = tp_data[:top] || []
912
- contributor_participants = tp_data[:contributors] || []
1013

11-
tr id=dom_id(topic) class="topic-row topic-#{state[:status] || 'new'}" data-topic-id=topic.id data-last-message-id=topic.last_message_id
14+
tr id=dom_id(topic) class=row_class.join(" ") data-topic-id=topic.id data-last-message-id=topic.last_message_id
1215
= render partial: "topics/status_cell", locals: { topic: topic, state: state, note_count: note_count, team_readers: team_readers, star_data: star_data }
1316
td.topic-activity data-label="Activity"
1417
- replies_count = [topic.message_count - 1, 0].max

app/views/topics/show.html.slim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@
200200
- if user_signed_in?
201201
button.button.button-secondary.button-small data-action="click->thread-actions#markAllRead" Mark all messages read
202202
= link_to "Jump to latest", "#message-#{last_message.id}", class: "button button-secondary button-small", title: "Jump to latest message", "aria-label": "Jump to latest message"
203+
- if user_signed_in?
204+
= link_to "Jump to unread", "#first-unread", class: "button button-secondary button-small", title: "Jump to first unread message", "aria-label": "Jump to first unread message"
203205

204206
- first_unread_found = false
205207
- @messages.each do |message|

0 commit comments

Comments
 (0)