33import React , { useState , useRef , useEffect } from "react" ;
44import { useRouter } from "next/navigation" ;
55import { motion , AnimatePresence } from "framer-motion" ;
6- import { Wallet , LogOut , Copy , Check , ChevronDown , ExternalLink , AlertCircle , Coins , AlertTriangle } from "lucide-react" ;
6+ import { Wallet , LogOut , Copy , Check , ChevronDown , ExternalLink , AlertCircle , Coins , AlertTriangle , Maximize2 , Minimize2 } from "lucide-react" ;
77import { useStellarAuth } from "@/context/StellarContext" ;
88import { ConfirmDialog } from "@/components/ui/confirm-dialog" ;
99import { BottomSheet } from "@/components/ui/bottom-sheet" ;
@@ -38,9 +38,17 @@ export default function ConnectWalletButton() {
3838 const dropdownRef = useRef < HTMLDivElement > ( null ) ;
3939 const router = useRouter ( ) ;
4040 const [ showConfirm , setShowConfirm ] = useState ( false ) ;
41+ const [ showFullAddress , setShowFullAddress ] = useState ( false ) ;
4142 const isMobile = useIsMobile ( ) ;
4243 const appNetwork = getCurrentNetwork ( ) ;
4344
45+ // Auto-collapse full address when dropdown closes
46+ useEffect ( ( ) => {
47+ if ( ! isOpen ) {
48+ setShowFullAddress ( false ) ;
49+ }
50+ } , [ isOpen ] ) ;
51+
4452 const hasNetworkMismatch = isWalletNetworkMismatch ( walletNetwork , appNetwork ) ;
4553 const mismatchMessage = hasNetworkMismatch
4654 ? `Wallet is on ${ toDisplayNetworkName ( walletNetwork ! ) } , app uses ${ toDisplayNetworkName ( appNetwork === "mainnet" ? "MAINNET" : "TESTNET" ) } .`
@@ -246,11 +254,20 @@ export default function ConnectWalletButton() {
246254 animate = { { opacity : 1 , y : 5 , scale : 1 } }
247255 exit = { { opacity : 0 , y : 10 , scale : 0.95 } }
248256 transition = { { duration : 0.2 , ease : "easeOut" } }
249- className = "absolute right-0 top-full z-50 w-48 mt-2 glass rounded-xl border border-white/10 shadow-2xl overflow-hidden"
257+ className = "absolute right-0 top-full z-50 w-64 mt-2 glass rounded-xl border border-white/10 shadow-2xl overflow-hidden"
250258 >
251259 { /* Balance display */ }
252260 < div className = "px-3 py-2 border-b border-white/5 mb-1" >
253- < p className = "text-[10px] text-dark-500 uppercase tracking-widest font-semibold mb-0.5" > Balance</ p >
261+ < div className = "flex items-center justify-between mb-0.5" >
262+ < p className = "text-[10px] text-dark-500 uppercase tracking-widest font-semibold" > Balance</ p >
263+ < button
264+ onClick = { ( ) => setShowFullAddress ( ! showFullAddress ) }
265+ className = "p-1 rounded-md bg-white/5 hover:bg-brand-500/20 text-brand-400 transition-all"
266+ title = { showFullAddress ? "Show Truncated" : "Show Full Address" }
267+ >
268+ { showFullAddress ? < Minimize2 size = { 12 } /> : < Maximize2 size = { 12 } /> }
269+ </ button >
270+ </ div >
254271 { isBalanceLoading ? (
255272 < div className = "h-4 w-20 bg-dark-800/60 rounded animate-pulse" />
256273 ) : (
@@ -261,6 +278,12 @@ export default function ConnectWalletButton() {
261278 ) }
262279 </ div >
263280
281+ < div className = "px-3 py-2 bg-dark-950/30 rounded-lg mx-1 mb-2 border border-white/5" >
282+ < p className = { `text-[11px] font-mono break-all leading-relaxed ${ showFullAddress ? "text-dark-100" : "text-dark-400" } ` } >
283+ { showFullAddress ? publicKey : truncatedKey }
284+ </ p >
285+ </ div >
286+
264287 < div className = "p-1" >
265288 < div className = "flex items-center justify-between px-3 py-2 hover:bg-white/5 rounded-lg transition-colors" >
266289 < div className = "flex items-center gap-3 text-sm text-dark-300" >
0 commit comments