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.
This commit is contained in:
Richard van der Hoff 2016-02-09 14:42:32 +00:00
parent 7fd56351a9
commit 30b4b91cf3

View file

@ -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 (
<div className="mx_RoomStatusBar_scrollDownIndicator"
onClick={ this.props.onScrollToBottomClick }>
<img src="img/newmessages.svg" width="24" height="24"
alt=""/>
</div>
);
}
if (!this.props.atEndOfLiveTimeline) {
return (
<div className="mx_RoomStatusBar_scrollDownIndicator"
onClick={ this.props.onScrollToBottomClick }>
<img src="img/scrolldown.svg" width="24" height="24"
alt="Scroll to bottom of page"
title="Scroll to bottom of page"/>
</div>
);
}
if (this.props.hasActiveCall) {
return (
<img src="img/sound-indicator.svg" width="23" height="20"/>
);
}
if (wantPlaceholder) {
return (
<div className="mx_RoomStatusBar_placeholderIndicator">...</div>
);
}
return null;
},
// return suitable content for the main (text) part of the status bar.
_getContent: function() {
var TabCompleteBar = sdk.getComponent('rooms.TabCompleteBar'); var TabCompleteBar = sdk.getComponent('rooms.TabCompleteBar');
var TintableSvg = sdk.getComponent("elements.TintableSvg"); var TintableSvg = sdk.getComponent("elements.TintableSvg");
@ -86,15 +129,13 @@ module.exports = React.createClass({
// a connection! // a connection!
if (this.state.syncState === "ERROR") { if (this.state.syncState === "ERROR") {
return ( return (
<div className="mx_RoomView_connectionLostBar"> <div className="mx_RoomStatusBar_connectionLostBar">
<img src="img/warning.svg" width="24" height="23" title="/!\ " alt="/!\ "/> <img src="img/warning.svg" width="24" height="23" title="/!\ " alt="/!\ "/>
<div className="mx_RoomView_connectionLostBar_textArea"> <div className="mx_RoomStatusBar_connectionLostBar_title">
<div className="mx_RoomView_connectionLostBar_title"> Connectivity to the server has been lost.
Connectivity to the server has been lost. </div>
</div> <div className="mx_RoomStatusBar_connectionLostBar_desc">
<div className="mx_RoomView_connectionLostBar_desc"> Sent messages will be stored until your connection has returned.
Sent messages will be stored until your connection has returned.
</div>
</div> </div>
</div> </div>
); );
@ -102,11 +143,10 @@ module.exports = React.createClass({
if (this.props.tabCompleteEntries) { if (this.props.tabCompleteEntries) {
return ( return (
<div className="mx_RoomView_tabCompleteBar"> <div className="mx_RoomStatusBar_tabCompleteBar">
<div className="mx_RoomView_tabCompleteImage">...</div> <div className="mx_RoomStatusBar_tabCompleteWrapper">
<div className="mx_RoomView_tabCompleteWrapper">
<TabCompleteBar entries={this.props.tabCompleteEntries} /> <TabCompleteBar entries={this.props.tabCompleteEntries} />
<div className="mx_RoomView_tabCompleteEol" title="->|"> <div className="mx_RoomStatusBar_tabCompleteEol" title="->|">
<TintableSvg src="img/eol.svg" width="22" height="16"/> <TintableSvg src="img/eol.svg" width="22" height="16"/>
Auto-complete Auto-complete
</div> </div>
@ -117,18 +157,16 @@ module.exports = React.createClass({
if (this.props.hasUnsentMessages) { if (this.props.hasUnsentMessages) {
return ( return (
<div className="mx_RoomView_connectionLostBar"> <div className="mx_RoomStatusBar_connectionLostBar">
<img src="img/warning.svg" width="24" height="23" title="/!\ " alt="/!\ "/> <img src="img/warning.svg" width="24" height="23" title="/!\ " alt="/!\ "/>
<div className="mx_RoomView_connectionLostBar_textArea"> <div className="mx_RoomStatusBar_connectionLostBar_title">
<div className="mx_RoomView_connectionLostBar_title"> Some of your messages have not been sent.
Some of your messages have not been sent. </div>
</div> <div className="mx_RoomStatusBar_connectionLostBar_desc">
<div className="mx_RoomView_connectionLostBar_desc"> <a className="mx_RoomStatusBar_resend_link"
<a className="mx_RoomView_resend_link" onClick={ this.props.onResendAllClick }>
onClick={ this.props.onResendAllClick }> Resend all now
Resend all now </a> or select individual messages to re-send.
</a> or select individual messages to re-send.
</div>
</div> </div>
</div> </div>
); );
@ -141,8 +179,8 @@ module.exports = React.createClass({
(this.props.numUnreadMessages > 1 ? "s" : ""); (this.props.numUnreadMessages > 1 ? "s" : "");
return ( return (
<div className="mx_RoomView_unreadMessagesBar" onClick={ this.props.onScrollToBottomClick }> <div className="mx_RoomStatusBar_unreadMessagesBar"
<img src="img/newmessages.svg" width="24" height="24" alt=""/> onClick={ this.props.onScrollToBottomClick }>
{unreadMsgs} {unreadMsgs}
</div> </div>
); );
@ -151,30 +189,35 @@ module.exports = React.createClass({
var typingString = WhoIsTyping.whoIsTypingString(this.props.room); var typingString = WhoIsTyping.whoIsTypingString(this.props.room);
if (typingString) { if (typingString) {
return ( return (
<div className="mx_RoomView_typingBar"> <div className="mx_RoomStatusBar_typingBar">
<div className="mx_RoomView_typingImage">...</div> {typingString}
<span className="mx_RoomView_typingText">{typingString}</span>
</div> </div>
); );
} }
if (!this.props.atEndOfLiveTimeline) {
return (
<div className="mx_RoomView_scrollToBottomBar" onClick={ this.props.onScrollToBottomClick }>
<img src="img/scrolldown.svg" width="24" height="24" alt="Scroll to bottom of page" title="Scroll to bottom of page"/>
</div>
);
}
if (this.props.hasActiveCall) { if (this.props.hasActiveCall) {
return ( return (
<div className="mx_RoomView_callBar"> <div className="mx_RoomStatusBar_callBar">
<img src="img/sound-indicator.svg" width="23" height="20"/>
<b>Active call</b> <b>Active call</b>
</div> </div>
); );
} }
return <div />; return null;
}, },
render: function() {
var content = this._getContent();
var indicator = this._getIndicator(content !== null);
return (
<div className="mx_RoomStatusBar">
<div className="mx_RoomStatusBar_indicator">
{indicator}
</div>
{content}
</div>
);
},
}); });