]>
cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/components/status_list.js
1 import React
from 'react';
2 import ImmutablePropTypes
from 'react-immutable-proptypes';
3 import PropTypes
from 'prop-types';
4 import StatusContainer
from '../containers/status_container';
5 import ImmutablePureComponent
from 'react-immutable-pure-component';
6 import ScrollableList
from './scrollable_list';
8 export default class StatusList
extends ImmutablePureComponent
{
11 scrollKey: PropTypes
.string
.isRequired
,
12 statusIds: ImmutablePropTypes
.list
.isRequired
,
13 onScrollToBottom: PropTypes
.func
,
14 onScrollToTop: PropTypes
.func
,
15 onScroll: PropTypes
.func
,
16 trackScroll: PropTypes
.bool
,
17 shouldUpdateScroll: PropTypes
.func
,
18 isLoading: PropTypes
.bool
,
19 hasMore: PropTypes
.bool
,
20 prepend: PropTypes
.node
,
21 emptyMessage: PropTypes
.node
,
24 static defaultProps
= {
28 handleMoveUp
= id
=> {
29 const elementIndex
= this.props
.statusIds
.indexOf(id
) - 1;
30 this._selectChild(elementIndex
);
33 handleMoveDown
= id
=> {
34 const elementIndex
= this.props
.statusIds
.indexOf(id
) + 1;
35 this._selectChild(elementIndex
);
38 _selectChild (index
) {
39 const element
= this.node
.node
.querySelector(`article:nth-of-type(${index + 1}) .focusable`);
51 const { statusIds
, ...other
} = this.props
;
52 const { isLoading
} = other
;
54 const scrollableContent
= (isLoading
|| statusIds
.size
> 0) ? (
55 statusIds
.map((statusId
) => (
59 onMoveUp
={this.handleMoveUp
}
60 onMoveDown
={this.handleMoveDown
}
66 <ScrollableList
{...other
} ref
={this.setRef
}>
This page took 0.158881 seconds and 4 git commands to generate.