2017-05-02 20:04:16 -04:00
|
|
|
import React from 'react';
|
2016-12-03 15:04:57 -05:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2017-04-21 14:05:35 -04:00
|
|
|
import PropTypes from 'prop-types';
|
2017-07-13 05:40:16 -04:00
|
|
|
import StatusContainer from '../../glitch/components/status/container';
|
2017-01-30 12:04:15 -05:00
|
|
|
import LoadMore from './load_more';
|
2017-05-02 20:04:16 -04:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2017-08-28 16:23:44 -04:00
|
|
|
import ScrollableList from './scrollable_list';
|
2016-08-24 11:56:44 -04:00
|
|
|
|
2017-06-23 13:36:54 -04:00
|
|
|
export default class StatusList extends ImmutablePureComponent {
|
2017-04-21 14:05:35 -04:00
|
|
|
|
2017-05-12 08:44:10 -04:00
|
|
|
static propTypes = {
|
|
|
|
scrollKey: PropTypes.string.isRequired,
|
|
|
|
statusIds: ImmutablePropTypes.list.isRequired,
|
|
|
|
onScrollToBottom: PropTypes.func,
|
|
|
|
onScrollToTop: PropTypes.func,
|
|
|
|
onScroll: PropTypes.func,
|
2017-06-05 09:20:46 -04:00
|
|
|
trackScroll: PropTypes.bool,
|
2017-05-12 08:44:10 -04:00
|
|
|
shouldUpdateScroll: PropTypes.func,
|
|
|
|
isLoading: PropTypes.bool,
|
|
|
|
hasMore: PropTypes.bool,
|
|
|
|
prepend: PropTypes.node,
|
2017-05-20 11:31:47 -04:00
|
|
|
emptyMessage: PropTypes.node,
|
2017-05-12 08:44:10 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
static defaultProps = {
|
2017-05-20 11:31:47 -04:00
|
|
|
trackScroll: true,
|
2017-05-12 08:44:10 -04:00
|
|
|
};
|
|
|
|
|
2016-08-31 10:15:12 -04:00
|
|
|
render () {
|
2017-08-28 16:23:44 -04:00
|
|
|
const { statusIds, ...other } = this.props;
|
|
|
|
const { isLoading } = other;
|
|
|
|
|
|
|
|
const scrollableContent = (isLoading || statusIds.size > 0) ? (
|
|
|
|
statusIds.map((statusId) => (
|
|
|
|
<StatusContainer key={statusId} id={statusId} />
|
|
|
|
))
|
|
|
|
) : null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ScrollableList {...other}>
|
|
|
|
{scrollableContent}
|
|
|
|
</ScrollableList>
|
|
|
|
);
|
2016-08-24 11:56:44 -04:00
|
|
|
}
|
2016-08-31 10:15:12 -04:00
|
|
|
|
2017-04-21 14:05:35 -04:00
|
|
|
}
|