Skip to content

Commit

Permalink
Merge pull request #1951 from myxmaster/improve-wallet-header-layout
Browse files Browse the repository at this point in the history
Improve wallet header layout
  • Loading branch information
kaloudis authored Jan 15, 2024
2 parents e12b3ee + e197964 commit 181d088
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
41 changes: 32 additions & 9 deletions components/WalletHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import React, { useEffect, useState } from 'react';
import { Badge } from 'react-native-elements';
import {
Animated,
Dimensions,
Easing,
Image,
StyleSheet,
Text,
TouchableOpacity,
View
Expand Down Expand Up @@ -283,17 +285,20 @@ export default class WalletHeader extends React.Component<
infoValue = localeString('views.Wallet.MainPane.regnet');
}

const { fontScale } = Dimensions.get('window');

const NetworkBadge = () => {
return infoValue ? (
<Badge
onPress={() => navigation.navigate('NodeInfo')}
value={infoValue}
badgeStyle={{
...styles.badgeStyle,
backgroundColor: 'gray',
borderWidth: 0,
marginLeft: 8,
marginRight: 8
minHeight: 18 * fontScale,
borderRadius: 9 * fontScale
}}
textStyle={styles.badgeTextStyle}
/>
) : null;
};
Expand Down Expand Up @@ -326,11 +331,12 @@ export default class WalletHeader extends React.Component<
<Badge
value={localeString('general.readOnlyWallet')}
badgeStyle={{
...styles.badgeStyle,
backgroundColor: themeColor('error'),
borderWidth: 0,
marginLeft: 8,
marginRight: 8
minHeight: 18 * fontScale,
borderRadius: 9 * fontScale
}}
textStyle={styles.badgeTextStyle}
/>
) : null;
};
Expand Down Expand Up @@ -405,7 +411,12 @@ export default class WalletHeader extends React.Component<
<Header
leftComponent={
loading ? undefined : (
<Row>
<Row
style={{
flexGrow: 1,
alignItems: 'center'
}}
>
<SettingsButton />
{paid && paid.length > 0 && (
<TouchableOpacity
Expand Down Expand Up @@ -481,7 +492,7 @@ export default class WalletHeader extends React.Component<
</Row>
</View>
) : (
<Row>
<Row style={{ alignItems: 'center', flexGrow: 1 }}>
<NetworkBadge />
<ReadOnlyBadge />
<TorBadge />
Expand All @@ -502,7 +513,7 @@ export default class WalletHeader extends React.Component<
) : (
<View
style={{
flex: 1,
flexGrow: 1,
flexDirection: 'row',
alignItems: 'center'
}}
Expand Down Expand Up @@ -553,3 +564,15 @@ export default class WalletHeader extends React.Component<
);
}
}

const styles = StyleSheet.create({
badgeStyle: {
borderWidth: 0,
marginHorizontal: 8,
height: undefined
},
badgeTextStyle: {
fontWeight: 'normal',
textAlign: 'center'
}
});
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"general.error": "Error",
"general.danger": "Danger!",
"general.ok": "OK",
"general.readOnlyWallet": "Read-only wallet",
"general.show": "Show",
"general.close": "Close",
"general.hide": "Hide",
Expand Down

0 comments on commit 181d088

Please sign in to comment.