Skip to content

Commit

Permalink
feat: Add hide balance option (#2056)
Browse files Browse the repository at this point in the history
  • Loading branch information
devkudasov committed Aug 26, 2024
1 parent 2404fe5 commit a44b4e3
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/components/modals/wallets-bottom-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function WalletsBottomSheet({
errorEventName,
successEventName,
onClose,
hideBalance,
}: Modals[ModalType.walletsBottomSheet]) {
const closeDistanceCalculated = useCalculatedDimensionsValue(
() => closeDistance?.(),
Expand Down Expand Up @@ -64,6 +65,7 @@ export function WalletsBottomSheet({
onPress={onPressWallet}
type={WalletRowTypes.variant5}
hideArrow
hideBalance={hideBalance}
checked={checked}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/wallet-row-variant-3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {StyleSheet, View} from 'react-native';
import {TouchableOpacity} from 'react-native-gesture-handler';

import {Color} from '@app/colors';
import {CardSmall, Text} from '@app/components/ui';
import {CardSmall, Text, TextVariant} from '@app/components/ui';
import {createTheme} from '@app/helpers';

import {WalletRowProps} from './wallet-row';
Expand Down Expand Up @@ -44,7 +44,7 @@ export const WalletRowVariant3 = ({
colorPattern={item.colorPattern}
/>
<View style={styles.textContainer}>
<Text t18 color={Color.textBase3}>
<Text variant={TextVariant.t18} color={Color.textBase3}>
{addressString}
</Text>
</View>
Expand Down
9 changes: 6 additions & 3 deletions src/components/wallet-row-variant-4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {StyleSheet, View} from 'react-native';
import {TouchableOpacity} from 'react-native-gesture-handler';

import {Color} from '@app/colors';
import {CardSmall, Text} from '@app/components/ui';
import {CardSmall, Text, TextVariant} from '@app/components/ui';
import {createTheme} from '@app/helpers';
import {splitAddress} from '@app/utils';

Expand Down Expand Up @@ -50,10 +50,13 @@ export const WalletRowVariant4 = ({
colorPattern={item.colorPattern}
/>
<View style={styles.textContainer}>
<Text t14 color={Color.textBase3} numberOfLines={1}>
<Text
variant={TextVariant.t14}
color={Color.textBase3}
numberOfLines={1}>
{item.name}
</Text>
<Text t18 color={Color.textBase3}>
<Text variant={TextVariant.t18} color={Color.textBase3}>
{addressString}
</Text>
</View>
Expand Down
13 changes: 8 additions & 5 deletions src/components/wallet-row-variant-5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const WalletRowVariant5 = ({
hideArrow = false,
checked = false,
style,
hideBalance,
}: Omit<WalletRowProps, 'type'>) => {
const containerStyle = useMemo(
() => StyleSheet.flatten([item.isHidden && {opacity: 0.5}, style]),
Expand Down Expand Up @@ -62,11 +63,13 @@ export const WalletRowVariant5 = ({
{addressString}
</Text>
</CardSmall>
<DataContent
style={styles.info}
title={item.name}
subtitle={balance.toBalanceString()}
/>
{!hideBalance && (
<DataContent
style={styles.info}
title={item.name}
subtitle={balance.toBalanceString()}
/>
)}
</MenuNavigationButton>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/components/wallet-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type WalletRowProps = {
checked?: boolean;
disabled?: boolean;
type?: WalletRowTypes;
hideBalance?: boolean;
};

export const WalletRow = ({
Expand Down
1 change: 1 addition & 0 deletions src/helpers/await-for-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface AwaitForWalletParams {
autoSelectWallet?: boolean;
suggestedAddress?: string;
eventSuffix?: string | number;
hideBalance?: boolean;
}

export class AwaitForWalletError {
Expand Down
1 change: 1 addition & 0 deletions src/screens/HomeStack/BrowserStack/web3-browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const Web3BrowserScreen = memo(() => {
title: I18N.selectAccount,
autoSelectWallet: false,
initialAddress: accountId,
hideBalance: true,
});
helper.current?.changeAccount?.(selectedAccount);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const requestAccount = async ({helper}: JsonRpcMethodHandlerParams) => {
title: I18N.selectAccount,
autoSelectWallet: false,
initialAddress,
hideBalance: true,
});
return selectedAccount;
};
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,7 @@ export type Modals = {
title: I18N;
autoSelectWallet?: boolean;
initialAddress?: string;
hideBalance?: boolean;
};
transactionError: {
onClose?: () => void;
Expand Down

0 comments on commit a44b4e3

Please sign in to comment.