bigbuffet-rw/app/soapbox/features/home_timeline/components/column_settings.js

54 lines
2.2 KiB
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
2021-10-15 17:23:24 -07:00
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
2020-03-27 13:59:38 -07:00
import SettingToggle from '../../notifications/components/setting_toggle';
2021-10-15 17:23:24 -07:00
import IconButton from 'soapbox/components/icon_button';
const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' },
});
2020-03-27 13:59:38 -07:00
export default @injectIntl
class ColumnSettings extends React.PureComponent {
static propTypes = {
2021-10-15 17:23:24 -07:00
intl: PropTypes.object.isRequired,
2020-03-27 13:59:38 -07:00
settings: ImmutablePropTypes.map.isRequired,
onChange: PropTypes.func.isRequired,
2021-10-15 17:23:24 -07:00
onClose: PropTypes.func.isRequired,
2020-03-27 13:59:38 -07:00
};
render() {
2021-10-15 17:23:24 -07:00
const { intl, settings, onChange, onClose } = this.props;
2020-03-27 13:59:38 -07:00
return (
2021-10-15 17:23:24 -07:00
<div className='column-settings'>
<div className='column-settings__header'>
<h1 className='column-settings__title'>
<FormattedMessage id='home.column_settings.title' defaultMessage='Home settings' />
</h1>
<div className='column-settings__close'>
<IconButton title={intl.formatMessage(messages.close)} src={require('@tabler/icons/icons/x.svg')} onClick={onClose} />
</div>
2020-03-27 13:59:38 -07:00
</div>
2021-10-15 17:23:24 -07:00
<div className='column-settings__content'>
<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'reblog']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_reblogs' defaultMessage='Show reposts' />} />
</div>
<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'reply']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_replies' defaultMessage='Show replies' />} />
</div>
2021-10-15 17:23:24 -07:00
<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'direct']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_direct' defaultMessage='Show direct messages' />} />
</div>
</div>
2020-03-27 13:59:38 -07:00
</div>
);
}
}