From 997f43cb82507d7004d576175f594ee5d67cec9f Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Fri, 3 Sep 2021 12:03:19 +0100 Subject: [PATCH] Implement new narrow mode UI --- res/css/views/rooms/_MessageComposer.scss | 9 +++- .../views/rooms/MessageComposer.tsx | 48 ++++++++++++------- src/i18n/strings/en_EN.json | 4 +- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/res/css/views/rooms/_MessageComposer.scss b/res/css/views/rooms/_MessageComposer.scss index 5b36d1e9a1..5c8f6809de 100644 --- a/res/css/views/rooms/_MessageComposer.scss +++ b/res/css/views/rooms/_MessageComposer.scss @@ -238,11 +238,11 @@ limitations under the License. } .mx_MessageComposer_buttonMenu::before { - mask-image: url('$(res)/img/feather-customised/chevron-down.svg'); + mask-image: url('$(res)/img/image-view/more.svg'); } .mx_MessageComposer_closeButtonMenu::before { - transform: rotate(180deg); + transform: rotate(90deg); transform-origin: center; } @@ -365,3 +365,8 @@ limitations under the License. margin-right: 0; } } + +.mx_MessageComposer_Menu .mx_CallContextMenu_item { + display: flex; + align-items: center; +} diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx index 635d372d82..b7ef2a51a4 100644 --- a/src/components/views/rooms/MessageComposer.tsx +++ b/src/components/views/rooms/MessageComposer.tsx @@ -33,6 +33,7 @@ import { ContextMenuTooltipButton, useContextMenu, MenuItem, + ChevronFace, } from "../../structures/ContextMenu"; import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import ReplyPreview from "./ReplyPreview"; @@ -416,25 +417,32 @@ export default class MessageComposer extends React.Component { }; private renderButtons(menuPosition): JSX.Element | JSX.Element[] { - const buttons = []; - + const buttons = new Map(); if (!this.state.haveRecording) { - buttons.push( + buttons.set( + _t("Send File"), , + ); + buttons.set( + _t("Show Emojis"), , ); } if (this.shouldShowStickerPicker()) { - buttons.push( this.showStickers(!this.state.showStickers)} - title={this.state.showStickers ? _t("Hide Stickers") : _t("Show Stickers")} - />); + buttons.set( + _t("Show Stickers"), + this.showStickers(!this.state.showStickers)} + title={this.state.showStickers ? _t("Hide Stickers") : _t("Show Stickers")} + />, + ); } if (!this.state.haveRecording && !this.state.narrowMode) { - buttons.push( + buttons.set( + _t("Send voice message"), this.voiceRecordingButton?.onRecordStartEndClick()} @@ -444,7 +452,7 @@ export default class MessageComposer extends React.Component { } if (!this.state.narrowMode) { - return buttons; + return Array.from(buttons.values()); } else { const classnames = classNames({ mx_MessageComposer_button: true, @@ -457,19 +465,23 @@ export default class MessageComposer extends React.Component { { this.state.isMenuOpen && ( - { buttons.slice(1).map((button, index) => ( - + { Array.from(buttons).slice(1).map(([label, button]) => ( + { button } + { label } )) } @@ -568,7 +580,7 @@ export default class MessageComposer extends React.Component { }); return ( -
+
{ recordingTooltip }
{ this.props.showReplyPreview && ( diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index bfa8e846a9..28f05bbe8c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1558,8 +1558,10 @@ "Send a reply…": "Send a reply…", "Send an encrypted message…": "Send an encrypted message…", "Send a message…": "Send a message…", - "Hide Stickers": "Hide Stickers", + "Send File": "Send File", + "Show Emojis": "Show Emojis", "Show Stickers": "Show Stickers", + "Hide Stickers": "Hide Stickers", "Send voice message": "Send voice message", "view more options": "view more options", "The conversation continues here.": "The conversation continues here.",