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 ) }
< / T e x t >
< / d i v >
< div className = { [ _s . default , _s . mb10 ] . join ( ' ' ) } >
< Text weight = 'bold' color = 'secondary' >
Font Size
< / T e x t >
< div className = { [ _s . default , _s . radiusSmall , _s . mt10 , _s . py15 , _s . px15 , _s . bgTertiary ] . join ( ' ' ) } >
test
< / d i v >
< / d i v >
< div className = { [ _s . default , _s . mb10 ] . join ( ' ' ) } >
< Text weight = 'bold' color = 'secondary' >
Rounded
< / T e x t >
< 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' }
/ >
< / d i v >
< / d i v >
< div className = { [ _s . default , _s . mb10 ] . join ( ' ' ) } >
< Text weight = 'bold' color = 'secondary' >
Theme
< / T e x t >
< 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
< / T e x t >
< / d i v >
< / d i v >
< div className = { [ _s . default , _s . py10 , _s . px10 , _s . flexGrow1 ] . join ( ' ' ) } >
< div className = { [ _s . default , _s . bgPrimary , _s . radiusSmall ] } >
< Text >
Muted
< / T e x t >
< / d i v >
< / d i v >
< div className = { [ _s . default , _s . py10 , _s . px10 , _s . flexGrow1 ] . join ( ' ' ) } >
< div className = { [ _s . default , _s . bgPrimary , _s . radiusSmall ] } >
< Text >
Black
< / T e x t >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< div className = { [ _s . mlAuto , _s . mrAuto ] . join ( ' ' ) } >
< Button >
< Text size = 'medium' color = 'inherit' >
Done
< / T e x t >
< / B u t t o n >
< / d i v >
2020-04-28 06:33:58 +01:00
< / M o d a l L a y o u t >
)
}
}