Changeset View
Changeset View
Standalone View
Standalone View
cashtab/src/components/Header/index.tsx
| // Copyright (c) 2024 The Bitcoin developers | // Copyright (c) 2024 The Bitcoin developers | ||||
| // Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
| import React, { useContext } from 'react'; | import React, { useContext } from 'react'; | ||||
| import { WalletContext, isWalletContextLoaded } from 'wallet/context'; | import { WalletContext, isWalletContextLoaded } from 'wallet/context'; | ||||
| import WalletHeaderActions from 'components/Common/WalletHeaderActions'; | import WalletHeaderActions from 'components/Common/WalletHeaderActions'; | ||||
| import { supportedFiatCurrencies } from 'config/CashtabSettings'; | import { supportedFiatCurrencies } from 'config/CashtabSettings'; | ||||
| import { getUserLocale } from 'helpers'; | import { getUserLocale } from 'helpers'; | ||||
| import appConfig from 'config/app'; | import appConfig from 'config/app'; | ||||
| import PopOut from 'assets/popout.png'; | import PopOut from 'assets/popout.png'; | ||||
| import { toXec } from 'wallet'; | import { toXec } from 'wallet'; | ||||
| import { FIRMA } from 'constants/tokens'; | import { FIRMA } from 'constants/tokens'; | ||||
| import { FIRMA_BALANCE_LABEL } from 'constants/tokenDisplayOverrides'; | |||||
| import { ReactComponent as EcashIcon } from 'assets/ecash-icon.svg'; | import { ReactComponent as EcashIcon } from 'assets/ecash-icon.svg'; | ||||
| import { ReactComponent as StakeIcon } from 'assets/stake.svg'; | import { ReactComponent as StakeIcon } from 'assets/stake.svg'; | ||||
| import { ReactComponent as SavingsIcon } from 'assets/dollar-sign.svg'; | import { ReactComponent as SavingsIcon } from 'assets/dollar-sign.svg'; | ||||
| import { sortWalletsForDisplay } from 'wallet'; | import { sortWalletsForDisplay } from 'wallet'; | ||||
| import { | import { | ||||
| HeaderCtn, | HeaderCtn, | ||||
| WalletDropdown, | WalletDropdown, | ||||
| WalletSelectCtn, | WalletSelectCtn, | ||||
| ▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | const AssetBalanceCard = ({ | ||||
| </BalanceTitle> | </BalanceTitle> | ||||
| <BalanceRow | <BalanceRow | ||||
| title={`Balance ${tokenLabel}`} | title={`Balance ${tokenLabel}`} | ||||
| hideBalance={balanceVisible} | hideBalance={balanceVisible} | ||||
| tokenLabel={tokenLabel} | tokenLabel={tokenLabel} | ||||
| > | > | ||||
| {balanceAmount}{' '} | {balanceAmount}{' '} | ||||
| {tokenLabel === 'FIRMA' ? ( | {tokenLabel === FIRMA_BALANCE_LABEL ? ( | ||||
| <a href={`#/token/${FIRMA.tokenId}`}>{tokenLabel}</a> | <a href={`#/token/${FIRMA.tokenId}`}>{tokenLabel}</a> | ||||
| ) : tokenLabel === 'XECX' ? ( | ) : tokenLabel === 'XECX' ? ( | ||||
| <a href={`#/token/${appConfig.vipTokens.xecx.tokenId}`}> | <a href={`#/token/${appConfig.vipTokens.xecx.tokenId}`}> | ||||
| XECX | XECX | ||||
| </a> | </a> | ||||
| ) : ( | ) : ( | ||||
| <>{tokenLabel}</> | <>{tokenLabel}</> | ||||
| )} | )} | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | return ( | ||||
| balanceAmount={formattedBalanceXecx} | balanceAmount={formattedBalanceXecx} | ||||
| fiatAmount={formattedXECXBalanceFiat} | fiatAmount={formattedXECXBalanceFiat} | ||||
| balanceVisible={settings.balanceVisible === false} | balanceVisible={settings.balanceVisible === false} | ||||
| /> | /> | ||||
| <AssetBalanceCard | <AssetBalanceCard | ||||
| title="USD" | title="USD" | ||||
| logo={<SavingsIcon />} | logo={<SavingsIcon />} | ||||
| logoAlt="Savings" | logoAlt="Savings" | ||||
| tokenLabel="FIRMA" | tokenLabel={FIRMA_BALANCE_LABEL} | ||||
| balanceAmount={formattedBalanceFirma} | balanceAmount={formattedBalanceFirma} | ||||
| fiatAmount={formattedFIRMABalanceFiat} | fiatAmount={formattedFIRMABalanceFiat} | ||||
| balanceVisible={settings.balanceVisible === false} | balanceVisible={settings.balanceVisible === false} | ||||
| /> | /> | ||||
| </BalanceXec> | </BalanceXec> | ||||
| </CardWrapper> | </CardWrapper> | ||||
| </HeaderCtn> | </HeaderCtn> | ||||
| ); | ); | ||||
| }; | }; | ||||
| export default Header; | export default Header; | ||||