recent_topics: Move from overlay to a narrow-like view.

Recent Topics is no longer an overlay now, but note that it is
also not a typical messages narrow. It can reside between
an overlay and a Filter in the sense that it is dispalyed as
a typical Filter narrow but has properties of an Overlay.

Compose box is not visible in this view as it will be confusing
to many users and hence compose shortcuts have also been disabled.

Keyboard shortcuts that apply on messages have also been disabled.

The remaining shortcuts that apply to a narrow are still accessible
here.
This commit is contained in:
Aman Agrawal
2020-07-05 15:49:09 +05:30
committed by Tim Abbott
parent 9ed3e47796
commit 1eafb1d8b3
19 changed files with 210 additions and 139 deletions

View File

@@ -36,10 +36,19 @@ function set_hash(hash) {
}
}
function maybe_hide_recent_topics() {
if (recent_topics.is_visible()) {
recent_topics.hide();
return true;
}
return false;
}
exports.changehash = function (newhash) {
if (changing_hash) {
return;
}
maybe_hide_recent_topics();
message_viewport.stop_auto_scrolling();
set_hash(newhash);
};
@@ -53,8 +62,9 @@ exports.save_narrow = function (operators) {
};
function activate_home_tab() {
const coming_from_recent_topics = maybe_hide_recent_topics();
ui_util.change_tab_to("#message_feed_container");
narrow.deactivate();
narrow.deactivate(coming_from_recent_topics);
floating_recipient_bar.update();
search.update_button_visibility();
// We need to maybe scroll to the selected message
@@ -76,7 +86,6 @@ function is_overlay_hash(hash) {
"settings",
"organization",
"invite",
"recent_topics",
"keyboard-shortcuts",
"message-formatting",
"search-operators",
@@ -96,6 +105,7 @@ function do_hashchange_normal(from_reload) {
const hash = window.location.hash.split("/");
switch (hash[0]) {
case "#narrow": {
maybe_hide_recent_topics();
ui_util.change_tab_to("#message_feed_container");
const operators = hash_util.parse_narrow(hash);
if (operators === undefined) {
@@ -125,6 +135,9 @@ function do_hashchange_normal(from_reload) {
case "#":
activate_home_tab();
break;
case "#recent_topics":
recent_topics.show();
break;
case "#keyboard-shortcuts":
case "#message-formatting":
case "#search-operators":
@@ -133,7 +146,6 @@ function do_hashchange_normal(from_reload) {
case "#streams":
case "#organization":
case "#settings":
case "#recent_topics":
blueslip.error("overlay logic skipped for: " + hash);
break;
}
@@ -222,10 +234,6 @@ function do_hashchange_overlay(old_hash) {
return;
}
if (base === "recent_topics") {
recent_topics.launch();
return;
}
if (base === "keyboard-shortcuts") {
info_overlay.show("keyboard-shortcuts");
return;