compose_box: Improve structures around compose buttons.

This commit is contained in:
Karl Stolley
2023-11-01 12:43:48 -05:00
committed by Tim Abbott
parent e608a389af
commit 9f00b513f7
11 changed files with 24 additions and 26 deletions

View File

@@ -17,13 +17,13 @@ export function update_audio_and_video_chat_button_display() {
export function update_video_chat_button_display() {
const show_video_chat_button = compose_call.compute_show_video_chat_button();
$("#below-compose-content .video_link").toggle(show_video_chat_button);
$(".compose-control-buttons-container .video_link").toggle(show_video_chat_button);
$(".message-edit-feature-group .video_link").toggle(show_video_chat_button);
}
export function update_audio_chat_button_display() {
const show_audio_chat_button = compose_call.compute_show_audio_chat_button();
$("#below-compose-content .audio_link").toggle(show_audio_chat_button);
$(".compose-control-buttons-container .audio_link").toggle(show_audio_chat_button);
$(".message-edit-feature-group .audio_link").toggle(show_audio_chat_button);
}

View File

@@ -44,8 +44,12 @@ export function initialize() {
// Register hooks for compose_actions.
setup_compose_actions_hooks();
$("#below-compose-content .video_link").toggle(compose_call.compute_show_video_chat_button());
$("#below-compose-content .audio_link").toggle(compose_call.compute_show_audio_chat_button());
$(".compose-control-buttons-container .video_link").toggle(
compose_call.compute_show_video_chat_button(),
);
$(".compose-control-buttons-container .audio_link").toggle(
compose_call.compute_show_audio_chat_button(),
);
$("textarea#compose-textarea").on("keydown", (event) => {
compose_ui.handle_keydown(event, $("textarea#compose-textarea").expectOne());

View File

@@ -619,7 +619,7 @@ export function check_overflow_text() {
// expensive.
const text = compose_state.message_content();
const max_length = page_params.max_message_length;
const $indicator = $("#compose_limit_indicator");
const $indicator = $("#compose-limit-indicator");
if (text.length > max_length) {
$indicator.addClass("over_limit");

View File

@@ -238,19 +238,15 @@
}
}
#below-compose-content {
#message-formatting-controls-container {
display: flex;
flex-direction: column;
width: 100%;
margin-top: 6px;
margin-bottom: -2px;
.compose_bottom_top_container {
display: flex;
}
}
#compose_limit_indicator {
#compose-limit-indicator {
margin-right: 8px;
font-size: 12px;
color: hsl(39deg 100% 50%);
@@ -862,7 +858,7 @@ textarea.new_message_textarea,
min-height: var(--compose-recipient-box-min-height);
}
.compose_control_buttons_container {
.compose-control-buttons-container {
margin-right: auto;
display: flex;
gap: 4px;

View File

@@ -606,7 +606,7 @@
border-color: hsl(0deg 0% 0% / 90%);
}
.compose_control_buttons_container .divider {
.compose-control-buttons-container .divider {
color: hsl(236deg 33% 90% / 50%);
}

View File

@@ -86,7 +86,7 @@
<a role="button" class="compose_control_button compose_draft_button hide-sm" tabindex=0 href="#drafts" data-tooltip-template-id="compose_draft_tooltip_template">
{{t 'Drafts' }}
</a>
<span id="compose_limit_indicator"></span>
<span id="compose-limit-indicator"></span>
<div class="message-send-controls">
<button type="submit" id="compose-send-button" class="button small send_message compose-submit-button animated-purple-button">
<img class="loader" alt="" src="" />
@@ -99,10 +99,8 @@
</div>
</div>
<div id="below-compose-content">
<div class="compose_bottom_top_container">
{{> compose_control_buttons }}
</div>
<div id="message-formatting-controls-container">
{{> compose_control_buttons }}
</div>
</div>
</div>

View File

@@ -1,4 +1,4 @@
<div class="compose_control_buttons_container order-1">
<div class="compose-control-buttons-container order-1">
<input type="file" class="file_input notvisible" multiple />
{{#if file_upload_enabled }}
<div class="compose_control_button_container preview_mode_disabled" data-tippy-content="{{t 'Upload files' }}">

View File

@@ -1,4 +1,4 @@
<div class="compose_control_buttons_container preview_mode_disabled">
<div class="compose-control-buttons-container preview_mode_disabled">
<a role="button" data-format-type="bold" class="compose_control_button fa fa-bold formatting_button" aria-label="{{t 'Bold' }}" {{#unless preview_mode_on}} tabindex=0 {{/unless}} data-tippy-content="{{t 'Bold' }}"></a>
<a role="button" data-format-type="italic" class="compose_control_button fa fa-italic formatting_button" aria-label="{{t 'Italic' }}" {{#unless preview_mode_on}} tabindex=0 {{/unless}} data-tippy-content="{{t 'Italic' }}"></a>
<a role="button" data-format-type="bulleted" class="compose_control_button fa fa-list-ul formatting_button" aria-label="{{t 'Bulleted list' }}" {{#unless preview_mode_on}} tabindex=0 {{/unless}} data-tippy-content="{{t 'Bulleted list' }}"></a>

View File

@@ -1,3 +1,3 @@
<div class="compose_control_buttons_container order-1 {{#if preview_mode_on}} preview_mode {{/if}}">
<div class="compose-control-buttons-container order-1 {{#if preview_mode_on}} preview_mode {{/if}}">
{{> compose_control_buttons_in_popover}}
</div>

View File

@@ -547,7 +547,7 @@ test_ui("test_check_overflow_text", ({mock_template}) => {
page_params.max_message_length = 10000;
const $textarea = $("textarea#compose-textarea");
const $indicator = $("#compose_limit_indicator");
const $indicator = $("#compose-limit-indicator");
const $send_button = $("#compose-send-button");
let banner_rendered = false;
mock_template("compose_banner/compose_banner.hbs", false, (data) => {

View File

@@ -30,7 +30,7 @@ const server_events_dispatch = zrequire("server_events_dispatch");
const compose_setup = zrequire("compose_setup");
function stub_out_video_calls() {
const $elem = $("#below-compose-content .video_link");
const $elem = $(".compose-control-buttons-container .video_link");
$elem.toggle = (show) => {
/* istanbul ignore if */
if (show) {
@@ -251,7 +251,7 @@ test("test_video_chat_button_toggle disabled", ({override}) => {
page_params.realm_video_chat_provider = realm_available_video_chat_providers.disabled.id;
compose_setup.initialize();
assert.equal($("#below-compose-content .video_link").visible(), false);
assert.equal($(".compose-control-buttons-container .video_link").visible(), false);
});
test("test_video_chat_button_toggle no url", ({override}) => {
@@ -260,7 +260,7 @@ test("test_video_chat_button_toggle no url", ({override}) => {
page_params.realm_video_chat_provider = realm_available_video_chat_providers.jitsi_meet.id;
page_params.jitsi_server_url = null;
compose_setup.initialize();
assert.equal($("#below-compose-content .video_link").visible(), false);
assert.equal($(".compose-control-buttons-container .video_link").visible(), false);
});
test("test_video_chat_button_toggle enabled", ({override}) => {
@@ -269,5 +269,5 @@ test("test_video_chat_button_toggle enabled", ({override}) => {
page_params.realm_video_chat_provider = realm_available_video_chat_providers.jitsi_meet.id;
page_params.realm_jitsi_server_url = "https://meet.jit.si";
compose_setup.initialize();
assert.equal($("#below-compose-content .video_link").visible(), true);
assert.equal($(".compose-control-buttons-container .video_link").visible(), true);
});