-
Notifications
You must be signed in to change notification settings - Fork 6
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 #542 from rainlanguage/2024-04-04-top-connect-button
move `connect to wallet` button to sidebar
- Loading branch information
Showing
6 changed files
with
97 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<script lang="ts"> | ||
import { Button, Modal } from 'flowbite-svelte'; | ||
import InputLedgerWallet from '$lib/components/InputLedgerWallet.svelte'; | ||
import { ledgerWalletDerivationIndex, ledgerWalletAddress } from '$lib/stores/wallets'; | ||
import InputWalletConnect from '$lib/components/InputWalletConnect.svelte'; | ||
import IconLedger from '$lib/components/IconLedger.svelte'; | ||
import IconWalletConnect from '$lib/components/IconWalletConnect.svelte'; | ||
import { walletconnectAccount } from '$lib/stores/walletconnect'; | ||
let open = false; | ||
let selectedLedger = false; | ||
let selectedWalletconnect = false; | ||
$: walletconnectLabel = $walletconnectAccount | ||
? `${$walletconnectAccount.slice(0, 5)}...${$walletconnectAccount.slice(-5)}` | ||
: 'Connect to Wallet'; | ||
function reset() { | ||
open = false; | ||
selectedLedger = false; | ||
selectedWalletconnect = false; | ||
} | ||
</script> | ||
|
||
<div class="flex w-full w-full flex-col py-4"> | ||
<Button color="primary" on:click={() => (open = true)}>{walletconnectLabel}</Button> | ||
</div> | ||
|
||
<Modal title="Connect to Wallet" bind:open outsideclose size="sm" on:close={reset}> | ||
{#if !selectedLedger && !selectedWalletconnect && !$walletconnectAccount} | ||
<div class="flex justify-center space-x-4"> | ||
<Button class="text-lg" on:click={() => (selectedLedger = true)}> | ||
<div class="mr-4"> | ||
<IconLedger /> | ||
</div> | ||
Ledger Wallet | ||
</Button> | ||
<Button class="text-lg" on:click={() => (selectedWalletconnect = true)}> | ||
<div class="mr-3"> | ||
<IconWalletConnect /> | ||
</div> | ||
WalletConnect | ||
</Button> | ||
</div> | ||
{:else if selectedLedger} | ||
<InputLedgerWallet | ||
bind:derivationIndex={$ledgerWalletDerivationIndex} | ||
bind:walletAddress={$ledgerWalletAddress.value} | ||
/> | ||
<div class="flex justify-end space-x-4"> | ||
<Button color="alternative" on:click={() => (selectedLedger = false)}>Back</Button> | ||
</div> | ||
{:else if selectedWalletconnect || $walletconnectAccount} | ||
<InputWalletConnect /> | ||
{#if !$walletconnectAccount} | ||
<div class="flex justify-end space-x-4"> | ||
<Button color="alternative" on:click={() => (selectedWalletconnect = false)}>Back</Button> | ||
</div> | ||
{/if} | ||
{/if} | ||
</Modal> |
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