vega-frontend-monorepo/apps/trading/pages/toasts-manager.tsx

46 lines
1.5 KiB
TypeScript
Raw Normal View History

import { Intent, ToastsContainer, useToasts } from '@vegaprotocol/ui-toolkit';
import { useProposalToasts } from '@vegaprotocol/proposals';
import { useVegaTransactionToasts } from '@vegaprotocol/web3';
import { useEthereumTransactionToasts } from '@vegaprotocol/web3';
import { useEthereumWithdrawApprovalsToasts } from '@vegaprotocol/web3';
import { useReadyToWithdrawalToasts } from '@vegaprotocol/withdraws';
import { Links } from '../lib/links';
import { useReferralToasts } from '../client-pages/referrals/hooks/use-referral-toasts';
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>
);
};
feat: transaction store and toasts (#2382) * feat: add eth and vega transaction stores feat: replace useStoredEthereumTransaction with useEthTransactionManager feat: add event bus subsciption to vega transaction store feat: handle order cancellation feat: rename Deposit, Order and Withdraw status field to be unique Revert "feat: rename Deposit, Order and Withdraw status field to be unique" This reverts commit f0b314d53fb3ada6fbebaba4fd1e5af6f38beaed. feat: split transaction update subscription feat: handle order and deposit transaction feat: handle withdrawal creation through transaction store feat: handle withdraw approval feat: handle panding withdrawls, add createdAt feat: handle transaction toast/dialog dismissal feat: add use vega transaction store tests feat: add use vega transaction store tests feat: add use vega transaction menager tests feat: add use vega transaction menager tests feat: add use vega transaction updater tests feat: improve use vega transaction updater tests feat: add use eth transaction store feat: add use eth withdraw approvals store feat: add use eth transaction updater tests fixed tests * feat: toasts feat: toasts feat: toasts * feat: add use eth withdraw approval manager tests * feat: add use eth transaction manager tests * feat: add use eth transaction manager tests * feat: add useEthWithdrawApprovalsManager tests * feat: remove Web3Container react container from CreateWithdrawalDialog * feat: remove Web3Container react container around TransactionsHandler * feat: remove unnecessary async from PendingWithdrawalsTable * feat: remove comments from WithdrawalFeedback * fixed z-index issue * cypress Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
2022-12-21 09:29:32 +00:00
export const ToastsManager = () => {
useProposalToasts();
useVegaTransactionToasts();
useEthereumTransactionToasts();
useEthereumWithdrawApprovalsToasts();
useReadyToWithdrawalToasts({
withdrawalsLink: Links.PORTFOLIO(),
});
useReferralToasts();
useWalletDisconnectedToasts(<WalletDisconnectAdditionalContent />);
feat: transaction store and toasts (#2382) * feat: add eth and vega transaction stores feat: replace useStoredEthereumTransaction with useEthTransactionManager feat: add event bus subsciption to vega transaction store feat: handle order cancellation feat: rename Deposit, Order and Withdraw status field to be unique Revert "feat: rename Deposit, Order and Withdraw status field to be unique" This reverts commit f0b314d53fb3ada6fbebaba4fd1e5af6f38beaed. feat: split transaction update subscription feat: handle order and deposit transaction feat: handle withdrawal creation through transaction store feat: handle withdraw approval feat: handle panding withdrawls, add createdAt feat: handle transaction toast/dialog dismissal feat: add use vega transaction store tests feat: add use vega transaction store tests feat: add use vega transaction menager tests feat: add use vega transaction menager tests feat: add use vega transaction updater tests feat: improve use vega transaction updater tests feat: add use eth transaction store feat: add use eth withdraw approvals store feat: add use eth transaction updater tests fixed tests * feat: toasts feat: toasts feat: toasts * feat: add use eth withdraw approval manager tests * feat: add use eth transaction manager tests * feat: add use eth transaction manager tests * feat: add useEthWithdrawApprovalsManager tests * feat: remove Web3Container react container from CreateWithdrawalDialog * feat: remove Web3Container react container around TransactionsHandler * feat: remove unnecessary async from PendingWithdrawalsTable * feat: remove comments from WithdrawalFeedback * fixed z-index issue * cypress Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
2022-12-21 09:29:32 +00:00
const toasts = useToasts((store) => store.toasts);
feat: transaction store and toasts (#2382) * feat: add eth and vega transaction stores feat: replace useStoredEthereumTransaction with useEthTransactionManager feat: add event bus subsciption to vega transaction store feat: handle order cancellation feat: rename Deposit, Order and Withdraw status field to be unique Revert "feat: rename Deposit, Order and Withdraw status field to be unique" This reverts commit f0b314d53fb3ada6fbebaba4fd1e5af6f38beaed. feat: split transaction update subscription feat: handle order and deposit transaction feat: handle withdrawal creation through transaction store feat: handle withdraw approval feat: handle panding withdrawls, add createdAt feat: handle transaction toast/dialog dismissal feat: add use vega transaction store tests feat: add use vega transaction store tests feat: add use vega transaction menager tests feat: add use vega transaction menager tests feat: add use vega transaction updater tests feat: improve use vega transaction updater tests feat: add use eth transaction store feat: add use eth withdraw approvals store feat: add use eth transaction updater tests fixed tests * feat: toasts feat: toasts feat: toasts * feat: add use eth withdraw approval manager tests * feat: add use eth transaction manager tests * feat: add use eth transaction manager tests * feat: add useEthWithdrawApprovalsManager tests * feat: remove Web3Container react container from CreateWithdrawalDialog * feat: remove Web3Container react container around TransactionsHandler * feat: remove unnecessary async from PendingWithdrawalsTable * feat: remove comments from WithdrawalFeedback * fixed z-index issue * cypress Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
2022-12-21 09:29:32 +00:00
return <ToastsContainer order="desc" toasts={toasts} />;
};
export default ToastsManager;