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

fix(coinmarket): show DCA page only for Bitcoin accounts #14290 #14291

Merged
merged 1 commit into from
Sep 12, 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
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const CoinmarketLayout = ({
)}
</WalletSubpageHeading>

<CoinmarketLayoutNavigation />
<CoinmarketLayoutNavigation selectedAccount={selectedAccount} />

<Layout>
<CardWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const CoinmarketLayout = ({ children, selectedAccount }: CoinmarketLayoutProps)
<WalletLayout title="TR_NAV_TRADE" isSubpage account={selectedAccount}>
<CoinmarketWrapper>
<WalletSubpageHeading title="TR_NAV_TRADE" />
<CoinmarketLayoutNavigation />
<CoinmarketLayoutNavigation selectedAccount={selectedAccount} />
<CoinmarketFormWrapper>{children}</CoinmarketFormWrapper>
<CoinmarketFooter />
</CoinmarketWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Divider } from '@trezor/components';
import { spacings } from '@trezor/theme';
import regional from 'src/constants/wallet/coinmarket/regional';
import { getIsTorEnabled } from 'src/utils/suite/tor';
import { SelectedAccountLoaded } from '@suite-common/wallet-types';

const List = styled.div`
display: flex;
Expand All @@ -17,18 +18,23 @@ const SeparatorWrapper = styled.div`
height: 42px;
`;

const CoinmarketLayoutNavigation = () => {
interface CoinmarketLayoutNavigationProps {
selectedAccount: SelectedAccountLoaded;
}

const CoinmarketLayoutNavigation = ({ selectedAccount }: CoinmarketLayoutNavigationProps) => {
const { device } = useDevice();
const isBitcoinOnly = device?.firmwareType === FirmwareType.BitcoinOnly;

const isBtcAccount = selectedAccount.account.symbol === 'btc';
const torStatus = useSelector(state => state.suite.torStatus);
const isTorEnabled = getIsTorEnabled(torStatus);
const country = useSelector(
state =>
state.wallet.coinmarket.buy.buyInfo?.buyInfo?.country ??
state.wallet.coinmarket.sell.sellInfo?.sellList?.country,
);
const isInEEA = Boolean(!isTorEnabled && country && regional.isInEEA(country));
const showDCA = Boolean(isBtcAccount && !isTorEnabled && country && regional.isInEEA(country));

return (
<List>
Expand All @@ -51,7 +57,7 @@ const CoinmarketLayoutNavigation = () => {
/>
) : null}

{isInEEA ? (
{showDCA ? (
<>
<SeparatorWrapper>
<Divider
Expand Down
Loading