@@ -13,16 +13,19 @@ import {
13
13
} from '@trezor/components' ;
14
14
import { isTestnet } from '@suite-common/wallet-utils' ;
15
15
16
- import { useLoadingSkeleton , useSelector } from '../../../../../hooks/suite' ;
17
- import { selectLocalCurrency } from '../../../../../reducers/wallet/settingsReducer' ;
16
+ import { useLoadingSkeleton , useSelector } from 'src/hooks/suite' ;
17
+ import {
18
+ selectIsDiscreteModeActive ,
19
+ selectLocalCurrency ,
20
+ } from 'src/reducers/wallet/settingsReducer' ;
18
21
import {
19
22
AccountLabel ,
20
23
CoinBalance ,
21
24
FiatValue ,
22
25
HiddenPlaceholder ,
23
26
Translation ,
24
- } from '../../../.. /suite' ;
25
- import { AccountItemType } from '../../../../.. /types/wallet' ;
27
+ } from 'src/components /suite' ;
28
+ import { AccountItemType } from 'src /types/wallet' ;
26
29
27
30
const AccountLabelContainer = styled . div `
28
31
flex: 1;
@@ -32,6 +35,7 @@ const AccountLabelContainer = styled.div`
32
35
text-overflow: ellipsis;
33
36
white-space: nowrap;
34
37
` ;
38
+
35
39
type ItemContentProps = {
36
40
customFiatValue ?: string ;
37
41
account : Account ;
@@ -43,6 +47,14 @@ type ItemContentProps = {
43
47
formattedBalance : string ;
44
48
dataTestKey ?: string ;
45
49
} ;
50
+
51
+ const FiatValueRenderComponent = ( { value } : { value : JSX . Element | null } ) => {
52
+ const discreetMode = useSelector ( selectIsDiscreteModeActive ) ;
53
+ if ( discreetMode || value === null ) return value ;
54
+
55
+ return < TruncateWithTooltip delayShow = { TOOLTIP_DELAY_LONG } > { value } </ TruncateWithTooltip > ;
56
+ } ;
57
+
46
58
export const AccountItemContent = ( {
47
59
customFiatValue,
48
60
account,
@@ -56,12 +68,14 @@ export const AccountItemContent = ({
56
68
} : ItemContentProps ) => {
57
69
const { FiatAmountFormatter } = useFormatters ( ) ;
58
70
const localCurrency = useSelector ( selectLocalCurrency ) ;
71
+ const discreetMode = useSelector ( selectIsDiscreteModeActive ) ;
59
72
const { shouldAnimate } = useLoadingSkeleton ( ) ;
60
73
61
74
const isBalanceShown = account . backendType !== 'coinjoin' || account . status !== 'initial' ;
62
75
63
76
return (
64
- < Column flex = "1" overflow = "hidden" gap = { spacings . xxxs } >
77
+ // content is constant size in discreet mode, so overflow: hidden is unnecessary. Though it would cut off CSS blur effect, so we may turn it off
78
+ < Column flex = "1" overflow = { discreetMode ? 'visible' : 'hidden' } gap = { spacings . xxxs } >
65
79
< Row gap = { spacings . md } margin = { { right : spacings . xxs } } justifyContent = "space-between" >
66
80
< AccountLabelContainer data-testid = { `${ dataTestKey } /label` } >
67
81
{ type === 'coin' && (
@@ -93,13 +107,7 @@ export const AccountItemContent = ({
93
107
maximumFractionDigits : 0 ,
94
108
} }
95
109
>
96
- { ( { value } ) =>
97
- value ? (
98
- < TruncateWithTooltip delayShow = { TOOLTIP_DELAY_LONG } >
99
- { value }
100
- </ TruncateWithTooltip >
101
- ) : null
102
- }
110
+ { FiatValueRenderComponent }
103
111
</ FiatValue >
104
112
) }
105
113
</ Row >
0 commit comments