Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions apps/explorer/src/components/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@ import type { Address as AddressType } from 'ox'
import { HexFormatter } from '#lib/formatting'

export function Address(props: Address.Props) {
const { address, chars, self, className } = props
const { address, chars, self, className, framed = false } = props
return (
<>
<Link
to="/account/$address"
params={{ address }}
title={address}
className={className}
>
{HexFormatter.shortenHex(address, chars)}
</Link>
{framed ? (
<span
title={address}
className={className}
>
{HexFormatter.shortenHex(address, chars)}
</span>
) : (
<Link
to="/account/$address"
params={{ address }}
title={address}
className={className}
>
{HexFormatter.shortenHex(address, chars)}
</Link>
)}
{self && <span className="text-tertiary"> (self)</span>}
</>
)
Expand All @@ -25,5 +34,6 @@ export namespace Address {
chars?: number
self?: boolean
className?: string
framed?: boolean
}
}
4 changes: 3 additions & 1 deletion apps/explorer/src/components/EventDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Address } from './Address.tsx'
import { Amount } from './Receipt/Amount.tsx'

export function EventDescription(props: EventDescription.Props) {
const { event, seenAs, className } = props
const { event, seenAs, className, framed = false } = props

return (
<div
Expand Down Expand Up @@ -55,6 +55,7 @@ export function EventDescription(props: EventDescription.Props) {
address={part.value}
className="text-accent items-end press-down whitespace-nowrap"
self={seenAs ? isAddressEqual(part.value, seenAs) : false}
framed={framed}
/>
)
case 'hex':
Expand Down Expand Up @@ -98,5 +99,6 @@ export namespace EventDescription {
event: KnownEvent
seenAs?: AddressType.Address
className?: string | undefined
framed?: boolean
}
}
64 changes: 48 additions & 16 deletions apps/explorer/src/components/Receipt/Receipt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { EventDescription } from '#components/EventDescription'
import { DateFormatter, HexFormatter, PriceFormatter } from '#lib/formatting'
import { useCopy } from '#lib/hooks'
import type { KnownEvent } from '#lib/known-events'
import ExternalLink from '~icons/lucide/external-link'
import { ReceiptMark } from './ReceiptMark'

export function Receipt(props: Receipt.Props) {
Expand All @@ -16,6 +17,7 @@ export function Receipt(props: Receipt.Props) {
events = [],
fee,
total,
framed = false,
} = props
const [hashExpanded, setHashExpanded] = useState(false)
const { copy, notifying } = useCopy()
Expand All @@ -29,24 +31,36 @@ export function Receipt(props: Receipt.Props) {
<div className="flex flex-col gap-[8px] font-mono text-[13px] leading-[16px] flex-1">
<div className="flex justify-between items-end">
<span className="text-tertiary capitalize">Block</span>
<Link
to={'/block/$id'}
params={{ id: Hex.fromNumber(blockNumber) }}
className="text-accent text-right before:content-['#'] press-down"
>
{String(blockNumber)}
</Link>
{framed ? (
<span className="text-accent text-right before:content-['#']">
{String(blockNumber)}
</span>
) : (
<Link
to={'/block/$id'}
params={{ id: Hex.fromNumber(blockNumber) }}
className="text-accent text-right before:content-['#'] press-down"
>
{String(blockNumber)}
</Link>
)}
</div>
<div className="flex justify-between items-end">
<span className="text-tertiary capitalize">Sender</span>
<Link
to={'/account/$address'}
params={{ address: sender }}
className="text-accent text-right press-down"
title={sender}
>
{HexFormatter.shortenHex(sender)}
</Link>
{framed ? (
<span className="text-accent text-right" title={sender}>
{HexFormatter.shortenHex(sender)}
</span>
) : (
<Link
to={'/account/$address'}
params={{ address: sender }}
className="text-accent text-right press-down"
title={sender}
>
{HexFormatter.shortenHex(sender)}
</Link>
)}
</div>
<div className="flex justify-between items-start">
<div className="relative">
Expand Down Expand Up @@ -125,7 +139,7 @@ export function Receipt(props: Receipt.Props) {
<div className="flex flex-row justify-between items-start gap-[10px]">
<div className="flex flex-row items-start gap-[4px] grow min-w-0">
<div className="flex items-center text-tertiary before:content-[counter(event)_'.'] shrink-0 leading-[24px]"></div>
<EventDescription event={event} />
<EventDescription event={event} framed={framed} />
</div>
<div className="flex items-center text-right shrink-0 leading-[24px]">
{totalAmountBigInt > 0n && (
Expand Down Expand Up @@ -186,6 +200,23 @@ export function Receipt(props: Receipt.Props) {
</div>
</>
)}
{framed && (
<>
<div className="border-t border-dashed border-base-border" />
<div className="flex justify-center px-[20px] py-[16px]">
<Link
to={'/tx/$hash'}
params={{ hash }}
target="_blank"
rel="noopener noreferrer"
className="text-accent text-[13px] font-mono active:translate-y-[.5px] flex items-center gap-[6px]"
>
View in Explorer
<ExternalLink className="w-[14px] h-[14px]" />
</Link>
</div>
</>
)}
</div>
)
}
Expand All @@ -199,5 +230,6 @@ export namespace Receipt {
events?: KnownEvent[]
fee?: number
total?: number
framed?: boolean
}
}
21 changes: 21 additions & 0 deletions apps/explorer/src/routeTree.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading