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} +
+ ); + }, });