Skip to content

Commit d965c87

Browse files
committed
add nice zero state for port
1 parent 1005e7c commit d965c87

3 files changed

Lines changed: 64 additions & 21 deletions

File tree

listen-interface/src/components/Portfolio.tsx

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { WalletSwitcher } from "./WalletSwitcher";
1414
import { EoaEvmWalletSelector } from "./EoaEvmWalletSelector";
1515
import { PortfolioItem } from "../lib/types";
1616
import { aggregatePortfolioItems } from "../lib/portfolioHelpers";
17-
import { ensurePortfolioItem } from "../lib/util";
17+
import { ensurePortfolioItem, imageMap } from "../lib/util";
1818

1919
export function Portfolio() {
2020
const {
@@ -140,6 +140,43 @@ export function Portfolio() {
140140

141141
// Show empty portfolio if we have a wallet but no assets
142142
if (hasWallet && !isLoading && assets.length === 0) {
143+
// Create placeholder assets with zero balances
144+
const placeholderAssets: PortfolioItem[] = [
145+
{
146+
address: "So11111111111111111111111111111111111111112",
147+
name: "Solana",
148+
symbol: "SOL",
149+
decimals: 9,
150+
logoURI: imageMap.solana,
151+
price: 0,
152+
amount: 0,
153+
chain: "solana",
154+
priceChange24h: 0,
155+
},
156+
{
157+
address: "BTC",
158+
name: "Bitcoin",
159+
symbol: "BTC",
160+
decimals: 8,
161+
logoURI: "https://app.hyperliquid.xyz/coins/BTC.svg",
162+
price: 0,
163+
amount: 0,
164+
chain: "hyperliquid",
165+
priceChange24h: 0,
166+
},
167+
{
168+
address: "ETH",
169+
name: "Ethereum",
170+
symbol: "ETH",
171+
decimals: 18,
172+
logoURI: imageMap.eth,
173+
price: 0,
174+
amount: 0,
175+
chain: "ethereum",
176+
priceChange24h: 0,
177+
},
178+
];
179+
143180
return (
144181
<div
145182
className={`h-full font-mono overflow-y-auto scrollbar-thin scrollbar-thumb-[#2D2D2D] scrollbar-track-transparent scrollable-container pb-16 md:pb-0 ${
@@ -148,12 +185,11 @@ export function Portfolio() {
148185
>
149186
<WalletSwitcher />
150187
{activeWallet === "eoaEvm" && <EoaEvmWalletSelector />}
151-
<PortfolioSummary
152-
totalBalance={0}
153-
portfolioPnL={0}
154-
/>
155-
<div className="flex-1 flex items-center justify-center">
156-
<p className="text-gray-400 text-center">No assets in this wallet</p>
188+
<PortfolioSummary totalBalance={0} portfolioPnL={0} />
189+
<div className="flex-1 space-y-2">
190+
{placeholderAssets.map((asset) => (
191+
<PortfolioItemTile key={asset.address} asset={asset} />
192+
))}
157193
</div>
158194
</div>
159195
);

listen-interface/src/components/PortfolioItemTile.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@ export function PortfolioItemTile({
8888
<p className="font-bold font-dm-sans">
8989
${(asset.price * asset.amount).toFixed(2)}
9090
</p>
91-
<p className={`text-sm font-dm-sans font-[500] ${pnlColor}`}>
92-
{pnlSign}
93-
{Math.abs(asset.priceChange24h).toFixed(2)}%
94-
</p>
91+
{asset.priceChange24h != 0 && (
92+
<p className={`text-sm font-dm-sans font-[500] ${pnlColor}`}>
93+
{pnlSign}
94+
{Math.abs(asset.priceChange24h).toFixed(2)}%
95+
</p>
96+
)}
9597
</div>
9698
</div>
9799
</div>

listen-interface/src/components/PortfolioSummary.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ const PnLArrow = ({ isPositive }: { isPositive: boolean }) => {
4242
);
4343
};
4444

45-
export function PortfolioSummary({ totalBalance, portfolioPnL }: PortfolioSummaryProps) {
45+
export function PortfolioSummary({
46+
totalBalance,
47+
portfolioPnL,
48+
}: PortfolioSummaryProps) {
4649
const { solanaAddress, activeWallet } = useWalletStore();
4750
const { fundWallet } = useFundWallet();
4851
const { login } = usePrivy();
@@ -70,15 +73,17 @@ export function PortfolioSummary({ totalBalance, portfolioPnL }: PortfolioSummar
7073
maximumFractionDigits: 2,
7174
})}
7275
</span>
73-
<div
74-
className={`mt-4 text-lg ${pnlColor} flex items-center justify-center gap-1 font-dm-sans`}
75-
>
76-
<PnLArrow isPositive={portfolioPnL >= 0} />
77-
<span>
78-
{pnlSign}${Math.abs(pnlAmount).toFixed(2)} {pnlSign}(
79-
{Math.abs(portfolioPnL).toFixed(2)}%)
80-
</span>
81-
</div>
76+
{portfolioPnL != 0 && (
77+
<div
78+
className={`mt-4 text-lg ${pnlColor} flex items-center justify-center gap-1 font-dm-sans`}
79+
>
80+
<PnLArrow isPositive={portfolioPnL >= 0} />
81+
<span>
82+
{pnlSign}${Math.abs(pnlAmount).toFixed(2)} {pnlSign}(
83+
{Math.abs(portfolioPnL).toFixed(2)}%)
84+
</span>
85+
</div>
86+
)}
8287
</div>
8388
<div className="flex flex-row items-center gap-3 justify-center mt-2">
8489
<>

0 commit comments

Comments
 (0)