|
3 | 3 | import { useLocale, useTranslations } from "next-intl"; |
4 | 4 | import Image from "next/image"; |
5 | 5 | 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"; |
14 | 6 | import { toIntlLocale } from "@/lib/i18n/format"; |
15 | 7 |
|
16 | 8 | export interface EnrichedToken { |
@@ -82,47 +74,42 @@ export function TokenHoldingsClient({ tokens, error }: TokenHoldingsClientProps) |
82 | 74 | <CardDescription>{t("tokens.description")}</CardDescription> |
83 | 75 | </CardHeader> |
84 | 76 | <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"> |
117 | 107 | {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> |
126 | 113 | </CardContent> |
127 | 114 | </Card> |
128 | 115 | ); |
|
0 commit comments