Skip to content

Commit 3394a0a

Browse files
committed
fix type error
1 parent 7025b2b commit 3394a0a

4 files changed

Lines changed: 52 additions & 12 deletions

File tree

src/components/blockchain-address-link.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ const BlockchainAddressLink = ({
3434
>
3535
<AddressDisplayFilterDappRemark
3636
address={address}
37-
formatAddress={(address) => toShortText(address, frontLength, backLength)}
37+
formatAddress={(address) =>
38+
toShortText({
39+
text: address,
40+
frontLength,
41+
backLength
42+
})
43+
}
3844
/>
3945
</Link>
4046
);
@@ -54,7 +60,13 @@ const BlockchainAddressLink = ({
5460
>
5561
<AddressDisplayFilterDappRemark
5662
address={address}
57-
formatAddress={(address) => toShortText(address, frontLength, backLength)}
63+
formatAddress={(address) =>
64+
toShortText({
65+
text: address,
66+
frontLength,
67+
backLength
68+
})
69+
}
5870
/>
5971
</Link>
6072
);
@@ -64,7 +76,13 @@ const BlockchainAddressLink = ({
6476
<span title={address} className={className}>
6577
<AddressDisplayFilterDappRemark
6678
address={address}
67-
formatAddress={(address) => toShortText(address, frontLength, backLength)}
79+
formatAddress={(address) =>
80+
toShortText({
81+
text: address,
82+
frontLength,
83+
backLength
84+
})
85+
}
6886
/>
6987
</span>
7088
);

src/components/chain-tx-display.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ const ChainTxDisplay = ({
4141
className={cn('truncate hover:underline', CodeFont.className, className)}
4242
title={value}
4343
>
44-
{isFullText ? value : toShortText(value, 6, 4)}
44+
{isFullText
45+
? value
46+
: toShortText({
47+
text: value,
48+
frontLength: 6,
49+
backLength: 4
50+
})}
4551
</Link>
4652
);
4753
}
@@ -53,13 +59,25 @@ const ChainTxDisplay = ({
5359
target="_blank"
5460
rel="noreferrer noopener"
5561
>
56-
{isFullText ? value : toShortText(value, 6, 4)}
62+
{isFullText
63+
? value
64+
: toShortText({
65+
text: value,
66+
frontLength: 6,
67+
backLength: 4
68+
})}
5769
</Link>
5870
);
5971
} else {
6072
return (
6173
<span className={cn('truncate', CodeFont.className, className)} title={value}>
62-
{isFullText ? value : toShortText(value, 6, 4)}
74+
{isFullText
75+
? value
76+
: toShortText({
77+
text: value,
78+
frontLength: 6,
79+
backLength: 4
80+
})}
6381
</span>
6482
);
6583
}

src/components/stats-container.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { StatCard } from './stat-card';
22

33
import type { MessageProgress } from '@/graphql/type';
44

5-
65
interface StatsContainerProps {
76
data?: MessageProgress[];
87
networkTotal: number;
@@ -17,10 +16,10 @@ const StatsContainer = ({ data, networkTotal }: StatsContainerProps) => {
1716

1817
return (
1918
<div className="grid gap-4 sm:grid-cols-2 sm:gap-8 lg:grid-cols-4">
20-
<StatCard title="Total Messages" value={totalMessageValue} percentageChange={20.1} />
21-
<StatCard title="Inflight Messages" value={inflightMessageValue} percentageChange={20.1} />
22-
<StatCard title="Networks" value={networkValue} percentageChange={20.1} />
23-
<StatCard title="Protocols" value={protocolValue} percentageChange={20.1} />
19+
<StatCard title="Total Messages" value={totalMessageValue} />
20+
<StatCard title="Inflight Messages" value={inflightMessageValue} />
21+
<StatCard title="Networks" value={networkValue} />
22+
<StatCard title="Protocols" value={protocolValue} />
2423
</div>
2524
);
2625
};

src/utils/string.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { isString } from 'lodash-es';
22

3-
export function toShortText(text: string, frontLength: number, backLength: number): string {
3+
interface ShortTextOptions {
4+
text?: string;
5+
frontLength: number;
6+
backLength: number;
7+
}
8+
export function toShortText({ text, frontLength, backLength }: ShortTextOptions): string {
49
if (!isString(text)) {
510
return '';
611
}

0 commit comments

Comments
 (0)