-
Notifications
You must be signed in to change notification settings - Fork 200
fix: address book baby #10803
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
Merged
Merged
fix: address book baby #10803
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
e0aa2ab
feat: new mobile send flow
NeOMakinG 18c9102
fix: finish amount screen
NeOMakinG 05fa17f
fix: send details
NeOMakinG 6a44104
fix: finish betweek quote
NeOMakinG 5a59b81
fix: hnnng desktop hnnng
NeOMakinG d581be6
fix: review feedbacks
NeOMakinG 214f0d9
Merge branch 'develop' into send-flow-mobile
NeOMakinG cc3d2b1
fix: address book babt
NeOMakinG 54a7b3e
fix: qr code and default asset route
NeOMakinG 09cb446
Merge branch 'send-flow-mobile' of github.com:shapeshift/web into sen…
NeOMakinG d43913b
Merge branch 'send-flow-mobile' into address-book
NeOMakinG 957ff34
fix: continue
NeOMakinG e514817
fix: review feedbacks
NeOMakinG e82c56b
Merge remote-tracking branch 'origin/develop' into address-book
NeOMakinG 92c20c1
fix: review feedbacks
NeOMakinG f07dd93
fix: review feedbacks
NeOMakinG cb2e498
fix: review feedbacks
NeOMakinG 5b34a3f
fix: review feedbacks
NeOMakinG 71a9ecd
fix: review feedbacks
NeOMakinG 9a979c3
fix: review feedbacks
NeOMakinG 8373ce2
fix: feature flag
NeOMakinG 49c93da
fix: review feedbacks
NeOMakinG 4f90c09
fix: review feedbacks
NeOMakinG 58ff44f
fix: address CodeRabbit review comments
NeOMakinG 526fb38
chore: run lint:fix
NeOMakinG f373009
fix: review feedbacks
NeOMakinG a73e838
fix: review feedbacks
NeOMakinG c58d3e8
fix: review feedbacks
NeOMakinG 5639b25
fix: review feedbacks
NeOMakinG 54f346b
fix: review feedbacks
NeOMakinG 6c10dc2
fix: review feedbacks
NeOMakinG 9e467f0
fix: review feedbacks
NeOMakinG ce0f677
fix: review feedbacks
NeOMakinG ee9c02e
Merge branch 'develop' into address-book
NeOMakinG 733f133
fix: review feedbacks
NeOMakinG 265fd63
fix: review feedbacks
NeOMakinG 3954bac
Merge branch 'develop' into address-book
NeOMakinG f0c87bb
fix: review feedbacks
NeOMakinG 07894f5
fix: review feedbacks
NeOMakinG bd63f10
Merge branch 'develop' into address-book
NeOMakinG 757a7dd
fix: review feedbacks
NeOMakinG 07c3424
fix: review feedbacks
NeOMakinG 4ed769c
fix: review feedbacks
NeOMakinG 97fd979
Merge branch 'develop' into address-book
NeOMakinG 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
fix: review feedbacks
- Loading branch information
commit a73e838503384cbfffdeabd84021619b08c0622b
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
85 changes: 85 additions & 0 deletions
85
src/components/Modals/Send/AddressBook/AddressBookEntryButton.tsx
This file contains hidden or 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,85 @@ | ||
| import { Avatar, Box, Button, HStack, Icon, Text as CText, VStack } from '@chakra-ui/react' | ||
| import { memo, useCallback } from 'react' | ||
| import { FaTrash } from 'react-icons/fa' | ||
|
|
||
| import { MiddleEllipsis } from '@/components/MiddleEllipsis/MiddleEllipsis' | ||
|
|
||
| type AddressBookEntryButtonProps = { | ||
| avatarUrl: string | ||
| label: string | ||
| address: string | ||
| entryKey: string | ||
| onSelect: (address: string) => void | ||
| onDelete: (key: string) => void | ||
| } | ||
|
|
||
| const addressSx = { | ||
| _hover: { | ||
| background: 'background.surface.raised.base', | ||
| }, | ||
| } | ||
|
|
||
| const deleteButtonSx = { | ||
| svg: { | ||
| width: '12px', | ||
| height: '12px', | ||
| }, | ||
| } | ||
|
|
||
| const AddressBookEntryButtonComponent = ({ | ||
| avatarUrl, | ||
| label, | ||
| address, | ||
| entryKey, | ||
| onSelect, | ||
| onDelete, | ||
| }: AddressBookEntryButtonProps) => { | ||
| const handleClick = useCallback(() => onSelect(address), [onSelect, address]) | ||
| const handleDelete = useCallback( | ||
| (key: string) => (e: React.MouseEvent<HTMLButtonElement>) => { | ||
| e.stopPropagation() | ||
| e.preventDefault() | ||
| onDelete(key) | ||
| }, | ||
| [onDelete], | ||
| ) | ||
|
|
||
| return ( | ||
| <Box | ||
| cursor='pointer' | ||
| alignItems='center' | ||
| justifyContent='space-between' | ||
| display='flex' | ||
| overflow='hidden' | ||
| width='full' | ||
| > | ||
| <HStack | ||
| px={2} | ||
| py={1} | ||
| borderRadius='lg' | ||
| spacing={3} | ||
| align='center' | ||
| flex={1} | ||
| minWidth={0} | ||
| onClick={handleClick} | ||
| transition='all 0.2s' | ||
| sx={addressSx} | ||
| me={2} | ||
| > | ||
| <Avatar src={avatarUrl} size='sm' flexShrink={0} /> | ||
| <VStack align='start' spacing={0} flex={1} minWidth={0}> | ||
| <CText fontSize='md' fontWeight='semibold' color='text.primary' lineHeight={1}> | ||
| {label} | ||
| </CText> | ||
| <MiddleEllipsis fontSize='sm' color='text.subtle' noOfLines={1} value={address} /> | ||
| </VStack> | ||
| </HStack> | ||
| <Button size='sm' onClick={handleDelete(entryKey)} sx={deleteButtonSx} flexShrink={0}> | ||
| <Icon as={FaTrash} boxSize={4} /> | ||
| </Button> | ||
| </Box> | ||
| ) | ||
| } | ||
|
|
||
| // Memoize to prevent re-renders when props haven't changed | ||
| export const AddressBookEntryButton = memo(AddressBookEntryButtonComponent) |
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.
Uh oh!
There was an error while loading. Please reload this page.