Skip to content
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

enhancement: nft send form improvements #5157

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
MarkNerdi996 marked this conversation as resolved.
Show resolved Hide resolved
>
<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