Minor fixes

This commit is contained in:
Reckless_Satoshi 2023-02-18 09:32:15 -08:00
parent d674aa2616
commit 240328a6c5
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 296 additions and 228 deletions

View File

@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { import {
Alert, Alert,
Box,
Button, Button,
ButtonGroup, ButtonGroup,
Collapse, Collapse,
@ -10,6 +11,7 @@ import {
LinearProgress, LinearProgress,
Link, Link,
Typography, Typography,
useTheme,
} from '@mui/material'; } from '@mui/material';
import { Page } from '../NavBar'; import { Page } from '../NavBar';
import { Robot } from '../../models'; import { Robot } from '../../models';
@ -43,6 +45,7 @@ const Onboarding = ({
}: OnboardingProps): JSX.Element => { }: OnboardingProps): JSX.Element => {
const { t } = useTranslation(); const { t } = useTranslation();
const history = useHistory(); const history = useHistory();
const theme = useTheme();
const [step, setStep] = useState<'1' | '2' | '3'>('1'); const [step, setStep] = useState<'1' | '2' | '3'>('1');
const [generatedToken, setGeneratedToken] = useState<boolean>(false); const [generatedToken, setGeneratedToken] = useState<boolean>(false);
@ -61,21 +64,26 @@ const Onboarding = ({
}; };
return ( return (
<Grid container direction='column' alignItems='center' spacing={2}> <Grid container direction='column' alignItems='center' spacing={2} padding={2}>
<Grid item> <Grid item>
<Typography variant='h5' color={step == '1' ? 'text.primary' : 'text.disabled'}> <Typography variant='h5' color={step == '1' ? 'text.primary' : 'text.disabled'}>
{t('1. Generate a token')} {t('1. Generate a token')}
</Typography> </Typography>
<Collapse in={step == '1'}> <Collapse in={step == '1'}>
<Grid <Box
container sx={{
direction='column' padding: '0.5em',
alignItems='center' backgroundColor: 'background.paper',
spacing={1} border: '1px solid',
padding={1.5} borderRadius: '4px',
paddingLeft={4} borderColor: theme.palette.mode === 'dark' ? '#434343' : '#c4c4c4',
'&:hover': {
borderColor: theme.palette.mode === 'dark' ? '#ffffff' : '#2f2f2f',
},
}}
> >
<Grid container direction='column' alignItems='center' spacing={1} padding={1.5}>
<Grid item> <Grid item>
<Typography> <Typography>
{t( {t(
@ -98,7 +106,7 @@ const Onboarding = ({
<Alert variant='outlined' severity='info'> <Alert variant='outlined' severity='info'>
<b>{`${t('Store it somewhere safe!')} `}</b> <b>{`${t('Store it somewhere safe!')} `}</b>
{t( {t(
`This token is the one and only key to your robot and trade. You will need it later to recover your order or check it's status.`, `This token is the one and only key to your robot and trade. You will need it later to recover your order or check its status.`,
)} )}
</Alert> </Alert>
</Grid> </Grid>
@ -146,6 +154,7 @@ const Onboarding = ({
</Grid> </Grid>
)} )}
</Grid> </Grid>
</Box>
</Collapse> </Collapse>
</Grid> </Grid>
@ -155,14 +164,19 @@ const Onboarding = ({
</Typography> </Typography>
<Collapse in={step == '2'}> <Collapse in={step == '2'}>
<Grid <Box
container sx={{
direction='column' padding: '0.5em',
alignItems='center' backgroundColor: 'background.paper',
spacing={1} border: '1px solid',
padding={1.5} borderRadius: '4px',
paddingLeft={4} borderColor: theme.palette.mode === 'dark' ? '#434343' : '#c4c4c4',
'&:hover': {
borderColor: theme.palette.mode === 'dark' ? '#ffffff' : '#2f2f2f',
},
}}
> >
<Grid container direction='column' alignItems='center' spacing={1} padding={1.5}>
<Grid item> <Grid item>
<Typography> <Typography>
{robot.avatarLoaded && robot.nickname ? ( {robot.avatarLoaded && robot.nickname ? (
@ -231,6 +245,7 @@ const Onboarding = ({
</Collapse> </Collapse>
</Grid> </Grid>
</Grid> </Grid>
</Box>
</Collapse> </Collapse>
</Grid> </Grid>
@ -239,14 +254,19 @@ const Onboarding = ({
{t('3. Browse or create an order')} {t('3. Browse or create an order')}
</Typography> </Typography>
<Collapse in={step == '3'}> <Collapse in={step == '3'}>
<Grid <Box
container sx={{
direction='column' padding: '0.5em',
alignItems='center' backgroundColor: 'background.paper',
spacing={1} border: '1px solid',
padding={1.5} borderRadius: '4px',
paddingLeft={4} borderColor: theme.palette.mode === 'dark' ? '#434343' : '#c4c4c4',
'&:hover': {
borderColor: theme.palette.mode === 'dark' ? '#ffffff' : '#2f2f2f',
},
}}
> >
<Grid container direction='column' alignItems='center' spacing={1} padding={1.5}>
<Grid item> <Grid item>
<Typography> <Typography>
{t( {t(
@ -270,19 +290,21 @@ const Onboarding = ({
<Grid item> <Grid item>
<Typography> <Typography>
{`${t('If you need help on your RoboSats journey, join our public support')} `} {`${t('If you need help on your RoboSats journey join our public support')} `}
<Link target='_blank' href='https://t.me/robosats_es' rel='noreferrer'> <Link target='_blank' href='https://t.me/robosats_es' rel='noreferrer'>
{t('Telegram group')} {t('Telegram group')}
</Link> </Link>
</Typography> </Typography>
</Grid> </Grid>
<Grid item>
<Button onClick={() => setView('profile')}>{t('See profile')}</Button>
</Grid>
</Grid> </Grid>
</Box>
</Collapse> </Collapse>
</Grid> </Grid>
<Grid item>
<Button color='inherit' onClick={() => setView('profile')}>
{t('See profile')}
</Button>
</Grid>
</Grid> </Grid>
); );
}; };

View File

@ -0,0 +1,24 @@
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Box, Button, Grid, Typography, useTheme } from '@mui/material';
import { RoboSatsTextIcon } from '../../components/Icons';
import { FastForward, RocketLaunch } from '@mui/icons-material';
import SmartToy from '@mui/icons-material/SmartToy';
interface RobotProfileProps {
setView: (state: 'welcome' | 'onboarding' | 'recovery' | 'profile') => void;
width: number;
}
const RobotProfile = ({ setView, width }: RobotProfileProps): JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();
return (
<Grid container direction='column' alignItems='center' spacing={1} padding={1}>
<Grid item></Grid>
</Grid>
);
};
export default RobotProfile;

View File

@ -1,9 +1,8 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Box, Button, Grid, Typography, useTheme } from '@mui/material'; import { Box, Button, Grid, Typography, useTheme } from '@mui/material';
import { RoboSatsNoTextIcon, RoboSatsTextIcon } from '../../components/Icons'; import { RoboSatsTextIcon } from '../../components/Icons';
import { FastForward, RocketLaunch } from '@mui/icons-material'; import { FastForward, RocketLaunch, Key } from '@mui/icons-material';
import SmartToy from '@mui/icons-material/SmartToy';
interface WelcomeProps { interface WelcomeProps {
setView: (state: 'welcome' | 'onboarding' | 'recovery' | 'profile') => void; setView: (state: 'welcome' | 'onboarding' | 'recovery' | 'profile') => void;
@ -15,22 +14,43 @@ const Welcome = ({ setView, width }: WelcomeProps): JSX.Element => {
const theme = useTheme(); const theme = useTheme();
return ( return (
<Grid container direction='column' alignItems='center' spacing={1} padding={1}> <Grid
container
direction='column'
alignItems='center'
spacing={1.8}
paddingTop={2}
padding={0.5}
>
<Grid item>
<svg width={0} height={0}>
<linearGradient id='linearColors' x1={1} y1={0} x2={1} y2={1}>
<stop offset={0} stopColor={theme.palette.primary.main} />
<stop offset={1} stopColor={theme.palette.secondary.main} />
</linearGradient>
</svg>
<RoboSatsTextIcon <RoboSatsTextIcon
color='primary'
sx={{ sx={{
height: `${Math.min(width * 0.65, 13) * 0.25}em`, fill: 'url(#linearColors)',
width: `${Math.min(width * 0.65, 13)}em`, height: `${Math.min(width * 0.7, 16) * 0.25}em`,
width: `${Math.min(width * 0.7, 16)}em`,
}} }}
/> />
<Typography align='center' component='h5' variant='h5'> <Typography
lineHeight={0.8}
sx={{ position: 'relative', bottom: '0.3em' }}
color='secondary'
align='center'
component='h6'
variant='h6'
>
{t('Simple and Private LN P2P Exchange')} {t('Simple and Private LN P2P Exchange')}
</Typography> </Typography>
</Grid>
<Grid item> <Grid item>
<Box <Box
sx={{ sx={{
padding: '0.5em',
backgroundColor: 'background.paper', backgroundColor: 'background.paper',
border: '1px solid', border: '1px solid',
borderRadius: '4px', borderRadius: '4px',
@ -65,14 +85,14 @@ const Welcome = ({ setView, width }: WelcomeProps): JSX.Element => {
</Grid> </Grid>
<Grid item> <Grid item>
<Button color='secondary' variant='contained' onClick={() => setView('recovery')}> <Button color='secondary' variant='contained' onClick={() => setView('recovery')}>
<SmartToy /> <Key />
{t('Recovery')} {t('Recovery')}
</Button> </Button>
</Grid> </Grid>
</Grid> </Grid>
</Box> </Box>
</Grid> </Grid>
<Grid item> <Grid item sx={{ position: 'relative', bottom: '0.5em' }}>
<Button color='primary' onClick={() => setView('profile')}> <Button color='primary' onClick={() => setView('profile')}>
<FastForward /> <FastForward />
{t('Skip to Robot Generator')} {t('Skip to Robot Generator')}

View File

@ -12,6 +12,8 @@ import { genKey } from '../../pgp';
import { sha256 } from 'js-sha256'; import { sha256 } from 'js-sha256';
import Onboarding from './Onboarding'; import Onboarding from './Onboarding';
import Welcome from './Welcome'; import Welcome from './Welcome';
import RobotProfile from './RobotProfile';
import Recovery from './Recovery';
interface RobotPageProps { interface RobotPageProps {
setPage: (state: Page) => void; setPage: (state: Page) => void;
@ -36,7 +38,7 @@ const RobotPage = ({
const params = useParams(); const params = useParams();
const theme = useTheme(); const theme = useTheme();
const refCode = params.refCode; const refCode = params.refCode;
const width = Math.min(windowSize.width * 0.8, 30); const width = Math.min(windowSize.width * 0.8, 28);
const maxHeight = windowSize.height * 0.85 - 3; const maxHeight = windowSize.height * 0.85 - 3;
const [robotFound, setRobotFound] = useState<boolean>(false); const [robotFound, setRobotFound] = useState<boolean>(false);
@ -141,15 +143,13 @@ const RobotPage = ({
const handleClickNewRandomToken = () => {}; const handleClickNewRandomToken = () => {};
return ( return (
<Grid container direction='column' alignItems='center' spacing={1}>
<Grid item>
<Paper <Paper
elevation={12} elevation={12}
style={{ style={{
padding: '1em',
width: `${width}em`, width: `${width}em`,
maxHeight: `${maxHeight}em`, maxHeight: `${maxHeight}em`,
overflow: 'auto', overflow: 'auto',
overflowX: 'clip',
}} }}
> >
{view === 'welcome' ? <Welcome setView={setView} width={width} /> : null} {view === 'welcome' ? <Welcome setView={setView} width={width} /> : null}
@ -167,9 +167,11 @@ const RobotPage = ({
baseUrl={baseUrl} baseUrl={baseUrl}
/> />
) : null} ) : null}
{view === 'profile' ? <RobotProfile setView={setView} width={width} /> : null}
{view === 'recovery' ? <Recovery setView={setView} width={width} /> : null}
</Paper> </Paper>
</Grid>
</Grid>
); );
}; };