@ -9,11 +9,13 @@ import locales from '../../../../app/_locales/index.json';
import Jazzicon from '../../../components/ui/jazzicon' ;
import Jazzicon from '../../../components/ui/jazzicon' ;
import BlockieIdenticon from '../../../components/ui/identicon/blockieIdenticon' ;
import BlockieIdenticon from '../../../components/ui/identicon/blockieIdenticon' ;
import Typography from '../../../components/ui/typography' ;
import Typography from '../../../components/ui/typography' ;
import { EVENT } from '../../../../shared/constants/metametrics' ;
import {
import {
getNumberOfSettingsInSection ,
getNumberOfSettingsInSection ,
handleSettingsRefs ,
handleSettingsRefs ,
} from '../../../helpers/utils/settings-search' ;
} from '../../../helpers/utils/settings-search' ;
import { THEME _TYPE } from './settings-tab.constant' ;
const sortedCurrencies = availableCurrencies . sort ( ( a , b ) => {
const sortedCurrencies = availableCurrencies . sort ( ( a , b ) => {
return a . name . toLocaleLowerCase ( ) . localeCompare ( b . name . toLocaleLowerCase ( ) ) ;
return a . name . toLocaleLowerCase ( ) . localeCompare ( b . name . toLocaleLowerCase ( ) ) ;
@ -37,6 +39,7 @@ export default class SettingsTab extends PureComponent {
static contextTypes = {
static contextTypes = {
t : PropTypes . func ,
t : PropTypes . func ,
metricsEvent : PropTypes . func ,
metricsEvent : PropTypes . func ,
trackEvent : PropTypes . func ,
} ;
} ;
static propTypes = {
static propTypes = {
@ -55,6 +58,8 @@ export default class SettingsTab extends PureComponent {
lastFetchedConversionDate : PropTypes . number ,
lastFetchedConversionDate : PropTypes . number ,
selectedAddress : PropTypes . string ,
selectedAddress : PropTypes . string ,
tokenList : PropTypes . object ,
tokenList : PropTypes . object ,
theme : PropTypes . string ,
setTheme : PropTypes . func ,
} ;
} ;
settingsRefs = Array (
settingsRefs = Array (
@ -144,7 +149,7 @@ export default class SettingsTab extends PureComponent {
return (
return (
< div
< div
ref = { this . settingsRefs [ 4 ] }
ref = { this . settingsRefs [ 5 ] }
className = "settings-page__content-row"
className = "settings-page__content-row"
id = "toggle-zero-balance"
id = "toggle-zero-balance"
>
>
@ -179,7 +184,7 @@ export default class SettingsTab extends PureComponent {
return (
return (
< div
< div
ref = { this . settingsRefs [ 3 ] }
ref = { this . settingsRefs [ 4 ] }
className = "settings-page__content-row"
className = "settings-page__content-row"
id = "blockie-optin"
id = "blockie-optin"
>
>
@ -320,6 +325,58 @@ export default class SettingsTab extends PureComponent {
) ;
) ;
}
}
renderTheme ( ) {
const { t } = this . context ;
const { theme , setTheme } = this . props ;
const themesOptions = [
{
name : t ( 'lightTheme' ) ,
value : THEME _TYPE . LIGHT ,
} ,
{
name : t ( 'darkTheme' ) ,
value : THEME _TYPE . DARK ,
} ,
{
name : t ( 'osTheme' ) ,
value : THEME _TYPE . OS ,
} ,
] ;
const onChange = ( newTheme ) => {
this . context . trackEvent ( {
category : EVENT . CATEGORIES . SETTINGS ,
event : 'Theme Changed' ,
properties : {
theme _selected : newTheme ,
} ,
} ) ;
setTheme ( newTheme ) ;
} ;
return (
< div ref = { this . settingsRefs [ 3 ] } className = "settings-page__content-row" >
< div className = "settings-page__content-item" >
< span > { this . context . t ( 'theme' ) } < / s p a n >
< div className = "settings-page__content-description" >
{ this . context . t ( 'themeDescription' ) }
< / d i v >
< / d i v >
< div className = "settings-page__content-item" >
< div className = "settings-page__content-item-col" >
< Dropdown
id = "select-theme"
options = { themesOptions }
selectedOption = { theme }
onChange = { onChange }
/ >
< / d i v >
< / d i v >
< / d i v >
) ;
}
render ( ) {
render ( ) {
const { warning } = this . props ;
const { warning } = this . props ;
@ -329,6 +386,7 @@ export default class SettingsTab extends PureComponent {
{ this . renderCurrentConversion ( ) }
{ this . renderCurrentConversion ( ) }
{ this . renderUsePrimaryCurrencyOptions ( ) }
{ this . renderUsePrimaryCurrencyOptions ( ) }
{ this . renderCurrentLocale ( ) }
{ this . renderCurrentLocale ( ) }
{ this . renderTheme ( ) }
{ this . renderBlockieOptIn ( ) }
{ this . renderBlockieOptIn ( ) }
{ this . renderHideZeroBalanceTokensOptIn ( ) }
{ this . renderHideZeroBalanceTokensOptIn ( ) }
< / d i v >
< / d i v >