Skip to content

Commit

Permalink
enhancement: nft send form improvements (#5157)
Browse files Browse the repository at this point in the history
* enhancement: hide nft tab if wallet owns no nft

* fix: fix title on send confirmation

* enhancement: remove nft preview on send form

* enhancement: remove shimmer EVM from network list

* chore: remove shimmer evm

* fix: fix send popups titles
  • Loading branch information
MarkNerdi996 committed Nov 7, 2022
1 parent 82b2e9b commit 7733ecc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
Expand Up @@ -44,7 +44,6 @@
export let _onMount: (..._: any[]) => Promise<void> = async () => {}
export let disableBack = false
export let tokenSend = false
let { recipient, expirationDate, giftStorageDeposit, surplus, disableChangeExpiration, disableToggleGift } =
get(newTransactionDetails)
Expand Down Expand Up @@ -181,7 +180,7 @@

<send-confirmation-popup class="w-full h-full space-y-6 flex flex-auto flex-col flex-shrink-0">
<Text type={TextType.h3} fontWeight={FontWeight.semibold} classes="text-left"
>{localize(tokenSend ? 'popups.transaction.title' : 'popups.sendNft.confirmationTitle')}</Text
>{localize('popups.transaction.title')}</Text
>
<div class="w-full flex-col space-y-2">
{#if transactionDetails.type === NewTransactionType.TokenTransfer}
Expand Down
20 changes: 8 additions & 12 deletions packages/shared/components/popups/send/SendFormPopup.svelte
Expand Up @@ -9,18 +9,11 @@
NewTransactionType,
setNewTransactionDetails,
} from '@core/wallet'
import {
RecipientInput,
AssetAmountInput,
OptionalInput,
NetworkInput,
NftInput,
NftMediaSize,
NftMediaContainer,
} from 'shared/components'
import { RecipientInput, AssetAmountInput, OptionalInput, NetworkInput, NftInput } from 'shared/components'
import { DestinationNetwork } from '@core/network'
import { getByteLengthOfString } from '@core/utils'
import { get } from 'svelte/store'
import { selectedAccount } from '@core/account'
enum SendForm {
SendToken = 'general.sendToken',
Expand Down Expand Up @@ -54,6 +47,8 @@
let activeTab: SendForm =
transactionDetails.type === NewTransactionType.TokenTransfer ? SendForm.SendToken : SendForm.SendNft
$: ownsNfts = $selectedAccount.balances.nfts.length > 0
function getTransactionDetails(): NewTransactionDetails {
if (activeTab === SendForm.SendToken) {
return {
Expand Down Expand Up @@ -122,14 +117,15 @@

<send-form-popup class="w-full h-full space-y-6 flex flex-auto flex-col flex-shrink-0">
<Text type={TextType.h3} fontWeight={FontWeight.semibold} classes="text-left">
{localize('general.sendAsset')}
{localize('popups.transaction.title')}
</Text>
<Tabs bind:activeTab {tabs} />
{#if ownsNfts}
<Tabs bind:activeTab {tabs} />
{/if}
<send-form-inputs class="flex flex-col space-y-4">
{#if activeTab === SendForm.SendToken}
<AssetAmountInput bind:this={assetAmountInput} bind:asset bind:rawAmount bind:unit />
{:else}
<NftMediaContainer {nftId} size={NftMediaSize.Medium} />
<NftInput bind:nftId />
{/if}
<NetworkInput bind:network />
Expand Down
Expand Up @@ -3,10 +3,10 @@ import { DestinationNetwork, NetworkType } from '../enums'
export const NETWORK_ADDRESS: Readonly<{ [key in NetworkType]?: { [key in DestinationNetwork]?: string } }> = {
[NetworkType.Mainnet]: {
[DestinationNetwork.Shimmer]: '-',
[DestinationNetwork.ShimmerEvm]: 'TO_DO',
// [DestinationNetwork.ShimmerEvm]: 'TO_DO',
},
[NetworkType.Devnet]: {
[DestinationNetwork.Shimmer]: '-',
[DestinationNetwork.ShimmerEvm]: 'rms1qrut5ajyfrtgjs325kd9chwfwyyy2z3fewy4vgy0vvdtf2pr8prg5u3zwjn',
// [DestinationNetwork.ShimmerEvm]: 'rms1qrut5ajyfrtgjs325kd9chwfwyyy2z3fewy4vgy0vvdtf2pr8prg5u3zwjn',
},
}
@@ -1,4 +1,4 @@
export enum DestinationNetwork {
Shimmer = 'Shimmer',
ShimmerEvm = 'Shimmer EVM',
// ShimmerEvm = 'Shimmer EVM',
}
3 changes: 1 addition & 2 deletions packages/shared/locales/en.json
Expand Up @@ -726,7 +726,7 @@
"userPath": "User Path"
},
"transaction": {
"title": "Confirm transaction",
"title": "Send asset",
"body": "You’re about to send {amount} to",
"surplusIncluded": "This transaction contains a surplus amount. Please double check this is the amount you want to send.",
"sendingFromStakedAccount": "You are sending a transfer from a wallet that is currently being staked. This may unstake your tokens. Feel free to send the transfer but you may need to restake your remaining tokens afterwards.",
Expand Down Expand Up @@ -1141,7 +1141,6 @@
"sendFunds": "Send funds",
"sendTokensToAddress": "Send tokens to an address",
"sendToAddress": "Send to address",
"sendAsset": "Send asset",
"sendToken": "Send token",
"sendNft": "Send NFT",
"sendNftToAddress": "Send NFT to an address",
Expand Down

0 comments on commit 7733ecc

Please sign in to comment.