generated from ChainSafe/yarn-workspaces-typescript-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: improved web poc #4
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
387ad04
refactor wallet select
BeroBurny 6cfef73
something
BeroBurny faf3db6
prettfy listing transactions
BeroBurny e2fffa4
submit TX action
BeroBurny cd1f3c0
fix formating
BeroBurny 47025d0
fix light theme
BeroBurny 198b76a
smoll pactch
BeroBurny 7022475
error handling
BeroBurny baa6330
added approval flow
BeroBurny d15ce07
smoll fixes
BeroBurny b73a44e
smoll fixes
BeroBurny e1fa479
Merge remote-tracking branch 'origin/beroburny/improved-web-poc' into…
BeroBurny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use
optional chaining operator