Skip to content

Commit

Permalink
chore: remove DefiDashboard flag & dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
0xApotheosis committed Sep 19, 2024
1 parent 9a75b97 commit d3276ac
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 164 deletions.
1 change: 0 additions & 1 deletion .env.base
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ REACT_APP_FEATURE_ARBITRUM_NOVA=false
REACT_APP_FEATURE_BASE=true
REACT_APP_FEATURE_OPTIMISM=true
REACT_APP_FEATURE_JAYPEGZ=true
REACT_APP_FEATURE_DEFI_DASHBOARD=true
REACT_APP_FEATURE_MIXPANEL=true
REACT_APP_FEATURE_SAVERS_VAULTS=true
REACT_APP_FEATURE_SAVERS_VAULTS_DEPOSIT=true
Expand Down
1 change: 0 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const validators = {
REACT_APP_MTPELERIN_REFERRAL_CODE: str(),
REACT_APP_MTPELERIN_INTEGRATION_KEY: str(),
REACT_APP_FRIENDLY_CAPTCHA_SITE_KEY: str(),
REACT_APP_FEATURE_DEFI_DASHBOARD: bool({ default: false }),
REACT_APP_ZAPPER_API_KEY: str(),
REACT_APP_COVALENT_API_KEY: str(),
REACT_APP_FEATURE_LIFI_SWAP: bool({ default: false }),
Expand Down
78 changes: 29 additions & 49 deletions src/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FlexProps, StackDirection, TabProps } from '@chakra-ui/react'
import { Flex, Stack, Tab, TabIndicator, TabList, Tabs, useMediaQuery } from '@chakra-ui/react'
import type { FlexProps, TabProps } from '@chakra-ui/react'
import { Flex, Tab, TabIndicator, TabList, Tabs, useMediaQuery } from '@chakra-ui/react'
import { memo, useCallback, useMemo, useState } from 'react'
import { useTranslate } from 'react-polyglot'
import { Route, Switch, useHistory, useRouteMatch } from 'react-router'
Expand All @@ -17,15 +17,11 @@ import { TransactionHistory } from 'pages/TransactionHistory/TransactionHistory'
import { breakpoints } from 'theme/theme'

import { DashboardHeader } from './components/DashboardHeader/DashboardHeader'
import { DashboardSidebar } from './DashboardSidebar'
import { EarnDashboard } from './EarnDashboard'
import { MobileActivity } from './MobileActivity'
import { Portfolio } from './Portfolio'
import { RewardsDashboard } from './RewardsDashboard'
import { WalletDashboard } from './WalletDashboard'

