From 2a84271e85564928c4b5e241d7d3bde69fef40ed Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Thu, 22 Sep 2016 20:58:35 +0200
Subject: Infinite scroll for account timelines

---
 .../components/features/account/index.jsx          | 32 ++++++++++++++--------
 1 file changed, 21 insertions(+), 11 deletions(-)

(limited to 'app/assets/javascripts/components/features/account/index.jsx')

diff --git a/app/assets/javascripts/components/features/account/index.jsx b/app/assets/javascripts/components/features/account/index.jsx
index edbc34826..46d0e5954 100644
--- a/app/assets/javascripts/components/features/account/index.jsx
+++ b/app/assets/javascripts/components/features/account/index.jsx
@@ -1,13 +1,19 @@
-import { connect }                                                            from 'react-redux';
-import PureRenderMixin                                                        from 'react-addons-pure-render-mixin';
-import ImmutablePropTypes                                                     from 'react-immutable-proptypes';
-import { fetchAccount, followAccount, unfollowAccount, fetchAccountTimeline } from '../../actions/accounts';
-import { replyCompose }                                                       from '../../actions/compose';
-import { favourite, reblog }                                                  from '../../actions/interactions';
-import Header                                                                 from './components/header';
-import { selectStatus }                                                       from '../../reducers/timelines';
-import StatusList                                                             from '../../components/status_list';
-import Immutable                                                              from 'immutable';
+import { connect }           from 'react-redux';
+import PureRenderMixin       from 'react-addons-pure-render-mixin';
+import ImmutablePropTypes    from 'react-immutable-proptypes';
+import {
+  fetchAccount,
+  followAccount,
+  unfollowAccount,
+  fetchAccountTimeline,
+  expandAccountTimeline
+}                            from '../../actions/accounts';
+import { replyCompose }      from '../../actions/compose';
+import { favourite, reblog } from '../../actions/interactions';
+import Header                from './components/header';
+import { selectStatus }      from '../../reducers/timelines';
+import StatusList            from '../../components/status_list';
+import Immutable             from 'immutable';
 
 function selectAccount(state, id) {
   return state.getIn(['timelines', 'accounts', id], null);
@@ -65,6 +71,10 @@ const Account = React.createClass({
     this.props.dispatch(favourite(status));
   },
 
+  handleScrollToBottom () {
+    this.props.dispatch(expandAccountTimeline(this.props.account.get('id')));
+  },
+
   render () {
     const { account, statuses } = this.props;
 
@@ -75,7 +85,7 @@ const Account = React.createClass({
     return (
       <div style={{ display: 'flex', flexDirection: 'column', 'flex': '0 0 auto', height: '100%' }}>
         <Header account={account} onFollow={this.handleFollow} onUnfollow={this.handleUnfollow} />
-        <StatusList statuses={statuses} onReply={this.handleReply} onReblog={this.handleReblog} onFavourite={this.handleFavourite} />
+        <StatusList statuses={statuses} onScrollToBottom={this.handleScrollToBottom} onReply={this.handleReply} onReblog={this.handleReblog} onFavourite={this.handleFavourite} />
       </div>
     );
   }
-- 
cgit 

