Skip to content

Commit 9e734ad

Browse files
committed
feat(frontend): surface USDC balance in wallet status area
Displays the connected wallet's USDC balance alongside wallet and RPC status so users can verify available funds directly from the connect area. Made-with: Cursor
1 parent 944a2de commit 9e734ad

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

frontend/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ function AppContent() {
7070
<div className="app-container">
7171
<Navbar
7272
walletAddress={walletAddress}
73+
usdcBalance={usdcBalance}
7374
onConnect={handleConnect}
7475
onDisconnect={handleDisconnect}
7576
/>

frontend/src/components/Navbar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ interface NavbarProps {
88
currentPath: '/' | '/analytics' | '/portfolio';
99
onNavigate: (path: '/' | '/analytics' | '/portfolio') => void;
1010
walletAddress: string | null;
11+
usdcBalance?: number;
1112
onConnect: (address: string) => void;
1213
onDisconnect: () => void;
1314
}
1415

1516
const Navbar: React.FC<NavbarProps> = ({
1617
walletAddress,
18+
usdcBalance = 0,
1719
onConnect,
1820
onDisconnect,
1921
}) => {
@@ -116,6 +118,7 @@ const Navbar: React.FC<NavbarProps> = ({
116118
<ThemeToggle />
117119
<WalletConnect
118120
walletAddress={walletAddress}
121+
usdcBalance={usdcBalance}
119122
onConnect={onConnect}
120123
onDisconnect={onDisconnect}
121124
/>

frontend/src/components/WalletConnect.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import { discoverConnectedAddress } from "../lib/stellarAccount";
99

1010
interface WalletConnectProps {
1111
walletAddress: string | null;
12+
usdcBalance?: number;
1213
onConnect: (address: string) => void;
1314
onDisconnect: () => void;
1415
}
1516

1617
type ConnectionErrorType = 'not-installed' | 'not-allowed' | 'no-address' | 'generic' | null;
1718

18-
const WalletConnect: React.FC<WalletConnectProps> = ({ walletAddress, onConnect, onDisconnect }) => {
19+
const WalletConnect: React.FC<WalletConnectProps> = ({ walletAddress, usdcBalance = 0, onConnect, onDisconnect }) => {
1920
const [isConnecting, setIsConnecting] = useState(false);
2021
const [connectionError, setConnectionError] = useState<ConnectionErrorType>(null);
2122
const [showTooltip, setShowTooltip] = useState(false);
@@ -200,6 +201,21 @@ const WalletConnect: React.FC<WalletConnectProps> = ({ walletAddress, onConnect,
200201
>
201202
{t('wallet.rpcPrefix')} {hasCustomRpcConfig ? t('wallet.rpcCustom') : t('wallet.rpcDefault')}
202203
</div>
204+
<div
205+
className="glass-panel"
206+
style={{
207+
padding: '8px 12px',
208+
borderRadius: '10px',
209+
border: '1px solid var(--border-glass)',
210+
fontSize: '0.75rem',
211+
color: 'var(--text-secondary)',
212+
minWidth: '130px',
213+
textAlign: 'right'
214+
}}
215+
aria-label="USDC wallet balance"
216+
>
217+
USDC: <span style={{ color: 'var(--text-primary)', fontWeight: 600 }}>{usdcBalance.toFixed(2)}</span>
218+
</div>
203219
<button
204220
className="btn btn-outline"
205221
style={{ padding: '8px', borderRadius: '50%' }}

0 commit comments

Comments
 (0)