fix eslint errors

pull/9399/head
alxd 2018-11-30 13:55:15 +01:00
parent 189359d75e
commit 6eb9d8fe9a
4 changed files with 19 additions and 14 deletions

View File

@ -35,7 +35,7 @@ export default class ColumnSettings extends React.PureComponent {
<ClearColumnButton onClick={onClear} />
</div>
<div role='filter' aria-labelledby='show-filter-bar'>
<div role='group' aria-labelledby='show-filter-bar'>
<div className='column-settings__row'>
<SettingToggle id='show-filter-bar' prefix='notifications' settings={settings} settingPath={['showFilterBar']} onChange={onChange} label={filterStr} />
</div>

View File

@ -6,16 +6,20 @@ export default class FilterBar extends React.PureComponent {
static propTypes = {
selectFilter: PropTypes.func.isRequired,
selectedFilter: PropTypes.string.isRequired
selectedFilter: PropTypes.string.isRequired,
};
onClick (notificationType) {
return () => this.props.selectFilter(notificationType);
}
render () {
const { selectFilter, selectedFilter } = this.props
const { selectedFilter } = this.props;
return (
<div className='notification__filter-bar'>
<button
className={selectedFilter === 'all' ? 'active' : ''}
onClick={() => selectFilter('all')}
onClick={this.onClick('all')}
>
<FormattedMessage
id='notifications.filter.all'
@ -24,7 +28,7 @@ export default class FilterBar extends React.PureComponent {
</button>
<button
className={selectedFilter === 'mention' ? 'active' : ''}
onClick={() => selectFilter('mention')}
onClick={this.onClick('mention')}
>
<FormattedMessage
id='notifications.filter.mentions'
@ -33,7 +37,7 @@ export default class FilterBar extends React.PureComponent {
</button>
<button
className={selectedFilter === 'favourite' ? 'active' : ''}
onClick={() => selectFilter('favourite')}
onClick={this.onClick('favourite')}
>
<FormattedMessage
id='notifications.filter.favourites'
@ -42,7 +46,7 @@ export default class FilterBar extends React.PureComponent {
</button>
<button
className={selectedFilter === 'reblog' ? 'active' : ''}
onClick={() => selectFilter('reblog')}
onClick={this.onClick('reblog')}
>
<FormattedMessage
id='notifications.filter.boosts'
@ -51,7 +55,7 @@ export default class FilterBar extends React.PureComponent {
</button>
<button
className={selectedFilter === 'follow' ? 'active' : ''}
onClick={() => selectFilter('follow')}
onClick={this.onClick('follow')}
>
<FormattedMessage
id='notifications.filter.follows'

View File

@ -3,13 +3,13 @@ import FilterBar from '../components/filter_bar';
import { changeSetting } from '../../../actions/settings';
const makeMapStateToProps = state => ({
selectedFilter: state.getIn(['settings', 'notifications', 'filter'])
selectedFilter: state.getIn(['settings', 'notifications', 'filter']),
});
const mapDispatchToProps = (dispatch, { intl }) => ({
const mapDispatchToProps = (dispatch) => ({
selectFilter (newActiveFilter) {
dispatch(changeSetting(['notifications', 'filter'], newActiveFilter));
}
})
},
});
export default connect(makeMapStateToProps, mapDispatchToProps)(FilterBar);

View File

@ -29,7 +29,7 @@ const getNotifications = createSelector([
if (!showFilterBar || allowedType === 'all') {
return notifications.filterNot(item => item !== null && excludedTypes.includes(item.get('type')));
}
return notifications.filter(item => item !== null && allowedType === item.get('type'))
return notifications.filter(item => item !== null && allowedType === item.get('type'));
});
const mapStateToProps = state => ({
@ -47,6 +47,7 @@ class Notifications extends React.PureComponent {
static propTypes = {
columnId: PropTypes.string,
notifications: ImmutablePropTypes.list.isRequired,
showFilterBar: PropTypes.bool.isRequired,
dispatch: PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func,
intl: PropTypes.object.isRequired,
@ -134,7 +135,7 @@ class Notifications extends React.PureComponent {
const filterBarContainer = showFilterBar
? (<FilterBarContainer />)
: null
: null;
if (isLoading && this.scrollableContent) {
scrollableContent = this.scrollableContent;