Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
left_sidebar: Improve logic for showing Scheduled messages.
Karl Stolley41635566fd16
diff --git a/web/src/left_sidebar_navigation_area.js b/web/src/left_sidebar_navigation_area.jsindex e8a231b5df5..f62946cfe5d 100644--- a/web/src/left_sidebar_navigation_area.js+++ b/web/src/left_sidebar_navigation_area.js@@ -15,9 +15,9 @@ export function update_scheduled_messages_row() {const $scheduled_li = $(".top_left_scheduled_messages");const count = scheduled_messages.get_count();if (count > 0) {- $scheduled_li.show();+ $scheduled_li.addClass("show-with-scheduled-messages");} else {- $scheduled_li.hide();+ $scheduled_li.removeClass("show-with-scheduled-messages");}ui_util.update_unread_count_in_dom($scheduled_li, count);}diff --git a/web/src/left_sidebar_navigation_area_popovers.js b/web/src/left_sidebar_navigation_area_popovers.jsindex f848fdc4774..e92a015374a 100644--- a/web/src/left_sidebar_navigation_area_popovers.js+++ b/web/src/left_sidebar_navigation_area_popovers.js@@ -108,8 +108,17 @@ export function initialize() {popover_menus.register_popover_menu(".left-sidebar-navigation-menu-icon", {...popover_menus.left_sidebar_tippy_options,onShow(instance) {+ // Determine at show time whether there are scheduled messages,+ // so that Tippy properly calculates the height of the popover+ const scheduled_message_count = scheduled_messages.get_count();+ let has_scheduled_messages = false;+ if (scheduled_message_count > 0) {+ has_scheduled_messages = true;+ }popovers.hide_all();- instance.setContent(parse_html(render_left_sidebar_condensed_views_popover()));+ instance.setContent(+ parse_html(render_left_sidebar_condensed_views_popover({has_scheduled_messages})),+ );},onMount() {update_unread_count_in_dom(diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.cssindex 02951ffbefd..2e81d56399d 100644--- a/web/styles/left_sidebar.css+++ b/web/styles/left_sidebar.css@@ -615,6 +615,15 @@ li.top_left_scheduled_messages {}}+/* Don't show the scheduled messages item... */+li.top_left_scheduled_messages {+ display: none;+ /* ...unless there are scheduled messages to show. */+ &.show-with-scheduled-messages {+ display: list-item;+ }+}+.top_left_row {padding-left: $far_left_gutter_size;padding-right: 10px;diff --git a/web/templates/popovers/left_sidebar_condensed_views_popover.hbs b/web/templates/popovers/left_sidebar_condensed_views_popover.hbsindex 0f8e2b5db92..d9ffdfbe3ab 100644--- a/web/templates/popovers/left_sidebar_condensed_views_popover.hbs+++ b/web/templates/popovers/left_sidebar_condensed_views_popover.hbs@@ -10,6 +10,7 @@<span class="unread_count"></span></a></li>+ {{#if has_scheduled_messages }}<li class="condensed-views-popover-menu-scheduled-messages"><a tabindex="0" href="#scheduled" class="left-sidebar-popover-icon-label-count"><span class="filter-icon">@@ -19,4 +20,5 @@<span class="unread_count"></span></a></li>+ {{/if}}</ul>