Merge pull request #670 from matrix-org/matthew/empty-timelines

show placeholder when timeline empty
pull/21833/head
Matthew Hodgson 2017-02-02 16:35:13 +00:00 committed by GitHub
commit a0e4afc231
3 changed files with 13 additions and 0 deletions

View File

@ -105,6 +105,7 @@ var FilePanel = React.createClass({
showUrlPreview = { false } showUrlPreview = { false }
tileShape="file_grid" tileShape="file_grid"
opacity={ this.props.opacity } opacity={ this.props.opacity }
empty="There are no visible files in this room"
/> />
); );
} }

View File

@ -48,6 +48,7 @@ var NotificationPanel = React.createClass({
showUrlPreview = { false } showUrlPreview = { false }
opacity={ this.props.opacity } opacity={ this.props.opacity }
tileShape="notif" tileShape="notif"
empty="You have no visible notifications"
/> />
); );
} }

View File

@ -96,6 +96,9 @@ var TimelinePanel = React.createClass({
// shape property to be passed to EventTiles // shape property to be passed to EventTiles
tileShape: React.PropTypes.string, tileShape: React.PropTypes.string,
// placeholder text to use if the timeline is empty
empty: React.PropTypes.string,
}, },
statics: { statics: {
@ -990,6 +993,14 @@ var TimelinePanel = React.createClass({
); );
} }
if (this.state.events.length == 0) {
return (
<div className={ this.props.className + " mx_RoomView_messageListWrapper" }>
<div className="mx_RoomView_empty">{ this.props.empty }</div>
</div>
);
}
// give the messagepanel a stickybottom if we're at the end of the // give the messagepanel a stickybottom if we're at the end of the
// live timeline, so that the arrival of new events triggers a // live timeline, so that the arrival of new events triggers a
// scroll. // scroll.