diff --git a/cosmos.config.json b/cosmos.config.json index fdcc5fe5c0..78d83b3526 100644 --- a/cosmos.config.json +++ b/cosmos.config.json @@ -5,5 +5,6 @@ "webpack": { "configPath": "react-scripts/config/webpack.config", "overridePath": "cosmos.override.js" - } + }, + "port": 5001 } \ No newline at end of file diff --git a/src/lib/components/EtherscanLink.tsx b/src/lib/components/EtherscanLink.tsx index 61a14058a5..b4c7c03ccf 100644 --- a/src/lib/components/EtherscanLink.tsx +++ b/src/lib/components/EtherscanLink.tsx @@ -7,7 +7,7 @@ import { ExplorerDataType, getExplorerLink } from 'utils/getExplorerLink' import ExternalLink from './ExternalLink' const Link = styled(ExternalLink)<{ color: Color }>` - color: ${({ theme, color }) => theme[color]} + color: ${({ theme, color }) => theme[color]}; text-decoration: none; ` diff --git a/src/lib/components/Swap/Status/StatusDialog.tsx b/src/lib/components/Swap/Status/StatusDialog.tsx index 814620f0b4..3478a0519e 100644 --- a/src/lib/components/Swap/Status/StatusDialog.tsx +++ b/src/lib/components/Swap/Status/StatusDialog.tsx @@ -1,10 +1,13 @@ import { Trans } from '@lingui/macro' import ErrorDialog, { StatusHeader } from 'lib/components/Error/ErrorDialog' +import EtherscanLink from 'lib/components/EtherscanLink' import useInterval from 'lib/hooks/useInterval' import { CheckCircle, Clock, Spinner } from 'lib/icons' import { SwapTransactionInfo, Transaction } from 'lib/state/transactions' import styled, { ThemedText } from 'lib/theme' +import ms from 'ms.macro' import { useCallback, useMemo, useState } from 'react' +import { ExplorerDataType } from 'utils/getExplorerLink' import ActionButton from '../../ActionButton' import Column from '../../Column' @@ -25,16 +28,9 @@ const TransactionRow = styled(Row)` function ElapsedTime({ tx }: { tx: Transaction }) { const [elapsedMs, setElapsedMs] = useState(0) - useInterval( - () => { - if (tx.info.response.timestamp) { - setElapsedMs(tx.info.response.timestamp - tx.addedTime) - } else { - setElapsedMs(Date.now() - tx.addedTime) - } - }, - elapsedMs === tx.info.response.timestamp ? null : 1000 - ) + + useInterval(() => setElapsedMs(Date.now() - tx.addedTime), tx.receipt ? null : ms`1s`) + const toElapsedTime = useCallback((ms: number) => { let sec = Math.floor(ms / 1000) const min = Math.floor(sec / 60) @@ -57,11 +53,6 @@ function ElapsedTime({ tx }: { tx: Transaction }) { ) } -const EtherscanA = styled.a` - color: ${({ theme }) => theme.accent}; - text-decoration: none; -` - interface TransactionStatusProps { tx: Transaction onClose: () => void @@ -74,6 +65,7 @@ function TransactionStatus({ tx, onClose }: TransactionStatusProps) { const heading = useMemo(() => { return tx.receipt?.status ? Transaction submitted : Transaction pending }, [tx.receipt?.status]) + return ( @@ -82,9 +74,9 @@ function TransactionStatus({ tx, onClose }: TransactionStatusProps) { - + View on Etherscan - +