Skip to content

Commit

Permalink
add ms on confirmation screen
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed May 14, 2024
1 parent fa2528f commit 0641b4e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
3 changes: 2 additions & 1 deletion web-frontend/src/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@
"failed-timeout": "Operation failed due to timeout, please retry with more fees."
},
"mns": {
"mns-correlation": "MNS: {mns} correlates with the following address: {address}"
"mns-correlation": "MNS: {mns} correlates with the following address: {address}",
"mns": "MNS:"
}
},
"receive-coins": {
Expand Down
2 changes: 0 additions & 2 deletions web-frontend/src/pages/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ import { useNavigate, useParams } from 'react-router-dom';
import { Loading } from './Loading';
import { TAB_SEND, TAB_RECEIVE } from '@/const/tabs/tabs';
import { useResource } from '@/custom/api';
// import { useMNS } from '@/custom/useMNS';
import { useMNS } from '@/custom/useMNS';
import Intl from '@/i18n/i18n';
import { WalletLayout, MenuItem } from '@/layouts/WalletLayout/WalletLayout';
import { AccountObject } from '@/models/AccountModel';
import { maskAddress, routeFor } from '@/utils';
// import { useMNS } from '@/custom/useMNS';

export default function Home() {
const navigate = useNavigate();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { useEffect } from 'react';

import {
Balance,
Button,
Tooltip,
formatFTAmount,
getAssetIcons,
parseAmount,
Clipboard,
} from '@massalabs/react-ui-kit';
import { FiChevronLeft } from 'react-icons/fi';

import { PRESET_HIGH, PRESET_LOW, PRESET_STANDARD } from './Advanced';
import { useFTTransfer } from '@/custom/smart-contract/useFTTransfer';
import { useMNS } from '@/custom/useMNS';
import Intl from '@/i18n/i18n';
import { Asset } from '@/models/AssetModel';
import { maskAddress } from '@/utils';
Expand Down Expand Up @@ -50,6 +54,12 @@ export function SendConfirmation(props: SendConfirmationProps) {
decimals,
).amountFormattedFull;

const { reverseResolveDns, mns } = useMNS();

useEffect(() => {
reverseResolveDns();
}, [reverseResolveDns]);

let selectedFees;

switch (fees) {
Expand Down Expand Up @@ -90,12 +100,12 @@ export function SendConfirmation(props: SendConfirmationProps) {
</div>
<div
data-testid="send-confirmation"
className="flex flex-col items-center p-10 bg-secondary rounded-lg mb-6"
className="flex flex-col items-center gap-4 p-10 bg-secondary rounded-lg mb-6"
>
<p className="mb-6 mas-body">{Intl.t('send-coins.send-message')}</p>

<Balance
customClass="p-0 bg-transparent mb-3"
customClass="p-0 bg-transparent"
amount={formattedAmount}
symbol={symbol}
icon={getAssetIcons(
Expand All @@ -106,19 +116,29 @@ export function SendConfirmation(props: SendConfirmationProps) {
'mr-3',
)}
/>
<div className="flex flex-row items-center gap-8 mb-3">
<div className="flex flex-row items-center">
<div className="flex items-center gap-8 ">
<div className="flex items-center">
<Tooltip body={content} />
<p>{Intl.t('send-coins.fee')}</p>
</div>
<Balance amount={fees} symbol="MAS" size="xs" />
</div>
<div className="text-info flex items-center gap-2">
{Intl.t('send-coins.recipient')}
<p data-testid="send-confirmation-recipient">
{formattedRecipientAddress}
</p>
<div>{Intl.t('send-coins.recipient')}</div>
<Clipboard
displayedContent={formattedRecipientAddress}
rawContent={recipientAddress}
error={Intl.t('errors.no-content-to-copy')}
className="flex flex-row items-center mas-body2 justify-between
w-fit h-fit px-3 rounded bg-primary cursor-pointer"
/>
</div>
{mns && (
<div className="flex items-center gap-2 text-info">
<div>{Intl.t('send-coins.mns.mns')}</div>
<div>{mns}</div>
</div>
)}
</div>
<Button disabled={isLoading} onClick={() => handleConfirm(true)}>
{Intl.t('send-coins.confirm-sign')}
Expand Down

0 comments on commit 0641b4e

Please sign in to comment.