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.
This commit is contained in:
Rinwaoluwa 2024-01-07 19:28:51 +01:00 committed by Tim Abbott
parent 497bd740e9
commit afe3bcd6c5

View File

@ -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();