Skip to content

Commit

Permalink
chore(rerender): fix sofi banner, header nav (#6253)
Browse files Browse the repository at this point in the history
  • Loading branch information
mperdomo-bc committed Jan 26, 2024
1 parent b336376 commit 9f943bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { FormattedMessage } from 'react-intl'
import { useSelector } from 'react-redux'
import { shallowEqual, useSelector } from 'react-redux'

import { Image, Link, Text } from 'blockchain-info-components'
import { selectors } from 'data'
Expand All @@ -9,7 +9,7 @@ import { getData } from '../selectors'
import { SofiRow } from './styles'

export const SofiBanner = ({ userLoggedOut = false }: { userLoggedOut?: boolean }) => {
const { country, ipCountry, signupCountry } = useSelector(getData)
const { country, ipCountry, signupCountry } = useSelector(getData, shallowEqual)
const sofiUserStatus = useSelector(selectors.modules.profile.getSofiUserMigrationStatus)
const userCountry = country !== undefined ? country : ipCountry
const hideBanner = userCountry !== 'US' && signupCountry !== 'US'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, { useCallback, useMemo } from 'react'
import React, { useCallback } from 'react'
import { FormattedMessage } from 'react-intl'

import { Navbar } from 'components/Navbar'
import { PrimaryNavItem } from 'components/Navbar/Navbar'
import { selectors } from 'data'
import { Analytics, ModalName } from 'data/types'
import { useRemote } from 'hooks'

import { Props } from '.'

Expand All @@ -14,10 +12,9 @@ type OwnProps = Props & {
}

const Header = (props: OwnProps) => {
const { data } = useRemote(selectors.modules.profile.getCurrentTier)
const isGoldVerified = useMemo(() => data === 2, [data])
const {
analyticsActions,
currentTier,
featureFlags,
history,
invitations,
Expand All @@ -31,6 +28,9 @@ const Header = (props: OwnProps) => {
settingsActions,
walletDebitCardEnabled
} = props

const isGoldVerified = currentTier === 2

const refreshCallback = useCallback(() => {
refreshActions.refreshClicked()
}, [refreshActions])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import Header from './Header'
const HeaderContainer = (props: Props) => <Header {...props} />

const mapStateToProps = (state: RootState) => ({
currenTier: lift(
(currentTier: ExtractSuccess<ReturnType<typeof selectors.modules.profile.getCurrentTier>>) =>
currentTier
)(selectors.modules.profile.getCurrentTier(state)),
currentTier: selectors.modules.profile.getCurrentTier(state).getOrElse(0),
featureFlags: selectors.core.walletOptions
.getFeatureFlags(state)
.getOrElse({} as { [key in string]: boolean }),
Expand Down

0 comments on commit 9f943bb

Please sign in to comment.