-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9f739c
commit 381c8a2
Showing
4 changed files
with
182 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
src/context/WalletProvider/NewWalletViews/wallets/native/NativeIntro.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { | ||
Box, | ||
Button, | ||
Divider, | ||
Flex, | ||
Icon, | ||
Stack, | ||
Text as CText, | ||
useColorModeValue, | ||
} from '@chakra-ui/react' | ||
import { useCallback } from 'react' | ||
import { FaArrowRight } from 'react-icons/fa' | ||
import { useTranslate } from 'react-polyglot' | ||
import { useHistory } from 'react-router-dom' | ||
import { FoxIcon } from 'components/Icons/FoxIcon' | ||
import { Text } from 'components/Text' | ||
import { NativeWalletRoutes } from 'context/WalletProvider/types' | ||
|
||
export const NativeIntro = () => { | ||
const translate = useTranslate() | ||
const history = useHistory() | ||
|
||
const headingColor = useColorModeValue('gray.800', 'whiteAlpha.800') | ||
const bodyColor = useColorModeValue('gray.600', 'whiteAlpha.600') | ||
const mainTextColor = useColorModeValue('gray.700', 'whiteAlpha.800') | ||
|
||
const handleCreateClick = useCallback(() => history.push(NativeWalletRoutes.Create), [history]) | ||
const handleImportClick = useCallback( | ||
() => history.push(NativeWalletRoutes.ImportSelect), | ||
[history], | ||
) | ||
const handleImportKeystoreClick = useCallback( | ||
() => history.push(NativeWalletRoutes.ImportKeystore), | ||
[history], | ||
) | ||
|
||
return ( | ||
<Stack h='full'> | ||
<Flex | ||
direction='column' | ||
alignItems='center' | ||
justifyContent='center' | ||
h='full' | ||
maxW='md' | ||
mx='auto' | ||
px={4} | ||
textAlign='center' | ||
> | ||
<Box mb={6}> | ||
<FoxIcon boxSize='16' /> | ||
</Box> | ||
|
||
<Text | ||
fontSize='2xl' | ||
fontWeight='bold' | ||
mb={4} | ||
color={headingColor} | ||
translation='walletProvider.shapeShift.onboarding.whatIsShapeshiftWallet' | ||
/> | ||
|
||
<Text | ||
color={mainTextColor} | ||
mb={8} | ||
translation='walletProvider.shapeShift.onboarding.yourDecentralizedGateway' | ||
/> | ||
<Text | ||
color={mainTextColor} | ||
mb={12} | ||
translation='walletProvider.shapeShift.onboarding.crossChainFreedom' | ||
/> | ||
|
||
<Button colorScheme='blue' px={4} onClick={handleCreateClick}> | ||
{translate('walletProvider.shapeShift.onboarding.createNewWallet')} | ||
</Button> | ||
|
||
<Button variant='link' color={bodyColor} mt={4} onClick={handleImportClick}> | ||
{translate('walletProvider.shapeShift.onboarding.importExisting')} | ||
</Button> | ||
</Flex> | ||
<Box width='100%' mb={4} textAlign='center' position='absolute' left={0} bottom={0}> | ||
<Divider my={6} /> | ||
<CText color={bodyColor}> | ||
{translate('walletProvider.shapeShift.onboarding.comingFromThorswap')}{' '} | ||
<Button | ||
variant='link' | ||
color='blue.500' | ||
onClick={handleImportKeystoreClick} | ||
fontWeight='medium' | ||
colorScheme='blue' | ||
> | ||
{translate('walletProvider.shapeShift.onboarding.importFromKeystore')} | ||
<Icon as={FaArrowRight} ml={2} /> | ||
</Button> | ||
</CText> | ||
</Box> | ||
</Stack> | ||
) | ||
} |
149 changes: 69 additions & 80 deletions
149
src/context/WalletProvider/NewWalletViews/wallets/native/NativeStart.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,87 @@ | ||
import { | ||
Box, | ||
Button, | ||
Divider, | ||
Flex, | ||
Icon, | ||
Stack, | ||
Text as CText, | ||
useColorModeValue, | ||
} from '@chakra-ui/react' | ||
import { ArrowForwardIcon } from '@chakra-ui/icons' | ||
import type { ResponsiveValue } from '@chakra-ui/react' | ||
import { Button, Divider, Flex, ModalBody, ModalHeader, Stack } from '@chakra-ui/react' | ||
import type { Property } from 'csstype' | ||
import { useCallback } from 'react' | ||
import { FaArrowRight } from 'react-icons/fa' | ||
import { useTranslate } from 'react-polyglot' | ||
import { useHistory } from 'react-router-dom' | ||
import { FoxIcon } from 'components/Icons/FoxIcon' | ||
import type { RouteComponentProps } from 'react-router' | ||
import { Text } from 'components/Text' | ||
import { NativeWalletRoutes } from 'context/WalletProvider/types' | ||
import { useFeatureFlag } from 'hooks/useFeatureFlag/useFeatureFlag' | ||
|
||
export const NativeStart = () => { | ||
const translate = useTranslate() | ||
const history = useHistory() | ||
const directionProp: ResponsiveValue<Property.FlexDirection> = ['column', 'row'] | ||
const mlProp = [0, 1.5] | ||
const arrowForwardIcon = <ArrowForwardIcon /> | ||
|
||
const headingColor = useColorModeValue('gray.800', 'whiteAlpha.800') | ||
const bodyColor = useColorModeValue('gray.600', 'whiteAlpha.600') | ||
const mainTextColor = useColorModeValue('gray.700', 'whiteAlpha.800') | ||
export const NativeStart = ({ history }: RouteComponentProps) => { | ||
const isShapeShiftMobileWalletEnabled = useFeatureFlag('ShapeShiftMobileWallet') | ||
const translate = useTranslate() | ||
|
||
const handleCreateClick = useCallback(() => history.push(NativeWalletRoutes.Create), [history]) | ||
const handleCreate = useCallback(() => history.push(NativeWalletRoutes.Create), [history]) | ||
const handleImportClick = useCallback( | ||
() => history.push(NativeWalletRoutes.ImportSelect), | ||
[history], | ||
) | ||
const handleImportKeystoreClick = useCallback( | ||
() => history.push(NativeWalletRoutes.ImportKeystore), | ||
[history], | ||
) | ||
const handleLogin = useCallback(() => history.push(NativeWalletRoutes.LegacyLogin), [history]) | ||
|
||
return ( | ||
<Stack h='full'> | ||
<Flex | ||
direction='column' | ||
alignItems='center' | ||
justifyContent='center' | ||
h='full' | ||
maxW='md' | ||
mx='auto' | ||
px={4} | ||
textAlign='center' | ||
> | ||
<Box mb={6}> | ||
<FoxIcon boxSize='16' /> | ||
</Box> | ||
|
||
<Text | ||
fontSize='2xl' | ||
fontWeight='bold' | ||
mb={4} | ||
color={headingColor} | ||
translation='walletProvider.shapeShift.onboarding.whatIsShapeshiftWallet' | ||
/> | ||
|
||
<Text | ||
color={mainTextColor} | ||
mb={8} | ||
translation='walletProvider.shapeShift.onboarding.yourDecentralizedGateway' | ||
/> | ||
<Text | ||
color={mainTextColor} | ||
mb={12} | ||
translation='walletProvider.shapeShift.onboarding.crossChainFreedom' | ||
/> | ||
|
||
<Button colorScheme='blue' px={4} onClick={handleCreateClick}> | ||
{translate('walletProvider.shapeShift.onboarding.createNewWallet')} | ||
</Button> | ||
|
||
<Button variant='link' color={bodyColor} mt={4} onClick={handleImportClick}> | ||
{translate('walletProvider.shapeShift.onboarding.importExisting')} | ||
</Button> | ||
</Flex> | ||
<Box width='100%' mb={4} textAlign='center' position='absolute' left={0} bottom={0}> | ||
<Divider my={6} /> | ||
<CText color={bodyColor}> | ||
{translate('walletProvider.shapeShift.onboarding.comingFromThorswap')}{' '} | ||
<> | ||
<ModalHeader> | ||
<Text translation={'walletProvider.shapeShift.start.header'} /> | ||
</ModalHeader> | ||
<ModalBody> | ||
<Text mb={4} color='text.subtle' translation={'walletProvider.shapeShift.start.body'} /> | ||
<Stack mt={6} spacing={4}> | ||
<Divider /> | ||
<Button | ||
w='full' | ||
h='auto' | ||
px={6} | ||
py={4} | ||
justifyContent='space-between' | ||
rightIcon={arrowForwardIcon} | ||
onClick={handleCreate} | ||
data-test='wallet-native-create-button' | ||
> | ||
<Text translation={'walletProvider.shapeShift.start.create'} /> | ||
</Button> | ||
<Button | ||
variant='link' | ||
color='blue.500' | ||
onClick={handleImportKeystoreClick} | ||
fontWeight='medium' | ||
colorScheme='blue' | ||
w='full' | ||
h='auto' | ||
px={6} | ||
py={4} | ||
justifyContent='space-between' | ||
rightIcon={arrowForwardIcon} | ||
onClick={handleImportClick} | ||
data-test='wallet-native-import-button' | ||
> | ||
{translate('walletProvider.shapeShift.onboarding.importFromKeystore')} | ||
<Icon as={FaArrowRight} ml={2} /> | ||
<Text translation={'walletProvider.shapeShift.start.import'} /> | ||
</Button> | ||
</CText> | ||
</Box> | ||
</Stack> | ||
{isShapeShiftMobileWalletEnabled && ( | ||
<> | ||
<Divider mt={4} /> | ||
<Flex | ||
direction={directionProp} | ||
mt={2} | ||
pt={4} | ||
justifyContent='center' | ||
alignItems='center' | ||
> | ||
<Text translation={'walletProvider.shapeShift.legacy.haveMobileWallet'} /> | ||
<Button | ||
variant='link' | ||
ml={mlProp} | ||
borderTopRadius='none' | ||
colorScheme='blue' | ||
onClick={handleLogin} | ||
> | ||
{translate('common.login')} | ||
</Button> | ||
</Flex> | ||
</> | ||
)} | ||
</Stack> | ||
</ModalBody> | ||
</> | ||
) | ||
} |