From 7df47cbc87a8a6358b72ddc5dce4fb12716cdd9d Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 12 Nov 2018 16:09:51 +0100 Subject: [PATCH 01/11] move typing notifications to WhoIsTypingTile, shown in ScrollPanel --- res/css/_components.scss | 1 + res/css/views/rooms/_WhoIsTypingTile.scss | 123 ++++++++++++++++ src/components/structures/MessagePanel.js | 2 + src/components/structures/TimelinePanel.js | 1 + src/components/views/rooms/WhoIsTypingTile.js | 134 ++++++++++++++++++ 5 files changed, 261 insertions(+) create mode 100644 res/css/views/rooms/_WhoIsTypingTile.scss create mode 100644 src/components/views/rooms/WhoIsTypingTile.js diff --git a/res/css/_components.scss b/res/css/_components.scss index a230842c77..d56f782ffb 100644 --- a/res/css/_components.scss +++ b/res/css/_components.scss @@ -108,6 +108,7 @@ @import "./views/rooms/_SearchableEntityList.scss"; @import "./views/rooms/_Stickers.scss"; @import "./views/rooms/_TopUnreadMessagesBar.scss"; +@import "./views/rooms/_WhoIsTypingTile.scss"; @import "./views/settings/_DevicesPanel.scss"; @import "./views/settings/_IntegrationsManager.scss"; @import "./views/settings/_Notifications.scss"; diff --git a/res/css/views/rooms/_WhoIsTypingTile.scss b/res/css/views/rooms/_WhoIsTypingTile.scss new file mode 100644 index 0000000000..1323523618 --- /dev/null +++ b/res/css/views/rooms/_WhoIsTypingTile.scss @@ -0,0 +1,123 @@ +/* +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_WhoIsTypingTile { + margin-left: 65px; + min-height: 50px; + font-size: 14px; +} + +/* position the indicator in the same place horizontally as .mx_EventTile_avatar. */ +.mx_WhoIsTypingTile_indicator { + padding-left: 17px; + padding-right: 12px; + margin-left: -73px; + margin-top: 15px; + float: left; + width: 24px; + text-align: center; +} + +.mx_WhoIsTypingTile_placeholderIndicator span { + color: $primary-fg-color; + opacity: 0.5; + position: relative; + top: -4px; +/* + animation-duration: 1s; + animation-name: bounce; + animation-direction: alternate; + animation-iteration-count: infinite; +*/ +} + +.mx_WhoIsTypingTile_placeholderIndicator span:nth-child(1) { + animation-delay: 0.3s; +} +.mx_WhoIsTypingTile_placeholderIndicator span:nth-child(2) { + animation-delay: 0.6s; +} +.mx_WhoIsTypingTile_placeholderIndicator span:nth-child(3) { + animation-delay: 0.9s; +} + +@keyframes bounce { + from { + opacity: 0.5; + top: 0; + } + + to { + opacity: 0.2; + top: -3px; + } +} + +.mx_WhoIsTypingTile_typingIndicatorAvatars { + width: 52px; + margin-top: -1px; +} + +.mx_WhoIsTypingTile_typingIndicatorAvatars .mx_BaseAvatar_image { + margin-right: -12px; + border: 1px solid $primary-bg-color; +} + +.mx_WhoIsTypingTile_typingIndicatorAvatars .mx_BaseAvatar_initial { + padding-left: 1px; + padding-top: 1px; +} + +.mx_WhoIsTypingTile_typingIndicatorRemaining { + display: inline-block; + color: #acacac; + background-color: #ddd; + border: 1px solid $primary-bg-color; + border-radius: 40px; + width: 24px; + height: 24px; + line-height: 24px; + font-size: 0.8em; + vertical-align: top; + text-align: center; + position: absolute; +} + +.mx_WhoIsTypingTile_typingBar { + height: 50px; + line-height: 50px; + + color: $primary-fg-color; + opacity: 0.5; + overflow-y: hidden; + display: block; +} + + +.mx_MatrixChat_useCompactLayout { + .mx_WhoIsTypingTile { + min-height: 40px; + } + + .mx_WhoIsTypingTile_indicator { + margin-top: 10px; + } + + .mx_WhoIsTypingTile_typingBar { + height: 40px; + line-height: 40px; + } +} diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js index bbaea617f4..7e3a5941ef 100644 --- a/src/components/structures/MessagePanel.js +++ b/src/components/structures/MessagePanel.js @@ -637,6 +637,7 @@ module.exports = React.createClass({ render: function() { const ScrollPanel = sdk.getComponent("structures.ScrollPanel"); + const WhoIsTypingTile = sdk.getComponent("rooms.WhoIsTypingTile"); const Spinner = sdk.getComponent("elements.Spinner"); let topSpinner; let bottomSpinner; @@ -666,6 +667,7 @@ module.exports = React.createClass({ stickyBottom={this.props.stickyBottom}> { topSpinner } { this._getEventTiles() } + { bottomSpinner } ); diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 44d14cd7cf..f5dc6c7ef4 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -1154,6 +1154,7 @@ var TimelinePanel = React.createClass({ ); return (