Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve wallet header layout #1951

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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