Skip to content

Commit

Permalink
Merge pull request #1356 from kaloudis/tor-icon-location
Browse files Browse the repository at this point in the history
Tor icon: move out of BalancePane and into WalletHeader
  • Loading branch information
kaloudis authored Mar 15, 2023
2 parents 55ea7de + 8944ca5 commit f4fadb0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
29 changes: 28 additions & 1 deletion components/WalletHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { Row } from '../components/layout/Row';

const Contact = require('../assets/images/Mascot.png');

const TorIcon = require('../assets/images/tor.png');

const protectedNavigation = async (
navigation: any,
route: string,
Expand Down Expand Up @@ -194,6 +196,7 @@ export default class WalletHeader extends React.Component<
);

const displayName = selectedNode && selectedNode.nickname;
const nodeAddress = SettingsStore.host || SettingsStore.url;

let infoValue: string;
if (NodeInfoStore.nodeInfo.isTestNet) {
Expand All @@ -217,6 +220,26 @@ export default class WalletHeader extends React.Component<
) : null;
};

const TorBadge = () => (
<>
{nodeAddress && nodeAddress.includes('.onion') ? (
<TouchableOpacity
onPress={() => navigation.navigate('NodeInfo')}
>
<Image
style={{
marginLeft: 5,
marginRight: 5,
width: 25,
height: 25
}}
source={TorIcon}
/>
</TouchableOpacity>
) : null}
</>
);

return (
<Header
leftComponent={loading ? undefined : <SettingsButton />}
Expand All @@ -241,10 +264,14 @@ export default class WalletHeader extends React.Component<
<Row>
<Body>{displayName}</Body>
<NetworkBadge />
<TorBadge />
</Row>
</View>
) : (
<NetworkBadge />
<Row>
<NetworkBadge />
<TorBadge />
</Row>
)
}
rightComponent={
Expand Down
28 changes: 1 addition & 27 deletions views/Wallet/BalancePane.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Image, Text, View, StyleSheet, TouchableOpacity } from 'react-native';
import { Text, View, StyleSheet } from 'react-native';
import { inject, observer } from 'mobx-react';
import Button from '../../components/Button';
import WalletHeader from '../../components/WalletHeader';
Expand All @@ -14,8 +14,6 @@ import SettingsStore from './../../stores/SettingsStore';

import { version, playStore } from './../../package.json';

const TorIcon = require('./../../assets/images/tor.png');

interface BalancePaneProps {
navigation: any;
BalanceStore: BalanceStore;
Expand All @@ -39,7 +37,6 @@ export default class BalancePane extends React.PureComponent<
pendingOpenBalance
} = BalanceStore;
const { implementation } = SettingsStore;
const nodeAddress = SettingsStore.host || SettingsStore.url;

const pendingUnconfirmedBalance =
Number(pendingOpenBalance) + Number(unconfirmedBlockchainBalance);
Expand Down Expand Up @@ -113,21 +110,6 @@ export default class BalancePane extends React.PureComponent<
</View>
);

const NetworkBadge = () => (
<>
{nodeAddress && nodeAddress.includes('.onion') ? (
<TouchableOpacity
onPress={() => navigation.navigate('NodeInfo')}
>
<Image
style={{ width: 25, height: 25 }}
source={TorIcon}
/>
</TouchableOpacity>
) : null}
</>
);

let balancePane;
const error = NodeInfoStore.error || SettingsStore.error;

Expand All @@ -150,14 +132,6 @@ export default class BalancePane extends React.PureComponent<
) : (
<BalanceViewCombined />
)}
<View
style={{
marginTop: 5,
alignItems: 'center'
}}
>
<NetworkBadge />
</View>
</View>
</View>
);
Expand Down

0 comments on commit f4fadb0

Please sign in to comment.