Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

left_sidebar: Grid 'Back to streams' with unread count.

Karl Stolleyae146c3df778
diff --git a/web/src/left_sidebar_navigation_area.js b/web/src/left_sidebar_navigation_area.js
index 6cdbcb67144..a96f9acd9ac 100644
--- a/web/src/left_sidebar_navigation_area.js
+++ b/web/src/left_sidebar_navigation_area.js
@@ -31,10 +31,12 @@ export function update_dom_with_unread_counts(counts, skip_animations) {
const $mentioned_li = $(".top_left_mentions");
const $home_view_li = $(".selected-home-view");
const $streams_header = $("#streams_header");
+ const $back_to_streams = $("#topics_header");
ui_util.update_unread_count_in_dom($mentioned_li, counts.mentioned_message_count);
ui_util.update_unread_count_in_dom($home_view_li, counts.home_unread_messages);
ui_util.update_unread_count_in_dom($streams_header, counts.stream_unread_messages);
+ ui_util.update_unread_count_in_dom($back_to_streams, counts.stream_unread_messages);
if (!skip_animations) {
animate_mention_changes($mentioned_li, counts.mentioned_message_count);
diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css
index bd515d79a86..e6846c81265 100644
--- a/web/styles/left_sidebar.css
+++ b/web/styles/left_sidebar.css
@@ -773,7 +773,8 @@ li.top_left_scheduled_messages {
}
#private_messages_section_header,
-#streams_header {
+#streams_header,
+#topics_header {
display: grid;
align-items: center;
/* This extends the general pattern of left sidebar rows, but includes a
@@ -1139,12 +1140,14 @@ li.topic-list-item {
position: sticky;
top: 0;
z-index: 2;
- margin-right: 10px;
+ grid-template-columns: 0 0 minmax(0, 1fr) max-content 0 42px;
+ grid-template-rows: 24px;
padding-top: $sections_vertical_gutter;
color: hsl(0deg 0% 43%);
background-color: var(--color-background);
.show-all-streams {
+ grid-area: row-content;
color: inherit;
text-decoration: none;
text-transform: uppercase;
@@ -1156,6 +1159,10 @@ li.topic-list-item {
top: 1px;
}
}
+
+ .unread_count {
+ grid-area: markers-and-controls;
+ }
}
#streams_header {
@@ -1336,6 +1343,7 @@ li.topic-list-item {
background-color: var(--color-background);
}
+ #streams_header,
#subscribe-to-more-streams,
.show-more-topics {
display: none;
diff --git a/web/templates/left_sidebar.hbs b/web/templates/left_sidebar.hbs
index c4545c77473..ea043c23fd3 100644
--- a/web/templates/left_sidebar.hbs
+++ b/web/templates/left_sidebar.hbs
@@ -175,7 +175,7 @@
</div>
</div>
<div id="topics_header">
- <a class="show-all-streams" tabindex="0">{{t 'Back to streams' }}</a>
+ <a class="show-all-streams" tabindex="0">{{t 'Back to streams' }}</a> <span class="unread_count"></span>
</div>
<div id="stream-filters-container">
<ul id="stream_filters" class="filters"></ul>
diff --git a/web/tests/left_sidebar_navigation_area.test.js b/web/tests/left_sidebar_navigation_area.test.js
index ecc305f31a2..16df32d069e 100644
--- a/web/tests/left_sidebar_navigation_area.test.js
+++ b/web/tests/left_sidebar_navigation_area.test.js
@@ -96,6 +96,8 @@ run_test("update_count_in_dom", () => {
make_elem($("#streams_header"), "<stream-count>");
+ make_elem($("#topics_header"), "<topics-count>");
+
left_sidebar_navigation_area.update_dom_with_unread_counts(counts, false);
left_sidebar_navigation_area.update_starred_count(444);
// Calls left_sidebar_navigation_area.update_scheduled_messages_row
@@ -106,6 +108,7 @@ run_test("update_count_in_dom", () => {
assert.equal($("<starred-count>").text(), "444");
assert.equal($("<scheduled-count>").text(), "555");
assert.equal($("<stream-count>").text(), "666");
+ assert.equal($("<topics-count>").text(), "666");
counts.mentioned_message_count = 0;
scheduled_messages.get_count = () => 0;