gab-social/app/javascript/gabsocial/components/modal/display_options_modal.js

150 lines
4.3 KiB
JavaScript
Raw Normal View History

2020-04-28 06:33:58 +01:00
import { injectIntl, defineMessages } from 'react-intl'
2020-04-30 05:34:50 +01:00
import ImmutablePureComponent from 'react-immutable-pure-component'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ModalLayout from './modal_layout'
import Button from '../button'
import Text from '../text'
import SettingSwitch from '../setting_switch'
2020-04-28 06:33:58 +01:00
const messages = defineMessages({
2020-04-30 05:34:50 +01:00
message: { id: 'display_options.message', defaultMessage: 'Display settings affect your Gab account on this browser. These settings are only visible to you.' },
title: { id: 'display_options', defaultMessage: 'Customize your view' },
2020-04-28 06:33:58 +01:00
})
const mapStateToProps = (state) => ({
2020-04-30 05:34:50 +01:00
settings: state.getIn(['notifications', 'filter']),
2020-04-28 06:33:58 +01:00
})
const mapDispatchToProps = (dispatch) => ({
2020-04-30 05:34:50 +01:00
onChange(path, value) {
dispatch(setFilter(path, value))
},
2020-04-28 06:33:58 +01:00
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
2020-04-30 05:34:50 +01:00
class DisplayOptionsModal extends ImmutablePureComponent {
2020-04-28 06:33:58 +01:00
static propTypes = {
isSubmitting: PropTypes.bool.isRequired,
account: PropTypes.object.isRequired,
onConfirm: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
2020-04-30 05:34:50 +01:00
onChange: PropTypes.func.isRequired,
settings: ImmutablePropTypes.map.isRequired,
2020-04-28 06:33:58 +01:00
}
handleClick = () => {
this.props.onClose()
this.props.onConfirm(this.props.account, this.props.notifications)
}
// document.documentElement.style.setProperty("--color-surface", "black");
render() {
2020-04-30 05:34:50 +01:00
const {
account,
intl,
settings,
onChange,
onClose,
} = this.props
// theme - light, muted, dark
// text size - extra small, small, normal, medium, large, extra large
// rounded borders
2020-04-28 06:33:58 +01:00
return (
<ModalLayout
2020-04-30 05:34:50 +01:00
onClose={onClose}
width={520}
2020-04-28 06:33:58 +01:00
title={intl.formatMessage(messages.title)}
>
2020-04-30 05:34:50 +01:00
<div className={[_s.default, _s.mb15].join(' ')}>
<Text>
{intl.formatMessage(messages.message)}
</Text>
</div>
<div className={[_s.default, _s.mb10].join(' ')}>
<Text weight='bold' color='secondary'>
Font Size
</Text>
<div className={[_s.default, _s.radiusSmall, _s.mt10, _s.py15, _s.px15, _s.bgTertiary].join(' ')}>
test
</div>
</div>
<div className={[_s.default, _s.mb10].join(' ')}>
<Text weight='bold' color='secondary'>
Rounded
</Text>
<div className={[_s.default, _s.radiusSmall, _s.mt10, _s.py15, _s.px15, _s.bgTertiary].join(' ')}>
<SettingSwitch
prefix='notification'
settings={settings}
settingPath={'onlyVerified'}
onChange={onChange}
label={'Small Radius'}
/>
<SettingSwitch
prefix='notification'
settings={settings}
settingPath={'onlyVerified'}
onChange={onChange}
label={'Circle Radius'}
/>
</div>
</div>
<div className={[_s.default, _s.mb10].join(' ')}>
<Text weight='bold' color='secondary'>
Theme
</Text>
<div className={[_s.default, _s.radiusSmall, _s.flexRow, _s.mt10, _s.py15, _s.px15, _s.bgTertiary].join(' ')}>
<div className={[_s.default, _s.py10, _s.px10, _s.flexGrow1].join(' ')}>
<div className={[_s.default, _s.bgPrimary, _s.radiusSmall]}>
<Text>
Light
</Text>
</div>
</div>
<div className={[_s.default, _s.py10, _s.px10, _s.flexGrow1].join(' ')}>
<div className={[_s.default, _s.bgPrimary, _s.radiusSmall]}>
<Text>
Muted
</Text>
</div>
</div>
<div className={[_s.default, _s.py10, _s.px10, _s.flexGrow1].join(' ')}>
<div className={[_s.default, _s.bgPrimary, _s.radiusSmall]}>
<Text>
Black
</Text>
</div>
</div>
</div>
</div>
<div className={[_s.mlAuto, _s.mrAuto].join(' ')}>
<Button>
<Text size='medium' color='inherit'>
Done
</Text>
</Button>
</div>
2020-04-28 06:33:58 +01:00
</ModalLayout>
)
}
}