generated from ChainSafe/yarn-workspaces-typescript-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Just a bit improved POC https://e533c10e.gopher-poc.pages.dev
- Loading branch information
Showing
13 changed files
with
800 additions
and
1,041 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,18 @@ | ||
<script lang="ts"> | ||
import { getModalStore, type ModalSettings } from '@skeletonlabs/skeleton'; | ||
import Web3Modal from '$lib/components/Web3Modal.svelte'; | ||
const modalStore = getModalStore(); | ||
function handleConnect() { | ||
const modal: ModalSettings = { | ||
type: 'component', | ||
component: { ref: Web3Modal }, | ||
title: 'Select wallet', | ||
buttonTextCancel: 'close' | ||
}; | ||
modalStore.trigger(modal); | ||
} | ||
</script> | ||
|
||
<button class="btn variant-filled" on:click={handleConnect}> Connect Wallet </button> |
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
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 |
---|---|---|
@@ -1,5 +1,51 @@ | ||
<script lang="ts"> | ||
import { connect } from '$lib/stores/wallet'; | ||
import type { SvelteComponent } from 'svelte'; | ||
import { getModalStore } from '@skeletonlabs/skeleton'; | ||
import { providers, selectedProvider } from '$lib/stores/wallet'; | ||
import type { EIP6963ProviderDetail } from 'mipd'; | ||
// Props | ||
/** Exposes parent props to this component. */ | ||
export let parent: SvelteComponent; | ||
const modalStore = getModalStore(); | ||
function selectWallet(provider: EIP6963ProviderDetail): void { | ||
selectedProvider.set(provider); | ||
modalStore.close(); | ||
} | ||
// Base Classes | ||
const cBase = 'card p-4 w-modal shadow-xl space-y-4'; | ||
const cHeader = 'text-2xl font-bold'; | ||
</script> | ||
|
||
<button class="btn variant-filled" on:click={() => connect()}> Connect Wallet </button> | ||
{#if $modalStore[0]} | ||
<div class="modal-example-form {cBase}"> | ||
<header class={cHeader}>{$modalStore[0].title ?? '(title missing)'}</header> | ||
<article class="container mx-auto p-4"> | ||
<ul class="space-y-4"> | ||
{#each $providers as provider} | ||
<li | ||
on:click={() => selectWallet(provider)} | ||
class="relative bg-white dark:bg-gray-800 p-4 rounded-lg shadow hover:bg-gray-100 dark:hover:bg-gray-700 hover:shadow-lg transition duration-300 flex items-center cursor-pointer" | ||
> | ||
<img src={provider.info.icon} alt="{provider.info.icon} Icon" class="w-12 h-12 mr-4" /> | ||
<div> | ||
<h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100"> | ||
{provider.info.name} | ||
</h3> | ||
<p class="text-gray-600 dark:text-gray-400">{provider.info.rdns}</p> | ||
</div> | ||
</li> | ||
{/each} | ||
</ul> | ||
</article> | ||
<footer class="modal-footer {parent.regionFooter}"> | ||
<button class="btn {parent.buttonNeutral}" on:click={parent.onClose} | ||
>{parent.buttonTextCancel}</button | ||
> | ||
</footer> | ||
</div> | ||
{/if} |
Oops, something went wrong.