From e4eeafd4852a2669c51ec465c740a4152fc3d0ac Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sun, 21 Feb 2021 18:02:34 +0100 Subject: [PATCH 01/11] migrate the message context menu to IconizedContextMenu Signed-off-by: Michael Weimann --- res/css/_components.scss | 1 - .../context_menus/_MessageContextMenu.scss | 30 --- .../views/context_menus/MessageContextMenu.js | 172 ++++++++++++------ .../views/messages/MessageActionBar.js | 17 +- 4 files changed, 124 insertions(+), 96 deletions(-) delete mode 100644 res/css/views/context_menus/_MessageContextMenu.scss diff --git a/res/css/_components.scss b/res/css/_components.scss index ec3af8655e..77f13437a2 100644 --- a/res/css/_components.scss +++ b/res/css/_components.scss @@ -57,7 +57,6 @@ @import "./views/beta/_BetaCard.scss"; @import "./views/context_menus/_CallContextMenu.scss"; @import "./views/context_menus/_IconizedContextMenu.scss"; -@import "./views/context_menus/_MessageContextMenu.scss"; @import "./views/context_menus/_StatusMessageContextMenu.scss"; @import "./views/context_menus/_TagTileContextMenu.scss"; @import "./views/dialogs/_AddExistingToSpaceDialog.scss"; diff --git a/res/css/views/context_menus/_MessageContextMenu.scss b/res/css/views/context_menus/_MessageContextMenu.scss deleted file mode 100644 index 2ecb93e734..0000000000 --- a/res/css/views/context_menus/_MessageContextMenu.scss +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2015, 2016 OpenMarket Ltd - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -.mx_MessageContextMenu { - padding: 6px; -} - -.mx_MessageContextMenu_field { - display: block; - padding: 3px 6px 3px 6px; - cursor: pointer; - white-space: nowrap; -} - -.mx_MessageContextMenu_field.mx_MessageContextMenu_fieldSet { - font-weight: bold; -} diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index eef10c995a..f0ee2cb259 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -22,13 +22,13 @@ import { EventStatus } from 'matrix-js-sdk/src/models/event'; import { MatrixClientPeg } from '../../../MatrixClientPeg'; import dis from '../../../dispatcher/dispatcher'; import * as sdk from '../../../index'; -import { _t } from '../../../languageHandler'; +import {_t} from '../../../languageHandler'; import Modal from '../../../Modal'; import Resend from '../../../Resend'; import SettingsStore from '../../../settings/SettingsStore'; import { isUrlPermitted } from '../../../HtmlUtils'; import { isContentActionable } from '../../../utils/EventUtils'; -import { MenuItem } from "../../structures/ContextMenu"; +import IconizedContextMenu, {IconizedContextMenuOption, IconizedContextMenuOptionList} from "./IconizedContextMenu"; import { EventType } from "matrix-js-sdk/src/@types/event"; import { replaceableComponent } from "../../../utils/replaceableComponent"; import { ReadPinsEventId } from "../right_panel/PinnedMessagesCard"; @@ -257,55 +257,62 @@ export default class MessageContextMenu extends React.Component { let externalURLButton; let quoteButton; let collapseReplyThread; + const optionLists = []; // status is SENT before remote-echo, null after const isSent = !eventStatus || eventStatus === EventStatus.SENT; if (!mxEvent.isRedacted()) { if (unsentReactionsCount !== 0) { resendReactionsButton = ( - - { _t('Resend %(unsentCount)s reaction(s)', {unsentCount: unsentReactionsCount}) } - + ); } } if (isSent && this.state.canRedact) { redactButton = ( - - { _t('Remove') } - + ); } if (isContentActionable(mxEvent)) { forwardButton = ( - - { _t('Forward Message') } - + ); if (this.state.canPin) { pinButton = ( - - { this._isPinned() ? _t('Unpin Message') : _t('Pin Message') } - + ); } } const viewSourceButton = ( - - { _t('View Source') } - + ); if (this.props.eventTileOps) { if (this.props.eventTileOps.isWidgetHidden()) { unhidePreviewButton = ( - - { _t('Unhide Preview') } - + ); } } @@ -316,77 +323,130 @@ export default class MessageContextMenu extends React.Component { } // XXX: if we use room ID, we should also include a server where the event can be found (other than in the domain of the event ID) const permalinkButton = ( - - { mxEvent.isRedacted() || mxEvent.getType() !== 'm.room.message' - ? _t('Share Permalink') : _t('Share Message') } - + /> ); if (this.props.eventTileOps) { // this event is rendered using TextualBody quoteButton = ( - - { _t('Quote') } - + ); } // Bridges can provide a 'external_url' to link back to the source. if ( - typeof(mxEvent.event.content.external_url) === "string" && + typeof (mxEvent.event.content.external_url) === "string" && isUrlPermitted(mxEvent.event.content.external_url) ) { externalURLButton = ( - - { _t('Source URL') } - + /> ); } if (this.props.collapseReplyThread) { collapseReplyThread = ( - - { _t('Collapse Reply Thread') } - + ); } let reportEventButton; if (mxEvent.getSender() !== me) { reportEventButton = ( - - { _t('Report Content') } - + ); } + if (forwardButton || quoteButton || collapseReplyThread) { + optionLists.push(( + + {quoteButton} + {forwardButton} + {collapseReplyThread} + + )); + } + + if (resendReactionsButton) { + optionLists.push(( + + {resendReactionsButton} + + )); + } + + if (externalURLButton || permalinkButton) { + optionLists.push(( + + {externalURLButton} + {permalinkButton} + + )); + } + + if (pinButton || unhidePreviewButton) { + optionLists.push(( + + {pinButton} + {unhidePreviewButton} + + )); + } + + if (reportEventButton) { + optionLists.push(( + + {reportEventButton} + + )); + } + + if (viewSourceButton) { + optionLists.push(( + + {viewSourceButton} + + )); + } + + if (redactButton) { + optionLists.push(( + + {redactButton} + + )); + } + return ( -
- { resendReactionsButton } - { redactButton } - { forwardButton } - { pinButton } - { viewSourceButton } - { unhidePreviewButton } - { permalinkButton } - { quoteButton } - { externalURLButton } - { collapseReplyThread } - { reportEventButton } -
+ + {optionLists} + ); } } diff --git a/src/components/views/messages/MessageActionBar.js b/src/components/views/messages/MessageActionBar.js index 37737519ce..3d434e0ee2 100644 --- a/src/components/views/messages/MessageActionBar.js +++ b/src/components/views/messages/MessageActionBar.js @@ -48,15 +48,14 @@ const OptionsButton = ({mxEvent, getTile, getReplyThread, permalinkCreator, onFo const replyThread = getReplyThread && getReplyThread(); const buttonRect = button.current.getBoundingClientRect(); - contextMenu = - - ; + contextMenu = ; } return From 62efea7e1995e95e54512e48daebb4f472ac0b95 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 23 Feb 2021 18:49:11 +0100 Subject: [PATCH 02/11] add message context menu icons Signed-off-by: Michael Weimann --- res/css/_components.scss | 1 + .../context_menus/_MessageContextMenu.scss | 71 +++++++++++++++++++ res/img/element-icons/message/chevron-up.svg | 1 + .../element-icons/message/corner-up-right.svg | 1 + res/img/element-icons/message/link.svg | 1 + res/img/element-icons/message/repeat.svg | 1 + res/img/element-icons/message/share.svg | 1 + .../views/context_menus/MessageContextMenu.js | 11 +++ 8 files changed, 88 insertions(+) create mode 100644 res/css/views/context_menus/_MessageContextMenu.scss create mode 100644 res/img/element-icons/message/chevron-up.svg create mode 100644 res/img/element-icons/message/corner-up-right.svg create mode 100644 res/img/element-icons/message/link.svg create mode 100644 res/img/element-icons/message/repeat.svg create mode 100644 res/img/element-icons/message/share.svg diff --git a/res/css/_components.scss b/res/css/_components.scss index 77f13437a2..ec3af8655e 100644 --- a/res/css/_components.scss +++ b/res/css/_components.scss @@ -57,6 +57,7 @@ @import "./views/beta/_BetaCard.scss"; @import "./views/context_menus/_CallContextMenu.scss"; @import "./views/context_menus/_IconizedContextMenu.scss"; +@import "./views/context_menus/_MessageContextMenu.scss"; @import "./views/context_menus/_StatusMessageContextMenu.scss"; @import "./views/context_menus/_TagTileContextMenu.scss"; @import "./views/dialogs/_AddExistingToSpaceDialog.scss"; diff --git a/res/css/views/context_menus/_MessageContextMenu.scss b/res/css/views/context_menus/_MessageContextMenu.scss new file mode 100644 index 0000000000..d4f5913064 --- /dev/null +++ b/res/css/views/context_menus/_MessageContextMenu.scss @@ -0,0 +1,71 @@ +.mx_MessageContextMenu { + + .mx_IconizedContextMenu_icon { + width: 16px; + height: 16px; + display: block; + + &::before { + content: ''; + width: 16px; + height: 16px; + display: block; + mask-position: center; + mask-size: contain; + mask-repeat: no-repeat; + background: $primary-fg-color; + } + } + + .mx_MessageContextMenu_iconCollapse::before { + mask-image: url('$(res)/img/element-icons/message/chevron-up.svg'); + } + + .mx_MessageContextMenu_iconReport::before { + mask-image: url('$(res)/img/feather-customised/warning-triangle.svg'); + } + + .mx_MessageContextMenu_iconLink::before { + mask-image: url('$(res)/img/element-icons/message/link.svg'); + } + + .mx_MessageContextMenu_iconPermalink::before { + mask-image: url('$(res)/img/element-icons/message/share.svg'); + } + + .mx_MessageContextMenu_iconUnhidePreview::before { + mask-image: url('$(res)/img/feather-customised/eye.svg'); + } + + .mx_MessageContextMenu_iconForward::before { + mask-image: url('$(res)/img/element-icons/message/corner-up-right.svg'); + } + + .mx_MessageContextMenu_iconCancel::before { + mask-image: url('$(res)/img/cancel.svg'); + } + + .mx_MessageContextMenu_iconRedact::before { + mask-image: url('$(res)/img/feather-customised/trash.custom.svg'); + } + + .mx_MessageContextMenu_iconResend::before { + mask-image: url('$(res)/img/element-icons/message/repeat.svg'); + } + + .mx_MessageContextMenu_iconSource::before { + mask-image: url('$(res)/img/element-icons/room/format-bar/code.svg'); + } + + .mx_MessageContextMenu_iconQuote::before { + mask-image: url('$(res)/img/format/quote.svg'); + } + + .mx_MessageContextMenu_iconPin::before { + mask-image: url('$(res)/img/element-icons/room/pin-upright.svg'); + } + + .mx_MessageContextMenu_iconUnpin::before { + mask-image: url('$(res)/img/element-icons/room/pin.svg'); + } +} diff --git a/res/img/element-icons/message/chevron-up.svg b/res/img/element-icons/message/chevron-up.svg new file mode 100644 index 0000000000..4eb5ecc33e --- /dev/null +++ b/res/img/element-icons/message/chevron-up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/res/img/element-icons/message/corner-up-right.svg b/res/img/element-icons/message/corner-up-right.svg new file mode 100644 index 0000000000..0b8f961b7b --- /dev/null +++ b/res/img/element-icons/message/corner-up-right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/res/img/element-icons/message/link.svg b/res/img/element-icons/message/link.svg new file mode 100644 index 0000000000..c89dd41c23 --- /dev/null +++ b/res/img/element-icons/message/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/res/img/element-icons/message/repeat.svg b/res/img/element-icons/message/repeat.svg new file mode 100644 index 0000000000..c7657b08ed --- /dev/null +++ b/res/img/element-icons/message/repeat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/res/img/element-icons/message/share.svg b/res/img/element-icons/message/share.svg new file mode 100644 index 0000000000..df38c14d63 --- /dev/null +++ b/res/img/element-icons/message/share.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index f0ee2cb259..c3f634231b 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -265,6 +265,7 @@ export default class MessageContextMenu extends React.Component { if (unsentReactionsCount !== 0) { resendReactionsButton = ( @@ -275,6 +276,7 @@ export default class MessageContextMenu extends React.Component { if (isSent && this.state.canRedact) { redactButton = ( @@ -284,6 +286,7 @@ export default class MessageContextMenu extends React.Component { if (isContentActionable(mxEvent)) { forwardButton = ( @@ -292,6 +295,7 @@ export default class MessageContextMenu extends React.Component { if (this.state.canPin) { pinButton = ( @@ -301,6 +305,7 @@ export default class MessageContextMenu extends React.Component { const viewSourceButton = ( @@ -310,6 +315,7 @@ export default class MessageContextMenu extends React.Component { if (this.props.eventTileOps.isWidgetHidden()) { unhidePreviewButton = ( @@ -324,6 +330,7 @@ export default class MessageContextMenu extends React.Component { // XXX: if we use room ID, we should also include a server where the event can be found (other than in the domain of the event ID) const permalinkButton = ( @@ -350,6 +358,7 @@ export default class MessageContextMenu extends React.Component { ) { externalURLButton = ( @@ -373,6 +383,7 @@ export default class MessageContextMenu extends React.Component { if (mxEvent.getSender() !== me) { reportEventButton = ( From 74f61795eb47dce50a1ae4b0a7b20d0d637557a1 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 23 Feb 2021 19:06:01 +0100 Subject: [PATCH 03/11] add _MessageContextMenu.scss license header Signed-off-by: Michael Weimann --- .../views/context_menus/_MessageContextMenu.scss | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/res/css/views/context_menus/_MessageContextMenu.scss b/res/css/views/context_menus/_MessageContextMenu.scss index d4f5913064..fdce390b17 100644 --- a/res/css/views/context_menus/_MessageContextMenu.scss +++ b/res/css/views/context_menus/_MessageContextMenu.scss @@ -1,3 +1,19 @@ +/* +Copyright 2021 Michael Weimann + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + .mx_MessageContextMenu { .mx_IconizedContextMenu_icon { From 8f6904ec1bc51efb678ae8e3609cfb843715a048 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Wed, 24 Feb 2021 18:52:50 +0100 Subject: [PATCH 04/11] tweak the message menu cancel icon size Signed-off-by: Michael Weimann --- res/css/views/context_menus/_MessageContextMenu.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/res/css/views/context_menus/_MessageContextMenu.scss b/res/css/views/context_menus/_MessageContextMenu.scss index fdce390b17..c22518387a 100644 --- a/res/css/views/context_menus/_MessageContextMenu.scss +++ b/res/css/views/context_menus/_MessageContextMenu.scss @@ -58,7 +58,12 @@ limitations under the License. } .mx_MessageContextMenu_iconCancel::before { + height: 12px; + left: 2px; mask-image: url('$(res)/img/cancel.svg'); + position: relative; + top: 2px; + width: 12px; } .mx_MessageContextMenu_iconRedact::before { From ffca23344ac7e329e89168e74d4ed6998a579d99 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 25 May 2021 12:41:34 +0200 Subject: [PATCH 05/11] tweak context menu order Signed-off-by: Michael Weimann --- .../views/context_menus/MessageContextMenu.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index c3f634231b..ffb974f7f6 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -392,7 +392,7 @@ export default class MessageContextMenu extends React.Component { if (forwardButton || quoteButton || collapseReplyThread) { optionLists.push(( - + {quoteButton} {forwardButton} {collapseReplyThread} @@ -402,7 +402,7 @@ export default class MessageContextMenu extends React.Component { if (resendReactionsButton) { optionLists.push(( - + {resendReactionsButton} )); @@ -410,25 +410,16 @@ export default class MessageContextMenu extends React.Component { if (externalURLButton || permalinkButton) { optionLists.push(( - + {externalURLButton} {permalinkButton} )); } - if (pinButton || unhidePreviewButton) { - optionLists.push(( - - {pinButton} - {unhidePreviewButton} - - )); - } - if (reportEventButton) { optionLists.push(( - + {reportEventButton} )); @@ -436,15 +427,24 @@ export default class MessageContextMenu extends React.Component { if (viewSourceButton) { optionLists.push(( - + {viewSourceButton} )); } + if (pinButton || unhidePreviewButton) { + optionLists.push(( + + {pinButton} + {unhidePreviewButton} + + )); + } + if (redactButton) { optionLists.push(( - + {redactButton} )); From 6ea79b297f5d026f4311dec9fe4c8e6cbbbb16e0 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 25 May 2021 13:36:26 +0200 Subject: [PATCH 06/11] tweak message context icons Signed-off-by: Michael Weimann --- .../context_menus/_MessageContextMenu.scss | 19 +++++-------------- res/img/element-icons/message/fwd.svg | 3 +++ res/img/element-icons/warning-badge.svg | 7 +++---- 3 files changed, 11 insertions(+), 18 deletions(-) create mode 100644 res/img/element-icons/message/fwd.svg diff --git a/res/css/views/context_menus/_MessageContextMenu.scss b/res/css/views/context_menus/_MessageContextMenu.scss index c22518387a..4900488bb8 100644 --- a/res/css/views/context_menus/_MessageContextMenu.scss +++ b/res/css/views/context_menus/_MessageContextMenu.scss @@ -38,7 +38,7 @@ limitations under the License. } .mx_MessageContextMenu_iconReport::before { - mask-image: url('$(res)/img/feather-customised/warning-triangle.svg'); + mask-image: url('$(res)/img/element-icons/warning-badge.svg'); } .mx_MessageContextMenu_iconLink::before { @@ -46,7 +46,7 @@ limitations under the License. } .mx_MessageContextMenu_iconPermalink::before { - mask-image: url('$(res)/img/element-icons/message/share.svg'); + mask-image: url('$(res)/img/element-icons/room/share.svg'); } .mx_MessageContextMenu_iconUnhidePreview::before { @@ -54,20 +54,11 @@ limitations under the License. } .mx_MessageContextMenu_iconForward::before { - mask-image: url('$(res)/img/element-icons/message/corner-up-right.svg'); - } - - .mx_MessageContextMenu_iconCancel::before { - height: 12px; - left: 2px; - mask-image: url('$(res)/img/cancel.svg'); - position: relative; - top: 2px; - width: 12px; + mask-image: url('$(res)/img/element-icons/message/fwd.svg'); } .mx_MessageContextMenu_iconRedact::before { - mask-image: url('$(res)/img/feather-customised/trash.custom.svg'); + mask-image: url('$(res)/img/element-icons/trashcan.svg'); } .mx_MessageContextMenu_iconResend::before { @@ -79,7 +70,7 @@ limitations under the License. } .mx_MessageContextMenu_iconQuote::before { - mask-image: url('$(res)/img/format/quote.svg'); + mask-image: url('$(res)/img/element-icons/room/format-bar/quote.svg'); } .mx_MessageContextMenu_iconPin::before { diff --git a/res/img/element-icons/message/fwd.svg b/res/img/element-icons/message/fwd.svg new file mode 100644 index 0000000000..8bcc70d092 --- /dev/null +++ b/res/img/element-icons/message/fwd.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/img/element-icons/warning-badge.svg b/res/img/element-icons/warning-badge.svg index 1ae4e40ffe..4e2ff75679 100644 --- a/res/img/element-icons/warning-badge.svg +++ b/res/img/element-icons/warning-badge.svg @@ -1,5 +1,4 @@ - - - - + + From c2d51a115b63769ead82182bd41983ef6a324a24 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 25 May 2021 13:40:51 +0200 Subject: [PATCH 07/11] tweak message context labels Signed-off-by: Michael Weimann --- src/components/views/context_menus/MessageContextMenu.js | 9 ++++----- src/i18n/strings/en_EN.json | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index ffb974f7f6..e41f56ff2f 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -287,7 +287,7 @@ export default class MessageContextMenu extends React.Component { forwardButton = ( ); @@ -296,7 +296,7 @@ export default class MessageContextMenu extends React.Component { pinButton = ( ); @@ -332,8 +332,7 @@ export default class MessageContextMenu extends React.Component { Date: Tue, 22 Jun 2021 19:51:11 +0200 Subject: [PATCH 08/11] reorder message context menu items Signed-off-by: Michael Weimann --- .../views/context_menus/MessageContextMenu.js | 67 +++++-------------- src/i18n/strings/en_EN.json | 2 +- 2 files changed, 16 insertions(+), 53 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index e41f56ff2f..cd7dd91e4a 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -389,61 +389,24 @@ export default class MessageContextMenu extends React.Component { ); } - if (forwardButton || quoteButton || collapseReplyThread) { - optionLists.push(( - - {quoteButton} - {forwardButton} - {collapseReplyThread} - - )); - } - - if (resendReactionsButton) { - optionLists.push(( - - {resendReactionsButton} - - )); - } - - if (externalURLButton || permalinkButton) { - optionLists.push(( - - {externalURLButton} - {permalinkButton} - - )); - } - - if (reportEventButton) { - optionLists.push(( - - {reportEventButton} - - )); - } - - if (viewSourceButton) { - optionLists.push(( - - {viewSourceButton} - - )); - } - - if (pinButton || unhidePreviewButton) { - optionLists.push(( - - {pinButton} - {unhidePreviewButton} - - )); - } + optionLists.push(( + + {quoteButton} + {forwardButton} + {pinButton} + {permalinkButton} + {reportEventButton} + {externalURLButton} + {viewSourceButton} + {unhidePreviewButton} + {resendReactionsButton} + {collapseReplyThread} + + )); if (redactButton) { optionLists.push(( - + {redactButton} )); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index faff21c2dd..f95caeff71 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2252,7 +2252,7 @@ "Sending": "Sending", "Sent": "Sent", "Open link": "Open link", - "Forward message": "Forward message", + "Forward": "Forward", "Message preview": "Message preview", "Search for rooms or people": "Search for rooms or people", "Confirm abort of host creation": "Confirm abort of host creation", From 086042f078754d30ac047c389fb169868f663de8 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 22 Jun 2021 20:11:12 +0200 Subject: [PATCH 09/11] update message context texts and icons Signed-off-by: Michael Weimann --- .../context_menus/_MessageContextMenu.scss | 7 ++-- res/img/element-icons/warning-badge.svg | 34 ++++++++++++++-- .../views/context_menus/MessageContextMenu.js | 39 +++++++++---------- src/i18n/strings/en_EN.json | 12 +++--- 4 files changed, 60 insertions(+), 32 deletions(-) diff --git a/res/css/views/context_menus/_MessageContextMenu.scss b/res/css/views/context_menus/_MessageContextMenu.scss index 4900488bb8..338841cce4 100644 --- a/res/css/views/context_menus/_MessageContextMenu.scss +++ b/res/css/views/context_menus/_MessageContextMenu.scss @@ -1,4 +1,5 @@ /* +Copyright 2015, 2016 OpenMarket Ltd Copyright 2021 Michael Weimann Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,7 +43,7 @@ limitations under the License. } .mx_MessageContextMenu_iconLink::before { - mask-image: url('$(res)/img/element-icons/message/link.svg'); + mask-image: url('$(res)/img/element-icons/link.svg'); } .mx_MessageContextMenu_iconPermalink::before { @@ -50,7 +51,7 @@ limitations under the License. } .mx_MessageContextMenu_iconUnhidePreview::before { - mask-image: url('$(res)/img/feather-customised/eye.svg'); + mask-image: url('$(res)/img/element-icons/settings/appearance.svg'); } .mx_MessageContextMenu_iconForward::before { @@ -62,7 +63,7 @@ limitations under the License. } .mx_MessageContextMenu_iconResend::before { - mask-image: url('$(res)/img/element-icons/message/repeat.svg'); + mask-image: url('$(res)/img/element-icons/retry.svg'); } .mx_MessageContextMenu_iconSource::before { diff --git a/res/img/element-icons/warning-badge.svg b/res/img/element-icons/warning-badge.svg index 4e2ff75679..1c8da9aa8e 100644 --- a/res/img/element-icons/warning-badge.svg +++ b/res/img/element-icons/warning-badge.svg @@ -1,4 +1,32 @@ - - + + + + + + image/svg+xml + + + + + + + diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index cd7dd91e4a..b61d8b50f0 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -22,13 +22,13 @@ import { EventStatus } from 'matrix-js-sdk/src/models/event'; import { MatrixClientPeg } from '../../../MatrixClientPeg'; import dis from '../../../dispatcher/dispatcher'; import * as sdk from '../../../index'; -import {_t} from '../../../languageHandler'; +import { _t } from '../../../languageHandler'; import Modal from '../../../Modal'; import Resend from '../../../Resend'; import SettingsStore from '../../../settings/SettingsStore'; import { isUrlPermitted } from '../../../HtmlUtils'; import { isContentActionable } from '../../../utils/EventUtils'; -import IconizedContextMenu, {IconizedContextMenuOption, IconizedContextMenuOptionList} from "./IconizedContextMenu"; +import IconizedContextMenu, { IconizedContextMenuOption, IconizedContextMenuOptionList } from './IconizedContextMenu'; import { EventType } from "matrix-js-sdk/src/@types/event"; import { replaceableComponent } from "../../../utils/replaceableComponent"; import { ReadPinsEventId } from "../right_panel/PinnedMessagesCard"; @@ -306,7 +306,7 @@ export default class MessageContextMenu extends React.Component { const viewSourceButton = ( ); @@ -316,7 +316,7 @@ export default class MessageContextMenu extends React.Component { unhidePreviewButton = ( ); @@ -351,8 +351,7 @@ export default class MessageContextMenu extends React.Component { } // Bridges can provide a 'external_url' to link back to the source. - if (true || - typeof (mxEvent.event.content.external_url) === "string" && + if (typeof (mxEvent.event.content.external_url) === "string" && isUrlPermitted(mxEvent.event.content.external_url) ) { externalURLButton = ( @@ -372,7 +371,7 @@ export default class MessageContextMenu extends React.Component { collapseReplyThread = ( ); @@ -383,7 +382,7 @@ export default class MessageContextMenu extends React.Component { reportEventButton = ( ); @@ -391,23 +390,23 @@ export default class MessageContextMenu extends React.Component { optionLists.push(( - {quoteButton} - {forwardButton} - {pinButton} - {permalinkButton} - {reportEventButton} - {externalURLButton} - {viewSourceButton} - {unhidePreviewButton} - {resendReactionsButton} - {collapseReplyThread} + { quoteButton } + { forwardButton } + { pinButton } + { permalinkButton } + { reportEventButton } + { externalURLButton } + { unhidePreviewButton } + { viewSourceButton } + { resendReactionsButton } + { collapseReplyThread } )); if (redactButton) { optionLists.push(( - {redactButton} + { redactButton } )); } @@ -418,7 +417,7 @@ export default class MessageContextMenu extends React.Component { className="mx_MessageContextMenu" compact={true} > - {optionLists} + { optionLists } ); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index f95caeff71..7e1237f1cf 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2252,7 +2252,7 @@ "Sending": "Sending", "Sent": "Sent", "Open link": "Open link", - "Forward": "Forward", + "Forward message": "Forward message", "Message preview": "Message preview", "Search for rooms or people": "Search for rooms or people", "Confirm abort of host creation": "Confirm abort of host creation", @@ -2525,12 +2525,12 @@ "Are you sure you want to reject the invitation?": "Are you sure you want to reject the invitation?", "Unable to reject invite": "Unable to reject invite", "Resend %(unsentCount)s reaction(s)": "Resend %(unsentCount)s reaction(s)", - "Forward Message": "Forward", - "Unpin Message": "Unpin Message", - "Pin Message": "Pin Message", - "Unhide Preview": "Unhide Preview", + "Forward": "Forward", + "View source": "View source", + "Show preview": "Show preview", "Source URL": "Source URL", - "Collapse Reply Thread": "Collapse Reply Thread", + "Collapse reply thread": "Collapse reply thread", + "Report": "Report", "Clear status": "Clear status", "Update status": "Update status", "Set status": "Set status", From e685f1239d6bdc588d7d244119d9a9361a756111 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Thu, 24 Jun 2021 22:06:12 +0200 Subject: [PATCH 10/11] use null vars for context menu lists Signed-off-by: Michael Weimann --- .../views/context_menus/MessageContextMenu.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index b61d8b50f0..1d871b484d 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -257,7 +257,7 @@ export default class MessageContextMenu extends React.Component { let externalURLButton; let quoteButton; let collapseReplyThread; - const optionLists = []; + let redactItemList; // status is SENT before remote-echo, null after const isSent = !eventStatus || eventStatus === EventStatus.SENT; @@ -388,7 +388,7 @@ export default class MessageContextMenu extends React.Component { ); } - optionLists.push(( + const commonItemsList = ( { quoteButton } { forwardButton } @@ -401,14 +401,14 @@ export default class MessageContextMenu extends React.Component { { resendReactionsButton } { collapseReplyThread } - )); + ); if (redactButton) { - optionLists.push(( + redactItemList = ( { redactButton } - )); + ); } return ( @@ -417,7 +417,8 @@ export default class MessageContextMenu extends React.Component { className="mx_MessageContextMenu" compact={true} > - { optionLists } + { commonItemsList } + { redactItemList } ); } From d3bc7fe80633ad6b76db415e8a8e4ef85316d9ec Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sat, 26 Jun 2021 09:51:40 +0200 Subject: [PATCH 11/11] remove list keys Signed-off-by: Michael Weimann --- src/components/views/context_menus/MessageContextMenu.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index 1d871b484d..5d1aad0600 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -389,7 +389,7 @@ export default class MessageContextMenu extends React.Component { } const commonItemsList = ( - + { quoteButton } { forwardButton } { pinButton } @@ -405,7 +405,7 @@ export default class MessageContextMenu extends React.Component { if (redactButton) { redactItemList = ( - + { redactButton } );