Skip to content

Commit

Permalink
feat: added toast after add to wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
Taras Alechin committed Aug 9, 2023
1 parent ce7c837 commit 16b56d5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions shared/components/token-to-wallet/token-to-wallet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tooltip } from '@lidofinance/lido-ui';
import { ToastInfo, Tooltip } from '@lidofinance/lido-ui';
import { useTokenToWallet } from '@lido-sdk/react';
import { TokenToWalletStyle } from './styles';

Expand All @@ -12,9 +12,16 @@ export const TokenToWallet: TokenToWalletComponent = (props) => {

if (!addToken) return null;

const onClickHandler = async () => {
const result = await addToken();
if (!result) return;

ToastInfo('Tokens were successfully added to your wallet', {});
};

return (
<Tooltip placement="bottomLeft" title="Add tokens to wallet">
<TokenToWalletStyle tabIndex={-1} onClick={addToken} {...rest} />
<TokenToWalletStyle tabIndex={-1} onClick={onClickHandler} {...rest} />
</Tooltip>
);
};

0 comments on commit 16b56d5

Please sign in to comment.