@@ -21,11 +21,21 @@ const COINS: Coin[] = [
2121 { id : 'polkadot' , symbol : 'DOT' , label : 'Polkadot' } ,
2222 { id : 'avalanche-2' , symbol : 'AVAX' , label : 'Avalanche' } ,
2323] ;
24+ const ICONS : Record < string , string > = {
25+ BTC : 'https://assets.coingecko.com/coins/images/1/small/bitcoin.png' ,
26+ ETH : 'https://assets.coingecko.com/coins/images/279/small/ethereum.png' ,
27+ BNB : 'https://assets.coingecko.com/coins/images/825/small/binance-coin-logo.png' ,
28+ SOL : 'https://assets.coingecko.com/coins/images/4128/small/solana.png' ,
29+ XAUt : 'https://assets.coingecko.com/coins/images/10488/small/Tether_Gold.png' ,
30+ LINK : 'https://assets.coingecko.com/coins/images/877/small/chainlink-new-logo.png' ,
31+ DOT : 'https://assets.coingecko.com/coins/images/12171/small/polkadot.png' ,
32+ AVAX : 'https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png'
33+ } ;
2434
2535const API = ( ids : string [ ] ) =>
2636 `https://api.coingecko.com/api/v3/simple/price?ids=${ ids . join ( ',' ) } &vs_currencies=usd&precision=2` ;
2737
28- const DURATION_SEC = 180 ; // Adjust speed here (bigger = slower)
38+ const DURATION_SEC = 60 ; // Adjust speed here (bigger = slower)
2939
3040const PriceTicker : React . FC = ( ) => {
3141 const [ prices , setPrices ] = useState < Record < string , number > > ( { } ) ;
@@ -103,6 +113,17 @@ const PriceTicker: React.FC = () => {
103113 >
104114 { items . map ( ( it , idx ) => (
105115 < div key = { `${ i } -${ idx } ` } className = "flex items-center gap-2" >
116+ < img
117+ src = { ICONS [ it . symbol ] }
118+ alt = { `${ it . symbol } logo` }
119+ loading = "lazy"
120+ width = { 16 }
121+ height = { 16 }
122+ className = "inline-block"
123+ onError = { ( e ) => {
124+ ( e . currentTarget as HTMLImageElement ) . style . display = 'none' ;
125+ } }
126+ />
106127 < span className = "font-bold" > { it . symbol } :</ span >
107128 < span className = "text-alien-green" > ${ it . price . toLocaleString ( undefined , { minimumFractionDigits : 2 , maximumFractionDigits : 2 } ) } </ span >
108129 </ div >
0 commit comments