From 176a86dc6e7a96dca51acddea3c85bb067f035b2 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Fri, 17 Feb 2023 11:31:53 -0800 Subject: [PATCH] Add onboarding step 3 --- frontend/src/basic/RobotPage/Onboarding.tsx | 203 +++++++++++++------- frontend/src/basic/RobotPage/index.tsx | 1 + frontend/static/css/index.css | 13 +- 3 files changed, 139 insertions(+), 78 deletions(-) diff --git a/frontend/src/basic/RobotPage/Onboarding.tsx b/frontend/src/basic/RobotPage/Onboarding.tsx index a4149328..ac0b4dd9 100644 --- a/frontend/src/basic/RobotPage/Onboarding.tsx +++ b/frontend/src/basic/RobotPage/Onboarding.tsx @@ -1,11 +1,18 @@ -import React, { useEffect, useState } from 'react'; +import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { Alert, Button, Collapse, Grid, LinearProgress, Typography, useTheme } from '@mui/material'; -import { useParams } from 'react-router-dom'; - +import { useHistory } from 'react-router-dom'; +import { + Alert, + Button, + ButtonGroup, + Collapse, + Grid, + LinearProgress, + Typography, +} from '@mui/material'; import { Page } from '../NavBar'; import { Robot } from '../../models'; -import { Casino, Download, ContentCopy, SmartToy, Bolt, Check } from '@mui/icons-material'; +import { Casino, Bolt, Check, Storefront, AddBox } from '@mui/icons-material'; import RobotAvatar from '../../components/RobotAvatar'; import TokenInput from './TokenInput'; import { genBase62Token } from '../../utils'; @@ -32,7 +39,7 @@ const Onboarding = ({ baseUrl, }: OnboardingProps): JSX.Element => { const { t } = useTranslation(); - const theme = useTheme(); + const history = useHistory(); const [step, setStep] = useState<'1' | '2' | '3'>('1'); const [generatedToken, setGeneratedToken] = useState(false); @@ -45,14 +52,27 @@ const Onboarding = ({ setTimeout(() => setShowMimickProgress(false), 1000); }; + const changePage = function (newPage: Page) { + setPage(newPage); + history.push(`/${newPage}`); + }; + return ( {t('1. Generate a token')} + - + {t( @@ -109,7 +129,7 @@ const Onboarding = ({ onClick={() => { setStep('2'); getGenerateRobot(inputToken); - setRobot({ ...robot, nickname: null }); + setRobot({ ...robot, nickname: undefined }); }} variant='contained' size='large' @@ -124,53 +144,33 @@ const Onboarding = ({ )} + - - - {t('2. Meet your robot identity')} - - + + + {t('2. Meet your robot identity')} + - - {robot.avatarLoaded && robot.nickname ? ( - - {t('Hi! My name is')} - - - - - ) : ( - - {t('Your robot is under consctruction!')} - - )} + + + + {robot.avatarLoaded && robot.nickname ? ( + t('This is your trading avatar') + ) : ( + {t('Building your robot!')} + )} + + - + + {robot.avatarLoaded && robot.nickname ? ( + + {t('Hi! My name is')} + +
+ + {robot.nickname} + +
+
+
+ ) : null} - + + +
+
- - - {t('3. Browse or create an order')} - - - - Marketplace See Offers contained buttonm Create Offer container button If you need - help fire away on our support public Telegram group! Support Telegram Group My profile - not contained button + + + {t('3. Browse or create an order')} + + + + + + {t( + 'RoboSats is a peer-to-peer marketplace. You can browse the public offers or create a new one.', + )} + - - + + + + + + + + + + + {`${t('If you need help on your RoboSats journey, join our public support')} `} + + {t('Telegram group')} + + + + + + + + +
); diff --git a/frontend/src/basic/RobotPage/index.tsx b/frontend/src/basic/RobotPage/index.tsx index a7e0d322..5c1166be 100644 --- a/frontend/src/basic/RobotPage/index.tsx +++ b/frontend/src/basic/RobotPage/index.tsx @@ -52,6 +52,7 @@ const RobotPage = ({ const [badRequest, setBadRequest] = useState(undefined); const [tokenChanged, setTokenChanged] = useState(false); const [inputToken, setInputToken] = useState(''); + const [view, setView] = useState<'welcome' | 'onboarding' | 'recovery' | 'profile'>('welcome'); // useEffect(() => { // if (robot.nickname != null) { diff --git a/frontend/static/css/index.css b/frontend/static/css/index.css index d31eee24..838a3bc0 100644 --- a/frontend/static/css/index.css +++ b/frontend/static/css/index.css @@ -232,16 +232,7 @@ input[type='number'] { .generatingAvatar { background-size: 100%; border-radius: 50%; - border: 0.3px solid #555; + outline: 2px solid #555; + outline-offset: -2px; filter: dropShadow(1px 1px 1px #000000); - background-image: linear-gradient( - 0deg, - #ffd9001f 0%, - #3609ff33 40%, - #ff32322d 60%, - #ffd9001f 100% - ); - background-position: 0px 0px; - background-repeat: repeat; - animation: animatedBackground 5s linear infinite; }