From b63e8a7305dc3c6beca84ea2f00623d059073652 Mon Sep 17 00:00:00 2001 From: First-Terraner <40151034+KKA11010@users.noreply.github.com> Date: Sat, 16 Sep 2023 17:13:05 +0200 Subject: [PATCH] Fixes #161 (#223) --- src/components/Balance.tsx | 47 ++++++++++++++++++-------------------- src/styles/colors.ts | 7 +++++- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/components/Balance.tsx b/src/components/Balance.tsx index 81c1cd58..b5f5c5e6 100644 --- a/src/components/Balance.tsx +++ b/src/components/Balance.tsx @@ -9,7 +9,8 @@ import { usePrivacyContext } from '@src/context/Privacy' import { useThemeContext } from '@src/context/Theme' import { NS } from '@src/i18n' import { getLatestHistory } from '@store/latestHistoryEntries' -import { globals, highlight as hi, mainColors } from '@styles' +import { globals, highlight as hi } from '@styles' +import { getColor } from '@styles/colors' import { formatBalance, formatInt, isBool } from '@util' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' @@ -20,8 +21,6 @@ import Logo from './Logo' import Separator from './Separator' import Txt from './Txt' -const currencyColor = '#F0F0F0' - interface IBalanceProps { balance: number nav?: NativeStackNavigationProp @@ -76,7 +75,7 @@ export default function Balance({ balance, nav }: IBalanceProps) { styles.board, { borderColor: color.BORDER, backgroundColor: hi[highlight] } ]}> - + {/* balance */} {!hidden.balance && - + {formatSats ? formatBalance(balance) : formatInt(balance)} - + {formatSats ? 'BTC' : 'Satoshi'} - + } - + {/* No transactions yet */} {!history.length && !hidden.txs && - + } {/* latest 3 history entries */} @@ -108,9 +107,9 @@ export default function Balance({ balance, nav }: IBalanceProps) { + : - + } isSwap={h.type === 3} txType={getTxTypeStr(h.type)} @@ -128,11 +127,11 @@ export default function Balance({ balance, nav }: IBalanceProps) { > - + - + - + : @@ -142,7 +141,7 @@ export default function Balance({ balance, nav }: IBalanceProps) { nav?.navigate('history')} - txtColor={mainColors.WHITE} + txtColor={getColor(highlight, color)} style={[{ paddingTop: 20, paddingBottom: 0 }]} /> } @@ -161,6 +160,7 @@ interface IHistoryEntryProps { function HistoryEntry({ icon, txType, isSwap, timestamp, amount, onPress }: IHistoryEntryProps) { const { t } = useTranslation([NS.history]) + const { color, highlight } = useThemeContext() const getAmount = () => { if (isSwap) { return `${formatInt(Math.abs(amount))} Satoshi` } @@ -178,13 +178,13 @@ function HistoryEntry({ icon, txType, isSwap, timestamp, amount, onPress }: IHis {icon} - - + + - + ) @@ -195,7 +195,8 @@ const styles = StyleSheet.create({ borderBottomLeftRadius: 50, borderBottomRightRadius: 50, paddingHorizontal: 30, - paddingVertical: 70, + paddingTop: 70, + paddingBottom: 60, }, balanceWrap: { alignItems: 'center', @@ -205,7 +206,6 @@ const styles = StyleSheet.create({ alignItems: 'center', fontSize: 46, fontWeight: '500', - color: mainColors.WHITE, }, balAssetNameWrap: { flexDirection: 'row', @@ -214,13 +214,10 @@ const styles = StyleSheet.create({ }, balAssetName: { fontSize: 14, - marginRight: 5, - color: currencyColor + marginRight: 5 }, separator: { - marginTop: 20, - marginBottom: 10, - borderColor: '#E0E0E0' + marginVertical: 10 }, iconWrap: { minWidth: 45, diff --git a/src/styles/colors.ts b/src/styles/colors.ts index 1436d1ae..e511fcc9 100644 --- a/src/styles/colors.ts +++ b/src/styles/colors.ts @@ -111,4 +111,9 @@ export enum mainColors { ZAP = H_Colors.Zap } -export const themeColors = Object.keys(highlight) as HighlightKey[] \ No newline at end of file +export const themeColors = Object.keys(highlight) as HighlightKey[] + +export const getColor = (highlight: HighlightKey, color: Theme) => { + if (highlight === 'Azyre' || highlight === 'Zap') { return color.BACKGROUND } + return mainColors.WHITE +} \ No newline at end of file