@@ -89,7 +89,7 @@ function App() {
8989
9090 const wsStatus = useWebSocket ( account ?. publicKey ?? null , handleWsMessage ) ;
9191 const { status : networkStatus } = useNetworkStatus ( ) ;
92- const xlmUsdRate = useExchangeRate ( lastWsMessage ) ;
92+ const { rate : xlmUsdRate , loading : rateLoading } = useExchangeRate ( lastWsMessage ) ;
9393
9494 useEffect ( ( ) => {
9595 const onKeyDown = ( e ) => {
@@ -542,11 +542,12 @@ function App() {
542542 ) }
543543 </ AnimatePresence >
544544 < FeeDisplay amount = { amount } visible = { amountValid } />
545- { amountValid && xlmUsdRate && (
546- < p className = "rate-estimate" aria-live = "polite" >
547- ≈ ${ ( parseFloat ( amount ) * xlmUsdRate ) . toFixed ( 2 ) } USD
548- < span className = "rate-source" > · live rate</ span >
549- </ p >
545+ { amountValid && ( xlmUsdRate
546+ ? < p className = "rate-estimate" aria-live = "polite" >
547+ ≈ ${ ( parseFloat ( amount ) * xlmUsdRate ) . toFixed ( 2 ) } USD
548+ < span className = "rate-source" > · live rate</ span >
549+ </ p >
550+ : rateLoading && < p className = "rate-estimate rate-estimate--loading" aria-live = "polite" > Loading rate…</ p >
550551 ) }
551552 < div style = { { display : 'flex' , gap : 8 , alignItems : 'center' , flexWrap : 'wrap' } } >
552553 < motion . button onClick = { sendPayment } { ...tap } disabled = { ! recipientValid || ! amountValid || loading === 'send' } >
@@ -758,11 +759,12 @@ function App() {
758759 </ div >
759760
760761 < FeeDisplay amount = { amount } visible = { amountValid } />
761- { amountValid && xlmUsdRate && (
762- < p className = "rate-estimate" aria-live = "polite" >
763- ≈ ${ ( parseFloat ( amount ) * xlmUsdRate ) . toFixed ( 2 ) } USD
764- < span className = "rate-source" > · live rate</ span >
765- </ p >
762+ { amountValid && ( xlmUsdRate
763+ ? < p className = "rate-estimate" aria-live = "polite" >
764+ ≈ ${ ( parseFloat ( amount ) * xlmUsdRate ) . toFixed ( 2 ) } USD
765+ < span className = "rate-source" > · live rate</ span >
766+ </ p >
767+ : rateLoading && < p className = "rate-estimate rate-estimate--loading" aria-live = "polite" > Loading rate…</ p >
766768 ) }
767769 < div style = { { display : 'flex' , gap : 8 , alignItems : 'center' , flexWrap : 'wrap' } } >
768770 < motion . button
0 commit comments