const direction: StackDirection = { base: 'column', xl: 'row' }
const maxWidth = { base: 'full', lg: 'full', xl: 'sm' }
const mainPadding = { base: 0, md: 4 }
const customTabActive = { color: 'text.base' }
const customTabLast = { marginRight: 0 }
Expand Down Expand Up @@ -69,7 +65,6 @@ export const Dashboard = memo(() => {
const translate = useTranslate()
const [slideIndex, setSlideIndex] = useState(0)
const [isLargerThanMd] = useMediaQuery(`(min-width: ${breakpoints['md']})`, { ssr: false })
const isDefiDashboardEnabled = useFeatureFlag('DefiDashboard')
const { path } = useRouteMatch()
const isNftsEnabled = useFeatureFlag('Jaypegz')
const appIsMobile = isMobile || !isLargerThanMd
Expand Down Expand Up @@ -166,50 +161,35 @@ export const Dashboard = memo(() => {
)
}

if (isDefiDashboardEnabled)
return (
<Main headerComponent={dashboardHeader} py={mainPadding}>
<SEO title={translate('navBar.dashboard')} />
<Switch>
<Route exact path={`${path}`}>
<WalletDashboard />
</Route>
<Route exact path={`${path}/earn`}>
<EarnDashboard />
</Route>
<Route exact path={`${path}/rewards`}>
<RewardsDashboard />
</Route>
<Route path={`${path}/accounts`}>
<Accounts />
</Route>
<Route path={`${path}/activity`}>
<TransactionHistory />
</Route>
{isNftsEnabled && (
<Route exact path={`${path}/nfts`}>
<NftTable />
</Route>
)}

<Route>
<RawText>Not found</RawText>
</Route>
</Switch>
</Main>
)

return (
<Main>
<Main headerComponent={dashboardHeader} py={mainPadding}>
<SEO title={translate('navBar.dashboard')} />
<Stack alignItems='flex-start' spacing={4} mx='auto' direction={direction}>
<Stack spacing={4} flex='1 1 0%' width='full'>
<Portfolio />
</Stack>
<Stack flex='1 1 0%' width='full' maxWidth={maxWidth} spacing={4}>
<DashboardSidebar />
</Stack>
</Stack>
<Switch>
<Route exact path={`${path}`}>
<WalletDashboard />
</Route>
<Route exact path={`${path}/earn`}>
<EarnDashboard />
</Route>
<Route exact path={`${path}/rewards`}>
<RewardsDashboard />
</Route>
<Route path={`${path}/accounts`}>
<Accounts />
</Route>
<Route path={`${path}/activity`}>
<TransactionHistory />
</Route>
{isNftsEnabled && (
<Route exact path={`${path}/nfts`}>
<NftTable />
</Route>
)}

<Route>
<RawText>Not found</RawText>
</Route>
</Switch>
</Main>
)
})
2 changes: 0 additions & 2 deletions src/pages/Dashboard/Portfolio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Text } from 'components/Text'

import { AccountTable } from './components/AccountList/AccountTable'
import { DashboardChart } from './components/DashboardChart'
import { PortfolioBreakdown } from './PortfolioBreakdown'

const cardBodyPx = { base: 4, md: 2 }
const accountHeaderPaddingBottom = { base: 0, md: 4 }
Expand All @@ -15,7 +14,6 @@ export const Portfolio = memo(() => {
return (
<Stack spacing={stackSpacing} width='full'>
<DashboardChart />
<PortfolioBreakdown />
<Card variant='dashboard'>
<CardHeader pb={accountHeaderPaddingBottom} pt={accountHeaderPaddingTop}>
<Heading as='h6'>
Expand Down
108 changes: 0 additions & 108 deletions src/pages/Dashboard/PortfolioBreakdown.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/state/slices/preferencesSlice/preferencesSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export type FeatureFlags = {
SaversVaults: boolean
SaversVaultsDeposit: boolean
SaversVaultsWithdraw: boolean
DefiDashboard: boolean
Cowswap: boolean
ZrxSwap: boolean
Mixpanel: boolean
Expand Down Expand Up @@ -116,7 +115,6 @@ const initialState: Preferences = {
SaversVaults: getConfig().REACT_APP_FEATURE_SAVERS_VAULTS,
SaversVaultsDeposit: getConfig().REACT_APP_FEATURE_SAVERS_VAULTS_DEPOSIT,
SaversVaultsWithdraw: getConfig().REACT_APP_FEATURE_SAVERS_VAULTS_WITHDRAW,
DefiDashboard: getConfig().REACT_APP_FEATURE_DEFI_DASHBOARD,
Cowswap: getConfig().REACT_APP_FEATURE_COWSWAP,
ZrxSwap: getConfig().REACT_APP_FEATURE_ZRX_SWAP,
LifiSwap: getConfig().REACT_APP_FEATURE_LIFI_SWAP,
Expand Down
1 change: 0 additions & 1 deletion src/test/mocks/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export const mockStore: ReduxState = {
SaversVaults: false,
SaversVaultsDeposit: false,
SaversVaultsWithdraw: false,
DefiDashboard: false,
Mixpanel: false,
LifiSwap: false,
DynamicLpAssets: false,
Expand Down

0 comments on commit d3276ac

Please sign in to comment.