2024-01-23 15:32:23 +00:00
|
|
|
import { Intent, ToastsContainer, useToasts } from '@vegaprotocol/ui-toolkit';
|
2023-10-27 11:17:51 +00:00
|
|
|
import { useProposalToasts } from '@vegaprotocol/proposals';
|
2023-05-05 14:10:21 +00:00
|
|
|
import { useVegaTransactionToasts } from '@vegaprotocol/web3';
|
|
|
|
import { useEthereumTransactionToasts } from '@vegaprotocol/web3';
|
|
|
|
import { useEthereumWithdrawApprovalsToasts } from '@vegaprotocol/web3';
|
2023-06-26 14:28:14 +00:00
|
|
|
import { useReadyToWithdrawalToasts } from '@vegaprotocol/withdraws';
|
2023-09-20 20:28:34 +00:00
|
|
|
import { Links } from '../lib/links';
|
2023-11-28 15:08:21 +00:00
|
|
|
import { useReferralToasts } from '../client-pages/referrals/hooks/use-referral-toasts';
|
2024-01-23 15:32:23 +00:00
|
|
|
import {
|
|
|
|
useWalletDisconnectToastActions,
|
|
|
|
useWalletDisconnectedToasts,
|
|
|
|
} from '@vegaprotocol/web3';
|
|
|
|
import { VegaWalletConnectButton } from '../components/vega-wallet-connect-button';
|
|
|
|
|
|
|
|
const WalletDisconnectAdditionalContent = () => {
|
|
|
|
const { hideToast } = useWalletDisconnectToastActions();
|
|
|
|
return (
|
|
|
|
<p className="mt-2">
|
|
|
|
<VegaWalletConnectButton
|
|
|
|
intent={Intent.Danger}
|
|
|
|
onClick={() => {
|
|
|
|
// hide toast when clicked on `Connect`
|
|
|
|
hideToast();
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</p>
|
|
|
|
);
|
|
|
|
};
|
2022-12-21 09:29:32 +00:00
|
|
|
|
|
|
|
export const ToastsManager = () => {
|
2023-10-27 11:17:51 +00:00
|
|
|
useProposalToasts();
|
2023-02-06 20:09:56 +00:00
|
|
|
useVegaTransactionToasts();
|
|
|
|
useEthereumTransactionToasts();
|
|
|
|
useEthereumWithdrawApprovalsToasts();
|
2023-06-26 14:28:14 +00:00
|
|
|
useReadyToWithdrawalToasts({
|
2023-09-20 20:28:34 +00:00
|
|
|
withdrawalsLink: Links.PORTFOLIO(),
|
2023-06-26 14:28:14 +00:00
|
|
|
});
|
2023-11-28 15:08:21 +00:00
|
|
|
useReferralToasts();
|
2024-01-23 15:32:23 +00:00
|
|
|
useWalletDisconnectedToasts(<WalletDisconnectAdditionalContent />);
|
2022-12-21 09:29:32 +00:00
|
|
|
|
2023-02-06 20:09:56 +00:00
|
|
|
const toasts = useToasts((store) => store.toasts);
|
2022-12-21 09:29:32 +00:00
|
|
|
return <ToastsContainer order="desc" toasts={toasts} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ToastsManager;
|