Added TimelineQueueButtonHeader to status_list
updated render return to add timeline queue button header before scrollable list added handleDequeueTimeline action with totalQueuedItemsCount props
This commit is contained in:
		
							parent
							
								
									a41e6f2876
								
							
						
					
					
						commit
						a7f2837a37
					
				@ -7,6 +7,7 @@ import StatusContainer from '../containers/status_container';
 | 
				
			|||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
 | 
					import ImmutablePureComponent from 'react-immutable-pure-component';
 | 
				
			||||||
import LoadGap from './load_gap';
 | 
					import LoadGap from './load_gap';
 | 
				
			||||||
import ScrollableList from './scrollable_list';
 | 
					import ScrollableList from './scrollable_list';
 | 
				
			||||||
 | 
					import TimelineQueueButtonHeader from './timeline_queue_button_header';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class StatusList extends ImmutablePureComponent {
 | 
					export default class StatusList extends ImmutablePureComponent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -22,6 +23,12 @@ export default class StatusList extends ImmutablePureComponent {
 | 
				
			|||||||
    emptyMessage: PropTypes.node,
 | 
					    emptyMessage: PropTypes.node,
 | 
				
			||||||
    alwaysPrepend: PropTypes.bool,
 | 
					    alwaysPrepend: PropTypes.bool,
 | 
				
			||||||
    timelineId: PropTypes.string,
 | 
					    timelineId: PropTypes.string,
 | 
				
			||||||
 | 
					    queuedItemSize: PropTypes.number,
 | 
				
			||||||
 | 
					    onDequeueTimeline: PropTypes.func,
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  componentWillUnmount() {
 | 
				
			||||||
 | 
					    this.handleDequeueTimeline();
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getFeaturedStatusCount = () => {
 | 
					  getFeaturedStatusCount = () => {
 | 
				
			||||||
@ -64,13 +71,17 @@ export default class StatusList extends ImmutablePureComponent {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  handleDequeueTimeline = () => {
 | 
				
			||||||
 | 
					    const { onDequeueTimeline, timelineId } = this.props;
 | 
				
			||||||
 | 
					    onDequeueTimeline(timelineId);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setRef = c => {
 | 
					  setRef = c => {
 | 
				
			||||||
    this.node = c;
 | 
					    this.node = c;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  render () {
 | 
					  render () {
 | 
				
			||||||
    const { statusIds, featuredStatusIds, onLoadMore, timelineId, ...other }  = this.props;
 | 
					    const { statusIds, featuredStatusIds, onLoadMore, timelineId, totalQueuedItemsCount, isLoading, isPartial, ...other }  = this.props;
 | 
				
			||||||
    const { isLoading, isPartial } = other;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (isPartial) {
 | 
					    if (isPartial) {
 | 
				
			||||||
      return (
 | 
					      return (
 | 
				
			||||||
@ -119,11 +130,12 @@ export default class StatusList extends ImmutablePureComponent {
 | 
				
			|||||||
      )).concat(scrollableContent);
 | 
					      )).concat(scrollableContent);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return (
 | 
					    return [
 | 
				
			||||||
      <ScrollableList {...other} showLoading={isLoading && statusIds.size === 0} onLoadMore={onLoadMore && this.handleLoadOlder} ref={this.setRef}>
 | 
					      <TimelineQueueButtonHeader key='timeline-queue-button-header' onClick={this.handleDequeueTimeline} count={totalQueuedItemsCount} itemType='gab' />,
 | 
				
			||||||
 | 
					      <ScrollableList key='scrollable-list' {...other} showLoading={isLoading && statusIds.size === 0} onLoadMore={onLoadMore && this.handleLoadOlder} ref={this.setRef}>
 | 
				
			||||||
        {scrollableContent}
 | 
					        {scrollableContent}
 | 
				
			||||||
      </ScrollableList>
 | 
					      </ScrollableList>
 | 
				
			||||||
    );
 | 
					    ];
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user