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: Add logic and styles to show unreads on selected home view.

Karl Stolley5d2d8f921549
diff --git a/web/src/left_sidebar_navigation_area.js b/web/src/left_sidebar_navigation_area.js
index 35ca0f7cbba..2de7c6cceab 100644
--- a/web/src/left_sidebar_navigation_area.js
+++ b/web/src/left_sidebar_navigation_area.js
@@ -26,12 +26,12 @@ export function update_scheduled_messages_row() {
export function update_dom_with_unread_counts(counts, skip_animations) {
// Note that direct message counts are handled in pm_list.js.
- // mentioned/inbox have simple integer counts
+ // mentioned/home views have simple integer counts
const $mentioned_li = $(".top_left_mentions");
- const $inbox_li = $(".top_left_inbox");
+ const $home_view_li = $(".selected-home-view");
ui_util.update_unread_count_in_dom($mentioned_li, counts.mentioned_message_count);
- ui_util.update_unread_count_in_dom($inbox_li, counts.home_unread_messages);
+ ui_util.update_unread_count_in_dom($home_view_li, counts.home_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 ff288f650a7..66a7e5bcef4 100644
--- a/web/styles/left_sidebar.css
+++ b/web/styles/left_sidebar.css
@@ -604,6 +604,19 @@ li.active-sub-filter {
border: 0.5px solid var(--color-border-unread-counter);
}
+/* Don't show unread counts on views... */
+.top_left_inbox,
+.top_left_recent_view,
+.top_left_all_messages {
+ .unread_count {
+ visibility: hidden;
+ }
+ /* ...unless it's the selected home view. */
+ &.selected-home-view .unread_count {
+ visibility: visible;
+ }
+}
+
/* Don't show the scheduled messages item... */
li.top_left_scheduled_messages {
display: none;
diff --git a/web/tests/left_sidebar_navigation_area.test.js b/web/tests/left_sidebar_navigation_area.test.js
index 8727e094d52..be5281ab025 100644
--- a/web/tests/left_sidebar_navigation_area.test.js
+++ b/web/tests/left_sidebar_navigation_area.test.js
@@ -80,6 +80,8 @@ run_test("update_count_in_dom", () => {
make_elem($(".top_left_inbox"), "<home-count>");
+ make_elem($(".selected-home-view"), "<home-count>");
+
make_elem($(".top_left_starred_messages"), "<starred-count>");
make_elem($(".top_left_scheduled_messages"), "<scheduled-count>");