From d9952b10eaef8c32e464c489154da68e04e5e767 Mon Sep 17 00:00:00 2001 From: Pandelis Symeonidis Date: Mon, 11 Dec 2023 15:44:27 +0100 Subject: [PATCH] fix animation and connect-wallet page --- .../src/components/main-container/styles.ts | 2 +- .../components/notification-detail/styles.ts | 6 +- frontend/src/navigation/routes.tsx | 3 +- .../connect-wallet-mobile.tsx | 110 +++++++ .../src/pages/connect-wallet-mobile/index.ts | 1 + .../src/pages/connect-wallet-mobile/styles.ts | 286 ++++++++++++++++++ .../onboarding-mobile/onboarding-mobile.tsx | 4 +- .../src/pages/onboarding-mobile/styles.ts | 39 ++- 8 files changed, 432 insertions(+), 19 deletions(-) create mode 100644 frontend/src/pages/connect-wallet-mobile/connect-wallet-mobile.tsx create mode 100644 frontend/src/pages/connect-wallet-mobile/index.ts create mode 100644 frontend/src/pages/connect-wallet-mobile/styles.ts diff --git a/frontend/src/components/main-container/styles.ts b/frontend/src/components/main-container/styles.ts index ee618229f..3c694f220 100644 --- a/frontend/src/components/main-container/styles.ts +++ b/frontend/src/components/main-container/styles.ts @@ -6,7 +6,7 @@ interface MainProps { export const MainWrap = styled.div` display: flex; - width: 100vw; + width: 100%; height: 100vh; flex-direction: column; overflow: hidden; diff --git a/frontend/src/components/notification-detail/styles.ts b/frontend/src/components/notification-detail/styles.ts index 39bfae8c2..e22ff95d6 100644 --- a/frontend/src/components/notification-detail/styles.ts +++ b/frontend/src/components/notification-detail/styles.ts @@ -1,6 +1,6 @@ import styled from "@emotion/styled"; import { CloseIcon, ExclamationIcon, TickIcon } from "../../assets"; -import { color, margins } from "../../design"; +import { breakpoints, color, margins } from "../../design"; import { HeaderHorizontalDivider, NavigationTitle } from "../atoms"; export const ToastContainer = styled.div` @@ -18,6 +18,10 @@ export const ToastContainer = styled.div` position: absolute; left: 40px; height: fit-content; + + @media (max-width: ${breakpoints.tablet}) { + width: 100vw; + } `; export const Tick = styled(TickIcon)` diff --git a/frontend/src/navigation/routes.tsx b/frontend/src/navigation/routes.tsx index 76886d4a4..7659fd66e 100644 --- a/frontend/src/navigation/routes.tsx +++ b/frontend/src/navigation/routes.tsx @@ -11,6 +11,7 @@ import { MobileNotAvailable } from "../pages/mobile-not-available"; import { useIsMobile } from "../hooks"; import { breakpoints } from "../design"; import { OnboardingMobile } from "../pages/onboarding-mobile/onboarding-mobile"; +import { ConnectWalletMobile } from "../pages/connect-wallet-mobile/connect-wallet-mobile"; export const InternalAppWrapper = () => { return ( @@ -45,7 +46,7 @@ export const InternalAppRoutes: FC = () => { const mobileRoutes = <> {Object.values(desktopOnlyPaths).map((path, index) => } key={index} />)} - } /> + } /> } /> } /> } /> diff --git a/frontend/src/pages/connect-wallet-mobile/connect-wallet-mobile.tsx b/frontend/src/pages/connect-wallet-mobile/connect-wallet-mobile.tsx new file mode 100644 index 000000000..eabee90cc --- /dev/null +++ b/frontend/src/pages/connect-wallet-mobile/connect-wallet-mobile.tsx @@ -0,0 +1,110 @@ +import React, { FC, useRef, useState } from "react"; +import { useNavigate } from "react-router-dom"; +import { KeplerIcon, text } from "../../assets"; +import { breakpoints, color } from "../../design"; +import { + ButtonText, + FadeInOut, + Footer, + Kado, + KeplerIconWrapper, + LoadingPage, + MenuText, + NotificationDetail, + OnboardingCharacter, + Overlay, + PrimaryButton, + TitleText, +} from "../../components"; +import { + ArrowUp, + ButtonContainer, + FooterContainer, + InfoText, + KreadLogo, + LogoContainer, + OnboardingContainer, + OnboardingWrapper, + SectionContainer, + TextContainer, +} from "./styles"; +import { useIsMobile, useOnScreen, useViewport } from "../../hooks"; +import { useAgoricContext } from "../../context/agoric"; +import { routes } from "../../navigation"; +import { ButtonRow } from "../onboarding/styles"; +import { NotificationWrapper } from "../../components/notification-detail/styles"; + +export const ConnectWalletMobile: FC = () => { + const [service, _] = useAgoricContext(); + const navigate = useNavigate(); + const { width, height } = useViewport(); + const [isLoading, setIsLoading] = useState(false); + const ref = useRef(null); + const isConnectButtonVisible = useOnScreen(ref); + const isMobile = useIsMobile(breakpoints.tablet); + const [showWidget, setShowWidget] = useState(false); + const [showToast, setShowToast] = useState(false); + + const toggleWidget = () => { + setShowWidget(!showWidget); + }; + const showAnimation = false; + + const provisionWallet = async () => { + setIsLoading(true); + try { + await service.walletConnection.provisionSmartWallet(); + } catch (e) { + setIsLoading(false); + setShowToast(true); + } + }; + + if (!service.walletConnection.address) return ; + if (service.status.walletProvisioned) navigate(routes.character); + + return ( + + + + + + + + {text.general.activateSmartWallet} + {text.general.activateSmartWalletDescription} + + + + provisionWallet()}> + + + + {text.general.activateWallet} + {isLoading ? : } + + + {text.store.buyAssets} + + + + +