Add date seperator to the expanded events
netsplits across midnight is not handled, and @richvdh suggested splitting the list in two
This commit is contained in:
parent
04a934f738
commit
5f0b891d47
2 changed files with 7 additions and 8 deletions
|
@ -294,7 +294,6 @@ module.exports = React.createClass({
|
|||
|
||||
// Wrap consecutive member events in a ListSummary
|
||||
if (isMembershipChange(mxEv)) {
|
||||
|
||||
let summarisedEvents = [mxEv];
|
||||
i++;
|
||||
for (;i < this.props.events.length; i++) {
|
||||
|
@ -306,15 +305,14 @@ module.exports = React.createClass({
|
|||
}
|
||||
summarisedEvents.push(collapsedMxEv);
|
||||
}
|
||||
|
||||
let renderEvents = (events) => {
|
||||
let renderEvents = (pEvent, events) => {
|
||||
if (events.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return events.map(
|
||||
(e) => {
|
||||
// e, e to prevent date seperators
|
||||
let ret = this._getTilesForEvent(e, e);
|
||||
let ret = this._getTilesForEvent(pEvent, e);
|
||||
pEvent = e;
|
||||
return ret;
|
||||
}
|
||||
).reduce((a,b) => a.concat(b));
|
||||
|
@ -322,11 +320,11 @@ module.exports = React.createClass({
|
|||
ret.push(
|
||||
<MemberEventListSummary
|
||||
events={summarisedEvents}
|
||||
previousEvent={prevEvent}
|
||||
renderEvents={renderEvents}
|
||||
/>
|
||||
);
|
||||
// Use the first member event to create scroll token
|
||||
ret.push(<li key={eventId} data-scroll-token={eventId}/>);
|
||||
prevEvent = mxEv;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ module.exports = React.createClass({
|
|||
threshold: React.PropTypes.number,
|
||||
// The function to render events if they are not being summarised
|
||||
renderEvents: React.PropTypes.function,
|
||||
previousEvent: React.PropTypes.object,
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
|
@ -190,7 +191,7 @@ module.exports = React.createClass({
|
|||
let expandedEvents = null;
|
||||
|
||||
if (expanded) {
|
||||
expandedEvents = this.props.renderEvents(eventsToRender);
|
||||
expandedEvents = this.props.renderEvents(this.props.previousEvent, eventsToRender);
|
||||
}
|
||||
|
||||
let avatars = this.renderAvatars(joinEvents.concat(leaveEvents));
|
||||
|
|
Loading…
Reference in a new issue