From 072b2c38862bb9e4c34f742825fd29bd4c79f236 Mon Sep 17 00:00:00 2001 From: Pete Watters <2938440+pete-watters@users.noreply.github.com> Date: Wed, 24 Apr 2024 16:01:02 +0100 Subject: [PATCH] chore: teamwork makes the dream work --- .../features/container/utils/route-helpers.ts | 2 +- .../allow-diagnostics-layout.tsx | 78 ------------------- .../allow-diagnostics/allow-diagnostics.tsx | 45 ----------- src/app/routes/app-routes.tsx | 1 - .../containers/dialog/dialog.stories.tsx | 6 +- .../components/containers/dialog/dialog.tsx | 2 +- 6 files changed, 7 insertions(+), 127 deletions(-) delete mode 100644 src/app/pages/onboarding/allow-diagnostics/allow-diagnostics-layout.tsx delete mode 100644 src/app/pages/onboarding/allow-diagnostics/allow-diagnostics.tsx diff --git a/src/app/features/container/utils/route-helpers.ts b/src/app/features/container/utils/route-helpers.ts index 6ecf9896938..7e7f66f31fa 100644 --- a/src/app/features/container/utils/route-helpers.ts +++ b/src/app/features/container/utils/route-helpers.ts @@ -12,7 +12,7 @@ function isHomePage(pathname: RouteUrls) { } export function isLandingPage(pathname: RouteUrls) { - return pathname === pathname.match(RouteUrls.Onboarding); // need to match get-started/ledger + return pathname.match(RouteUrls.Onboarding); // need to match get-started/ledger } function isOnboardingPage(pathname: RouteUrls) { diff --git a/src/app/pages/onboarding/allow-diagnostics/allow-diagnostics-layout.tsx b/src/app/pages/onboarding/allow-diagnostics/allow-diagnostics-layout.tsx deleted file mode 100644 index ce7e6ddf6a4..00000000000 --- a/src/app/pages/onboarding/allow-diagnostics/allow-diagnostics-layout.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { OnboardingSelectors } from '@tests/selectors/onboarding.selectors'; -import { Box, Flex, Stack, styled } from 'leather-styles/jsx'; - -import { Button } from '@app/ui/components/button/button'; -import { Dialog } from '@app/ui/components/containers/dialog/dialog'; -import { Footer } from '@app/ui/components/containers/footers/footer'; -import { Flag } from '@app/ui/components/flag/flag'; -import { CheckmarkIcon } from '@app/ui/icons/'; -import { LogomarkIcon } from '@app/ui/icons/logomark-icon'; - -interface ReasonToAllowDiagnosticsProps { - text: string; -} -function ReasonToAllowDiagnostics({ text }: ReasonToAllowDiagnosticsProps) { - return ( - }> - {text} - - ); -} - -interface AllowDiagnosticsLayoutProps { - onUserAllowDiagnostics(): void; - onUserDenyDiagnostics(): void; -} -export function AllowDiagnosticsLayout({ - onUserAllowDiagnostics, - onUserDenyDiagnostics, -}: AllowDiagnosticsLayoutProps) { - // this dialog cannot close without a footer action has no header - return ( - null} - footer={ - - } - > - - - - - - - Help us improve - - Leather would like to gather deidentified service usage data to help improve the - experience of the wallet. - - - - - - - - - - ); -} diff --git a/src/app/pages/onboarding/allow-diagnostics/allow-diagnostics.tsx b/src/app/pages/onboarding/allow-diagnostics/allow-diagnostics.tsx deleted file mode 100644 index 4d1dd6e5263..00000000000 --- a/src/app/pages/onboarding/allow-diagnostics/allow-diagnostics.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { useCallback, useEffect } from 'react'; -import { useDispatch } from 'react-redux'; -import { useLocation, useNavigate } from 'react-router-dom'; - -import { RouteUrls } from '@shared/route-urls'; - -import { useAnalytics } from '@app/common/hooks/analytics/use-analytics'; -import { settingsActions } from '@app/store/settings/settings.actions'; - -import { AllowDiagnosticsLayout } from './allow-diagnostics-layout'; - -export function AllowDiagnosticsModal() { - const navigate = useNavigate(); - const dispatch = useDispatch(); - const analytics = useAnalytics(); - const { pathname } = useLocation(); - - useEffect(() => void analytics.page('view', `${pathname}`), [analytics, pathname]); - - const setDiagnosticsPermissionsAndGoToOnboarding = useCallback( - (areDiagnosticsAllowed: boolean) => { - dispatch(settingsActions.setHasAllowedAnalytics(areDiagnosticsAllowed)); - - navigate(RouteUrls.Onboarding); - }, - [navigate, dispatch] - ); - - return ( - { - void analytics.track('respond_diagnostics_consent', { - areDiagnosticsAllowed: false, - }); - setDiagnosticsPermissionsAndGoToOnboarding(false); - }} - onUserAllowDiagnostics={() => { - void analytics.track('respond_diagnostics_consent', { - areDiagnosticsAllowed: true, - }); - setDiagnosticsPermissionsAndGoToOnboarding(true); - }} - /> - ); -} diff --git a/src/app/routes/app-routes.tsx b/src/app/routes/app-routes.tsx index 8f4d4b16583..564cba2a437 100644 --- a/src/app/routes/app-routes.tsx +++ b/src/app/routes/app-routes.tsx @@ -33,7 +33,6 @@ import { ChooseAccount } from '@app/pages/choose-account/choose-account'; import { ChooseCryptoAssetToFund } from '@app/pages/fund/choose-asset-to-fund/choose-asset-to-fund'; import { FundPage } from '@app/pages/fund/fund'; import { Home } from '@app/pages/home/home'; -import { AllowDiagnosticsModal } from '@app/pages/onboarding/allow-diagnostics/allow-diagnostics'; import { BackUpSecretKeyPage } from '@app/pages/onboarding/back-up-secret-key/back-up-secret-key'; import { SignIn } from '@app/pages/onboarding/sign-in/sign-in'; import { WelcomePage } from '@app/pages/onboarding/welcome/welcome'; diff --git a/src/app/ui/components/containers/dialog/dialog.stories.tsx b/src/app/ui/components/containers/dialog/dialog.stories.tsx index dbbb86e3770..fc746780938 100644 --- a/src/app/ui/components/containers/dialog/dialog.stories.tsx +++ b/src/app/ui/components/containers/dialog/dialog.stories.tsx @@ -18,7 +18,11 @@ export function Dialog() { return ( <> - setIsShowing(false)}> + Some Header} + isShowing={isShowing} + onClose={() => setIsShowing(false)} + >

Some Dialog

diff --git a/src/app/ui/components/containers/dialog/dialog.tsx b/src/app/ui/components/containers/dialog/dialog.tsx index 980b5baf8ba..b2a4a3e90ef 100644 --- a/src/app/ui/components/containers/dialog/dialog.tsx +++ b/src/app/ui/components/containers/dialog/dialog.tsx @@ -14,7 +14,7 @@ export interface DialogProps { interface RadixDialogProps extends DialogProps { children: ReactNode; footer?: ReactNode; - header?: ReactElement>; + header: ReactElement>; onGoBack?(): void; }