From 30b4b91cf3a916e3ee455ad55f2f9d5a2352d532 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 9 Feb 2016 14:42:32 +0000 Subject: [PATCH] Show jump-to-bottom icon even when there is other stuff in the status bar Also includes a general simplification of the classes being used in the status bar. This should fix vector-im/vector-web#879. Obviously it needs corresponding changes in the CSS in vector-web. --- src/components/structures/RoomStatusBar.js | 123 ++++++++++++++------- 1 file changed, 83 insertions(+), 40 deletions(-) diff --git a/src/components/structures/RoomStatusBar.js b/src/components/structures/RoomStatusBar.js index 9ff3925b10..7a5f2ffdb2 100644 --- a/src/components/structures/RoomStatusBar.js +++ b/src/components/structures/RoomStatusBar.js @@ -76,7 +76,50 @@ module.exports = React.createClass({ }); }, - render: function() { + // return suitable content for the image on the left of the status bar. + // + // if wantPlaceholder is true, we include a "..." placeholder if + // there is nothing better to put in. + _getIndicator: function(wantPlaceholder) { + if (this.props.numUnreadMessages) { + return ( +
+ +
+ ); + } + + if (!this.props.atEndOfLiveTimeline) { + return ( +
+ Scroll to bottom of page +
+ ); + } + + if (this.props.hasActiveCall) { + return ( + + ); + } + + if (wantPlaceholder) { + return ( +
...
+ ); + } + + return null; + }, + + + // return suitable content for the main (text) part of the status bar. + _getContent: function() { var TabCompleteBar = sdk.getComponent('rooms.TabCompleteBar'); var TintableSvg = sdk.getComponent("elements.TintableSvg"); @@ -86,15 +129,13 @@ module.exports = React.createClass({ // a connection! if (this.state.syncState === "ERROR") { return ( -
+
/!\ -
-
- Connectivity to the server has been lost. -
-
- Sent messages will be stored until your connection has returned. -
+
+ Connectivity to the server has been lost. +
+
+ Sent messages will be stored until your connection has returned.
); @@ -102,11 +143,10 @@ module.exports = React.createClass({ if (this.props.tabCompleteEntries) { return ( -
-
...
-
+
+
-
+
Auto-complete
@@ -117,18 +157,16 @@ module.exports = React.createClass({ if (this.props.hasUnsentMessages) { return ( -
+
/!\ -
-
- Some of your messages have not been sent. -
-
- - Resend all now - or select individual messages to re-send. -
+
+ Some of your messages have not been sent. +
+
+ + Resend all now + or select individual messages to re-send.
); @@ -141,8 +179,8 @@ module.exports = React.createClass({ (this.props.numUnreadMessages > 1 ? "s" : ""); return ( -
- +
{unreadMsgs}
); @@ -151,30 +189,35 @@ module.exports = React.createClass({ var typingString = WhoIsTyping.whoIsTypingString(this.props.room); if (typingString) { return ( -
-
...
- {typingString} +
+ {typingString}
); } - if (!this.props.atEndOfLiveTimeline) { - return ( -
- Scroll to bottom of page -
- ); - } - if (this.props.hasActiveCall) { return ( -
- +
Active call
); } - return
; + return null; }, + + + render: function() { + var content = this._getContent(); + var indicator = this._getIndicator(content !== null); + + return ( +
+
+ {indicator} +
+ {content} +
+ ); + }, });