Skip to content

Commit 5cb6421

Browse files
authored
changed read-row contrast and color, so it's easier to see what was read vs unread (#44)
Signed-off-by: Kai Wagner <[email protected]>
1 parent f297fca commit 5cb6421

File tree

3 files changed

+107
-42
lines changed

3 files changed

+107
-42
lines changed

app/assets/stylesheets/colors.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
--color-bg-card: var(--color-bg-container);
5454
--color-bg-card-hover: var(--color-gray-200);
5555
--color-bg-hover: var(--color-primary-2);
56+
--color-bg-read-hover: var(--color-primary-3);
57+
--color-bg-read: var(--color-primary-1);
58+
--color-bg-unread: var(--color-primary-2);
59+
--color-bg-unread-hover: var(--color-primary-3);
5660
--color-bg-sidebar: #f3f4ff;
5761
--color-bg-sidebar-header: var(--color-primary-2);
5862
--color-bg-table-header: var(--color-primary-2);
@@ -144,6 +148,10 @@
144148
--color-bg-card: var(--color-gray-100);
145149
--color-bg-card-hover: var(--color-gray-300);
146150
--color-bg-hover: var(--color-gray-300);
151+
--color-bg-read-hover: var(--color-primary-5);
152+
--color-bg-read: var(--color-primary-4);
153+
--color-bg-unread: var(--color-primary-2);
154+
--color-bg-unread-hover: var(--color-primary-3);
147155
--color-bg-sidebar: var(--color-primary-2);
148156
--color-bg-sidebar-header: var(--color-gray-100);
149157
--color-bg-table-header: var(--color-gray-100);

