Skip to content

Commit

Permalink
style: linted
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Jul 26, 2023
1 parent f6e9e85 commit 7a8456b
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 45 deletions.
32 changes: 16 additions & 16 deletions src/components/elements/input/token/selector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@
filteredTokens = tokenOptions
} else {
filteredTokens =
($tokens &&
$tokens.filter((token) => {
const blockchainMatches = token.chainId.equals($activeBlockchain.chainId)
const queryExists = query.length === 0
const queryMatches = String(token.name)
.toLowerCase()
.includes(query.toLowerCase())
return blockchainMatches && (queryExists || queryMatches)
})) ||
[]
($tokens &&
$tokens.filter((token) => {
const blockchainMatches = token.chainId.equals($activeBlockchain.chainId)
const queryExists = query.length === 0
const queryMatches = String(token.name)
.toLowerCase()
.includes(query.toLowerCase())
return blockchainMatches && (queryExists || queryMatches)
})) ||
[]
}
}
</script>

Expand Down Expand Up @@ -183,14 +182,15 @@
</Modal>

{#if selectedToken}
<TokenSelectorRow onClick={() => ($displayModal = true)} token={selectedToken || defaultToken} />
<TokenSelectorRow
onClick={() => ($displayModal = true)}
token={selectedToken || defaultToken}
/>
{:else}
<div class="placeholder" on:click={() => ($displayModal = true)}>
<span class="text-container">
Select Token
</span>
<span class="text-container"> Select Token </span>
<div class="arrow-container">
<Icon name="chevron-right" size="large" />
</div>
</div>
</div>
{/if}
3 changes: 2 additions & 1 deletion src/components/elements/input/token/selector/row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
if (token.balance) {
balance = token.balance
} else {
balance = $balances && $balances.find((balance) => balance.tokenKey === token.key)?.quantity
balance =
$balances && $balances.find((balance) => balance.tokenKey === token.key)?.quantity
}
if (balance) {
Expand Down
26 changes: 10 additions & 16 deletions src/pages/evm/swap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import Confirm from './swap/confirm.svelte'
import Success from './swap/success.svelte'
import Error from './swap/error.svelte'
import type { Token } from '~/stores/tokens'
import type {Token} from '~/stores/tokens'
type AccountType = 'Native' | 'EVM'
Expand Down Expand Up @@ -63,8 +63,8 @@
step = 'confirm'
}
let connectInterval: number | undefined;
let connectingToEvmWallet = false;
let connectInterval: number | undefined
let connectingToEvmWallet = false
async function connectEvmWallet() {
let ethWalletAccount
Expand All @@ -73,7 +73,7 @@
return
}
connectingToEvmWallet = true;
connectingToEvmWallet = true
try {
ethWalletAccount = await connectEthWallet()
Expand All @@ -85,21 +85,21 @@
}
if (!e.message) {
return connectingToEvmWallet = false;
return (connectingToEvmWallet = false)
}
return (errorMessage = `Could not connect to ETH wallet. Error: ${e.message}`)
}
if (ethWalletAccount) {
evmAccount.set(ethWalletAccount)
connectInterval && clearInterval(connectInterval);
connectingToEvmWallet = false;
connectInterval && clearInterval(connectInterval)
connectingToEvmWallet = false
}
}
connectInterval = window.setInterval(connectEvmWallet, 3000);
connectEvmWallet();
connectInterval = window.setInterval(connectEvmWallet, 3000)
connectEvmWallet()
</script>

<style type="scss">
Expand All @@ -116,13 +116,7 @@
{:else if step === 'form' || !from || !to}
<Form handleContinue={submitForm} bind:amount bind:from bind:to />
{:else if step === 'confirm'}
<Confirm
{amount}
{from}
{to}
handleConfirm={transfer}
{handleBack}
/>
<Confirm {amount} {from} {to} handleConfirm={transfer} {handleBack} />
{:else if (step === 'success' && nativeTransactResult) || evmTransactResult}
<Success {from} {to} {nativeTransactResult} {evmTransactResult} {handleBack} />
{/if}
Expand Down
7 changes: 4 additions & 3 deletions src/pages/evm/swap/confirm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import Button from '~/components/elements/button.svelte'
import {evmAccount, activeSession} from '~/store'
import type { Token } from '~/stores/tokens'
import type {Token} from '~/stores/tokens'
export let from: Token
export let to: Token
Expand Down Expand Up @@ -51,7 +51,7 @@
margin: auto;
}
/* Media Query for Mobile */
/* Media Query for Mobile */
@media screen and (max-width: 768px) {
padding: 1em;
Expand All @@ -78,7 +78,8 @@
<table>
<tr>
<td>From {from.name}</td>
<td>{from?.name === 'EOS (EVM)' ? $evmAccount?.address : $activeSession?.auth.actor}</td>
<td>{from?.name === 'EOS (EVM)' ? $evmAccount?.address : $activeSession?.auth.actor}</td
>
</tr>
<tr>
<td>To {to.name}</td>
Expand Down
15 changes: 8 additions & 7 deletions src/pages/evm/swap/form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
}
}
/* Media Query for Mobile */
/* Media Query for Mobile */
@media screen and (max-width: 768px) {
flex-direction: column;
Expand Down Expand Up @@ -167,7 +167,7 @@
selectedToken={from}
tokenOptions={fromOptions}
/>
</div>
</div>
<Label align="left">Amount</Label>
<Asset
fluid
Expand All @@ -190,13 +190,14 @@
</div>
</div>
<div class="bottom-section">
<Button fluid style="primary" disabled={!from || !to || !validAmount || !$evmAccount} on:action={onContinue}
>Continue</Button
<Button
fluid
style="primary"
disabled={!from || !to || !validAmount || !$evmAccount}
on:action={onContinue}>Continue</Button
>
{#if !$evmAccount}
<h3>
Connect to metamask wallet to continue
</h3>
<h3>Connect to metamask wallet to continue</h3>
{/if}
</div>
</Form>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/evm/swap/success.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type {ethers} from 'ethers'
import {activeBlockchain} from '~/store'
import type { Token } from '~/stores/tokens'
import type {Token} from '~/stores/tokens'
export let from: Token
export let to: Token
Expand Down Expand Up @@ -49,7 +49,7 @@
gap: 1em;
}
/* Media Query for Mobile */
/* Media Query for Mobile */
@media screen and (max-width: 768px) {
padding: 1em;
Expand Down

0 comments on commit 7a8456b

Please sign in to comment.