11import { Link } from '@tanstack/react-router'
22import { type Address , Hex } from 'ox'
33import { useState } from 'react'
4+ import ExternalLink from '~icons/lucide/external-link'
45import { EventDescription } from '#components/EventDescription'
56import { DateFormatter , HexFormatter , PriceFormatter } from '#lib/formatting'
67import { useCopy } from '#lib/hooks'
@@ -16,6 +17,7 @@ export function Receipt(props: Receipt.Props) {
1617 events = [ ] ,
1718 fee,
1819 total,
20+ framed = false ,
1921 } = props
2022 const [ hashExpanded , setHashExpanded ] = useState ( false )
2123 const { copy, notifying } = useCopy ( )
@@ -29,24 +31,39 @@ export function Receipt(props: Receipt.Props) {
2931 < div className = "flex flex-col gap-[8px] font-mono text-[13px] leading-[16px] flex-1" >
3032 < div className = "flex justify-between items-end" >
3133 < span className = "text-tertiary capitalize" > Block</ span >
32- < Link
33- to = { '/block/$id' }
34- params = { { id : Hex . fromNumber ( blockNumber ) } }
35- className = "text-accent text-right before:content-['#'] active:translate-y-[.5px]"
36- >
37- { String ( blockNumber ) }
38- </ Link >
34+ { framed ? (
35+ < span className = "text-accent text-right before:content-['#']" >
36+ { String ( blockNumber ) }
37+ </ span >
38+ ) : (
39+ < Link
40+ to = { '/block/$id' }
41+ params = { { id : Hex . fromNumber ( blockNumber ) } }
42+ className = "text-accent text-right before:content-['#'] active:translate-y-[.5px]"
43+ >
44+ { String ( blockNumber ) }
45+ </ Link >
46+ ) }
3947 </ div >
4048 < div className = "flex justify-between items-end" >
4149 < span className = "text-tertiary capitalize" > Sender</ span >
42- < Link
43- to = { '/account/$address' }
44- params = { { address : sender } }
45- className = "text-accent text-right active:translate-y-[.5px]"
46- title = { sender }
47- >
48- { HexFormatter . shortenHex ( sender ) }
49- </ Link >
50+ { framed ? (
51+ < span
52+ className = "text-accent text-right"
53+ title = { sender }
54+ >
55+ { HexFormatter . shortenHex ( sender ) }
56+ </ span >
57+ ) : (
58+ < Link
59+ to = { '/account/$address' }
60+ params = { { address : sender } }
61+ className = "text-accent text-right active:translate-y-[.5px]"
62+ title = { sender }
63+ >
64+ { HexFormatter . shortenHex ( sender ) }
65+ </ Link >
66+ ) }
5067 </ div >
5168 < div className = "flex justify-between items-start" >
5269 < div className = "relative" >
@@ -125,7 +142,7 @@ export function Receipt(props: Receipt.Props) {
125142 < div className = "flex flex-row justify-between items-start gap-[10px]" >
126143 < div className = "flex flex-row items-start gap-[4px] grow min-w-0" >
127144 < div className = "flex items-center text-tertiary before:content-[counter(event)_'.'] shrink-0 leading-[24px]" > </ div >
128- < EventDescription event = { event } />
145+ < EventDescription event = { event } framed = { framed } />
129146 </ div >
130147 < div className = "flex items-center text-right shrink-0 leading-[24px]" >
131148 { totalAmountBigInt > 0n && (
@@ -186,6 +203,23 @@ export function Receipt(props: Receipt.Props) {
186203 </ div >
187204 </ >
188205 ) }
206+ { framed && (
207+ < >
208+ < div className = "border-t border-dashed border-base-border" />
209+ < div className = "flex justify-center px-[20px] py-[16px]" >
210+ < Link
211+ to = { '/tx/$hash' }
212+ params = { { hash } }
213+ target = "_blank"
214+ rel = "noopener noreferrer"
215+ className = "text-accent text-[13px] font-mono active:translate-y-[.5px] flex items-center gap-[6px]"
216+ >
217+ View in Explorer
218+ < ExternalLink className = "w-[14px] h-[14px]" />
219+ </ Link >
220+ </ div >
221+ </ >
222+ ) }
189223 </ div >
190224 )
191225}
@@ -199,5 +233,6 @@ export namespace Receipt {
199233 events ?: KnownEvent [ ]
200234 fee ?: number
201235 total ?: number
236+ framed ?: boolean
202237 }
203238}
0 commit comments