Skip to content

Commit

Permalink
feat: always remain the value of the input when changing tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
VmMad committed Oct 11, 2023
1 parent 3e545fa commit 3d02885
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/shared/components/inputs/NftInput.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { Modal, SelectorInput, IOption, NftImageOrIconBox, NftSize } from 'shared/components'
import { INft, ownedNfts } from '@core/nfts'
import { ownedNfts } from '@core/nfts'
import { getNftByIdFromAllAccountNfts } from '@core/nfts'
import { selectedAccountIndex } from '@core/account'
import { localize } from '@core/i18n'
Expand All @@ -10,16 +10,17 @@
export let error: string = ''
export let readonly: boolean | null = null
let selectedNftById: INft | undefined
let modal: Modal = undefined
let inputElement: HTMLInputElement | undefined = undefined
let selected: IOption = selectedNftById ? { key: selectedNftById.name, value: selectedNftById.id } : {}
let modal: Modal = undefined
const selectedNftFromAccount = getNftByIdFromAllAccountNfts($selectedAccountIndex, nftId)
let selected: IOption | undefined = selectedNftFromAccount
? { key: selectedNftFromAccount.name, value: selectedNftFromAccount.id }
: { value: nftId }
const nftOptions: IOption[] = $ownedNfts
.filter((nft) => nft.isSpendable && (!nft.timelockTime || nft.timelockTime < $time.getTime()))
.map((_nft) => ({ key: _nft.name, value: _nft.id }))
$: selectedNftById = getNftByIdFromAllAccountNfts($selectedAccountIndex, nftId)
$: nftId = selected?.value
export async function validate(): Promise<void> {
Expand Down

0 comments on commit 3d02885

Please sign in to comment.