forked from matrix/element-web
basic date separator support
This commit is contained in:
parent
a2ca5f2847
commit
1a95148dae
|
@ -28,6 +28,7 @@ div.error {
|
|||
}
|
||||
|
||||
h2 {
|
||||
color: #80cef4;
|
||||
font-weight: 400;
|
||||
font-size: 20px;
|
||||
margin-top: 16px;
|
||||
|
|
|
@ -44,7 +44,6 @@ limitations under the License.
|
|||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
|
||||
/* background-color: #0ff; */
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,6 @@ limitations under the License.
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
margin-bottom: 60px;
|
||||
/* background-color: #ff0; */
|
||||
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
@ -78,6 +77,14 @@ limitations under the License.
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.mx_RoomView_MessageList h2 {
|
||||
clear: both;
|
||||
margin-top: 32px;
|
||||
margin-bottom: 8px;
|
||||
padding-bottom: 6px;
|
||||
border-bottom: 1px solid #a8dbf3;
|
||||
}
|
||||
|
||||
.mx_RoomView_invitePrompt {
|
||||
}
|
||||
|
||||
|
|
|
@ -45,12 +45,14 @@ module.exports = React.createClass({
|
|||
|
||||
render: function() {
|
||||
// XXX: for now, just cheekily borrow the css from message tile...
|
||||
var timestamp = this.props.last ? <MessageTimestamp ts={this.props.mxEvent.getTs()} /> : null;
|
||||
|
||||
return (
|
||||
<div className="mx_MessageTile">
|
||||
<div className="mx_MessageTile_avatar">
|
||||
<img src={ this.props.mxEvent.target ? MatrixClientPeg.get().getAvatarUrlForMember(this.props.mxEvent.target, 40, 40, "crop") : null } width="40" height="40"/>
|
||||
</div>
|
||||
<MessageTimestamp ts={this.props.mxEvent.getTs()} />
|
||||
{ timestamp }
|
||||
<span className="mx_SenderProfile"></span>
|
||||
<span className="mx_MessageTile_content">
|
||||
{this.getMemberEventText()}
|
||||
|
|
|
@ -98,6 +98,7 @@ require('../skins/base/views/organisms/RightPanel');
|
|||
require('../skins/base/views/molecules/RoomCreate');
|
||||
require('../skins/base/views/molecules/RoomDropTarget');
|
||||
require('../skins/base/views/molecules/DirectoryMenu');
|
||||
require('../skins/base/views/molecules/DateSeparator');
|
||||
require('../skins/base/views/atoms/voip/VideoFeed');
|
||||
require('../skins/base/views/molecules/voip/VideoView');
|
||||
require('../skins/base/views/molecules/voip/CallView');
|
||||
|
|
|
@ -36,6 +36,8 @@ var tileTypes = {
|
|||
'm.call.hangup': ComponentBroker.get('molecules/voip/MCallHangupTile')
|
||||
};
|
||||
|
||||
var DateSeparator = ComponentBroker.get('molecules/DateSeparator');
|
||||
|
||||
module.exports = {
|
||||
getInitialState: function() {
|
||||
return {
|
||||
|
@ -231,22 +233,33 @@ module.exports = {
|
|||
var TileType = tileTypes[mxEv.getType()];
|
||||
var continuation = false;
|
||||
var last = false;
|
||||
var dateSeparator = null;
|
||||
if (i == this.state.room.timeline.length - 1) {
|
||||
last = true;
|
||||
}
|
||||
if (i > 0 &&
|
||||
count < this.state.messageCap - 1 &&
|
||||
this.state.room.timeline[i].sender &&
|
||||
if (i > 0 && count < this.state.messageCap - 1) {
|
||||
if (this.state.room.timeline[i].sender &&
|
||||
this.state.room.timeline[i - 1].sender &&
|
||||
this.state.room.timeline[i].sender.userId ===
|
||||
this.state.room.timeline[i - 1].sender.userId)
|
||||
{
|
||||
continuation = true;
|
||||
}
|
||||
|
||||
var ts0 = this.state.room.timeline[i - 1].getTs();
|
||||
var ts1 = this.state.room.timeline[i].getTs();
|
||||
if (new Date(ts0).toDateString() !== new Date(ts1).toDateString()) {
|
||||
dateSeparator = <DateSeparator key={ts1} ts={ts1}/>;
|
||||
continuation = false;
|
||||
}
|
||||
}
|
||||
if (!TileType) continue;
|
||||
ret.unshift(
|
||||
<TileType key={mxEv.getId()} mxEvent={mxEv} continuation={continuation} last={last}/>
|
||||
);
|
||||
if (dateSeparator) {
|
||||
ret.unshift(dateSeparator);
|
||||
}
|
||||
++count;
|
||||
}
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue