Progress
This commit is contained in:
@@ -1,89 +0,0 @@
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import ColumnHeaderSettingButton from '../../../../components/column_header_setting_button';
|
||||
import SettingSwitch from '../../../../components/setting_switch';
|
||||
|
||||
export default class ColumnSettings extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
settings: ImmutablePropTypes.map.isRequired,
|
||||
pushSettings: ImmutablePropTypes.map.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
onClear: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
onPushChange = (path, checked) => {
|
||||
this.props.onChange(['push', ...path], checked);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { settings, pushSettings, onChange, onClear } = this.props;
|
||||
|
||||
const filterShowStr = <FormattedMessage id='notifications.column_settings.filter_bar.show' defaultMessage='Show' />;
|
||||
const filterAdvancedStr = <FormattedMessage id='notifications.column_settings.filter_bar.advanced' defaultMessage='Display all categories' />;
|
||||
const alertStr = <FormattedMessage id='notifications.column_settings.alert' defaultMessage='Desktop notifications' />;
|
||||
const showStr = <FormattedMessage id='notifications.column_settings.show' defaultMessage='Show in column' />;
|
||||
const soundStr = <FormattedMessage id='notifications.column_settings.sound' defaultMessage='Play sound' />;
|
||||
|
||||
const showPushSettings = pushSettings.get('browserSupport') && pushSettings.get('isSubscribed');
|
||||
const pushStr = showPushSettings && <FormattedMessage id='notifications.column_settings.push' defaultMessage='Push notifications' />;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ColumnHeaderSettingButton
|
||||
onClick={onClear}
|
||||
title={<FormattedMessage id='notifications.clear' defaultMessage='Clear notifications' />}
|
||||
icon='eraser'
|
||||
/>
|
||||
|
||||
<div role='group' aria-labelledby='notifications-filter-bar'>
|
||||
<FormattedMessage id='notifications.column_settings.filter_bar.category' defaultMessage='Quick filter bar' />
|
||||
<SettingSwitch id='show-filter-bar' prefix='notifications' settings={settings} settingPath={['quickFilter', 'show']} onChange={onChange} label={filterShowStr} />
|
||||
<SettingSwitch id='show-filter-bar' prefix='notifications' settings={settings} settingPath={['quickFilter', 'advanced']} onChange={onChange} label={filterAdvancedStr} />
|
||||
</div>
|
||||
|
||||
<div role='group' aria-labelledby='notifications-follow'>
|
||||
<FormattedMessage id='notifications.column_settings.follow' defaultMessage='New followers:' />
|
||||
<SettingSwitch prefix='notifications_desktop' settings={settings} settingPath={['alerts', 'follow']} onChange={onChange} label={alertStr} />
|
||||
{showPushSettings && <SettingSwitch prefix='notifications_push' settings={pushSettings} settingPath={['alerts', 'follow']} onChange={this.onPushChange} label={pushStr} />}
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['shows', 'follow']} onChange={onChange} label={showStr} />
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['sounds', 'follow']} onChange={onChange} label={soundStr} />
|
||||
</div>
|
||||
|
||||
<div role='group' aria-labelledby='notifications-favorite'>
|
||||
<FormattedMessage id='notifications.column_settings.favorite' defaultMessage='Favorites:' />
|
||||
<SettingSwitch prefix='notifications_desktop' settings={settings} settingPath={['alerts', 'favorite']} onChange={onChange} label={alertStr} />
|
||||
{showPushSettings && <SettingSwitch prefix='notifications_push' settings={pushSettings} settingPath={['alerts', 'favorite']} onChange={this.onPushChange} label={pushStr} />}
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['shows', 'favorite']} onChange={onChange} label={showStr} />
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['sounds', 'favorite']} onChange={onChange} label={soundStr} />
|
||||
</div>
|
||||
|
||||
<div role='group' aria-labelledby='notifications-mention'>
|
||||
<FormattedMessage id='notifications.column_settings.mention' defaultMessage='Mentions:' />
|
||||
<SettingSwitch prefix='notifications_desktop' settings={settings} settingPath={['alerts', 'mention']} onChange={onChange} label={alertStr} />
|
||||
{showPushSettings && <SettingSwitch prefix='notifications_push' settings={pushSettings} settingPath={['alerts', 'mention']} onChange={this.onPushChange} label={pushStr} />}
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['shows', 'mention']} onChange={onChange} label={showStr} />
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['sounds', 'mention']} onChange={onChange} label={soundStr} />
|
||||
</div>
|
||||
|
||||
<div role='group' aria-labelledby='notifications-repost'>
|
||||
<FormattedMessage id='notifications.column_settings.repost' defaultMessage='Reposts:' />
|
||||
<SettingSwitch prefix='notifications_desktop' settings={settings} settingPath={['alerts', 'repost']} onChange={onChange} label={alertStr} />
|
||||
{showPushSettings && <SettingSwitch prefix='notifications_push' settings={pushSettings} settingPath={['alerts', 'repost']} onChange={this.onPushChange} label={pushStr} />}
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['shows', 'repost']} onChange={onChange} label={showStr} />
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['sounds', 'repost']} onChange={onChange} label={soundStr} />
|
||||
</div>
|
||||
|
||||
<div role='group' aria-labelledby='notifications-poll'>
|
||||
<FormattedMessage id='notifications.column_settings.poll' defaultMessage='Poll results:' />
|
||||
<SettingSwitch prefix='notifications_desktop' settings={settings} settingPath={['alerts', 'poll']} onChange={onChange} label={alertStr} />
|
||||
{showPushSettings && <SettingSwitch prefix='notifications_push' settings={pushSettings} settingPath={['alerts', 'poll']} onChange={this.onPushChange} label={pushStr} />}
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['shows', 'poll']} onChange={onChange} label={showStr} />
|
||||
<SettingSwitch prefix='notifications' settings={settings} settingPath={['sounds', 'poll']} onChange={onChange} label={soundStr} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from './column_settings'
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from './notification_filter_bar'
|
||||
@@ -1,95 +0,0 @@
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
|
||||
const messages = defineMessages({
|
||||
mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' },
|
||||
favorites: { id: 'notifications.filter.favorites', defaultMessage: 'Favorites' },
|
||||
boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Reposts' },
|
||||
polls: { id: 'notifications.filter.polls', defaultMessage: 'Poll results' },
|
||||
follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' },
|
||||
filterAll: { id: 'notifications.filter.all', defaultMessage: 'All' },
|
||||
filterMentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' },
|
||||
});
|
||||
|
||||
export default
|
||||
@injectIntl
|
||||
class NotificationFilterBar extends PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
selectFilter: PropTypes.func.isRequired,
|
||||
selectedFilter: PropTypes.string.isRequired,
|
||||
advancedMode: PropTypes.bool.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
onClick (notificationType) {
|
||||
return () => this.props.selectFilter(notificationType);
|
||||
}
|
||||
|
||||
render () {
|
||||
const { selectedFilter, advancedMode, intl } = this.props;
|
||||
|
||||
if (!advancedMode) {
|
||||
return (
|
||||
{ /* <SectionHeadlineBar
|
||||
items={[
|
||||
{
|
||||
className: selectedFilter === 'all' ? 'active' : '',
|
||||
onClick: this.onClick('all'),
|
||||
title: intl.formatMessage(messages.filterAll),
|
||||
},
|
||||
{
|
||||
className: selectedFilter === 'mention' ? 'active' : '',
|
||||
onClick: this.onClick('mention'),
|
||||
title: intl.formatMessage(messages.filterMentions),
|
||||
}
|
||||
]}
|
||||
/> */ }
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div />
|
||||
)
|
||||
|
||||
/* <SectionHeadlineBar
|
||||
items={[
|
||||
{
|
||||
className: selectedFilter === 'all' ? 'active' : '',
|
||||
onClick: this.onClick('all'),
|
||||
title: intl.formatMessage(messages.filterAll),
|
||||
},
|
||||
{
|
||||
className: selectedFilter === 'mention' ? 'active' : '',
|
||||
onClick: this.onClick('mention'),
|
||||
title: intl.formatMessage(messages.mentions),
|
||||
icon: 'at',
|
||||
},
|
||||
{
|
||||
className: selectedFilter === 'favorite' ? 'active' : '',
|
||||
onClick: this.onClick('favorite'),
|
||||
title: intl.formatMessage(messages.favorites),
|
||||
icon: 'star',
|
||||
},
|
||||
{
|
||||
className: selectedFilter === 'reblog' ? 'active' : '',
|
||||
onClick: this.onClick('reblog'),
|
||||
title: intl.formatMessage(messages.boosts),
|
||||
icon: 'retweet',
|
||||
},
|
||||
{
|
||||
className: selectedFilter === 'poll' ? 'active' : '',
|
||||
onClick: this.onClick('poll'),
|
||||
title: intl.formatMessage(messages.polls),
|
||||
icon: 'tasks',
|
||||
},
|
||||
{
|
||||
className: selectedFilter === 'follow' ? 'active' : '',
|
||||
onClick: this.onClick('follow'),
|
||||
title: intl.formatMessage(messages.follows),
|
||||
icon: 'user-plus',
|
||||
},
|
||||
]}
|
||||
/> */
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ const mapStateToProps = state => ({
|
||||
pushSettings: state.get('push_notifications'),
|
||||
});
|
||||
|
||||
// : todo : put all notification settings actually IN settings
|
||||
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||
|
||||
onChange (path, checked) {
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { setFilter } from '../../../actions/notifications';
|
||||
import FilterBar from '../components/notification_filter_bar';
|
||||
|
||||
const makeMapStateToProps = state => ({
|
||||
selectedFilter: state.getIn(['settings', 'notifications', 'quickFilter', 'active']),
|
||||
advancedMode: state.getIn(['settings', 'notifications', 'quickFilter', 'advanced']),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
selectFilter (newActiveFilter) {
|
||||
dispatch(setFilter(newActiveFilter));
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(makeMapStateToProps, mapDispatchToProps)(FilterBar);
|
||||
Reference in New Issue
Block a user