app/assets/stylesheets/components/topics.css

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ a.topic-icon {
142142

143143
.status-border {
144144
border-left: 8px solid transparent;
145+
position: relative;
146+
}
147+
148+
.topic-title-main,
149+
.topic-title-mobile {
150+
position: relative;
151+
z-index: 1;
145152
}
146153

147154
.status-border.status-new {
@@ -279,10 +286,55 @@ a.topic-icon {
279286
}
280287
}
281288

289+
.topic-row.topic-new,
290+
.topic-row.topic-reading {
291+
background: var(--color-bg-unread);
292+
293+
&:hover {
294+
background: var(--color-bg-unread-hover);
295+
}
296+
}
297+
298+
.topic-row.topic-reading {
299+
background: var(--color-bg-read);
300+
301+
&:hover {
302+
background: var(--color-bg-read-hover);
303+
}
304+
}
305+
282306
.topic-row.topic-read {
283307
color: var(--color-text-muted);
308+
background: var(--color-bg-read);
309+
310+
&:hover {
311+
background: var(--color-bg-read-hover);
312+
}
313+
}
314+
315+
.topic-title-icons {
316+
display: inline-flex;
317+
align-items: center;
318+
gap: var(--spacing-2);
319+
position: relative;
320+
padding: var(--spacing-2) var(--spacing-4) var(--spacing-2) var(--spacing-2);
321+
align-self: stretch;
322+
height: 100%;
284323
}
285324

325+
.status-border.has-new-replies::before {
326+
content: "";
327+
position: absolute;
328+
left: 0;
329+
top: 0;
330+
bottom: 0;
331+
width: var(--topic-new-replies-strip-width, 260px);
332+
background: var(--color-bg-unread);
333+
clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
334+
z-index: 0;
335+
}
336+
337+
286338
.topic-icon-hover {
287339
display: none;
288340
position: absolute;
@@ -376,9 +428,12 @@ a.topic-icon {
376428

377429

378430
.topic-title-main {
379-
display: inline-flex;
380-
align-items: center;
431+
display: grid;
432+
grid-auto-flow: column;
433+
grid-auto-columns: max-content;
434+
align-items: stretch;
381435
gap: var(--spacing-2);
436+
height: 100%;
382437
}
383438

384439
.topic-title-mobile {
Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
- status = state[:status] || "new"
2+
- reading_unread_count = nil
3+
- if status.to_s == "reading"
4+
- read_count = state[:read_count].to_i
5+
- total_count = topic.message_count
6+
- reading_unread_count = [total_count - read_count, 0].max
27
- status_class = "status-#{status}"
8+
- status_class = "#{status_class} has-new-replies" if status.to_s == "reading" && reading_unread_count.to_i.positive?
39
- star_data = star_data || {}
410
td.topic-title.status-border class=status_class id=dom_id(topic, "status_cell") data-label="Topic"
511
- creator = topic.creator_display_alias
612
- last_sender = topic.last_sender_person&.default_alias
713
.topic-title-main
8-
- if status.to_s == "reading"
9-
- read_count = state[:read_count].to_i
10-
- total_count = topic.message_count
11-
- unread_count = [total_count - read_count, 0].max
12-
- if unread_count.positive?
13-
= link_to topic_path(topic, anchor: "first-unread"), class: "topic-icon topic-icon-reading", title: "Jump to first unread message (#{unread_count} unread)" do
14-
i.fa-solid.fa-envelope
15-
span.topic-icon-badge.topic-icon-badge-sup = unread_count
16-
- else
17-
.topic-icon.topic-icon-reading title="All messages read"
18-
i.fa-solid.fa-envelope
19-
= render partial: "topics/star_icon", locals: { topic: topic, star_data: star_data }
20-
= render partial: "topics/note_icon", locals: { topic: topic, count: note_count.to_i }
21-
= render partial: "topics/team_readers_icon", locals: { topic: topic, readers: team_readers }
22-
- commitfest_summary = @commitfest_summaries&.dig(topic.id)
23-
- if commitfest_summary
24-
= render partial: "topics/commitfest_icon", locals: { summary: commitfest_summary }
25-
- elsif topic.has_attachments?
26-
.topic-icon title="Attachments"
27-
i.fa-solid.fa-paperclip
14+
.topic-title-icons
15+
- 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
23+
= render partial: "topics/star_icon", locals: { topic: topic, star_data: star_data }
24+
= render partial: "topics/note_icon", locals: { topic: topic, count: note_count.to_i }
25+
= render partial: "topics/team_readers_icon", locals: { topic: topic, readers: team_readers }
26+
- commitfest_summary = @commitfest_summaries&.dig(topic.id)
27+
- if commitfest_summary
28+
= render partial: "topics/commitfest_icon", locals: { summary: commitfest_summary }
29+
- elsif topic.has_attachments?
30+
.topic-icon title="Attachments"
31+
i.fa-solid.fa-paperclip
2832
= link_to topic.title, topic_path(topic), class: "topic-link"
2933
.topic-title-mobile
3034
= link_to topic.title, topic_path(topic), class: "topic-link"
@@ -41,26 +45,24 @@ td.topic-title.status-border class=status_class id=dom_id(topic, "status_cell")
4145
.topic-row-footer
4246
.topic-footer-icons
4347
.topic-icons
44-
- if status.to_s == "reading"
45-
- read_count = state[:read_count].to_i
46-
- total_count = topic.message_count
47-
- unread_count = [total_count - read_count, 0].max
48-
- if unread_count.positive?
49-
= link_to topic_path(topic, anchor: "first-unread"), class: "topic-icon topic-icon-reading", title: "Jump to first unread message (#{unread_count} unread)" do
50-
i.fa-solid.fa-envelope
51-
span.topic-icon-badge.topic-icon-badge-sup = unread_count
52-
- else
53-
.topic-icon.topic-icon-reading title="All messages read"
54-
i.fa-solid.fa-envelope
55-
= render partial: "topics/star_icon", locals: { topic: topic, star_data: star_data }
56-
= render partial: "topics/note_icon", locals: { topic: topic, count: note_count.to_i }
57-
= render partial: "topics/team_readers_icon", locals: { topic: topic, readers: team_readers }
58-
- commitfest_summary = @commitfest_summaries&.dig(topic.id)
59-
- if commitfest_summary
60-
= render partial: "topics/commitfest_icon", locals: { summary: commitfest_summary }
61-
- elsif topic.has_attachments?
62-
.topic-icon title="Attachments"
63-
i.fa-solid.fa-paperclip
48+
.topic-title-icons
49+
- 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
57+
= render partial: "topics/star_icon", locals: { topic: topic, star_data: star_data }
58+
= render partial: "topics/note_icon", locals: { topic: topic, count: note_count.to_i }
59+
= render partial: "topics/team_readers_icon", locals: { topic: topic, readers: team_readers }
60+
- commitfest_summary = @commitfest_summaries&.dig(topic.id)
61+
- if commitfest_summary
62+
= render partial: "topics/commitfest_icon", locals: { summary: commitfest_summary }
63+
- elsif topic.has_attachments?
64+
.topic-icon title="Attachments"
65+
i.fa-solid.fa-paperclip
6466
- replies_count = [topic.message_count - 1, 0].max
6567
.topic-footer-replies = pluralize(replies_count, "reply")
6668
.topic-footer-time title=absolute_time_display(topic.last_message_at) = smart_time_display(topic.last_message_at)

0 commit comments

Comments
 (0)