-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5969 from leather-io/release/bns-v2-send
Release/bns v2 send
- Loading branch information
Showing
21 changed files
with
1,073 additions
and
995 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
46 changes: 22 additions & 24 deletions
46
...-crypto-asset-form/components/recipient-fields/components/recipient-address-displayer.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,46 +1,44 @@ | ||
import { useCallback } from 'react'; | ||
|
||
import { SendCryptoAssetSelectors } from '@tests/selectors/send.selectors'; | ||
import { HStack, styled } from 'leather-styles/jsx'; | ||
import { motion } from 'framer-motion'; | ||
import { HStack } from 'leather-styles/jsx'; | ||
|
||
import { CopyIcon } from '@leather.io/ui'; | ||
import { AddressDisplayer, CopyIcon } from '@leather.io/ui'; | ||
|
||
import { analytics } from '@shared/utils/analytics'; | ||
|
||
import { useClipboard } from '@app/common/hooks/use-copy-to-clipboard'; | ||
import { BasicTooltip } from '@app/ui/components/tooltip/basic-tooltip'; | ||
import { useToast } from '@app/features/toasts/use-toast'; | ||
|
||
interface RecipientAddressDisplayerProps { | ||
address: string; | ||
} | ||
export function RecipientAddressDisplayer({ address }: RecipientAddressDisplayerProps) { | ||
const { onCopy, hasCopied } = useClipboard(address); | ||
const { onCopy } = useClipboard(address); | ||
const toast = useToast(); | ||
|
||
function copyToClipboard() { | ||
toast.success('Copied to clipboard!'); | ||
|
||
const copyToClipboard = useCallback(() => { | ||
void analytics.track('copy_recipient_bns_address_to_clipboard'); | ||
onCopy(); | ||
}, [onCopy]); | ||
} | ||
|
||
return ( | ||
<HStack mb="space.04" width="100%" px="space.04" mt="space.02"> | ||
<styled.span | ||
textStyle="caption.01" | ||
data-testid={SendCryptoAssetSelectors.RecipientBnsAddressLabel} | ||
> | ||
{address} | ||
</styled.span> | ||
{/** TODO: We need to persist the tooltip after it is clicked. | ||
Current implementation of radix-ui tooltip doesn't allow that, ref: https://github.com/radix-ui/primitives/issues/2029 */} | ||
<BasicTooltip label={hasCopied ? 'Copied!' : 'Copy address'} side="right" asChild> | ||
<styled.button | ||
_hover={{ cursor: 'pointer' }} | ||
data-testid={SendCryptoAssetSelectors.RecipientBnsAddressCopyToClipboard} | ||
onClick={copyToClipboard} | ||
<HStack mb="space.04" width="100%" mt="space.02"> | ||
<HStack onClick={copyToClipboard} cursor="pointer"> | ||
<AddressDisplayer | ||
data-testid={SendCryptoAssetSelectors.RecipientBnsAddressLabel} | ||
address={address} | ||
/> | ||
|
||
<motion.button | ||
type="button" | ||
whileTap={{ scale: 0.85 }} | ||
data-testid={SendCryptoAssetSelectors.RecipientBnsAddressCopyToClipboard} | ||
> | ||
<CopyIcon /> | ||
</styled.button> | ||
</BasicTooltip> | ||
</motion.button> | ||
</HStack> | ||
</HStack> | ||
); | ||
} |
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
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
4 changes: 2 additions & 2 deletions
4
...app/pages/send/send-crypto-asset-form/family/stacks/components/stacks-recipient-field.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,7 +1,7 @@ | ||
import { fetchNameOwner } from '@leather.io/query'; | ||
import { fetchStacksNameOwner } from '@leather.io/query'; | ||
|
||
import { RecipientField } from '../../../components/recipient-fields/recipient-field'; | ||
|
||
export function StacksRecipientField() { | ||
return <RecipientField bnsLookupFn={fetchNameOwner} />; | ||
return <RecipientField bnsLookupFn={fetchStacksNameOwner} />; | ||
} |
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
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
Oops, something went wrong.