Page MenuHomePhabricator

D13583.id.diff
No OneTemporary

D13583.id.diff

diff --git a/cashtab/src/components/Alias/Alias.js b/cashtab/src/components/Alias/Alias.js
--- a/cashtab/src/components/Alias/Alias.js
+++ b/cashtab/src/components/Alias/Alias.js
@@ -10,7 +10,7 @@
} from 'components/Common/Atoms';
import { DestinationAddressSingle } from 'components/Common/EnhancedInputs';
import { AntdFormWrapper } from 'components/Common/EnhancedInputs';
-import { Form } from 'antd';
+import { Form, Modal } from 'antd';
import { SmartButton } from 'components/Common/PrimaryButton';
import BalanceHeader from 'components/Common/BalanceHeader';
import BalanceHeaderFiat from 'components/Common/BalanceHeaderFiat';
@@ -78,6 +78,9 @@
const [aliasLength, setAliasLength] = useState(false); // real time tracking of alias char length
const [aliasFee, setAliasFee] = useState(false); // real time tracking of alias registration fee
+ // Show a confirmation modal on alias registrations
+ const [isModalVisible, setIsModalVisible] = useState(false);
+
useEffect(() => {
passLoadingStatus(false);
}, [balances.totalBalance]);
@@ -123,6 +126,15 @@
passLoadingStatus(false);
}, [wallet.name, cashtabCache.aliasCache.aliases]);
+ const handleOk = () => {
+ setIsModalVisible(false);
+ registerAlias();
+ };
+
+ const handleCancel = () => {
+ setIsModalVisible(false);
+ };
+
const registerAlias = async () => {
passLoadingStatus(true);
@@ -287,6 +299,16 @@
return (
<>
+ <Modal
+ title="Confirm Alias Registration"
+ open={isModalVisible}
+ onOk={handleOk}
+ onCancel={handleCancel}
+ >
+ <p>
+ {`Are you sure you want to register the alias '${formData.aliasName}' for ${fromSatoshisToXec(aliasFee)} XECs?`}
+ </p>
+ </Modal>
<WalletInfoCtn>
<WalletLabel
name={wallet.name}
@@ -358,7 +380,7 @@
<Form.Item>
<SmartButton
disabled={!isValidAliasInput}
- onClick={() => registerAlias()}
+ onClick={() => setIsModalVisible(true)}
>
Register Alias
</SmartButton>

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 09:57 (15 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4558996
Default Alt Text
D13583.id.diff (2 KB)

Event Timeline