Skip to content

Commit 78af8fa

Browse files
sktbrdclaude
andcommitted
fix(treasury): two-line token rows so values fit the narrow column
The three-column table clipped its Value column once Token Holdings moved into the right-hand column. Stacked value-over-amount rows fit any width; the now-unused table header keys are dropped from both locales. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 7a74466 commit 78af8fa

3 files changed

Lines changed: 35 additions & 58 deletions

File tree

messages/en/treasury.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
"tokens": {
1616
"title": "Token Holdings",
1717
"description": "ERC-20 tokens held in the treasury",
18-
"table": {
19-
"token": "Token",
20-
"amount": "Amount",
21-
"valueUsd": "Value (USD)"
22-
},
2318
"empty": "No tokens found",
2419
"emptyDescription": "The treasury currently holds no ERC-20 tokens",
2520
"errorLoading": "Error loading token holdings: {error}"

messages/pt-br/treasury.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
"tokens": {
1616
"title": "Holdings de Tokens",
1717
"description": "Tokens ERC-20 mantidos no tesouro",
18-
"table": {
19-
"token": "Token",
20-
"amount": "Quantia",
21-
"valueUsd": "Valor (USD)"
22-
},
2318
"empty": "Nenhum token encontrado",
2419
"emptyDescription": "O tesouro não tem tokens ERC-20 no momento",
2520
"errorLoading": "Erro ao carregar holdings de tokens: {error}"

src/components/treasury/TokenHoldingsClient.tsx

Lines changed: 35 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
import { useLocale, useTranslations } from "next-intl";
44
import Image from "next/image";
55
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
6-
import {
7-
Table,
8-
TableBody,
9-
TableCell,
10-
TableHead,
11-
TableHeader,
12-
TableRow,
13-
} from "@/components/ui/table";
146
import { toIntlLocale } from "@/lib/i18n/format";
157

168
export interface EnrichedToken {
@@ -82,47 +74,42 @@ export function TokenHoldingsClient({ tokens, error }: TokenHoldingsClientProps)
8274
<CardDescription>{t("tokens.description")}</CardDescription>
8375
</CardHeader>
8476
<CardContent>
85-
<Table>
86-
<TableHeader>
87-
<TableRow>
88-
<TableHead>{t("tokens.table.token")}</TableHead>
89-
<TableHead className="text-right">{t("tokens.table.amount")}</TableHead>
90-
<TableHead className="text-right">{t("tokens.table.valueUsd")}</TableHead>
91-
</TableRow>
92-
</TableHeader>
93-
<TableBody>
94-
{tokens.map((token) => (
95-
<TableRow key={token.contractAddress}>
96-
<TableCell>
97-
<div className="flex items-center space-x-3">
98-
{token.logo && (
99-
<Image
100-
src={token.logo}
101-
alt={token.symbol}
102-
width={24}
103-
height={24}
104-
className="rounded-full"
105-
onError={(event) => {
106-
event.currentTarget.style.display = "none";
107-
}}
108-
/>
109-
)}
110-
<div>
111-
<div className="font-medium">{token.name}</div>
112-
<div className="text-sm text-muted-foreground">{token.symbol}</div>
113-
</div>
114-
</div>
115-
</TableCell>
116-
<TableCell className="text-right tabular-nums">
77+
{/* Two-line rows instead of a three-column table: this card lives in
78+
the narrow right column, where the table's Value column clipped
79+
against the card edge. */}
80+
<ul className="divide-y">
81+
{tokens.map((token) => (
82+
<li
83+
key={token.contractAddress}
84+
className="flex items-center justify-between gap-3 py-3 first:pt-0 last:pb-0"
85+
>
86+
<div className="flex min-w-0 items-center gap-3">
87+
{token.logo && (
88+
<Image
89+
src={token.logo}
90+
alt={token.symbol}
91+
width={24}
92+
height={24}
93+
className="rounded-full"
94+
onError={(event) => {
95+
event.currentTarget.style.display = "none";
96+
}}
97+
/>
98+
)}
99+
<div className="min-w-0">
100+
<div className="truncate font-medium">{token.name}</div>
101+
<div className="text-sm text-muted-foreground">{token.symbol}</div>
102+
</div>
103+
</div>
104+
<div className="shrink-0 text-right">
105+
<div className="font-medium tabular-nums">{formatUsdValue(token.usdValue)}</div>
106+
<div className="text-sm text-muted-foreground tabular-nums">
117107
{formatBalance(token.balance, token.decimals)} {token.symbol}
118-
</TableCell>
119-
<TableCell className="text-right tabular-nums">
120-
{formatUsdValue(token.usdValue)}
121-
</TableCell>
122-
</TableRow>
123-
))}
124-
</TableBody>
125-
</Table>
108+
</div>
109+
</div>
110+
</li>
111+
))}
112+
</ul>
126113
</CardContent>
127114
</Card>
128115
);

0 commit comments

Comments
 (0)