File tree Expand file tree Collapse file tree
src/controllers/organisms Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,6 +365,8 @@ module.exports = {
365365 'm.room.topic' : sdk . getComponent ( 'molecules.EventAsTextTile' ) ,
366366 } ;
367367
368+ var DateSeparator = sdk . getComponent ( 'molecules.DateSeparator' ) ;
369+
368370 var ret = [ ] ;
369371 var count = 0 ;
370372
@@ -373,6 +375,7 @@ module.exports = {
373375 var TileType = tileTypes [ mxEv . getType ( ) ] ;
374376 var continuation = false ;
375377 var last = false ;
378+ var dateSeparator = null ;
376379 if ( i == this . state . room . timeline . length - 1 ) {
377380 last = true ;
378381 }
@@ -387,11 +390,21 @@ module.exports = {
387390 {
388391 continuation = true ;
389392 }
393+
394+ var ts0 = this . state . room . timeline [ i - 1 ] . getTs ( ) ;
395+ var ts1 = this . state . room . timeline [ i ] . getTs ( ) ;
396+ if ( new Date ( ts0 ) . toDateString ( ) !== new Date ( ts1 ) . toDateString ( ) ) {
397+ dateSeparator = < DateSeparator key = { ts1 } ts = { ts1 } /> ;
398+ continuation = false ;
399+ }
390400 }
391401 if ( ! TileType ) continue ;
392402 ret . unshift (
393403 < li key = { mxEv . getId ( ) } > < TileType mxEvent = { mxEv } continuation = { continuation } last = { last } /> </ li >
394404 ) ;
405+ if ( dateSeparator ) {
406+ ret . unshift ( dateSeparator ) ;
407+ }
395408 ++ count ;
396409 }
397410 return ret ;
You can’t perform that action at this time.
0 commit comments