Skip to content

Commit b522581

Browse files
authored
fix(explorer): fix truncated values display (#863)
* fix(explorer): fix truncated values display * fix(explorer): tighten truncated value layout
1 parent 396b938 commit b522581

20 files changed

Lines changed: 57 additions & 99 deletions

apps/explorer/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"cva": "catalog:",
5353
"hono": "catalog:",
5454
"idxs": "catalog:",
55+
"midcut": "catalog:",
5556
"ox": "catalog:",
5657
"react": "catalog:",
5758
"react-dom": "catalog:",

apps/explorer/src/comps/Address.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Link } from '@tanstack/react-router'
22
import type { Address as AddressType } from 'ox'
33
import { useAddressHighlight } from '#comps/AddressHighlight'
4-
import { Midcut } from '#comps/Midcut'
4+
import { Midcut } from 'midcut'
55
import { cx } from '#lib/css'
66

77
export function Address(props: Address.Props) {

apps/explorer/src/comps/AddressCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Link } from '@tanstack/react-router'
22
import type { Address } from 'ox'
33
import { useAddressHighlight } from '#comps/AddressHighlight'
4-
import { Midcut } from '#comps/Midcut'
4+
import { Midcut } from 'midcut'
55
import { cx } from '#lib/css'
66

77
export function AddressCell(props: {

apps/explorer/src/comps/BlockCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Link } from '@tanstack/react-router'
22
import type { Hex } from 'ox'
33
import * as React from 'react'
44
import { InfoCard } from '#comps/InfoCard'
5-
import { Midcut } from '#comps/Midcut'
5+
import { Midcut } from 'midcut'
66
import { ValidatorTag } from '#comps/ValidatorTag'
77
import { useAnimatedBlockNumber } from '#lib/block-number'
88
import { cx } from '#lib/css'

apps/explorer/src/comps/DataGrid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function DataGrid(props: DataGrid.Props) {
6969
if (typeof col.width === 'string')
7070
return col.minWidth
7171
? `minmax(${col.minWidth}px, ${col.width})`
72-
: col.width
72+
: `minmax(0, ${col.width})`
7373
if (col.minWidth) return `minmax(${col.minWidth}px, auto)`
7474
return mode === 'tabs' ? 'minmax(0, auto)' : 'auto'
7575
})

apps/explorer/src/comps/ExploreInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { keepPreviousData, queryOptions, useQuery } from '@tanstack/react-query'
22
import * as Address from 'ox/Address'
33
import * as Hex from 'ox/Hex'
44
import * as React from 'react'
5-
import { Midcut } from '#comps/Midcut'
5+
import { Midcut } from 'midcut'
66
import { useMountAnim } from '#lib/animation'
77
import { ProgressLine } from '#comps/ProgressLine'
88
import { RelativeTime } from '#comps/RelativeTime'

apps/explorer/src/comps/Midcut.tsx

Lines changed: 0 additions & 69 deletions
This file was deleted.

apps/explorer/src/comps/Receipt.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Address, Hex } from 'ox'
33
import * as Value from 'ox/Value'
44
import { useState } from 'react'
55
import { Amount } from '#comps/Amount'
6-
import { Midcut } from '#comps/Midcut'
6+
import { Midcut } from 'midcut'
77
import { ReceiptMark } from '#comps/ReceiptMark'
88
import { useTokenListMembership } from '#comps/TokenListMembership'
99
import { TxEventDescription } from '#comps/TxEventDescription'
@@ -76,7 +76,7 @@ export function Receipt(props: Receipt.Props) {
7676
params={{ address: sender }}
7777
className="text-accent text-right press-down min-w-0 flex-1 flex justify-end"
7878
>
79-
<Midcut value={sender} prefix="0x" align="end" />
79+
<Midcut value={sender} prefix="0x" align="end" min={4} />
8080
</Link>
8181
</div>
8282
<div className="flex justify-between items-start gap-4">
@@ -102,7 +102,7 @@ export function Receipt(props: Receipt.Props) {
102102
onClick={() => setHashExpanded(true)}
103103
className="text-right cursor-pointer press-down min-w-0 flex-1 flex justify-end"
104104
>
105-
<Midcut value={hash} prefix="0x" align="end" />
105+
<Midcut value={hash} prefix="0x" align="end" min={4} />
106106
</button>
107107
)}
108108
</div>
@@ -293,7 +293,11 @@ export function Receipt(props: Receipt.Props) {
293293
params={{ address: item.payer }}
294294
className="text-accent press-down"
295295
>
296-
<Midcut value={item.payer} prefix="0x" />
296+
<Midcut
297+
value={item.payer}
298+
prefix="0x"
299+
min={4}
300+
/>
297301
</Link>
298302
<span className="text-tertiary">paid</span>
299303
</>

apps/explorer/src/comps/TransactionCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Link } from '@tanstack/react-router'
22
import type { Hex } from 'ox'
3-
import { Midcut } from '#comps/Midcut'
3+
import { Midcut } from 'midcut'
44

55
export function TransactionCell(props: { hash: Hex.Hex }) {
66
const { hash } = props

apps/explorer/src/comps/TxEventDescription.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as React from 'react'
88
import { decodeFunctionData, isAddressEqual } from 'viem'
99
import { Address } from '#comps/Address'
1010
import { Amount } from '#comps/Amount'
11-
import { Midcut } from '#comps/Midcut'
11+
import { Midcut } from 'midcut'
1212
import { TokenIcon } from '#comps/TokenIcon'
1313
import { cx } from '#lib/css'
1414
import { extractContractAbi, getContractAbi } from '#lib/domain/contracts.ts'
@@ -84,12 +84,15 @@ function ContractCallPart(props: {
8484
<>
8585
<span className="text-accent items-end whitespace-nowrap">{fnName}</span>
8686
<span className="text-secondary">on</span>
87-
<Address
88-
address={address}
89-
search={{ tab: 'contract' }}
90-
title={address}
91-
className="whitespace-nowrap"
92-
/>
87+
<span className="min-w-[11ch] basis-[11ch] max-w-full flex-1 overflow-hidden">
88+
<Address
89+
address={address}
90+
chars={4}
91+
search={{ tab: 'contract' }}
92+
title={address}
93+
className="whitespace-nowrap w-full max-w-full"
94+
/>
95+
</span>
9396
</>
9497
)
9598
}
@@ -130,11 +133,14 @@ export namespace TxEventDescription {
130133
if (!OxAddress.validate(part.value))
131134
return <span className="text-tertiary">{String(part.value)}</span>
132135
return (
133-
<Address
134-
address={part.value}
135-
className="text-accent items-end press-down whitespace-nowrap"
136-
self={seenAs ? isAddressEqual(part.value, seenAs) : false}
137-
/>
136+
<span className="min-w-[11ch] basis-[11ch] max-w-full flex-1 overflow-hidden">
137+
<Address
138+
address={part.value}
139+
chars={4}
140+
className="text-accent items-end press-down whitespace-nowrap w-full max-w-full"
141+
self={seenAs ? isAddressEqual(part.value, seenAs) : false}
142+
/>
143+
</span>
138144
)
139145
}
140146
case 'action': {

0 commit comments

Comments
 (0)