-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: basic classic ui #20
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1 @@ | ||
#root { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
} | ||
|
||
.read-the-docs { | ||
color: #888; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Avatar, Button, Text } from '@chakra-ui/react' | ||
|
||
type AssetSelectionProps = { | ||
onClick: () => void | ||
label: string | ||
assetIcon: string | ||
assetName: string | ||
} | ||
|
||
export const AssetSelection: React.FC<AssetSelectionProps> = ({ | ||
label, | ||
onClick, | ||
assetIcon, | ||
assetName, | ||
}) => { | ||
return ( | ||
<Button flexDir='column' height='auto' py={4} gap={4} flex={1} onClick={onClick}> | ||
<Text color='text.subtle'>{label}</Text> | ||
<Avatar src={assetIcon} /> | ||
<Text>{assetName}</Text> | ||
</Button> | ||
) | ||
} |
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,50 @@ | ||
import { Button, Card, CardBody, Flex, Heading, IconButton } from '@chakra-ui/react' | ||
import { useCallback, useMemo } from 'react' | ||
import { FaArrowRightArrowLeft } from 'react-icons/fa6' | ||
import { useNavigate } from 'react-router-dom' | ||
import { BTCImage, ETHImage } from 'lib/const' | ||
|
||
import { AssetSelection } from './AssetSelection' | ||
|
||
export const SelectPair = () => { | ||
const navigate = useNavigate() | ||
const switchIcon = useMemo(() => <FaArrowRightArrowLeft />, []) | ||
const handleSubmit = useCallback(() => { | ||
navigate('/input') | ||
}, [navigate]) | ||
|
||
const handleFromAssetClick = useCallback(() => { | ||
console.info('asset click') | ||
}, []) | ||
const handleToAssetClick = useCallback(() => { | ||
console.info('to asset click') | ||
}, []) | ||
|
||
return ( | ||
<Card width='full' maxWidth='450px'> | ||
<CardBody display='flex' flexDir='column' gap={8}> | ||
<Heading as='h4' fontSize='md' textAlign='center'> | ||
Choose which assets to trade | ||
</Heading> | ||
<Flex alignItems='center' gap={4} color='text.subtle' width='full'> | ||
<AssetSelection | ||
label='Deposit' | ||
onClick={handleFromAssetClick} | ||
assetIcon={BTCImage} | ||
assetName='Bitcoin' | ||
/> | ||
<IconButton variant='ghost' icon={switchIcon} aria-label='Switch assets' /> | ||
<AssetSelection | ||
label='Receive' | ||
onClick={handleToAssetClick} | ||
assetIcon={ETHImage} | ||
assetName='Ethereum' | ||
/> | ||
</Flex> | ||
<Button size='lg' colorScheme='blue' onClick={handleSubmit}> | ||
Continue | ||
</Button> | ||
</CardBody> | ||
</Card> | ||
) | ||
} |
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,169 @@ | ||
import { | ||
Avatar, | ||
Card, | ||
CardBody, | ||
CardFooter, | ||
CardHeader, | ||
Center, | ||
Collapse, | ||
Divider, | ||
Flex, | ||
IconButton, | ||
Input, | ||
InputGroup, | ||
InputRightElement, | ||
Stack, | ||
Tag, | ||
Text, | ||
useSteps, | ||
} from '@chakra-ui/react' | ||
import { useCallback, useMemo } from 'react' | ||
import { FaArrowDown, FaArrowRightArrowLeft, FaCheck, FaRegCopy } from 'react-icons/fa6' | ||
import { useCopyToClipboard } from 'hooks/useCopyToClipboard' | ||
import { BTCImage, ETHImage } from 'lib/const' | ||
|
||
import type { StepProps } from './components/StatusStepper' | ||
import { StatusStepper } from './components/StatusStepper' | ||
|
||
const steps: StepProps[] = [ | ||
{ | ||
title: 'Awaiting Deposit', | ||
icon: FaArrowDown, | ||
}, | ||
{ | ||
title: 'Awaiting Exchange', | ||
icon: FaArrowRightArrowLeft, | ||
}, | ||
{ | ||
title: 'Trade Complete', | ||
icon: FaCheck, | ||
}, | ||
] | ||
|
||
export const Status = () => { | ||
const { activeStep } = useSteps({ | ||
index: 0, | ||
count: steps.length, | ||
}) | ||
const CopyIcon = useMemo(() => <FaRegCopy />, []) | ||
const CheckIcon = useMemo(() => <FaCheck />, []) | ||
const { copyToClipboard: copyToAddress, isCopied: isToAddressCopied } = useCopyToClipboard({ | ||
timeout: 3000, | ||
}) | ||
const { copyToClipboard: copyDepositAddress, isCopied: isDepositAddressCopied } = | ||
useCopyToClipboard({ timeout: 3000 }) | ||
|
||
const handleCopyToAddress = useCallback(() => { | ||
copyToAddress('1234') | ||
}, [copyToAddress]) | ||
|
||
const handleCopyDepositAddress = useCallback(() => { | ||
copyDepositAddress('1234') | ||
}, [copyDepositAddress]) | ||
|
||
return ( | ||
<Card width='full' maxW='465px'> | ||
<CardHeader | ||
bg='background.surface.raised.base' | ||
display='flex' | ||
justifyContent='center' | ||
gap={1} | ||
borderTopRadius='xl' | ||
fontSize='sm' | ||
py={2} | ||
> | ||
<Text color='text.subtle'>TX ID</Text> | ||
<Text>0x124567</Text> | ||
</CardHeader> | ||
<Collapse in={activeStep === 0}> | ||
<CardBody display='flex' flexDir='row-reverse' gap={6} px={4}> | ||
<Flex flexDir='column' gap={4}> | ||
<Center boxSize='150px' bg='background.surface.raised.base' borderRadius='xl' /> | ||
<Tag colorScheme='green' size='sm' justifyContent='center'> | ||
Time remaining 06:23 | ||
</Tag> | ||
</Flex> | ||
<Stack spacing={4} flex={1}> | ||
<Stack> | ||
<Text fontWeight='bold'>Send</Text> | ||
<Flex alignItems='center' gap={2}> | ||
<Avatar size='sm' src={BTCImage} /> | ||
<Text>0.002 BTC</Text> | ||
</Flex> | ||
</Stack> | ||
<Stack> | ||
<Text fontWeight='bold'>To</Text> | ||
<InputGroup> | ||
<Input isReadOnly value='bc1q8n6t65jpm6k0...x7gl' /> | ||
<InputRightElement> | ||
<IconButton | ||
borderRadius='lg' | ||
size='sm' | ||
variant='ghost' | ||
icon={isToAddressCopied ? CheckIcon : CopyIcon} | ||
aria-label='Copy address' | ||
onClick={handleCopyToAddress} | ||
/> | ||
</InputRightElement> | ||
</InputGroup> | ||
</Stack> | ||
<Divider borderColor='border.base' /> | ||
<Stack> | ||
<Text fontWeight='bold'>You will receive</Text> | ||
<Flex gap={2} alignItems='center'> | ||
<Avatar size='xs' src={ETHImage} /> | ||
<Text>0.000158162 ETH</Text> | ||
</Flex> | ||
</Stack> | ||
</Stack> | ||
</CardBody> | ||
</Collapse> | ||
<StatusStepper steps={steps} activeStep={activeStep} /> | ||
<CardFooter | ||
flexDir='column' | ||
gap={4} | ||
px={4} | ||
bg='background.surface.raised.base' | ||
borderBottomRadius='xl' | ||
> | ||
<Text fontWeight='bold'>Order Details</Text> | ||
<Stack> | ||
<Flex width='full' justifyContent='space-between'> | ||
<Flex alignItems='center' gap={2}> | ||
<Avatar size='xs' src={BTCImage} /> | ||
<Text>Deposit</Text> | ||
</Flex> | ||
<Text color='text.subtle'>0.002 BTC</Text> | ||
</Flex> | ||
<Flex alignItems='center' gap={2}> | ||
<Text>bc1q8n6t65jpm6k048ejvwgfa69xp5laqr2sexx7gl</Text> | ||
<IconButton | ||
size='sm' | ||
variant='ghost' | ||
icon={isDepositAddressCopied ? CheckIcon : CopyIcon} | ||
aria-label='Copy deposit address' | ||
onClick={handleCopyDepositAddress} | ||
/> | ||
</Flex> | ||
</Stack> | ||
<Stack> | ||
<Flex width='full' justifyContent='space-between'> | ||
<Flex alignItems='center' gap={2}> | ||
<Avatar size='xs' src={ETHImage} /> | ||
<Text>Receive</Text> | ||
</Flex> | ||
<Text color='text.subtle'>0.00158162 ETH</Text> | ||
</Flex> | ||
<Flex alignItems='center' gap={2}> | ||
<Text>0x1234484844949494949</Text> | ||
</Flex> | ||
</Stack> | ||
<Divider borderColor='border.base' /> | ||
<Flex alignItems='center' justifyContent='space-between'> | ||
<Text>Estimated Rate</Text> | ||
<Text>1 BTC = 12.90126 ETH</Text> | ||
</Flex> | ||
</CardFooter> | ||
</Card> | ||
) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for a follow-up PR: bring caip package in