@@ -20,7 +20,7 @@ import {
2020import { Input } from '@/components/ui/input' ;
2121import { useErrors } from '@/hooks/useErrors' ;
2222import { amount } from '@/lib/formTypes' ;
23- import { toMojos } from '@/lib/utils' ;
23+ import { fromMojos , toMojos } from '@/lib/utils' ;
2424import { useWalletState } from '@/state' ;
2525import { zodResolver } from '@hookform/resolvers/zod' ;
2626import { t } from '@lingui/core/macro' ;
@@ -397,6 +397,17 @@ export function OwnedCoinsCard({
397397 const selectedCoinCount = selectedCoinIds . length ;
398398 const selectedCoinLabel = selectedCoinCount === 1 ? t `coin` : t `coins` ;
399399
400+ // Calculate total value of selected coins
401+ const selectedCoinsTotal = useMemo ( ( ) => {
402+ if ( selectedCoinRecords . length === 0 ) return '0' ;
403+
404+ const totalMojos = selectedCoinRecords . reduce ( ( sum , coin ) => {
405+ return sum . plus ( coin . amount ) ;
406+ } , new BigNumber ( 0 ) ) ;
407+
408+ return fromMojos ( totalMojos , asset . precision ) . toString ( ) ;
409+ } , [ selectedCoinRecords , asset . precision ] ) ;
410+
400411 return (
401412 < Card className = 'max-w-full overflow-auto' >
402413 < CardHeader >
@@ -428,7 +439,7 @@ export function OwnedCoinsCard({
428439 disabled = { ! canSplit }
429440 onClick = { ( ) => setSplitOpen ( true ) }
430441 >
431- < SplitIcon className = 'mr-2 h-4 w-4' /> < Trans > Split</ Trans >
442+ < SplitIcon className = 'mr-2 h-4 w-4' aria-hidden = 'true' /> < Trans > Split</ Trans >
432443 </ Button >
433444 < Button
434445 variant = 'outline'
@@ -441,7 +452,7 @@ export function OwnedCoinsCard({
441452 }
442453 } }
443454 >
444- < MergeIcon className = 'mr-2 h-4 w-4' />
455+ < MergeIcon className = 'mr-2 h-4 w-4' aria-hidden = 'true' />
445456 { ! canCombine && canAutoCombine ? (
446457 < Trans > Sweep</ Trans >
447458 ) : (
@@ -454,13 +465,13 @@ export function OwnedCoinsCard({
454465 { selectedCoinCount > 0 && (
455466 < div className = 'flex items-center gap-2 mt-2' >
456467 < Button variant = 'outline' onClick = { ( ) => setSelectedCoins ( { } ) } >
457- < XIcon className = 'h-4 w-4 mr-2' />
468+ < XIcon className = 'h-4 w-4 mr-2' aria-hidden = 'true' />
458469 < Trans > Clear Selection</ Trans >
459470 </ Button >
460471
461472 < span className = 'text-muted-foreground text-sm flex items-center' >
462473 < Trans >
463- { selectedCoinCount } { selectedCoinLabel } selected
474+ { selectedCoinCount } { selectedCoinLabel } selected ( { selectedCoinsTotal } { asset . ticker } )
464475 </ Trans >
465476 </ span >
466477 </ div >
0 commit comments