From d47c9d8b6ee6740ef1de3a7f63605ceff68bc77e Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 12 Feb 2018 18:02:55 +0000 Subject: [PATCH 1/3] Add context menu to TagPanel See https://github.com/matrix-org/matrix-react-sdk/pull/1743 --- .../views/context_menus/TagTileContextMenu.js | 68 +++++++++++++++++++ src/i18n/strings/en_EN.json | 17 ++--- src/skins/vector/css/_components.scss | 5 +- .../structures/_TagPanel.scss | 18 +++++ .../context_menus/_TagTileContextMenu.scss | 44 ++++++++++++ 5 files changed, 142 insertions(+), 10 deletions(-) create mode 100644 src/components/views/context_menus/TagTileContextMenu.js create mode 100644 src/skins/vector/css/vector-web/views/context_menus/_TagTileContextMenu.scss diff --git a/src/components/views/context_menus/TagTileContextMenu.js b/src/components/views/context_menus/TagTileContextMenu.js new file mode 100644 index 0000000000..4ec6c5150f --- /dev/null +++ b/src/components/views/context_menus/TagTileContextMenu.js @@ -0,0 +1,68 @@ +/* +Copyright 2018 New Vector 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. +*/ + +import React from 'react'; +import PropTypes from 'prop-types'; +import { _t } from 'matrix-react-sdk/lib/languageHandler'; +import dis from 'matrix-react-sdk/lib/dispatcher'; +import TagOrderActions from 'matrix-react-sdk/lib/actions/TagOrderActions'; +import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; + +export default class TagTileContextMenu extends React.Component { + static propTypes = { + tag: PropTypes.string.isRequired, + /* callback called when the menu is dismissed */ + onFinished: PropTypes.func.isRequired, + }; + + constructor() { + super(); + + this._onViewCommunityClick = this._onViewCommunityClick.bind(this); + this._onRemoveClick = this._onRemoveClick.bind(this); + } + + _onViewCommunityClick() { + dis.dispatch({ + action: 'view_group', + group_id: this.props.tag, + }); + this.props.onFinished(); + } + + _onRemoveClick() { + dis.dispatch(TagOrderActions.removeTag( + // XXX: Context menus don't have a MatrixClient context + MatrixClientPeg.get(), + this.props.tag, + )); + this.props.onFinished(); + } + + render() { + return
+
+ + { _t('View Community') } +
+
+
+ + { _t('Remove') } +
+
; + } +} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 819c0cfa21..bbb94a609d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -43,9 +43,6 @@ "Off": "Off", "On": "On", "Noisy": "Noisy", - "Failed to set direct chat tag": "Failed to set direct chat tag", - "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", - "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", "Search…": "Search…", "Search": "Search", "This Room": "This Room", @@ -68,8 +65,6 @@ "What's New": "What's New", "Update": "Update", "What's new?": "What's new?", - "Appear Offline": "Appear Offline", - "Away": "Away", "A new version of Riot is available.": "A new version of Riot is available.", "To return to your account in future you need to set a password": "To return to your account in future you need to set a password", "Set Password": "Set Password", @@ -126,6 +121,7 @@ "Resend": "Resend", "Cancel Sending": "Cancel Sending", "Forward Message": "Forward Message", + "Reply": "Reply", "Unpin Message": "Unpin Message", "Pin Message": "Pin Message", "View Source": "View Source", @@ -134,6 +130,10 @@ "Permalink": "Permalink", "Quote": "Quote", "Source URL": "Source URL", + "Online": "Online", + "Away": "Away", + "Appear Offline": "Appear Offline", + "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", "Failed to set Direct Message status of room": "Failed to set Direct Message status of room", "unknown error code": "unknown error code", "Failed to forget room %(errCode)s": "Failed to forget room %(errCode)s", @@ -147,6 +147,7 @@ "Favourite": "Favourite", "Low Priority": "Low Priority", "Direct Chat": "Direct Chat", + "View Community": "View Community", "Sorry, your browser is not able to run Riot.": "Sorry, your browser is not able to run Riot.", "Riot uses many advanced browser features, some of which are not available or experimental in your current browser.": "Riot uses many advanced browser features, some of which are not available or experimental in your current browser.", "Please install Chrome or Firefox for the best experience.": "Please install Chrome or Firefox for the best experience.", @@ -156,10 +157,10 @@ "Couldn't load home page": "Couldn't load home page", "Login": "Login", "Register": "Register", - "Invite to this room": "Invite to this room", "Members": "Members", "%(count)s Members|other": "%(count)s Members", "%(count)s Members|one": "%(count)s Member", + "Invite to this room": "Invite to this room", "Files": "Files", "Notifications": "Notifications", "Rooms": "Rooms", @@ -189,6 +190,7 @@ "Search for a room": "Search for a room", "#example": "#example", "more": "more", + "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", "Expand panel": "Expand panel", "Collapse panel": "Collapse panel", "Filter room names": "Filter room names", @@ -219,6 +221,5 @@ "Contributing code to Matrix and Riot": "Contributing code to Matrix and Riot", "Dev chat for the Riot/Web dev team": "Dev chat for the Riot/Web dev team", "Dev chat for the Dendrite dev team": "Dev chat for the Dendrite dev team", - "Co-ordination for Riot/Web translators": "Co-ordination for Riot/Web translators", - "Reply": "Reply" + "Co-ordination for Riot/Web translators": "Co-ordination for Riot/Web translators" } diff --git a/src/skins/vector/css/_components.scss b/src/skins/vector/css/_components.scss index faf358bd94..837fe4532f 100644 --- a/src/skins/vector/css/_components.scss +++ b/src/skins/vector/css/_components.scss @@ -36,10 +36,10 @@ @import "./matrix-react-sdk/views/elements/_EditableItemList.scss"; @import "./matrix-react-sdk/views/elements/_MemberEventListSummary.scss"; @import "./matrix-react-sdk/views/elements/_ProgressBar.scss"; +@import "./matrix-react-sdk/views/elements/_Quote.scss"; @import "./matrix-react-sdk/views/elements/_RichText.scss"; @import "./matrix-react-sdk/views/elements/_RoleButton.scss"; @import "./matrix-react-sdk/views/elements/_ToolTipButton.scss"; -@import "./matrix-react-sdk/views/elements/_Quote.scss"; @import "./matrix-react-sdk/views/groups/_GroupPublicityToggle.scss"; @import "./matrix-react-sdk/views/groups/_GroupRoomList.scss"; @import "./matrix-react-sdk/views/groups/_GroupUserSettings.scss"; @@ -65,6 +65,7 @@ @import "./matrix-react-sdk/views/rooms/_PinnedEventTile.scss"; @import "./matrix-react-sdk/views/rooms/_PinnedEventsPanel.scss"; @import "./matrix-react-sdk/views/rooms/_PresenceLabel.scss"; +@import "./matrix-react-sdk/views/rooms/_QuotePreview.scss"; @import "./matrix-react-sdk/views/rooms/_RoomHeader.scss"; @import "./matrix-react-sdk/views/rooms/_RoomList.scss"; @import "./matrix-react-sdk/views/rooms/_RoomPreviewBar.scss"; @@ -72,7 +73,6 @@ @import "./matrix-react-sdk/views/rooms/_RoomTile.scss"; @import "./matrix-react-sdk/views/rooms/_SearchableEntityList.scss"; @import "./matrix-react-sdk/views/rooms/_TopUnreadMessagesBar.scss"; -@import "./matrix-react-sdk/views/rooms/_QuotePreview.scss"; @import "./matrix-react-sdk/views/settings/_DevicesPanel.scss"; @import "./matrix-react-sdk/views/settings/_IntegrationsManager.scss"; @import "./matrix-react-sdk/views/voip/_CallView.scss"; @@ -89,6 +89,7 @@ @import "./vector-web/views/context_menus/_MessageContextMenu.scss"; @import "./vector-web/views/context_menus/_PresenceContextMenuOption.scss"; @import "./vector-web/views/context_menus/_RoomTileContextMenu.scss"; +@import "./vector-web/views/context_menus/_TagTileContextMenu.scss"; @import "./vector-web/views/dialogs/_ChangelogDialog.scss"; @import "./vector-web/views/dialogs/_DevtoolsDialog.scss"; @import "./vector-web/views/dialogs/_SetEmailDialog.scss"; diff --git a/src/skins/vector/css/matrix-react-sdk/structures/_TagPanel.scss b/src/skins/vector/css/matrix-react-sdk/structures/_TagPanel.scss index 91199a11e7..ba745b111f 100644 --- a/src/skins/vector/css/matrix-react-sdk/structures/_TagPanel.scss +++ b/src/skins/vector/css/matrix-react-sdk/structures/_TagPanel.scss @@ -37,6 +37,7 @@ limitations under the License. .mx_TagPanel .mx_TagTile { padding: 6px 3px; opacity: 0.5; + position: relative; } .mx_TagPanel .mx_TagTile:focus, .mx_TagPanel .mx_TagTile:hover, @@ -64,6 +65,23 @@ limitations under the License. left: 5px; } +.mx_TagTile_context_button { + min-width: 15px; + height: 15px; + position: absolute; + right: -5px; + top: 1px; + border-radius: 8px; + background-color: $neutral-badge-color; + color: #ffffff; + font-weight: 600; + font-size: 10px; + text-align: center; + padding-top: 1px; + padding-left: 4px; + padding-right: 4px; +} + .mx_TagPanel_createGroupButton { opacity: 0.5; margin-bottom: 17px; diff --git a/src/skins/vector/css/vector-web/views/context_menus/_TagTileContextMenu.scss b/src/skins/vector/css/vector-web/views/context_menus/_TagTileContextMenu.scss new file mode 100644 index 0000000000..759b92bd68 --- /dev/null +++ b/src/skins/vector/css/vector-web/views/context_menus/_TagTileContextMenu.scss @@ -0,0 +1,44 @@ +/* +Copyright 2018 New Vector 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_TagTileContextMenu_item { + padding-top: 8px; + padding-right: 20px; + padding-bottom: 8px; + cursor: pointer; + white-space: nowrap; + display: flex; + align-items: center; + line-height: 16px; +} + + +.mx_TagTileContextMenu_item_icon { + padding-right: 8px; + padding-left: 4px; + display: inline-block +} + +.mx_TagTileContextMenu_separator { + margin-top: 0; + margin-bottom: 0; + border-bottom-style: none; + border-left-style: none; + border-right-style: none; + border-top-style: solid; + border-top-width: 1px; + border-color: $menu-border-color; +} From db5f4193ec44f1810d2a4efe0dbe31bbb5f20e66 Mon Sep 17 00:00:00 2001 From: rbozhkova Date: Tue, 13 Feb 2018 18:22:01 +0100 Subject: [PATCH 2/3] Fix typo --- docs/translating.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/translating.md b/docs/translating.md index 3fd0731d6c..5cfd9eaadd 100644 --- a/docs/translating.md +++ b/docs/translating.md @@ -35,7 +35,7 @@ Head to the explanations under Steb 2b ## Step 2b: Adding a new language 1. Go to one of the projects listed https://translate.riot.im/projects/riot-web/ -2. Click the ``Start new language`` button at the bottom +2. Click the ``Start new translation`` button at the bottom 3. Select a language 4. Start translating like in 2a.3 5. Repeat these steps for the other projects which are listed at the link of step 2b.1 From 55cacfba826479fe0bb624b133c47e2824e74f58 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 13 Feb 2018 20:42:46 +0000 Subject: [PATCH 3/3] Temporary hack to constrain LLP container size. --- src/skins/vector/css/vector-web/structures/_LeftPanel.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/skins/vector/css/vector-web/structures/_LeftPanel.scss b/src/skins/vector/css/vector-web/structures/_LeftPanel.scss index a2147a025d..b099cff766 100644 --- a/src/skins/vector/css/vector-web/structures/_LeftPanel.scss +++ b/src/skins/vector/css/vector-web/structures/_LeftPanel.scss @@ -23,6 +23,7 @@ limitations under the License. .mx_LeftPanel_container { display: flex; + flex: 0 0 235px; } .mx_LeftPanel_hideButton {