From 30f65e5e2dd6737bbd1b372c3124ec5148a694f0 Mon Sep 17 00:00:00 2001 From: opmkumar Date: Tue, 18 Jun 2024 15:05:02 +0530 Subject: [PATCH] left sidebar: Make Views label visible for spectators. We don't include the toggle functionality, to avoid needing to design what a collapsed Views thing would look like. Fixes #30324. --- web/src/left_sidebar_navigation_area.ts | 6 ++++++ web/src/sidebar_ui.ts | 1 + web/styles/left_sidebar.css | 5 +++++ web/templates/left_sidebar.hbs | 4 ++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/web/src/left_sidebar_navigation_area.ts b/web/src/left_sidebar_navigation_area.ts index 99863eeddd..c784b9fcf6 100644 --- a/web/src/left_sidebar_navigation_area.ts +++ b/web/src/left_sidebar_navigation_area.ts @@ -130,6 +130,12 @@ export function handle_narrow_activated(filter: Filter): void { function toggle_condensed_navigation_area(): void { const $views_label_container = $("#views-label-container"); const $views_label_icon = $("#toggle-top-left-navigation-area-icon"); + + if (page_params.is_spectator) { + // We don't support collapsing VIEWS for spectators, so exit early. + return; + } + if ($views_label_container.hasClass("showing-expanded-navigation")) { // Toggle into the condensed state $views_label_container.addClass("showing-condensed-navigation"); diff --git a/web/src/sidebar_ui.ts b/web/src/sidebar_ui.ts index 1dbda94899..dc9bdc0099 100644 --- a/web/src/sidebar_ui.ts +++ b/web/src/sidebar_ui.ts @@ -219,6 +219,7 @@ export function initialize_left_sidebar(): void { is_recent_view_home_view: user_settings.web_home_view === settings_config.web_home_view_values.recent_topics.code, hide_unread_counts: settings_data.should_mask_unread_count(false), + is_spectator: page_params.is_spectator, }); $("#left-sidebar-container").html(rendered_sidebar); diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css index 405f6a3270..a18c5e61bf 100644 --- a/web/styles/left_sidebar.css +++ b/web/styles/left_sidebar.css @@ -812,6 +812,11 @@ li.top_left_scheduled_messages { } } + /* Remove the cursor: pointer property of Views label for the spectators. */ + &.remove-pointer-for-spectator { + cursor: default; + } + #toggle-top-left-navigation-area-icon { grid-area: starting-anchor-element; } diff --git a/web/templates/left_sidebar.hbs b/web/templates/left_sidebar.hbs index 0c3db48bae..bb57174e68 100644 --- a/web/templates/left_sidebar.hbs +++ b/web/templates/left_sidebar.hbs @@ -1,7 +1,7 @@