diff --git a/src/components/transactions/ActiveTransactions.tsx b/src/components/transactions/ActiveTransactions.tsx new file mode 100644 index 00000000..2db0c257 --- /dev/null +++ b/src/components/transactions/ActiveTransactions.tsx @@ -0,0 +1,23 @@ +import { useMemo } from 'react'; +import { useStore } from '../../features/store'; +import { Card } from '../layout/Card'; +import { TransactionItem } from './TransactionItem'; + +export function ActiveTransactions() { + const { transfers } = useStore((s) => ({ + transfers: s.transfers, + transferLoading: s.transferLoading, + })); + + const transfersList = useMemo(() => transfers.filter(t => t.status === "signing-transfer"), [transfers]); + if (!transfersList.length) return null; + + return ( + +

Active Transactions

+
+ {transfersList.map((item) => )} +
+
+ ); +} diff --git a/src/components/transactions/TransactionItem.tsx b/src/components/transactions/TransactionItem.tsx new file mode 100644 index 00000000..36ab21c1 --- /dev/null +++ b/src/components/transactions/TransactionItem.tsx @@ -0,0 +1,57 @@ +import { SpinnerIcon } from '@hyperlane-xyz/widgets'; +import Image from 'next/image'; +import { useState } from 'react'; +import { useMultiProvider } from '../../features/chains/hooks'; +import { getChainDisplayName } from '../../features/chains/utils'; +import { tryFindToken, useWarpCore } from '../../features/tokens/hooks'; +import { TransfersDetailsModal } from '../../features/transfer/TransfersDetailsModal'; +import { TransferContext } from '../../features/transfer/types'; +import ArrowRightIcon from '../../images/icons/arrow-right.svg'; +import { TokenIcon } from '../icons/TokenIcon'; + +export function TransactionItem({ transaction }: { transaction: TransferContext }) { + const [showDetails, setShowDetails] = useState(false); + const multiProvider = useMultiProvider(); + const warpCore = useWarpCore(); + + const { + origin, + destination, + amount, + originTokenAddressOrDenom, + } = transaction || {}; + + const token = tryFindToken(warpCore, origin, originTokenAddressOrDenom); + + return ( +
setShowDetails(true)}> + +
+
+ {amount} {token.symbol} +
+
+ + {getChainDisplayName(multiProvider, origin, true)} + + arrow + + {getChainDisplayName(multiProvider, destination, true)} + +
+
+
+ +
+ {showDetails && ( + { + setShowDetails(false); + }} + transfer={transaction} + /> + )} +
+ ); +} diff --git a/src/features/transfer/TransfersDetailsModal.tsx b/src/features/transfer/TransfersDetailsModal.tsx index aa859430..09ee9122 100644 --- a/src/features/transfer/TransfersDetailsModal.tsx +++ b/src/features/transfer/TransfersDetailsModal.tsx @@ -15,6 +15,7 @@ import Image from 'next/image'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { ChainLogo } from '../../components/icons/ChainLogo'; import { TokenIcon } from '../../components/icons/TokenIcon'; +import ArrowRightIcon from '../../images/icons/arrow-right.svg'; import LinkIcon from '../../images/icons/external-link-icon.svg'; import { Color } from '../../styles/Color'; import { formatTimestamp } from '../../utils/date'; @@ -112,6 +113,12 @@ export function TransfersDetailsModal({ return ( + {!isFinal &&
+ back + + Bridge + +
} {isFinal && (

{date}

diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 3fb706aa..e86a6dad 100755 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,5 +1,6 @@ import type { NextPage } from 'next'; import { TipCard } from '../components/tip/TipCard'; +import { ActiveTransactions } from '../components/transactions/ActiveTransactions'; import { TransferTokenCard } from '../features/transfer/TransferTokenCard'; import { WalletFloatingButtons } from '../features/wallet/WalletFloatingButtons'; @@ -7,6 +8,7 @@ const Home: NextPage = () => { return (
+