Skip to content

Commit 90fd9df

Browse files
authored
Change the 'unread' image and also show the number of unread up to 9+ (#13)
Signed-off-by: Kai Wagner <kai.wagner@percona.com>
1 parent 7723f84 commit 90fd9df

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

app/assets/stylesheets/components/topics.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@
123123
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
124124
}
125125

126+
.topic-icon-badge-sup {
127+
bottom: -6px;
128+
right: -6px;
129+
border-radius: 6px;
130+
padding: 2px 6px;
131+
font-variant-numeric: tabular-nums;
132+
}
133+
126134
.status-border {
127135
border-left: 8px solid transparent;
128136
}

app/views/topics/_topics.html.slim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
tr class="topic-row topic-#{state[:status]}" data-topic-id=topic.id data-last-message-id=topic.messages.maximum(:id)
99
td class="topic-title status-border status-#{state[:status] || 'new'}" data-label="Topic"
1010
- if state[:status] == :reading
11+
- unread_count = [topic.messages.count - state[:read_count], 0].max
1112
.topic-icon.topic-icon-reading
12-
i.fa-solid.fa-message
13-
- unread_count = topic.messages.count - state[:read_count]
14-
span.topic-icon-badge = unread_count < 10 ? unread_count : "9+"
13+
i.fa-solid.fa-envelope
14+
- if unread_count.positive?
15+
span.topic-icon-badge.topic-icon-badge-sup = unread_count
1516
- if user_signed_in? && other_team_readers.any?
1617
- reader_count = other_team_readers.size
1718
div class="topic-icon activity-team-read" data-controller="hover-popover" data-hover-popover-delay-value="200" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide"

0 commit comments

Comments
 (0)