Skip to content

Commit

Permalink
fix(ceremony): save progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Swepool committed Sep 14, 2024
1 parent 61052b5 commit 44e75fd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
7 changes: 2 additions & 5 deletions ceremony/src/lib/components/Ceremony.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let addressValidState: ValidState = $state("PENDING")
<H1>Your position: <span class="text-union-accent-500">{contributor.queueState.position}</span></H1>
<H2>Queue length: <span class="text-union-accent-500">{contributor.queueState.count}</span></H2>

<!--Todo format time correctly-->
<!--Todo format time correctly if we want this, can probably be thousands of minutes?-->
<H3>Waiting time: <span class="text-union-accent-500">{contributor.queueState.estimatedTime} minutes</span> (est.).
</H3>

Expand All @@ -45,13 +45,10 @@ let addressValidState: ValidState = $state("PENDING")

{:else if contributor.state === 'contribute'}
<H1>Starting contribution...</H1>

{:else if contributor.state === 'contributing'}
<H1>Contributing...</H1>

{:else if contributor.state === 'verifying'}
<H1>Verifying your contribution...</H1>

{:else if contributor.state === 'contributed'}

<div class="flex flex-col justify-center items-center gap-4">
Expand All @@ -65,7 +62,7 @@ let addressValidState: ValidState = $state("PENDING")
<Install/>

{:else}
<H1>Loading...</H1>
<H1>Not able to contribute at this time</H1>
{/if}

</div>
Expand Down
10 changes: 9 additions & 1 deletion ceremony/src/lib/components/Join.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@ import H1 from "$lib/components/typography/H1.svelte"
import Button from "$lib/components/Button.svelte"
import Text from "$lib/components/typography/Text.svelte"
import { callJoinQueue } from "$lib/supabase"
import Spinner from "$lib/components/Spinner.svelte";
let code = $state("")
let loading = $state(false)
async function handleCode() {
loading = true
//Maybe check format etc
const codeValid = await callJoinQueue(code)
if (codeValid) {
console.log("valid")
}
}
async function joinWaitlist() {
loading = true
}
async function handleWaitlist() {}
</script>

Expand Down Expand Up @@ -47,4 +55,4 @@ async function handleWaitlist() {}

<Text>Or</Text>

<Button>Join the waitlist</Button>
<Button>Join the waitlist <Spinner /></Button>
2 changes: 2 additions & 0 deletions ceremony/src/lib/stores/state.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export class ContributorState {
console.log("Current contributionState:", this.contributionState)

if (this.contributionState === "contribute") {

switch (this.clientState) {
case "idle":
case "initializing":
Expand All @@ -254,6 +255,7 @@ export class ContributorState {
this.state = "contribute"
break
}

} else if (this.queueState.position !== null) {
this.state = "inQueue"
} else if (this.contributionState === "contributed") {
Expand Down
2 changes: 2 additions & 0 deletions ceremony/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ $effect(() => {
{#if contributor}
{#if contributor.loggedIn}
<Ceremony {contributor}/>

{:else if contributor.onWaitlist}
<H1>Your on the list</H1>
{:else}

<!--Do this if no code and no waitlist?-->
<Join />
{/if}
Expand Down

0 comments on commit 44e75fd

Please sign in to comment.