@@ -4,15 +4,15 @@ import Big from 'big.js';
44import { BodyText } from '../body-text/body-text' ;
55import { FlexColumn } from '../flex-column/flex-column' ;
66import { FlexRow } from '../flex-row/flex-row' ;
7- import { DEFAULT_PRECISION , formatHash } from '../../utils/formatters' ;
7+ import { DEFAULT_PRECISION , formatHash } from '../../utils/formatters' ;
88import { Tooltip } from '../tooltip/tooltip' ;
99import { useMatchMedia } from '../../utils/match-media' ;
1010import { CopyHash } from '../copy-hash/copy-hash' ;
1111import { Cspr } from '../cspr/cspr' ;
1212
1313import { PrecisionCase } from '../../utils/currency' ;
1414import { HashLength } from '../../utils/formatters' ;
15- import CEP18Token from " ../cep18-token/cep18-token" ;
15+ import CEP18Token from ' ../cep18-token/cep18-token' ;
1616
1717export const ValuesRow = styled ( FlexRow ) ( ( { theme } ) => ( {
1818 height : 36 ,
@@ -27,7 +27,7 @@ const StyledFlexColumn = styled(FlexColumn)<{ disabled?: boolean }>(
2727 ...( disabled && {
2828 opacity : 0.5 ,
2929 } ) ,
30- } )
30+ } ) ,
3131) ;
3232
3333const BalanceText = styled ( BodyText ) ( ( { } ) => ( {
@@ -51,14 +51,18 @@ interface TickerProps {
5151 cep18Config ?: CEP18Config ;
5252}
5353
54- const Ticker = ( { ticker, cep18Config, ...props } : TickerProps ) => {
55- return ticker === 'CSPR' ?
56- < Cspr { ...props } /> :
57- < CEP18Token ticker = { ticker }
58- motes = { props . motes }
59- decimals = { cep18Config ?. decimals || DEFAULT_PRECISION }
60- precision = { cep18Config ?. precision || DEFAULT_PRECISION } /> ;
61- }
54+ const Ticker = ( { ticker, cep18Config, ...props } : TickerProps ) => {
55+ return ticker === 'CSPR' ? (
56+ < Cspr { ...props } />
57+ ) : (
58+ < CEP18Token
59+ ticker = { ticker }
60+ motes = { props . motes }
61+ decimals = { cep18Config ?. decimals || DEFAULT_PRECISION }
62+ precision = { cep18Config ?. precision || DEFAULT_PRECISION }
63+ />
64+ ) ;
65+ } ;
6266
6367interface AccountInfoBalanceProps {
6468 accountBalance : string | null ;
@@ -69,26 +73,38 @@ interface AccountInfoBalanceProps {
6973 cep18Config ?: CEP18Config ;
7074}
7175
72- const AccountInfoBalance = ( { accountBalance, emptyBalance, loading, error, cep18Config, ticker = 'CSPR' } : AccountInfoBalanceProps ) => {
76+ const AccountInfoBalance = ( {
77+ accountBalance,
78+ emptyBalance,
79+ loading,
80+ error,
81+ cep18Config,
82+ ticker = 'CSPR' ,
83+ } : AccountInfoBalanceProps ) => {
7384 return (
74- < BalanceText size = { 3 } monotype >
75- { emptyBalance ? (
76- < Ticker ticker = { ticker } motes = { '0' } precisionCase = { PrecisionCase . deployCost } cep18Config = { cep18Config } />
77- ) : loading ? (
78- 'Loading...'
79- ) : error != null ? (
80- error
81- ) : (
82- < Ticker
83- ticker = { ticker }
84- motes = { accountBalance }
85- precisionCase = { PrecisionCase . deployCost }
86- cep18Config = { cep18Config }
87- />
88- ) }
89- </ BalanceText >
90- )
91- }
85+ < BalanceText size = { 3 } variation = { 'black' } monotype >
86+ { emptyBalance ? (
87+ < Ticker
88+ ticker = { ticker }
89+ motes = { '0' }
90+ precisionCase = { PrecisionCase . deployCost }
91+ cep18Config = { cep18Config }
92+ />
93+ ) : loading ? (
94+ 'Loading...'
95+ ) : error != null ? (
96+ error
97+ ) : (
98+ < Ticker
99+ ticker = { ticker }
100+ motes = { accountBalance }
101+ precisionCase = { PrecisionCase . deployCost }
102+ cep18Config = { cep18Config }
103+ />
104+ ) }
105+ </ BalanceText >
106+ ) ;
107+ } ;
92108
93109export interface AccountInfoRowProps {
94110 publicKey : string ;
@@ -99,7 +115,7 @@ export interface AccountInfoRowProps {
99115 error : string | null ;
100116 accountEmpty : boolean ;
101117 disabled ?: boolean ;
102- ticker ?:string ;
118+ ticker ?: string ;
103119 cep18Config ?: CEP18Config ;
104120}
105121
@@ -116,9 +132,9 @@ export function AccountInfoRow(props: AccountInfoRowProps) {
116132 cep18Config,
117133 } = props ;
118134
119- const responsiveHashSize = useMatchMedia (
135+ const responsiveHashSize = useMatchMedia < HashLength > (
120136 [ HashLength . TINY , HashLength . SMALL , HashLength . SMALL , HashLength . SMALL ] ,
121- [ ]
137+ [ ] ,
122138 ) ;
123139
124140 const emptyBalance =
@@ -128,23 +144,34 @@ export function AccountInfoRow(props: AccountInfoRowProps) {
128144 return (
129145 < StyledFlexColumn disabled = { props . disabled } gap = { 4 } >
130146 < FlexRow justify = "space-between" >
131- < BodyText size = { 1 } > { label } </ BodyText >
132- < BodyText size = { 1 } > { rightLabel } </ BodyText >
147+ < BodyText size = { 1 } variation = { 'black' } >
148+ { label }
149+ </ BodyText >
150+ < BodyText size = { 1 } variation = { 'black' } >
151+ { rightLabel }
152+ </ BodyText >
133153 </ FlexRow >
134154 < ValuesRow justify = "space-between" align = "center" >
135155 { publicKey && (
136156 < >
137157 < FlexRow align = "center" >
138158 < Tooltip title = { publicKey } >
139- < BodyText size = { 3 } monotype >
159+ < BodyText size = { 3 } variation = { 'black' } monotype >
140160 { formatHash ( publicKey , responsiveHashSize ) }
141161 </ BodyText >
142162 </ Tooltip >
143163 < StyledIconContainer >
144164 < CopyHash value = { publicKey } minified variation = "gray" />
145165 </ StyledIconContainer >
146166 </ FlexRow >
147- < AccountInfoBalance accountBalance = { accountBalance } emptyBalance = { emptyBalance } error = { error } loading = { loading } ticker = { ticker } cep18Config = { cep18Config } />
167+ < AccountInfoBalance
168+ accountBalance = { accountBalance }
169+ emptyBalance = { emptyBalance }
170+ error = { error }
171+ loading = { loading }
172+ ticker = { ticker }
173+ cep18Config = { cep18Config }
174+ />
148175 </ >
149176 ) }
150177 </ ValuesRow >
0 commit comments