refactor: conditions simplification
This commit is contained in:
parent
7157a11895
commit
e65737c237
1 changed files with 43 additions and 47 deletions
|
|
@ -71,43 +71,41 @@ 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"
|
PaperProps={{
|
||||||
PaperProps={{
|
style: {
|
||||||
style: {
|
borderRadius: 8,
|
||||||
borderRadius: 8,
|
minWidth: 656,
|
||||||
minWidth: 656,
|
bottom: 125,
|
||||||
bottom: 125,
|
right: 7
|
||||||
right: 7
|
}
|
||||||
}
|
}}
|
||||||
}}
|
{...props}>
|
||||||
{...props}>
|
<div className={classes.closeButton}>
|
||||||
<div className={classes.closeButton}>
|
<IconButton size={16} aria-label="close" onClick={onDissmised}>
|
||||||
<IconButton size={16} aria-label="close" onClick={onDissmised}>
|
<CloseIcon />
|
||||||
<CloseIcon />
|
</IconButton>
|
||||||
</IconButton>
|
</div>
|
||||||
</div>
|
<H2 className={classes.dialogTitle}>
|
||||||
<H2 className={classes.dialogTitle}>
|
{'Are you sure you want to enable this?'}
|
||||||
{'Are you sure you want to enable this?'}
|
</H2>
|
||||||
</H2>
|
<DialogContent className={classes.dialogContent}>
|
||||||
<DialogContent className={classes.dialogContent}>
|
<Info3>{`This mode means that only paper wallets will be printed for users, and they won't be permitted to scan an address from their own wallet.`}</Info3>
|
||||||
<Info3>{`This mode means that only paper wallets will be printed for users, and they won't be permitted to scan an address from their own wallet.`}</Info3>
|
<Info3>{`This mode is only useful for countries like Switzerland which mandates such a feature.\n`}</Info3>
|
||||||
<Info3>{`This mode is only useful for countries like Switzerland which mandates such a feature.\n`}</Info3>
|
<Info2>{`Don't enable this if you want users to be able to scan an address of their choosing.`}</Info2>
|
||||||
<Info2>{`Don't enable this if you want users to be able to scan an address of their choosing.`}</Info2>
|
</DialogContent>
|
||||||
</DialogContent>
|
<DialogActions className={classes.dialogActions}>
|
||||||
<DialogActions className={classes.dialogActions}>
|
<Button
|
||||||
<Button
|
backgroundColor="grey"
|
||||||
backgroundColor="grey"
|
className={classes.cancelButton}
|
||||||
className={classes.cancelButton}
|
onClick={() => onDissmised()}>
|
||||||
onClick={() => onDissmised()}>
|
Cancel
|
||||||
Cancel
|
</Button>
|
||||||
</Button>
|
<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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue