mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 16:01:58 +00:00
recent_topics: Set default text for reply btn when not focused in table.
When user is focused in search or filters, show "Compose Message" as label which is more appropriate.
This commit is contained in:
@@ -299,6 +299,9 @@ export function respond_to_message(opts) {
|
|||||||
if (recent_topics.is_visible()) {
|
if (recent_topics.is_visible()) {
|
||||||
message = recent_topics.get_focused_row_message();
|
message = recent_topics.get_focused_row_message();
|
||||||
if (message === undefined) {
|
if (message === undefined) {
|
||||||
|
// Open empty compose with nothing pre-filled since
|
||||||
|
// user is not focused on any table row.
|
||||||
|
compose_actions.start("stream", {trigger: "recent_topics_nofocus"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -9,14 +9,8 @@ function set_reply_button_label(label) {
|
|||||||
$(".compose_reply_button_label").text(label);
|
$(".compose_reply_button_label").text(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hide_reply_button() {
|
export function set_standard_text_for_reply_button() {
|
||||||
$(".reply_button_container").hide();
|
set_reply_button_label($t({defaultMessage: "Compose message"}));
|
||||||
$("#compose_buttons").css("justify-content", "flex-end");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function show_reply_button() {
|
|
||||||
$(".reply_button_container").show();
|
|
||||||
$("#compose_buttons").css("justify-content", "flex-start");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function update_reply_recipient_label(message) {
|
export function update_reply_recipient_label(message) {
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export function set_default_focus() {
|
|||||||
// focused element, we switch focus to search.
|
// focused element, we switch focus to search.
|
||||||
current_focus_elem = $("#recent_topics_search");
|
current_focus_elem = $("#recent_topics_search");
|
||||||
current_focus_elem.trigger("focus");
|
current_focus_elem.trigger("focus");
|
||||||
compose_closed_ui.hide_reply_button();
|
compose_closed_ui.set_standard_text_for_reply_button();
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_min_load_count(already_rendered_count, load_count) {
|
function get_min_load_count(already_rendered_count, load_count) {
|
||||||
@@ -149,7 +149,6 @@ function set_table_focus(row, col) {
|
|||||||
stream: topic_row.find(".recent_topic_stream a").text(),
|
stream: topic_row.find(".recent_topic_stream a").text(),
|
||||||
topic: topic_row.find(".recent_topic_name a").text(),
|
topic: topic_row.find(".recent_topic_name a").text(),
|
||||||
};
|
};
|
||||||
compose_closed_ui.show_reply_button();
|
|
||||||
compose_closed_ui.update_reply_recipient_label(message);
|
compose_closed_ui.update_reply_recipient_label(message);
|
||||||
|
|
||||||
// focused topic can be under table `thead`
|
// focused topic can be under table `thead`
|
||||||
@@ -755,7 +754,7 @@ export function change_focused_element($elt, input_key) {
|
|||||||
// go away from the input box when `revive_current_focus` is called
|
// go away from the input box when `revive_current_focus` is called
|
||||||
// on rerender when user is typing.
|
// on rerender when user is typing.
|
||||||
current_focus_elem = $("#recent_topics_search");
|
current_focus_elem = $("#recent_topics_search");
|
||||||
compose_closed_ui.hide_reply_button();
|
compose_closed_ui.set_standard_text_for_reply_button();
|
||||||
return true;
|
return true;
|
||||||
case "escape":
|
case "escape":
|
||||||
if (is_table_focused()) {
|
if (is_table_focused()) {
|
||||||
@@ -859,7 +858,7 @@ export function change_focused_element($elt, input_key) {
|
|||||||
if (current_focus_elem && input_key !== "escape") {
|
if (current_focus_elem && input_key !== "escape") {
|
||||||
current_focus_elem.trigger("focus");
|
current_focus_elem.trigger("focus");
|
||||||
if (current_focus_elem.hasClass("btn-recent-filters")) {
|
if (current_focus_elem.hasClass("btn-recent-filters")) {
|
||||||
compose_closed_ui.hide_reply_button();
|
compose_closed_ui.set_standard_text_for_reply_button();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user