From 0e0d0cf4f5e071a8cfe4b6ecaf0635091fd049ce Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 11 Feb 2016 15:38:13 +0000 Subject: [PATCH] post-review tweaks --- src/components/structures/MessagePanel.js | 45 ++++----- src/components/structures/TimelinePanel.js | 103 +++++++++++---------- 2 files changed, 76 insertions(+), 72 deletions(-) diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js index d0c12eac31..712a5f7561 100644 --- a/src/components/structures/MessagePanel.js +++ b/src/components/structures/MessagePanel.js @@ -23,7 +23,7 @@ module.exports = React.createClass({ displayName: 'MessagePanel', propTypes: { - // true to give the component a 'display: hidden' style. + // true to give the component a 'display: none' style. hidden: React.PropTypes.bool, // the list of MatrixEvents to display @@ -117,19 +117,6 @@ module.exports = React.createClass({ } }, - render: function() { - var ScrollPanel = sdk.getComponent("structures.ScrollPanel"); - return ( - - {this._getEventTiles()} - - ); - }, - _getEventTiles: function() { var DateSeparator = sdk.getComponent('messages.DateSeparator'); var EventTile = sdk.getComponent('rooms.EventTile'); @@ -240,15 +227,18 @@ module.exports = React.createClass({ // is the last element or not, because we only decide as we're going along. if (readMarkerIndex === undefined && ghostIndex && ghostIndex <= ret.length) { var hr; - hr = (
); + hr = ( +
); ret.splice(ghostIndex, 0, (
  • + className="mx_RoomView_myReadMarker_container"> {hr}
  • )); @@ -261,4 +251,17 @@ module.exports = React.createClass({ if (this.eventNodes == undefined) this.eventNodes = {}; this.eventNodes[eventId] = node; }, + + render: function() { + var ScrollPanel = sdk.getComponent("structures.ScrollPanel"); + return ( + + {this._getEventTiles()} + + ); + }, }); diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 6ca5765af8..7f170d3695 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -51,7 +51,7 @@ module.exports = React.createClass({ // representing. room: React.PropTypes.object.isRequired, - // true to give the component a 'display: hidden' style. + // true to give the component a 'display: none' style. hidden: React.PropTypes.bool, // ID of an event to highlight. If undefined, no event will be highlighted. @@ -279,56 +279,6 @@ module.exports = React.createClass({ return this.refs.messagePanel.getScrollState(); }, - render: function() { - var MessagePanel = sdk.getComponent("structures.MessagePanel"); - var Loader = sdk.getComponent("elements.Spinner"); - - // just show a spinner while the timeline loads. - // - // put it in a div of the right class (mx_RoomView_messagePanel) so - // that the order in the roomview flexbox is correct, and - // mx_RoomView_messageListWrapper to position the inner div in the - // right place. - // - // Note that the click-on-search-result functionality relies on the - // fact that the messagePanel is hidden while the timeline reloads, - // but that the RoomHeader (complete with search term) continues to - // exist. - if (this.state.timelineLoading) { - return ( -
    - -
    - ); - } - - // give the messagepanel a stickybottom if we're at the end of the - // live timeline, so that the arrival of new events triggers a - // scroll. - // - // Make sure that stickyBottom is *false* if we can paginate - // forwards, otherwise if somebody hits the bottom of the loaded - // events when viewing historical messages, we get stuck in a loop - // of paginating our way through the entire history of the room. - var stickyBottom = !this._timelineWindow.canPaginate(EventTimeline.FORWARDS); - - return ( -