fix: remove components/LNNodeBar, fix lint errors

This commit is contained in:
Ivan Vershigora 2024-07-29 11:29:04 +03:00
parent 7b87199ca4
commit b8f5cad12b
No known key found for this signature in database
GPG key ID: DCCF7FB5ED2CEBD7
3 changed files with 2 additions and 103 deletions

View file

@ -1,94 +0,0 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import loc, { formatBalanceWithoutSuffix } from '../loc';
import { BitcoinUnit } from '../models/bitcoinUnits';
import { useTheme } from './themes';
interface LNNodeBarProps {
canReceive: number;
canSend: number;
nodeAlias?: string;
disabled?: boolean;
itemPriceUnit?: BitcoinUnit;
}
export const LNNodeBar: React.FC<LNNodeBarProps> = ({
canReceive = 0,
canSend = 0,
nodeAlias = '',
disabled = false,
itemPriceUnit = BitcoinUnit.SATS,
}) => {
const { colors } = useTheme();
const opacity = { opacity: disabled ? 0.5 : 1.0 };
const canSendBarFlex = {
flex: canReceive > 0 && canSend > 0 ? Math.abs(canSend / (canReceive + canSend)) * 1.0 : 1.0,
};
const stylesHook = StyleSheet.create({
nodeAlias: {
color: colors.alternativeTextColor2,
},
});
return (
<View style={[styles.root, opacity]}>
{nodeAlias.trim().length > 0 && <Text style={[styles.nodeAlias, stylesHook.nodeAlias]}>{nodeAlias}</Text>}
<View style={styles.canReceiveBar}>
<View style={styles.fullFlexDirectionRow}>
<View style={[styles.canSendBar, canSendBarFlex]} />
</View>
</View>
<View style={styles.containerBottomText}>
<View style={styles.containerBottomRightText}>
<Text style={styles.titleText}>{loc.lnd.can_send.toUpperCase()}</Text>
<Text style={styles.canSend}>{formatBalanceWithoutSuffix(canSend, itemPriceUnit, true).toString()}</Text>
</View>
<View style={styles.containerBottomLeftText}>
<Text style={styles.titleText}>{loc.lnd.can_receive.toUpperCase()}</Text>
<Text style={styles.canReceive}>{formatBalanceWithoutSuffix(canReceive, itemPriceUnit, true).toString()}</Text>
</View>
</View>
</View>
);
};
export default LNNodeBar;
const styles = StyleSheet.create({
root: {
flex: 1,
},
containerBottomText: {
flexDirection: 'row',
justifyContent: 'space-between',
marginTop: 16,
},
nodeAlias: {
marginVertical: 16,
},
canSendBar: {
height: 14,
maxHeight: 14,
backgroundColor: '#4E6CF5',
borderRadius: 6,
},
canReceiveBar: { backgroundColor: '#57B996', borderRadius: 6, height: 14, maxHeight: 14 },
fullFlexDirectionRow: {
flexDirection: 'row',
flex: 1,
},
containerBottomLeftText: {},
containerBottomRightText: {},
titleText: {
color: '#9AA0AA',
},
canReceive: {
color: '#57B996',
textAlign: 'right',
},
canSend: {
color: '#4E6CF5',
textAlign: 'left',
},
});

View file

@ -19,13 +19,7 @@ import {
import A from '../../blue_modules/analytics';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import { BlueButtonLink, BlueFormLabel, BlueSpacing20, BlueSpacing40, BlueText } from '../../BlueComponents';
import {
BlueApp,
HDSegwitBech32Wallet,
HDSegwitP2SHWallet,
LightningCustodianWallet,
SegwitP2SHWallet,
} from '../../class';
import { BlueApp, HDSegwitBech32Wallet, HDSegwitP2SHWallet, LightningCustodianWallet, SegwitP2SHWallet } from '../../class';
import presentAlert from '../../components/Alert';
import Button from '../../components/Button';
import ListItem from '../../components/ListItem';
@ -120,7 +114,7 @@ const WalletsAdd: React.FC = () => {
const entropyButtonText = state.entropyButtonText;
//
const colorScheme = useColorScheme();
const { addWallet, saveToDisk, wallets } = useStorage();
const { addWallet, saveToDisk } = useStorage();
const { isAdvancedModeEnabled } = useSettings();
const { navigate, goBack, setOptions } = useNavigation();
const stylesHook = {

View file

@ -28,7 +28,6 @@ import { LightningCustodianWallet, MultisigHDWallet, WatchOnlyWallet } from '../
import WalletGradient from '../../class/wallet-gradient';
import presentAlert, { AlertType } from '../../components/Alert';
import { FButton, FContainer } from '../../components/FloatButtons';
import LNNodeBar from '../../components/LNNodeBar';
import navigationStyle from '../../components/navigationStyle';
import { useTheme } from '../../components/themes';
import { TransactionListItem } from '../../components/TransactionListItem';