left_sidebar_popovers: Show sidebar icon when visible.

Fixes #27508

Show sidebar icon when sidebar popover is visible so that
it tells users for which row popover is visible and also helps
tippy track when the reference of the popover so that it
can apply [data-reference-hidden] property appropriately.
This commit is contained in:
Aman Agrawal 2023-11-06 13:57:46 +00:00 committed by Tim Abbott
parent 1a1c5863e4
commit 48d0bedda9
2 changed files with 12 additions and 0 deletions

View File

@ -42,6 +42,7 @@ export function initialize() {
onMount(instance) { onMount(instance) {
const $popper = $(instance.popper); const $popper = $(instance.popper);
popover_menus.popover_instances.starred_messages = instance; popover_menus.popover_instances.starred_messages = instance;
ui_util.show_left_sidebar_menu_icon(instance.reference);
$popper.one("click", "#unstar_all_messages", () => { $popper.one("click", "#unstar_all_messages", () => {
starred_messages_ui.confirm_unstar_all_messages(); starred_messages_ui.confirm_unstar_all_messages();
@ -75,6 +76,7 @@ export function initialize() {
onHidden(instance) { onHidden(instance) {
instance.destroy(); instance.destroy();
popover_menus.popover_instances.starred_messages = undefined; popover_menus.popover_instances.starred_messages = undefined;
ui_util.hide_left_sidebar_menu_icon();
}, },
}); });
@ -85,6 +87,7 @@ export function initialize() {
const $popper = $(instance.popper); const $popper = $(instance.popper);
$popper.addClass("drafts-popover"); $popper.addClass("drafts-popover");
popover_menus.popover_instances.drafts = instance; popover_menus.popover_instances.drafts = instance;
ui_util.show_left_sidebar_menu_icon(instance.reference);
$popper.one("click", "#delete_all_drafts_sidebar", () => { $popper.one("click", "#delete_all_drafts_sidebar", () => {
drafts.confirm_delete_all_drafts(); drafts.confirm_delete_all_drafts();
@ -99,6 +102,7 @@ export function initialize() {
onHidden(instance) { onHidden(instance) {
instance.destroy(); instance.destroy();
popover_menus.popover_instances.drafts = undefined; popover_menus.popover_instances.drafts = undefined;
ui_util.hide_left_sidebar_menu_icon();
}, },
}); });
@ -108,6 +112,7 @@ export function initialize() {
onMount(instance) { onMount(instance) {
const $popper = $(instance.popper); const $popper = $(instance.popper);
popover_menus.popover_instances.left_sidebar_inbox_popover = instance; popover_menus.popover_instances.left_sidebar_inbox_popover = instance;
ui_util.show_left_sidebar_menu_icon(instance.reference);
$popper.one("click", "#mark_all_messages_as_read", () => { $popper.one("click", "#mark_all_messages_as_read", () => {
unread_ops.confirm_mark_all_as_read(); unread_ops.confirm_mark_all_as_read();
@ -129,6 +134,7 @@ export function initialize() {
onHidden(instance) { onHidden(instance) {
instance.destroy(); instance.destroy();
popover_menus.popover_instances.left_sidebar_inbox_popover = undefined; popover_menus.popover_instances.left_sidebar_inbox_popover = undefined;
ui_util.hide_left_sidebar_menu_icon();
}, },
}); });
@ -137,6 +143,7 @@ export function initialize() {
...popover_menus.left_sidebar_tippy_options, ...popover_menus.left_sidebar_tippy_options,
onShow(instance) { onShow(instance) {
popover_menus.popover_instances.left_sidebar_all_messages_popover = instance; popover_menus.popover_instances.left_sidebar_all_messages_popover = instance;
ui_util.show_left_sidebar_menu_icon(instance.reference);
popovers.hide_all(); popovers.hide_all();
const view_code = settings_config.web_home_view_values.all_messages.code; const view_code = settings_config.web_home_view_values.all_messages.code;
instance.setContent( instance.setContent(
@ -151,6 +158,7 @@ export function initialize() {
onHidden(instance) { onHidden(instance) {
instance.destroy(); instance.destroy();
popover_menus.popover_instances.left_sidebar_all_messages_popover = undefined; popover_menus.popover_instances.left_sidebar_all_messages_popover = undefined;
ui_util.hide_left_sidebar_menu_icon();
}, },
}); });
@ -159,6 +167,7 @@ export function initialize() {
...popover_menus.left_sidebar_tippy_options, ...popover_menus.left_sidebar_tippy_options,
onShow(instance) { onShow(instance) {
popover_menus.popover_instances.left_sidebar_recent_view_popover = instance; popover_menus.popover_instances.left_sidebar_recent_view_popover = instance;
ui_util.show_left_sidebar_menu_icon(instance.reference);
popovers.hide_all(); popovers.hide_all();
const view_code = settings_config.web_home_view_values.recent_topics.code; const view_code = settings_config.web_home_view_values.recent_topics.code;
instance.setContent( instance.setContent(
@ -173,6 +182,7 @@ export function initialize() {
onHidden(instance) { onHidden(instance) {
instance.destroy(); instance.destroy();
popover_menus.popover_instances.left_sidebar_recent_view_popover = undefined; popover_menus.popover_instances.left_sidebar_recent_view_popover = undefined;
ui_util.hide_left_sidebar_menu_icon();
}, },
}); });

View File

@ -23,6 +23,7 @@ export function initialize() {
...popover_menus.left_sidebar_tippy_options, ...popover_menus.left_sidebar_tippy_options,
onShow(instance) { onShow(instance) {
popover_menus.popover_instances.topics_menu = instance; popover_menus.popover_instances.topics_menu = instance;
ui_util.show_left_sidebar_menu_icon(instance.reference);
popover_menus.on_show_prep(instance); popover_menus.on_show_prep(instance);
let stream_id; let stream_id;
let topic_name; let topic_name;
@ -165,6 +166,7 @@ export function initialize() {
onHidden(instance) { onHidden(instance) {
instance.destroy(); instance.destroy();
popover_menus.popover_instances.topics_menu = undefined; popover_menus.popover_instances.topics_menu = undefined;
ui_util.hide_left_sidebar_menu_icon();
}, },
}, },
); );