refactor: conditions simplification

This commit is contained in:
José Oliveira 2021-09-09 23:10:34 +01:00
parent 7157a11895
commit e65737c237

View file

@ -71,7 +71,6 @@ const PaperWalletDialog = ({ onConfirmed, onDissmised, open, props }) => {
const classes = useStyles() const classes = useStyles()
return ( return (
<>
<Dialog <Dialog
open={open} open={open}
aria-labelledby="form-dialog-title" aria-labelledby="form-dialog-title"
@ -107,7 +106,6 @@ const PaperWalletDialog = ({ onConfirmed, onDissmised, open, props }) => {
<Button onClick={() => onConfirmed(true)}>Confirm</Button> <Button onClick={() => onConfirmed(true)}>Confirm</Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
</>
) )
} }
@ -154,7 +152,7 @@ const Blacklist = () => {
const rejectAddressReuse = complianceConfig?.rejectAddressReuse ?? false const rejectAddressReuse = complianceConfig?.rejectAddressReuse ?? false
const enablePaperWalletOnly = complianceConfig?.enablePaperWalletOnly ?? false const enablePaperWalletOnly = !!complianceConfig.enablePaperWalletOnly
const addressReuseSave = rawConfig => { const addressReuseSave = rawConfig => {
const config = toNamespace('compliance')(rawConfig) const config = toNamespace('compliance')(rawConfig)
@ -242,15 +240,13 @@ const Blacklist = () => {
<P>Enable paper wallet (only)</P> <P>Enable paper wallet (only)</P>
<Switch <Switch
checked={enablePaperWalletOnly} checked={enablePaperWalletOnly}
onChange={event => { onChange={e =>
if (enablePaperWalletOnly) { enablePaperWalletOnly
addressReuseSave({ ? addressReuseSave({
enablePaperWalletOnly: event.target.checked enablePaperWalletOnly: e.target.checked
}) })
} else { : setConfirmDialog(true)
setConfirmDialog(true)
} }
}}
value={enablePaperWalletOnly} value={enablePaperWalletOnly}
/> />
<Label2>{enablePaperWalletOnly ? 'On' : 'Off'}</Label2> <Label2>{enablePaperWalletOnly ? 'On' : 'Off'}</Label2>