From 086fc65457c85e063bd176ec5252a7c4857dce9c Mon Sep 17 00:00:00 2001 From: cartcrom <39385577+cartcrom@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:55:53 -0400 Subject: [PATCH] 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 --- package.json | 2 +- .../AccountDrawer/DownloadButton.tsx | 36 ++++++++++++------- src/components/AccountDrawer/SettingsMenu.tsx | 7 ++-- .../AccountDrawer/UniwalletModal.tsx | 7 ++-- src/components/Banner/UniswapWalletBanner.tsx | 6 +++- .../FeatureFlagModal/FeatureFlagModal.tsx | 8 +---- src/components/NavBar/index.tsx | 11 ------ src/featureFlags/flags/featureFlags.ts | 1 - src/featureFlags/flags/mgtm.ts | 5 --- src/pages/App.tsx | 7 +--- src/pages/Wallet/index.tsx | 3 -- yarn.lock | 8 ++--- 12 files changed, 41 insertions(+), 60 deletions(-) delete mode 100644 src/pages/Wallet/index.tsx diff --git a/package.json b/package.json index 9cc38b54bb..f9948ae283 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ "@sentry/tracing": "^7.45.0", "@types/react-window-infinite-loader": "^1.0.6", "@uniswap/analytics": "^1.3.1", - "@uniswap/analytics-events": "^2.9.0", + "@uniswap/analytics-events": "^2.10.0", "@uniswap/conedison": "^1.4.0", "@uniswap/governance": "^1.0.2", "@uniswap/liquidity-staker": "^1.0.2", diff --git a/src/components/AccountDrawer/DownloadButton.tsx b/src/components/AccountDrawer/DownloadButton.tsx index e8f62a38e0..4ac6f68f4c 100644 --- a/src/components/AccountDrawer/DownloadButton.tsx +++ b/src/components/AccountDrawer/DownloadButton.tsx @@ -1,7 +1,6 @@ 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 { useNavigate } from 'react-router-dom' import styled from 'styled-components/macro' import { ClickableStyle } from 'theme' import { isIOS } from 'utils/userAgent' @@ -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 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 -export function DownloadButton({ onClick, text = 'Download' }: { onClick?: () => void; text?: string }) { - const navigate = useNavigate() - const micrositeEnabled = useMGTMMicrositeEnabled() - +export function DownloadButton({ + onClick, + text = 'Download', + element, +}: { + onClick?: () => void + text?: string + element: InterfaceElementName +}) { const onButtonClick = useCallback(() => { // handles any actions required by the parent, i.e. cancelling wallet connection attempt or dismissing an ad onClick?.() - - if (isIOS || !micrositeEnabled) { - sendAnalyticsEvent('Uniswap wallet download clicked') - window.open(APP_STORE_LINK) - } else navigate('/wallet') - }, [onClick, micrositeEnabled, navigate]) + sendAnalyticsEvent(SharedEventName.ELEMENT_CLICKED, { element }) + if (isIOS) openAppStore() + else openWalletMicrosite() + }, [element, onClick]) return ( @@ -58,5 +68,5 @@ export function DownloadButton({ onClick, text = 'Download' }: { onClick?: () => } export function LearnMoreButton() { - return window.open('https://wallet.uniswap.org/', '_blank')}>Learn More + return Learn More } diff --git a/src/components/AccountDrawer/SettingsMenu.tsx b/src/components/AccountDrawer/SettingsMenu.tsx index ce4aa56a33..518ebd0150 100644 --- a/src/components/AccountDrawer/SettingsMenu.tsx +++ b/src/components/AccountDrawer/SettingsMenu.tsx @@ -3,7 +3,7 @@ import { LOCALE_LABEL, SUPPORTED_LOCALES, SupportedLocale } from 'constants/loca import { useActiveLocale } from 'hooks/useActiveLocale' import { useLocationLinkProps } from 'hooks/useLocationLinkProps' 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 { ClickableStyle, ThemedText } from 'theme' import ThemeToggle from 'theme/components/ThemeToggle' @@ -56,16 +56,13 @@ const BalanceToggleContainer = styled.div` export default function SettingsMenu({ onClose }: { onClose: () => void }) { const activeLocale = useActiveLocale() - const { pathname } = useLocation() - const isWalletPage = pathname.includes('/wallet') - return ( Settings} onClose={onClose}> Preferences - + diff --git a/src/components/AccountDrawer/UniwalletModal.tsx b/src/components/AccountDrawer/UniwalletModal.tsx index 630d8c4178..5065de9f96 100644 --- a/src/components/AccountDrawer/UniwalletModal.tsx +++ b/src/components/AccountDrawer/UniwalletModal.tsx @@ -1,5 +1,6 @@ import { Trans } from '@lingui/macro' import { sendAnalyticsEvent } from '@uniswap/analytics' +import { InterfaceElementName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' import { WalletConnect } from '@web3-react/walletconnect' import Column, { AutoColumn } from 'components/Column' @@ -95,7 +96,7 @@ export default function UniwalletModal() { )} - + ) @@ -108,7 +109,7 @@ const InfoSectionWrapper = styled(RowBetween)` gap: 20px; ` -function InfoSection({ onClose }: { onClose: () => void }) { +function InfoSection() { return ( @@ -122,7 +123,7 @@ function InfoSection({ onClose }: { onClose: () => void }) { - + ) diff --git a/src/components/Banner/UniswapWalletBanner.tsx b/src/components/Banner/UniswapWalletBanner.tsx index 9688fdf95e..a7c41a13fc 100644 --- a/src/components/Banner/UniswapWalletBanner.tsx +++ b/src/components/Banner/UniswapWalletBanner.tsx @@ -1,4 +1,5 @@ import { Trans } from '@lingui/macro' +import { InterfaceElementName } from '@uniswap/analytics-events' import { useAccountDrawer } from 'components/AccountDrawer' import { DownloadButton, LearnMoreButton } from 'components/AccountDrawer/DownloadButton' import { AutoColumn } from 'components/Column' @@ -99,7 +100,10 @@ export default function UniswapWalletBanner() { - toggleHideUniswapWalletBanner()} /> + toggleHideUniswapWalletBanner()} + element={InterfaceElementName.UNISWAP_WALLET_BANNER_DOWNLOAD_BUTTON} + /> diff --git a/src/components/FeatureFlagModal/FeatureFlagModal.tsx b/src/components/FeatureFlagModal/FeatureFlagModal.tsx index bcf9fc8b30..3a099d2305 100644 --- a/src/components/FeatureFlagModal/FeatureFlagModal.tsx +++ b/src/components/FeatureFlagModal/FeatureFlagModal.tsx @@ -1,4 +1,4 @@ -import { BaseVariant, FeatureFlag, featureFlagSettings, useBaseFlag, useUpdateFlag } from 'featureFlags' +import { BaseVariant, FeatureFlag, featureFlagSettings, useUpdateFlag } from 'featureFlags' import { MgtmVariant, useMgtmFlag } from 'featureFlags/flags/mgtm' import { useMiniPortfolioFlag } from 'featureFlags/flags/miniPortfolio' import { NftGraphqlVariant, useNftGraphqlFlag } from 'featureFlags/flags/nftlGraphql' @@ -211,12 +211,6 @@ export default function FeatureFlagModal() { featureFlag={FeatureFlag.mgtm} label="Mobile Wallet go-to-market assets" /> - { const isPoolActive = useIsPoolsPage() const isNftPage = useIsNftPage() - const micrositeEnabled = useMGTMMicrositeEnabled() const shouldDisableNFTRoutes = useAtomValue(shouldDisableNFTRoutesAtom) @@ -82,14 +79,6 @@ export const PageTabs = () => { Pools - {micrositeEnabled && ( - - - Wallet - - - - )} diff --git a/src/featureFlags/flags/featureFlags.ts b/src/featureFlags/flags/featureFlags.ts index 816b89fa4e..fc51623b60 100644 --- a/src/featureFlags/flags/featureFlags.ts +++ b/src/featureFlags/flags/featureFlags.ts @@ -10,6 +10,5 @@ export enum FeatureFlag { statsigDummy = 'web_dummy_gate_amplitude_id', nftGraphql = 'nft_graphql_migration', mgtm = 'web_mobile_go_to_market_enabled', - walletMicrosite = 'walletMicrosite', miniPortfolio = 'miniPortfolio', } diff --git a/src/featureFlags/flags/mgtm.ts b/src/featureFlags/flags/mgtm.ts index 1a6530399b..6a2e3a04ef 100644 --- a/src/featureFlags/flags/mgtm.ts +++ b/src/featureFlags/flags/mgtm.ts @@ -10,9 +10,4 @@ export function useMgtmEnabled(): boolean { return useMgtmFlag() === BaseVariant.Enabled } -export function useMGTMMicrositeEnabled() { - const mgtmEnabled = useMgtmEnabled() - return useBaseFlag(FeatureFlag.walletMicrosite) === BaseVariant.Enabled && mgtmEnabled -} - export { BaseVariant as MgtmVariant } diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 43c3d841f3..2aba81caa4 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -4,7 +4,6 @@ import { useWeb3React } from '@web3-react/core' import Loader from 'components/Icons/LoadingSpinner' import TopLevelModals from 'components/TopLevelModals' import { useFeatureFlagsIsLoaded } from 'featureFlags' -import { useMGTMMicrositeEnabled } from 'featureFlags/flags/mgtm' import ApeModeQueryParamReader from 'hooks/useApeModeQueryParamReader' import { useAtom } from 'jotai' import { useBag } from 'nft/hooks/useBag' @@ -48,7 +47,6 @@ import Tokens from './Tokens' const TokenDetails = lazy(() => import('./TokenDetails')) const Vote = lazy(() => import('./Vote')) -const Wallet = lazy(() => import('./Wallet')) const NftExplore = lazy(() => import('nft/pages/explore')) const Collection = lazy(() => import('nft/pages/collection')) const Profile = lazy(() => import('nft/pages/profile/profile')) @@ -192,9 +190,7 @@ export default function App() { }, []) const isBagExpanded = useBag((state) => state.bagExpanded) - const isOnWalletPage = useLocation().pathname === '/wallet' - const micrositeEnabled = useMGTMMicrositeEnabled() - const isHeaderTransparent = (!scrolledState && !isBagExpanded) || isOnWalletPage + const isHeaderTransparent = !scrolledState && !isBagExpanded const { account } = useWeb3React() const statsigUser: StatsigUser = useMemo( @@ -245,7 +241,6 @@ export default function App() { } /> } /> - {micrositeEnabled && } />} } /> } /> diff --git a/src/pages/Wallet/index.tsx b/src/pages/Wallet/index.tsx deleted file mode 100644 index 79d59df1a7..0000000000 --- a/src/pages/Wallet/index.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export default function Wallet() { - return
uniswap wallet pretty cool
-} diff --git a/yarn.lock b/yarn.lock index eef49d360b..d7807d9255 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4567,10 +4567,10 @@ "@typescript-eslint/types" "5.47.0" eslint-visitor-keys "^3.3.0" -"@uniswap/analytics-events@^2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.9.0.tgz#80c634bfae850da33b446df0a9fb325869fa8ffa" - integrity sha512-pgrr44L26/0MhRNKC7u8NwjIjVv5tKFqKre2h+TYpzRamZsOD37sR9mnovlF6FA91jNPRMPKK+kHouiimMfmrA== +"@uniswap/analytics-events@^2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.10.0.tgz#08c80d4c17212c112a7c182fa84a201b4199a241" + integrity sha512-Lkz2JqzixPDSGp71SczXMf9UQDo9QX2wEqfma09YoDHm8HCw/baqLQiK1KGdUQULZxbj64W4SH3nFlxq/Jb/OQ== "@uniswap/analytics@^1.3.1": version "1.3.1"