-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bridge-ui): tooltips, bug fix, general UI enhancements (#462)
- Loading branch information
1 parent
c373194
commit 846a18d
Showing
42 changed files
with
1,083 additions
and
452 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<script lang="ts"> | ||
import { ethers } from "ethers"; | ||
import { HORSE } from "../domain/token"; | ||
import { pendingTransactions } from "../store/transactions"; | ||
import { signer } from "../store/signer"; | ||
import { errorToast, successToast } from "../utils/toast"; | ||
import { _ } from "svelte-i18n"; | ||
import { Funnel } from "svelte-heros-v2"; | ||
import MintableERC20 from "../constants/abi/MintableERC20"; | ||
import { fromChain } from "../store/chain"; | ||
import { switchNetwork } from "@wagmi/core"; | ||
import { CHAIN_MAINNET } from "../domain/chain"; | ||
import Tooltip from "./Tooltip.svelte"; | ||
import TooltipModal from "./modals/TooltipModal.svelte"; | ||
import { token } from "../store/token"; | ||
export let onMint: () => Promise<void>; | ||
let tooltipOpen: boolean = false; | ||
async function mint() { | ||
try { | ||
if ($fromChain.id !== HORSE.addresses[0].chainId) { | ||
await switchNetwork({ | ||
chainId: CHAIN_MAINNET.id, | ||
}); | ||
} | ||
const contract = new ethers.Contract( | ||
HORSE.addresses[0].address, | ||
MintableERC20, | ||
$signer | ||
); | ||
const tx = await contract.mint(ethers.utils.parseEther("1000")); | ||
pendingTransactions.update((store) => { | ||
store.push(tx); | ||
return store; | ||
}); | ||
successToast($_("toast.transactionSent")); | ||
await $signer.provider.waitForTransaction(tx.hash, 1); | ||
await onMint(); | ||
} catch (e) { | ||
console.log(e); | ||
errorToast($_("toast.errorSendingTransaction")); | ||
} | ||
} | ||
</script> | ||
|
||
<button class="btn" on:click={mint}> | ||
<Funnel class="mr-2" /> Faucet | ||
</button> | ||
<Tooltip /> | ||
|
||
<TooltipModal title="{$token.symbol} Faucet" bind:isOpen={tooltipOpen}> | ||
<span slot="body"> | ||
<p class="text-left"> | ||
You can request 1000 {$token.symbol}. {$token.symbol} is only available to | ||
be minted on Ethereum A1. If you are on Taiko A1, your network will be changed | ||
first. You must have a small amount of ether in your Ethereum A1 wallet to | ||
send the transaction. | ||
</p> | ||
</span> | ||
</TooltipModal> |
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,21 +1,21 @@ | ||
<script lang="ts"> | ||
import Connect from "./buttons/Connect.svelte"; | ||
import Logo from "./icons/Logo.svelte"; | ||
import TaikoLogo from "./icons/TaikoLogo.svelte"; | ||
import { signer } from "../store/signer"; | ||
import AddressDropdown from "./AddressDropdown.svelte"; | ||
import ChainDropdown from "./ChainDropdown.svelte"; | ||
</script> | ||
|
||
<nav class="navbar mb-4 md:h-[125px] pt-4 md:pt-0 md:px-4 w-full"> | ||
<div class="navbar-end justify-start"> | ||
<Logo /> | ||
<div class="navbar bg-base-100"> | ||
<div class="flex-1"> | ||
<TaikoLogo width={120} /> | ||
</div> | ||
<div class="navbar-end"> | ||
<div class="flex-none"> | ||
{#if $signer} | ||
<ChainDropdown /> | ||
<AddressDropdown /> | ||
{:else} | ||
<Connect /> | ||
{/if} | ||
</div> | ||
</nav> | ||
</div> |
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,11 @@ | ||
<script lang="ts"> | ||
import { QuestionMarkCircle } from "svelte-heros-v2"; | ||
export let isOpen: boolean = false; | ||
</script> | ||
|
||
<QuestionMarkCircle | ||
on:click={() => (isOpen = true)} | ||
size="18" | ||
variation="outline" | ||
/> |
Oops, something went wrong.