Disable Ledger Live toggle for Firefox users (#11169)

feature/default_network_editable
David Walsh 4 years ago committed by GitHub
parent ff71005041
commit 3055db5c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      ui/components/ui/toggle-button/index.scss
  2. 11
      ui/components/ui/toggle-button/toggle-button.component.js
  3. 4
      ui/pages/settings/advanced-tab/advanced-tab.component.js

@ -33,4 +33,8 @@
visibility: hidden; visibility: hidden;
} }
} }
&--disabled {
opacity: 0.5;
}
} }

@ -47,15 +47,19 @@ const colors = {
}; };
const ToggleButton = (props) => { const ToggleButton = (props) => {
const { value, onToggle, offLabel, onLabel } = props; const { value, onToggle, offLabel, onLabel, disabled } = props;
const modifier = value ? 'on' : 'off'; const modifier = value ? 'on' : 'off';
return ( return (
<div className={classnames('toggle-button', `toggle-button--${modifier}`)}> <div
className={classnames('toggle-button', `toggle-button--${modifier}`, {
'toggle-button--disabled': disabled,
})}
>
<ReactToggleButton <ReactToggleButton
value={value} value={value}
onToggle={onToggle} onToggle={disabled ? undefined : onToggle}
activeLabel="" activeLabel=""
inactiveLabel="" inactiveLabel=""
trackStyle={value ? trackStyle : offTrackStyle} trackStyle={value ? trackStyle : offTrackStyle}
@ -76,6 +80,7 @@ ToggleButton.propTypes = {
onToggle: PropTypes.func, onToggle: PropTypes.func,
offLabel: PropTypes.string, offLabel: PropTypes.string,
onLabel: PropTypes.string, onLabel: PropTypes.string,
disabled: PropTypes.bool,
}; };
export default ToggleButton; export default ToggleButton;

@ -7,6 +7,9 @@ import TextField from '../../../components/ui/text-field';
import Button from '../../../components/ui/button'; import Button from '../../../components/ui/button';
import { MOBILE_SYNC_ROUTE } from '../../../helpers/constants/routes'; import { MOBILE_SYNC_ROUTE } from '../../../helpers/constants/routes';
import { getPlatform } from '../../../../app/scripts/lib/util';
import { PLATFORM_FIREFOX } from '../../../../shared/constants/app';
export default class AdvancedTab extends PureComponent { export default class AdvancedTab extends PureComponent {
static contextTypes = { static contextTypes = {
t: PropTypes.func, t: PropTypes.func,
@ -407,6 +410,7 @@ export default class AdvancedTab extends PureComponent {
onToggle={(value) => setLedgerLivePreference(!value)} onToggle={(value) => setLedgerLivePreference(!value)}
offLabel={t('off')} offLabel={t('off')}
onLabel={t('on')} onLabel={t('on')}
disabled={getPlatform() === PLATFORM_FIREFOX}
/> />
</div> </div>
</div> </div>

Loading…
Cancel
Save