Skip to content

Commit

Permalink
svelte code organization
Browse files Browse the repository at this point in the history
  • Loading branch information
steezeburger committed Jan 23, 2024
1 parent 6bec3d8 commit 7b75124
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Svelte</title>
<title>RIA Faucet</title>
</head>
<body>
<div id="app"></div>
Expand Down
52 changes: 30 additions & 22 deletions web/src/Faucet.svelte
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
<script lang="ts">
import { onMount } from 'svelte'
import { getAddress } from '@ethersproject/address'
import { CloudflareProvider } from '@ethersproject/providers'
import { setDefaults as setToast, toast, ToastType } from 'bulma-toast'
import { ClaimRequest, getResData } from './api'
<script lang="ts" context="module">
import { setDefaults as setToast } from 'bulma-toast'
// config
document.title = `RIA Faucet`
setToast({
position: 'bottom-center',
dismissible: true,
pauseOnHover: true,
closeOnClick: false,
animate: { in: 'fadeIn', out: 'fadeOut' },
})
// types
type FaucetInfo = {
fundingAddress: string
rollupName: string
network: string
payout: number
}
let input = null
let faucetInfo: FaucetInfo = {
fundingAddress: '',
rollupName: '',
network: 'testnet',
payout: 1,
}
$: document.title = `RIA Faucet`
// utils
// get the rollup name from the url path, e.g. the burger in faucet.hostname.com/burger
function getRollupNameFromPath(): string {
let path = window.location.pathname
if (path[0] === '/') {
Expand All @@ -37,14 +36,23 @@
}
return path
}
</script>

setToast({
position: 'bottom-center',
dismissible: true,
pauseOnHover: true,
closeOnClick: false,
animate: { in: 'fadeIn', out: 'fadeOut' },
})
<script lang="ts">
import { onMount } from 'svelte'
import { getAddress } from '@ethersproject/address'
import { CloudflareProvider } from '@ethersproject/providers'
import { toast, ToastType } from 'bulma-toast'
import { ClaimRequest, getResData } from './api'
let input = null
let faucetInfo: FaucetInfo = {
fundingAddress: '',
rollupName: '',
network: 'testnet',
payout: 1,
}
onMount(async () => {
if (window.location.pathname === '/') {
Expand Down

0 comments on commit 7b75124

Please sign in to comment.