From afe3bcd6c58f35b1aa152f782391e9748c7f8a2e Mon Sep 17 00:00:00 2001 From: Rinwaoluwa Date: Sun, 7 Jan 2024 19:28:51 +0100 Subject: [PATCH] left_sidebar: Simplify deselection with deselect_top_left_corner_item. Refactoring to avoid duplication, improve readability, and standardize deselection logic by converting calls to remove to deselect_top_left_corner_items. --- web/src/left_sidebar_navigation_area.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/web/src/left_sidebar_navigation_area.js b/web/src/left_sidebar_navigation_area.js index a489f00d81..9793c52ce3 100644 --- a/web/src/left_sidebar_navigation_area.js +++ b/web/src/left_sidebar_navigation_area.js @@ -154,10 +154,8 @@ function do_new_messages_animation($li) { } export function highlight_inbox_view() { - remove($(".top_left_all_messages")); - remove($(".top_left_starred_messages")); - remove($(".top_left_recent_view")); - remove($(".top_left_mentions")); + deselect_top_left_corner_items(); + $(".top_left_inbox").addClass("active-filter"); setTimeout(() => { resize.resize_stream_filters_container(); @@ -165,10 +163,8 @@ export function highlight_inbox_view() { } export function highlight_recent_view() { - remove($(".top_left_all_messages")); - remove($(".top_left_starred_messages")); - remove($(".top_left_mentions")); - remove($(".top_left_inbox")); + deselect_top_left_corner_items(); + $(".top_left_recent_view").addClass("active-filter"); setTimeout(() => { resize.resize_stream_filters_container(); @@ -176,10 +172,8 @@ export function highlight_recent_view() { } export function highlight_all_messages_view() { - remove($(".top_left_starred_messages")); - remove($(".top_left_mentions")); - remove($(".top_left_recent_view")); - remove($(".top_left_inbox")); + deselect_top_left_corner_items(); + $(".top_left_all_messages").addClass("active-filter"); setTimeout(() => { resize.resize_stream_filters_container();