11import { FC } from "react"
2- import { BodySm , List , HStack , ListProps } from "@threshold-network/components"
2+ import {
3+ BodySm ,
4+ List ,
5+ HStack ,
6+ ListProps ,
7+ LinkBox ,
8+ LinkOverlay ,
9+ Link ,
10+ } from "@threshold-network/components"
311import shortenAddress from "../../utils/shortenAddress"
412import Identicon from "../Identicon"
513import { OutlineListItem } from "../OutlineListItem"
614import { InlineTokenBalance } from "../TokenBalance"
715import { getRelativeTime } from "../../utils/date"
816import { RecentDeposit } from "../../hooks/tbtc/useFetchRecentDeposits"
17+ import ViewInBlockExplorer , {
18+ createLinkToBlockExplorerForChain ,
19+ } from "../ViewInBlockExplorer"
20+ import { ExplorerDataType } from "../../utils/createEtherscanLink"
921
1022export type RecentDepositsProps = {
1123 deposits : RecentDeposit [ ]
@@ -22,23 +34,46 @@ export const RecentDeposits: FC<RecentDepositsProps> = ({
2234 )
2335}
2436
25- const RecentDepositItem : FC < RecentDeposit > = ( { amount, address, date } ) => {
37+ const RecentDepositItem : FC < RecentDeposit > = ( {
38+ amount,
39+ address,
40+ date,
41+ txHash,
42+ } ) => {
2643 return (
27- < OutlineListItem >
28- < BodySm >
29- < InlineTokenBalance
30- tokenAmount = { amount }
31- withSymbol
32- tokenSymbol = "tBTC"
33- color = "brand.500"
34- />
35- </ BodySm >
44+ < LinkBox as = { OutlineListItem } >
45+ < LinkOverlay
46+ // We can't use `ViewInBlockExplorer` or our custom `Link` component
47+ // because `LinkOverlay` component from chakra doesn't pass the
48+ // `isExternal` prop forward so `ViewInBlockExplorer` or `Link`
49+ // component sees this link as an internal so the link will open in the
50+ // same tab and the TS compiler throws an error that `to` prop is
51+ // missing because of conditional props of `Link` component.
52+ as = { Link }
53+ textDecoration = "none"
54+ _hover = { { textDecoration : "none" } }
55+ color = "inherit"
56+ isExternal
57+ href = { createLinkToBlockExplorerForChain . ethereum (
58+ txHash ,
59+ ExplorerDataType . TRANSACTION
60+ ) }
61+ >
62+ < BodySm >
63+ < InlineTokenBalance
64+ tokenAmount = { amount }
65+ withSymbol
66+ tokenSymbol = "tBTC"
67+ color = "brand.500"
68+ />
69+ </ BodySm >
70+ </ LinkOverlay >
3671 < HStack spacing = "2" >
3772 < Identicon address = { address } />
3873 < BodySm textStyle = "chain-identifier" > { shortenAddress ( address ) } </ BodySm >
3974 </ HStack >
4075 < BodySm > { getRelativeTime ( date ) } </ BodySm >
41- </ OutlineListItem >
76+ </ LinkBox >
4277 )
4378}
4479
0 commit comments