Skip to content

Commit

Permalink
chore(suite): temporary hide ethereum staking under debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasklim authored and shotgunofdeath committed Feb 27, 2024
1 parent 60fd2a7 commit dd3988e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { goto } from 'src/actions/suite/routerActions';
import { useDispatch, useSelector, useEverstakePoolStats } from 'src/hooks/suite';
import { selectSelectedAccountHasSufficientEthForStaking } from 'src/reducers/wallet/selectedAccountReducer';
import { setFlag } from 'src/actions/suite/suiteActions';
import { selectIsDebugModeActive } from 'src/reducers/suite/suiteReducer';

const StyledCard = styled(Card)`
padding: ${spacingsPx.lg} ${spacingsPx.xxl} ${spacingsPx.lg} ${spacingsPx.md};
Expand Down Expand Up @@ -49,6 +50,7 @@ const Text = styled.div`
export const StakeEthBanner = () => {
const theme = useTheme();
const dispatch = useDispatch();
const isDebug = useSelector(selectIsDebugModeActive);
const { stakeEthBannerClosed } = useSelector(state => state.suite.flags);
const hasSufficientEthForStaking = useSelector(selectSelectedAccountHasSufficientEthForStaking);
const { pathname } = useLocation();
Expand All @@ -63,7 +65,8 @@ export const StakeEthBanner = () => {
dispatch(goto('wallet-staking', { preserveParams: true }));
};

if (!isShown) return null;
// TODO: remove isDebug for staking release
if (!isShown || !isDebug) return null;

return (
<StyledCard>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { selectSelectedAccount } from 'src/reducers/wallet/selectedAccountReduce
import { EventType, analytics } from '@trezor/suite-analytics';
import { SubpageNavigation } from 'src/components/suite/layouts/SuiteLayout';
import { Route } from '@suite-common/suite-types';
import { selectIsDebugModeActive } from 'src/reducers/suite/suiteReducer';

// to make sure the routes are taken from the main route definition
type AccountTab = Extract<
Expand All @@ -27,6 +28,7 @@ type NavigationItem = {
export const AccountNavigation = () => {
const account = useSelector(selectSelectedAccount);
const routerParams = useSelector(state => state.router.params) as WalletParams;
const isDebug = useSelector(selectIsDebugModeActive);
const dispatch = useDispatch();

const network = getNetwork(routerParams?.symbol || '');
Expand Down Expand Up @@ -74,7 +76,10 @@ export const AccountNavigation = () => {
goToWithAnalytics('wallet-staking', { preserveParams: true });
},
title: <Translation id="TR_NAV_STAKING" />,
isHidden: !hasNetworkFeatures(account, 'staking'),
// TODO: remove isDebug for staking release
isHidden:
!hasNetworkFeatures(account, 'staking') ||
(account?.networkType === 'ethereum' && !isDebug),
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ const AccountCryptoBalance = styled.div`
color: ${({ theme }) => theme.textSubdued};
`;

const AmountsWrapper = styled.div`
display: flex;
flex-direction: column;
gap: ${spacingsPx.sm};
& > div:nth-of-type(2) {
max-width: fit-content;
}
`;
// const AmountsWrapper = styled.div`
// display: flex;
// flex-direction: column;
// gap: ${spacingsPx.sm};
//
// & > div:nth-of-type(2) {
// max-width: fit-content;
// }
// `;

interface AccountTopPanelSkeletonProps {
animate?: boolean;
Expand All @@ -60,6 +60,7 @@ const AccountTopPanelSkeleton = ({ animate, symbol }: AccountTopPanelSkeletonPro
export const AccountTopPanel = forwardRef<HTMLDivElement>((_, ref) => {
const { account, loader, status } = useSelector(state => state.wallet.selectedAccount);
const localCurrency = useSelector(selectLocalCurrency);
const isDebug = useSelector(selectIsDebugModeActive);

// TODO: move this to FiatHeader
const { fiatAmount } = useFiatFromCryptoValue({
Expand All @@ -77,6 +78,8 @@ export const AccountTopPanel = forwardRef<HTMLDivElement>((_, ref) => {
}

const { symbol, formattedBalance } = account;
// TODO: remove isDebug for staking release
// const isStakeShown = STAKE_SYMBOLS.includes(symbol) && isDebug;

return (
<Container ref={ref}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { variables, H3, Icon, Card } from '@trezor/components';
import { DashboardSection } from 'src/components/dashboard';
import { Translation, StakingFeature, Divider } from 'src/components/suite';
import { Footer } from './components/Footer';
import { useDiscovery, useEverstakePoolStats } from 'src/hooks/suite';
import { useDiscovery, useEverstakePoolStats, useSelector } from 'src/hooks/suite';
import { useAccounts } from 'src/hooks/wallet';
import { MIN_ETH_BALANCE_FOR_STAKING } from 'src/constants/suite/ethStaking';
import { spacingsPx, borders } from '@trezor/theme';
import { selectIsDebugModeActive } from 'src/reducers/suite/suiteReducer';

const Flex = styled.div`
display: flex;
Expand Down Expand Up @@ -59,6 +60,7 @@ const FlexRowChild = styled.div`

export const StakeEthCard = () => {
const theme = useTheme();
const isDebug = useSelector(selectIsDebugModeActive);
const { ethApy } = useEverstakePoolStats();

const { discovery } = useDiscovery();
Expand Down Expand Up @@ -112,7 +114,8 @@ export const StakeEthCard = () => {
[ethApy, theme.iconPrimaryDefault],
);

if (!isShown) return null;
// TODO: remove isDebug for staking release
if (!isShown || !isDebug) return null;

return (
<>
Expand Down
7 changes: 6 additions & 1 deletion packages/suite/src/views/wallet/staking/WalletStaking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { useSelector } from 'src/hooks/suite';
import { CardanoStakingDashboard } from './components/CardanoStakingDashboard';
import { hasNetworkFeatures } from '@suite-common/wallet-utils';
import { EthStakingDashboard } from './components/EthStakingDashboard/EthStakingDashboard';
import { selectIsDebugModeActive } from 'src/reducers/suite/suiteReducer';

export const WalletStaking = () => {
const { selectedAccount } = useSelector(state => state.wallet);
const isDebug = useSelector(selectIsDebugModeActive);

if (selectedAccount.status !== 'loaded') {
return (
Expand All @@ -23,7 +25,10 @@ export const WalletStaking = () => {
case 'cardano':
return <CardanoStakingDashboard selectedAccount={selectedAccount} />;
case 'ethereum':
return <EthStakingDashboard selectedAccount={selectedAccount} />;
// TODO: remove isDebug for staking release
if (isDebug) {
return <EthStakingDashboard selectedAccount={selectedAccount} />;
}
// no default
}
}
Expand Down

0 comments on commit dd3988e

Please sign in to comment.