Skip to content

Commit

Permalink
feat(celo-news): skip Celo education carousel when celo news is enabl…
Browse files Browse the repository at this point in the history
…ed (#3298)

### Description

From the [experiment
design](https://www.notion.so/valora-inc/Celo-news-feed-43e09037425949b38f2fdc79812a62e3)
we learned users tapping the CELO menu item drop at the Celo education
carousel.
So when Celo News is enabled, we now skip it too.

Note: I slightly refactored the menu item thing so we don't have to
repeat ourselves.

### Test plan

- When Celo News is enabled, tapping the CELO menu item should directly
show the news feed, without the Celo education carousel.

### Related issues

Discussed on
[Slack](https://valora-app.slack.com/archives/C0494B52JTH/p1671805415760139).

### Backwards compatibility

Yes
  • Loading branch information
jeanregisser authored Dec 23, 2022
1 parent 177006c commit 5231e25
Showing 1 changed file with 29 additions and 39 deletions.
68 changes: 29 additions & 39 deletions src/navigator/DrawerNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import SettingsScreen from 'src/account/Settings'
import Support from 'src/account/Support'
import { HomeEvents, RewardsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import { inviteMethodSelector } from 'src/app/selectors'
import { celoNewsConfigSelector, inviteMethodSelector } from 'src/app/selectors'
import { InviteMethodType } from 'src/app/types'
import BackupIntroduction from 'src/backup/BackupIntroduction'
import AccountNumber from 'src/components/AccountNumber'
Expand Down Expand Up @@ -201,13 +201,35 @@ export default function DrawerNavigator() {

const shouldShowRecoveryPhraseInSettings = useSelector(shouldShowRecoveryPhraseInSettingsSelector)
const backupCompleted = useSelector(backupCompletedSelector)
const isCeloNewsEnabled = useSelector(celoNewsConfigSelector).enabled

const drawerContent = (props: DrawerContentComponentProps<DrawerContentOptions>) => (
<CustomDrawerContent {...props} />
)

const shouldShowSwapMenuInDrawerMenu = useSelector(isAppSwapsEnabledSelector)

// Show ExchangeHomeScreen if the user has completed the Celo education
// or if the Celo News feature is enabled
// Otherwise, show the Celo education screen
const celoMenuItem =
isCeloEducationComplete || isCeloNewsEnabled ? (
<Drawer.Screen
name={Screens.ExchangeHomeScreen}
component={ExchangeHomeScreen}
options={{ title: t('celoGold'), drawerIcon: Gold }}
/>
) : (
<Drawer.Screen
name={Screens.GoldEducation}
component={GoldEducation}
options={{
title: t('celoGold'),
drawerIcon: Gold,
}}
/>
)

return (
<Drawer.Navigator
initialRouteName={Screens.WalletHome}
Expand Down Expand Up @@ -237,24 +259,7 @@ export default function DrawerNavigator() {
options={{ title: t('swapScreen.title'), drawerIcon: Swap }}
/>
) : (
<>
{(isCeloEducationComplete && (
<Drawer.Screen
name={Screens.ExchangeHomeScreen}
component={ExchangeHomeScreen}
options={{ title: t('celoGold'), drawerIcon: Gold }}
/>
)) || (
<Drawer.Screen
name={Screens.GoldEducation}
component={GoldEducation}
options={{
title: t('celoGold'),
drawerIcon: Gold,
}}
/>
)}
</>
celoMenuItem
)}

{dappsListUrl && (
Expand Down Expand Up @@ -293,26 +298,11 @@ export default function DrawerNavigator() {
options={{ title: t('invite'), drawerIcon: InviteIcon }}
/>
)}
{shouldShowSwapMenuInDrawerMenu && (
<>
{(isCeloEducationComplete && (
<Drawer.Screen
name={Screens.ExchangeHomeScreen}
component={ExchangeHomeScreen}
options={{ title: t('celoGold'), drawerIcon: Gold }}
/>
)) || (
<Drawer.Screen
name={Screens.GoldEducation}
component={GoldEducation}
options={{
title: t('celoGold'),
drawerIcon: Gold,
}}
/>
)}
</>
)}

{
// When swap is enabled, the celo menu item is here
shouldShowSwapMenuInDrawerMenu && celoMenuItem
}

<Drawer.Screen
name={Screens.Settings}
Expand Down

0 comments on commit 5231e25

Please sign in to comment.