mirror of https://github.com/hykilpikonna/AquaDX
[+] Add a verify email state, state switching animation
parent
133140bf71
commit
17ee24286c
|
@ -1,11 +1,12 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Turnstile } from "svelte-turnstile";
|
import { Turnstile } from "svelte-turnstile";
|
||||||
|
import { slide } from 'svelte/transition';
|
||||||
import { TURNSTILE_SITE_KEY } from "../libs/config";
|
import { TURNSTILE_SITE_KEY } from "../libs/config";
|
||||||
import Icon from "@iconify/svelte";
|
import Icon from "@iconify/svelte";
|
||||||
import { login, register } from "../libs/sdk";
|
import { login, register } from "../libs/sdk";
|
||||||
|
|
||||||
let showLogin = false
|
let state = "verify"
|
||||||
let isSignup = false
|
$: isSignup = state === "signup"
|
||||||
let submitting = false
|
let submitting = false
|
||||||
|
|
||||||
let email = ""
|
let email = ""
|
||||||
|
@ -44,7 +45,8 @@
|
||||||
submitting = false
|
submitting = false
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO: Show verify email message
|
// Show verify email message
|
||||||
|
state = 'verify'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Send request to server
|
// Send request to server
|
||||||
|
@ -53,6 +55,8 @@
|
||||||
error = e.message
|
error = e.message
|
||||||
submitting = false
|
submitting = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO: Redirect to home page
|
||||||
}
|
}
|
||||||
|
|
||||||
submitting = false
|
submitting = false
|
||||||
|
@ -63,17 +67,17 @@
|
||||||
<main id="home" class="no-margin">
|
<main id="home" class="no-margin">
|
||||||
<div>
|
<div>
|
||||||
<h1 id="title">AquaNet</h1>
|
<h1 id="title">AquaNet</h1>
|
||||||
{#if !showLogin}
|
{#if state === "home"}
|
||||||
<div class="btn-group">
|
<div class="btn-group" transition:slide>
|
||||||
<button on:click={() => showLogin = true}>Log in</button>
|
<button on:click={() => state = 'login'}>Log in</button>
|
||||||
<button on:click={() => showLogin = isSignup = true}>Sign up</button>
|
<button on:click={() => state = 'signup'}>Sign up</button>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else if state === "login" || state === "signup"}
|
||||||
<div class="login-form">
|
<div class="login-form" transition:slide>
|
||||||
{#if error}
|
{#if error}
|
||||||
<span class="error">{error}</span>
|
<span class="error">{error}</span>
|
||||||
{/if}
|
{/if}
|
||||||
<div on:click={() => showLogin = isSignup = false} on:keypress={() => showLogin = isSignup = false}
|
<div on:click={() => state = 'home'} on:keypress={() => state = 'home'}
|
||||||
role="button" tabindex="0" class="clickable">
|
role="button" tabindex="0" class="clickable">
|
||||||
<Icon icon="line-md:chevron-small-left" />
|
<Icon icon="line-md:chevron-small-left" />
|
||||||
<span>Back</span>
|
<span>Back</span>
|
||||||
|
@ -96,6 +100,11 @@
|
||||||
on:turnstile-expired={_ => window.location.reload()}
|
on:turnstile-expired={_ => window.location.reload()}
|
||||||
on:turnstile-timeout={_ => console.log(error = "Network verification timed out. Please try again.")} />
|
on:turnstile-timeout={_ => console.log(error = "Network verification timed out. Please try again.")} />
|
||||||
</div>
|
</div>
|
||||||
|
{:else if state === "verify"}
|
||||||
|
<div class="login-form" transition:slide>
|
||||||
|
<span>A verification email has been sent to {email}. Please check your inbox!</span>
|
||||||
|
<button on:click={() => state = 'home'}>Back</button>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -137,13 +146,17 @@
|
||||||
|
|
||||||
margin-top: -$nav-height
|
margin-top: -$nav-height
|
||||||
|
|
||||||
|
// Content container
|
||||||
> div
|
> div
|
||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
align-items: flex-start
|
align-items: flex-start
|
||||||
gap: 16px
|
|
||||||
width: max-content
|
width: max-content
|
||||||
|
|
||||||
|
// Switching state container
|
||||||
|
> div
|
||||||
|
transition: opacity 0.3s
|
||||||
|
|
||||||
#title
|
#title
|
||||||
font-family: Quicksand, $font
|
font-family: Quicksand, $font
|
||||||
user-select: none
|
user-select: none
|
||||||
|
@ -151,7 +164,7 @@
|
||||||
// Gap between text characters
|
// Gap between text characters
|
||||||
letter-spacing: 12px
|
letter-spacing: 12px
|
||||||
margin-top: 0
|
margin-top: 0
|
||||||
margin-bottom: 16px
|
margin-bottom: 32px
|
||||||
opacity: 0.9
|
opacity: 0.9
|
||||||
|
|
||||||
.btn-group
|
.btn-group
|
||||||
|
|
Loading…
Reference in New Issue