-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add checkbox warning #2909
Add checkbox warning #2909
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM added one suggestion 👍
} = usePrivacy(); | ||
|
||
const [logs, setLogs] = useState(""); | ||
const [showingSendUnmixModal, showModal] = useState(false); | ||
const onToggleSendFromUnmixed = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useCallback here might be useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be a callback with multiple function methods on its array dependency, which will be re-rendered each update. That's why I didn't add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrrmmm i'm not sure if i understand, useCallback will prevent extra re-renders in children components (the one receives onToggleSendFromUnmixed
) it will guarantee to keep the same pointer to functions unless one of the deps array updates, in that case it will re-evaluate the useCallback value which will result in new pointer and children components wil re-render, without useCallback each re-render in parent will cause re-evaluation of the function which means new pointer which means children will re-render as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions are comparing by reference, so if I add a function at the array dependency, it will not have much effect. Here: https://hackernoon.com/grasp-by-value-and-by-reference-in-javascript-7ed75efa1293
So I see no reason for adding it. We will not increase performance and the method will be more verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i see, didn't notice these are functions.
showModal(false); | ||
} | ||
}; | ||
const onChangeCheckbox = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above comment
showModal(false); | ||
} | ||
}; | ||
const onChangeCheckbox = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5862ccc
to
b91d5c6
Compare
6e249c9
to
6a2d562
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I just loaded up a wallet which already has privacy enabled and the checkbox was not checked. Perhaps it is using the wrong default value when no value is found in the config file?
-
If I press "Cancel" in the modal, the checkbox value changes anyway
}) => ( | ||
<DefaultModal className={style.confirmSendFromUnmixed} {...{ show }}> | ||
<div className={style.titleConfirmSendFromUnmixed}> | ||
<T id="SendFromUnmixed.titleWarning" m="Seed Clipboard Copy Warning" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<T id="SendFromUnmixed.titleWarning" m="Seed Clipboard Copy Warning" /> | |
<T id="SendFromUnmixed.titleWarning" m="Sending from Unmixed Accounts" /> |
typedConfirmationPhrase.toLowerCase() !== | ||
copyConfirmationPhrase.toLowerCase() | ||
}> | ||
<T id="SendFromUnmixed.btnConfirm" m="Allow send from Unmixed" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<T id="SendFromUnmixed.btnConfirm" m="Allow send from Unmixed" /> | |
<T id="SendFromUnmixed.btnConfirm" m="Enable sending from unmixed accounts" /> |
label={ | ||
<T | ||
id="Privacy.checkbox" | ||
m="Send From Unmixed accounts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m="Send From Unmixed accounts" | |
m="Send from unmixed accounts" |
<Checkbox | ||
label={ | ||
<T | ||
id="Privacy.checkbox" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the only string ID I have seen starting with a capital letter. We can give it a more descriptive name too, in case we add another checkbox later.
id="Privacy.checkbox" | |
id="privacy.sendFromUnmixedCheckbox" |
@@ -0,0 +1,3 @@ | |||
## Allow Send from other unmixed accounts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this heading, because the modal already has one. This one isn't rendered properly anyway, it just appears as a bold line at the start of the paragraph.
@@ -0,0 +1,3 @@ | |||
## Allow Send from other unmixed accounts | |||
|
|||
Currently, you have privacy settings enabled. As part of this, we have turned off the ability to create external spends from non-mixed accounts. Any funds sent from the non-mixed account will not be private and will be able to be tracked. If you would like to turn off this setting please type in 'I understand the risks' below. You may re-engage this setting at any time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, you have privacy settings enabled. As part of this, we have turned off the ability to create external spends from non-mixed accounts. Any funds sent from the non-mixed account will not be private and will be able to be tracked. If you would like to turn off this setting please type in 'I understand the risks' below. You may re-engage this setting at any time. | |
Sending from unmixed accounts has been disabled by the privacy settings of this wallet. This is for your protection. | |
Sending from unmixed accounts is not private and could possibly be traced back to you. If you would like to turn off this setting please type 'I understand the risks' below. You may re-engage this setting at any time. |
This PR adds a checkbox for allowing sending transaction from other accounts than mixed account. closes #2877