Commit 086fc654 authored by cartcrom's avatar cartcrom Committed by GitHub

feat: remove /wallet route (#6350)

* feat: replace internal microsite routes with links to external site

* feat: use updated analytics events from events repo

* fix: remove unnused empty wallet page
parent 7df53f30
import { sendAnalyticsEvent } from '@uniswap/analytics' import { sendAnalyticsEvent } from '@uniswap/analytics'
import { useMGTMMicrositeEnabled } from 'featureFlags/flags/mgtm' import { InterfaceElementName, InterfaceEventName, SharedEventName } from '@uniswap/analytics-events'
import { PropsWithChildren, useCallback } from 'react' import { PropsWithChildren, useCallback } from 'react'
import { useNavigate } from 'react-router-dom'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ClickableStyle } from 'theme' import { ClickableStyle } from 'theme'
import { isIOS } from 'utils/userAgent' import { isIOS } from 'utils/userAgent'
...@@ -34,21 +33,32 @@ function BaseButton({ onClick, branded, children }: PropsWithChildren<{ onClick? ...@@ -34,21 +33,32 @@ function BaseButton({ onClick, branded, children }: PropsWithChildren<{ onClick?
} }
const APP_STORE_LINK = 'https://apps.apple.com/us/app/uniswap-wallet/id6443944476' const APP_STORE_LINK = 'https://apps.apple.com/us/app/uniswap-wallet/id6443944476'
const MICROSITE_LINK = 'https://wallet.uniswap.org/'
const openAppStore = () => {
window.open(APP_STORE_LINK, /* target = */ 'uniswap_wallet_appstore')
}
const openWalletMicrosite = () => {
sendAnalyticsEvent(InterfaceEventName.UNISWAP_WALLET_MICROSITE_OPENED)
window.open(MICROSITE_LINK, /* target = */ 'uniswap_wallet_microsite')
}
// Launches App Store if on an iOS device, else navigates to Uniswap Wallet microsite // Launches App Store if on an iOS device, else navigates to Uniswap Wallet microsite
export function DownloadButton({ onClick, text = 'Download' }: { onClick?: () => void; text?: string }) { export function DownloadButton({
const navigate = useNavigate() onClick,
const micrositeEnabled = useMGTMMicrositeEnabled() text = 'Download',
element,
}: {
onClick?: () => void
text?: string
element: InterfaceElementName
}) {
const onButtonClick = useCallback(() => { const onButtonClick = useCallback(() => {
// handles any actions required by the parent, i.e. cancelling wallet connection attempt or dismissing an ad // handles any actions required by the parent, i.e. cancelling wallet connection attempt or dismissing an ad
onClick?.() onClick?.()
sendAnalyticsEvent(SharedEventName.ELEMENT_CLICKED, { element })
if (isIOS || !micrositeEnabled) { if (isIOS) openAppStore()
sendAnalyticsEvent('Uniswap wallet download clicked') else openWalletMicrosite()
window.open(APP_STORE_LINK) }, [element, onClick])
} else navigate('/wallet')
}, [onClick, micrositeEnabled, navigate])
return ( return (
<BaseButton branded onClick={onButtonClick}> <BaseButton branded onClick={onButtonClick}>
...@@ -58,5 +68,5 @@ export function DownloadButton({ onClick, text = 'Download' }: { onClick?: () => ...@@ -58,5 +68,5 @@ export function DownloadButton({ onClick, text = 'Download' }: { onClick?: () =>
} }
export function LearnMoreButton() { export function LearnMoreButton() {
return <BaseButton onClick={() => window.open('https://wallet.uniswap.org/', '_blank')}>Learn More</BaseButton> return <BaseButton onClick={openWalletMicrosite}>Learn More</BaseButton>
} }
...@@ -3,7 +3,7 @@ import { LOCALE_LABEL, SUPPORTED_LOCALES, SupportedLocale } from 'constants/loca ...@@ -3,7 +3,7 @@ import { LOCALE_LABEL, SUPPORTED_LOCALES, SupportedLocale } from 'constants/loca
import { useActiveLocale } from 'hooks/useActiveLocale' import { useActiveLocale } from 'hooks/useActiveLocale'
import { useLocationLinkProps } from 'hooks/useLocationLinkProps' import { useLocationLinkProps } from 'hooks/useLocationLinkProps'
import { Check } from 'react-feather' import { Check } from 'react-feather'
import { Link, useLocation } from 'react-router-dom' import { Link } from 'react-router-dom'
import styled, { useTheme } from 'styled-components/macro' import styled, { useTheme } from 'styled-components/macro'
import { ClickableStyle, ThemedText } from 'theme' import { ClickableStyle, ThemedText } from 'theme'
import ThemeToggle from 'theme/components/ThemeToggle' import ThemeToggle from 'theme/components/ThemeToggle'
...@@ -56,16 +56,13 @@ const BalanceToggleContainer = styled.div` ...@@ -56,16 +56,13 @@ const BalanceToggleContainer = styled.div`
export default function SettingsMenu({ onClose }: { onClose: () => void }) { export default function SettingsMenu({ onClose }: { onClose: () => void }) {
const activeLocale = useActiveLocale() const activeLocale = useActiveLocale()
const { pathname } = useLocation()
const isWalletPage = pathname.includes('/wallet')
return ( return (
<SlideOutMenu title={<Trans>Settings</Trans>} onClose={onClose}> <SlideOutMenu title={<Trans>Settings</Trans>} onClose={onClose}>
<SectionTitle> <SectionTitle>
<Trans>Preferences</Trans> <Trans>Preferences</Trans>
</SectionTitle> </SectionTitle>
<ThemeToggleContainer> <ThemeToggleContainer>
<ThemeToggle disabled={isWalletPage} /> <ThemeToggle />
</ThemeToggleContainer> </ThemeToggleContainer>
<BalanceToggleContainer> <BalanceToggleContainer>
<SmallBalanceToggle /> <SmallBalanceToggle />
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { sendAnalyticsEvent } from '@uniswap/analytics' import { sendAnalyticsEvent } from '@uniswap/analytics'
import { InterfaceElementName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { WalletConnect } from '@web3-react/walletconnect' import { WalletConnect } from '@web3-react/walletconnect'
import Column, { AutoColumn } from 'components/Column' import Column, { AutoColumn } from 'components/Column'
...@@ -95,7 +96,7 @@ export default function UniwalletModal() { ...@@ -95,7 +96,7 @@ export default function UniwalletModal() {
)} )}
</QRCodeWrapper> </QRCodeWrapper>
<Divider /> <Divider />
<InfoSection onClose={onClose} /> <InfoSection />
</UniwalletConnectWrapper> </UniwalletConnectWrapper>
</Modal> </Modal>
) )
...@@ -108,7 +109,7 @@ const InfoSectionWrapper = styled(RowBetween)` ...@@ -108,7 +109,7 @@ const InfoSectionWrapper = styled(RowBetween)`
gap: 20px; gap: 20px;
` `
function InfoSection({ onClose }: { onClose: () => void }) { function InfoSection() {
return ( return (
<InfoSectionWrapper> <InfoSectionWrapper>
<AutoColumn gap="4px"> <AutoColumn gap="4px">
...@@ -122,7 +123,7 @@ function InfoSection({ onClose }: { onClose: () => void }) { ...@@ -122,7 +123,7 @@ function InfoSection({ onClose }: { onClose: () => void }) {
</ThemedText.Caption> </ThemedText.Caption>
</AutoColumn> </AutoColumn>
<Column> <Column>
<DownloadButton onClick={onClose} /> <DownloadButton element={InterfaceElementName.UNISWAP_WALLET_MODAL_DOWNLOAD_BUTTON} />
</Column> </Column>
</InfoSectionWrapper> </InfoSectionWrapper>
) )
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { InterfaceElementName } from '@uniswap/analytics-events'
import { useAccountDrawer } from 'components/AccountDrawer' import { useAccountDrawer } from 'components/AccountDrawer'
import { DownloadButton, LearnMoreButton } from 'components/AccountDrawer/DownloadButton' import { DownloadButton, LearnMoreButton } from 'components/AccountDrawer/DownloadButton'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
...@@ -99,7 +100,10 @@ export default function UniswapWalletBanner() { ...@@ -99,7 +100,10 @@ export default function UniswapWalletBanner() {
<ButtonRow> <ButtonRow>
<LearnMoreButton /> <LearnMoreButton />
<DownloadButton onClick={() => toggleHideUniswapWalletBanner()} /> <DownloadButton
onClick={() => toggleHideUniswapWalletBanner()}
element={InterfaceElementName.UNISWAP_WALLET_BANNER_DOWNLOAD_BUTTON}
/>
</ButtonRow> </ButtonRow>
</InnerContainer> </InnerContainer>
</PopupContainer> </PopupContainer>
......
import { BaseVariant, FeatureFlag, featureFlagSettings, useBaseFlag, useUpdateFlag } from 'featureFlags' import { BaseVariant, FeatureFlag, featureFlagSettings, useUpdateFlag } from 'featureFlags'
import { MgtmVariant, useMgtmFlag } from 'featureFlags/flags/mgtm' import { MgtmVariant, useMgtmFlag } from 'featureFlags/flags/mgtm'
import { useMiniPortfolioFlag } from 'featureFlags/flags/miniPortfolio' import { useMiniPortfolioFlag } from 'featureFlags/flags/miniPortfolio'
import { NftGraphqlVariant, useNftGraphqlFlag } from 'featureFlags/flags/nftlGraphql' import { NftGraphqlVariant, useNftGraphqlFlag } from 'featureFlags/flags/nftlGraphql'
...@@ -211,12 +211,6 @@ export default function FeatureFlagModal() { ...@@ -211,12 +211,6 @@ export default function FeatureFlagModal() {
featureFlag={FeatureFlag.mgtm} featureFlag={FeatureFlag.mgtm}
label="Mobile Wallet go-to-market assets" label="Mobile Wallet go-to-market assets"
/> />
<FeatureFlagOption
variant={BaseVariant}
value={useBaseFlag(FeatureFlag.walletMicrosite)}
featureFlag={FeatureFlag.walletMicrosite}
label="Mobile Wallet microsite (requires mgtm to also be enabled)"
/>
<FeatureFlagOption <FeatureFlagOption
variant={BaseVariant} variant={BaseVariant}
value={useMiniPortfolioFlag()} value={useMiniPortfolioFlag()}
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import NewBadge from 'components/WalletModal/NewBadge'
import Web3Status from 'components/Web3Status' import Web3Status from 'components/Web3Status'
import { useMGTMMicrositeEnabled } from 'featureFlags/flags/mgtm'
import { chainIdToBackendName } from 'graphql/data/util' import { chainIdToBackendName } from 'graphql/data/util'
import { useIsNftPage } from 'hooks/useIsNftPage' import { useIsNftPage } from 'hooks/useIsNftPage'
import { useIsPoolsPage } from 'hooks/useIsPoolsPage' import { useIsPoolsPage } from 'hooks/useIsPoolsPage'
...@@ -60,7 +58,6 @@ export const PageTabs = () => { ...@@ -60,7 +58,6 @@ export const PageTabs = () => {
const isPoolActive = useIsPoolsPage() const isPoolActive = useIsPoolsPage()
const isNftPage = useIsNftPage() const isNftPage = useIsNftPage()
const micrositeEnabled = useMGTMMicrositeEnabled()
const shouldDisableNFTRoutes = useAtomValue(shouldDisableNFTRoutesAtom) const shouldDisableNFTRoutes = useAtomValue(shouldDisableNFTRoutesAtom)
...@@ -82,14 +79,6 @@ export const PageTabs = () => { ...@@ -82,14 +79,6 @@ export const PageTabs = () => {
<Trans>Pools</Trans> <Trans>Pools</Trans>
</MenuItem> </MenuItem>
</Box> </Box>
{micrositeEnabled && (
<Box display={{ sm: 'none', xxxl: 'flex' }}>
<MenuItem href="/wallet" isActive={pathname.startsWith('/wallet')}>
<Trans>Wallet</Trans>
<NewBadge />
</MenuItem>
</Box>
)}
<Box marginY={{ sm: '4', md: 'unset' }}> <Box marginY={{ sm: '4', md: 'unset' }}>
<MenuDropdown /> <MenuDropdown />
</Box> </Box>
......
...@@ -10,6 +10,5 @@ export enum FeatureFlag { ...@@ -10,6 +10,5 @@ export enum FeatureFlag {
statsigDummy = 'web_dummy_gate_amplitude_id', statsigDummy = 'web_dummy_gate_amplitude_id',
nftGraphql = 'nft_graphql_migration', nftGraphql = 'nft_graphql_migration',
mgtm = 'web_mobile_go_to_market_enabled', mgtm = 'web_mobile_go_to_market_enabled',
walletMicrosite = 'walletMicrosite',
miniPortfolio = 'miniPortfolio', miniPortfolio = 'miniPortfolio',
} }
...@@ -10,9 +10,4 @@ export function useMgtmEnabled(): boolean { ...@@ -10,9 +10,4 @@ export function useMgtmEnabled(): boolean {
return useMgtmFlag() === BaseVariant.Enabled return useMgtmFlag() === BaseVariant.Enabled
} }
export function useMGTMMicrositeEnabled() {
const mgtmEnabled = useMgtmEnabled()
return useBaseFlag(FeatureFlag.walletMicrosite) === BaseVariant.Enabled && mgtmEnabled
}
export { BaseVariant as MgtmVariant } export { BaseVariant as MgtmVariant }
...@@ -4,7 +4,6 @@ import { useWeb3React } from '@web3-react/core' ...@@ -4,7 +4,6 @@ import { useWeb3React } from '@web3-react/core'
import Loader from 'components/Icons/LoadingSpinner' import Loader from 'components/Icons/LoadingSpinner'
import TopLevelModals from 'components/TopLevelModals' import TopLevelModals from 'components/TopLevelModals'
import { useFeatureFlagsIsLoaded } from 'featureFlags' import { useFeatureFlagsIsLoaded } from 'featureFlags'
import { useMGTMMicrositeEnabled } from 'featureFlags/flags/mgtm'
import ApeModeQueryParamReader from 'hooks/useApeModeQueryParamReader' import ApeModeQueryParamReader from 'hooks/useApeModeQueryParamReader'
import { useAtom } from 'jotai' import { useAtom } from 'jotai'
import { useBag } from 'nft/hooks/useBag' import { useBag } from 'nft/hooks/useBag'
...@@ -48,7 +47,6 @@ import Tokens from './Tokens' ...@@ -48,7 +47,6 @@ import Tokens from './Tokens'
const TokenDetails = lazy(() => import('./TokenDetails')) const TokenDetails = lazy(() => import('./TokenDetails'))
const Vote = lazy(() => import('./Vote')) const Vote = lazy(() => import('./Vote'))
const Wallet = lazy(() => import('./Wallet'))
const NftExplore = lazy(() => import('nft/pages/explore')) const NftExplore = lazy(() => import('nft/pages/explore'))
const Collection = lazy(() => import('nft/pages/collection')) const Collection = lazy(() => import('nft/pages/collection'))
const Profile = lazy(() => import('nft/pages/profile/profile')) const Profile = lazy(() => import('nft/pages/profile/profile'))
...@@ -192,9 +190,7 @@ export default function App() { ...@@ -192,9 +190,7 @@ export default function App() {
}, []) }, [])
const isBagExpanded = useBag((state) => state.bagExpanded) const isBagExpanded = useBag((state) => state.bagExpanded)
const isOnWalletPage = useLocation().pathname === '/wallet' const isHeaderTransparent = !scrolledState && !isBagExpanded
const micrositeEnabled = useMGTMMicrositeEnabled()
const isHeaderTransparent = (!scrolledState && !isBagExpanded) || isOnWalletPage
const { account } = useWeb3React() const { account } = useWeb3React()
const statsigUser: StatsigUser = useMemo( const statsigUser: StatsigUser = useMemo(
...@@ -245,7 +241,6 @@ export default function App() { ...@@ -245,7 +241,6 @@ export default function App() {
} }
/> />
<Route path="create-proposal" element={<Navigate to="/vote/create-proposal" replace />} /> <Route path="create-proposal" element={<Navigate to="/vote/create-proposal" replace />} />
{micrositeEnabled && <Route path="wallet" element={<Wallet />} />}
<Route path="send" element={<RedirectPathToSwapOnly />} /> <Route path="send" element={<RedirectPathToSwapOnly />} />
<Route path="swap" element={<Swap />} /> <Route path="swap" element={<Swap />} />
......
export default function Wallet() {
return <div>uniswap wallet pretty cool</div>
}
...@@ -4567,10 +4567,10 @@ ...@@ -4567,10 +4567,10 @@
"@typescript-eslint/types" "5.47.0" "@typescript-eslint/types" "5.47.0"
eslint-visitor-keys "^3.3.0" eslint-visitor-keys "^3.3.0"
"@uniswap/analytics-events@^2.9.0": "@uniswap/analytics-events@^2.10.0":
version "2.9.0" version "2.10.0"
resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.9.0.tgz#80c634bfae850da33b446df0a9fb325869fa8ffa" resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.10.0.tgz#08c80d4c17212c112a7c182fa84a201b4199a241"
integrity sha512-pgrr44L26/0MhRNKC7u8NwjIjVv5tKFqKre2h+TYpzRamZsOD37sR9mnovlF6FA91jNPRMPKK+kHouiimMfmrA== integrity sha512-Lkz2JqzixPDSGp71SczXMf9UQDo9QX2wEqfma09YoDHm8HCw/baqLQiK1KGdUQULZxbj64W4SH3nFlxq/Jb/OQ==
"@uniswap/analytics@^1.3.1": "@uniswap/analytics@^1.3.1":
version "1.3.1" version "1.3.1"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment