From cf299a5c2028753e444338c47b7ffb3889dcbb80 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sun, 19 Feb 2023 06:19:49 -0800 Subject: [PATCH] Add recovery component --- frontend/src/basic/RobotPage/Onboarding.tsx | 24 ++++++++++-- frontend/src/basic/RobotPage/Recovery.tsx | 42 ++++++++++++++++++++- frontend/src/basic/RobotPage/TokenInput.tsx | 6 ++- frontend/src/basic/RobotPage/Welcome.tsx | 28 ++++++++------ frontend/src/basic/RobotPage/index.tsx | 28 +++++++++++++- 5 files changed, 107 insertions(+), 21 deletions(-) diff --git a/frontend/src/basic/RobotPage/Onboarding.tsx b/frontend/src/basic/RobotPage/Onboarding.tsx index 071170e0..4cf2fb80 100644 --- a/frontend/src/basic/RobotPage/Onboarding.tsx +++ b/frontend/src/basic/RobotPage/Onboarding.tsx @@ -15,10 +15,11 @@ import { } from '@mui/material'; import { Page } from '../NavBar'; import { Robot } from '../../models'; -import { Casino, Bolt, Check, Storefront, AddBox } from '@mui/icons-material'; +import { Casino, Bolt, Check, Storefront, AddBox, School } from '@mui/icons-material'; import RobotAvatar from '../../components/RobotAvatar'; import TokenInput from './TokenInput'; import { genBase62Token } from '../../utils'; +import { NewTabIcon } from '../../components/Icons'; interface OnboardingProps { setView: (state: 'welcome' | 'onboarding' | 'recovery' | 'profile') => void; @@ -121,7 +122,6 @@ const Onboarding = ({ badRequest={badRequest} robot={robot} onPressEnter={() => null} - badRequest={badRequest} /> )} @@ -278,11 +278,11 @@ const Onboarding = ({ @@ -294,8 +294,24 @@ const Onboarding = ({ {t('Telegram group')} + {`, ${t('or visit the robot school for documentation.')} `} + + + diff --git a/frontend/src/basic/RobotPage/Recovery.tsx b/frontend/src/basic/RobotPage/Recovery.tsx index d8f830c5..cd1e8006 100644 --- a/frontend/src/basic/RobotPage/Recovery.tsx +++ b/frontend/src/basic/RobotPage/Recovery.tsx @@ -7,9 +7,13 @@ import { Page } from '../NavBar'; import { Robot } from '../../models'; import { Casino, Download, ContentCopy, SmartToy, Bolt } from '@mui/icons-material'; import RobotAvatar from '../../components/RobotAvatar'; +import TokenInput from './TokenInput'; +import Key from '@mui/icons-material/Key'; interface RecoveryProps { robot: Robot; + setRobot: (state: Robot) => void; + setView: (state: 'welcome' | 'onboarding' | 'recovery' | 'profile') => void; inputToken: string; setInputToken: (state: string) => void; getGenerateRobot: (token: string) => void; @@ -19,6 +23,7 @@ interface RecoveryProps { const Recovery = ({ robot, + setRobot, inputToken, setInputToken, getGenerateRobot, @@ -28,9 +33,42 @@ const Recovery = ({ const { t } = useTranslation(); const theme = useTheme(); + const recoveryDisabled = () => { + return inputToken.length > 10 ? false : true; + }; + const onClickRecover = () => { + if (recoveryDisabled()) { + return; + } else { + } + }; + return ( - - + + + + {t( + 'Please, introduce your robot token to re-build your robot and gain access to its trades.', + )} + + + + + + + + ); }; diff --git a/frontend/src/basic/RobotPage/TokenInput.tsx b/frontend/src/basic/RobotPage/TokenInput.tsx index d5c2c1d5..bfa41e15 100644 --- a/frontend/src/basic/RobotPage/TokenInput.tsx +++ b/frontend/src/basic/RobotPage/TokenInput.tsx @@ -28,10 +28,12 @@ interface TokenInputProps { onPressEnter: () => void; badRequest: string | undefined; setInputToken: (state: string) => void; + showCopy?: boolean; } const TokenInput = ({ robot, + showCopy = true, setRobot, showDownload = false, fullWidth = true, @@ -83,7 +85,7 @@ const TokenInput = ({ ) : null, - endAdornment: ( + endAdornment: showCopy ? ( - ), + ) : null, }} /> ); diff --git a/frontend/src/basic/RobotPage/Welcome.tsx b/frontend/src/basic/RobotPage/Welcome.tsx index 86f6d177..c7dc6f0d 100644 --- a/frontend/src/basic/RobotPage/Welcome.tsx +++ b/frontend/src/basic/RobotPage/Welcome.tsx @@ -19,7 +19,7 @@ const Welcome = ({ setView, width }: WelcomeProps): JSX.Element => { direction='column' alignItems='center' spacing={1.8} - paddingTop={2} + paddingTop={2.2} padding={0.5} > @@ -32,19 +32,19 @@ const Welcome = ({ setView, width }: WelcomeProps): JSX.Element => { - {t('Simple and Private LN P2P Exchange')} + {t('A Simple and Private LN P2P Exchange')} @@ -60,7 +60,7 @@ const Welcome = ({ setView, width }: WelcomeProps): JSX.Element => { }, }} > - + {t('Create a new robot and learn to use RoboSats')} @@ -74,6 +74,7 @@ const Welcome = ({ setView, width }: WelcomeProps): JSX.Element => { onClick={() => setView('onboarding')} > +
{t('Start')} @@ -84,8 +85,13 @@ const Welcome = ({ setView, width }: WelcomeProps): JSX.Element => { - @@ -93,9 +99,9 @@ const Welcome = ({ setView, width }: WelcomeProps): JSX.Element => { - diff --git a/frontend/src/basic/RobotPage/index.tsx b/frontend/src/basic/RobotPage/index.tsx index 84477a4b..23c18c74 100644 --- a/frontend/src/basic/RobotPage/index.tsx +++ b/frontend/src/basic/RobotPage/index.tsx @@ -168,9 +168,33 @@ const RobotPage = ({ /> ) : null} - {view === 'profile' ? : null} + {view === 'profile' ? ( + + ) : null} - {view === 'recovery' ? : null} + {view === 'recovery' ? ( + + ) : null} ); };