|
1 | 1 | <script lang="ts"> |
2 | 2 | import PingPongLogo from '$lib/components/PingPongLogo.svelte'; |
3 | | - import { Button, P, InputAddon, Input, Helper, Heading, ButtonGroup } from 'flowbite-svelte'; |
| 3 | + import { Button, InputAddon, Input, Heading, ButtonGroup } from 'flowbite-svelte'; |
4 | 4 | import { EnvelopeSolid } from 'flowbite-svelte-icons'; |
5 | 5 | import { writable } from 'svelte/store'; |
6 | 6 | import { fail } from '@sveltejs/kit'; |
|
10 | 10 |
|
11 | 11 | export let form; |
12 | 12 | const forward = $page.url.searchParams.get('forward') || '/'; |
| 13 | + const expired = $page.url.searchParams.get('expired') === 'true' || false; |
| 14 | + const new_link = $page.url.searchParams.get('new_link') === 'true' || false; |
13 | 15 | const loggingIn = writable(false); |
14 | 16 | const success = writable(false); |
15 | 17 | const loginWithMagicLink = async (evt: SubmitEvent) => { |
|
41 | 43 | <header class="bg-blue-dark-40 px-5 md:px-12 py-8"> |
42 | 44 | <Heading tag="h1" class="logo w-full text-center"><PingPongLogo size="full" /></Heading> |
43 | 45 | </header> |
44 | | - <div class="px-5 md:px-12 py-16 bg-white"> |
| 46 | + <div class="px-5 md:px-12 pb-16 pt-10 bg-white"> |
45 | 47 | {#if $success} |
46 | | - <div class="text-orange">Success! Follow the link in your email to finish signing in.</div> |
| 48 | + <div class="text-4xl text-center font-serif font-bold mt-5 mb-2 text-blue-dark-50"> |
| 49 | + Success! |
| 50 | + </div> |
| 51 | + <div class="text-lg text-center">Follow the link in your email to finish signing in.</div> |
| 52 | + {:else if new_link} |
| 53 | + <div class="text-4xl text-center font-serif font-bold mt-5 mb-4 text-blue-dark-50"> |
| 54 | + Let's try this again. |
| 55 | + </div> |
| 56 | + <div class="text-lg text-center"> |
| 57 | + This log-in link isn't currently valid.<br />We sent a new link to your email. |
| 58 | + </div> |
47 | 59 | {:else} |
| 60 | + <div class="mb-6"> |
| 61 | + {#if expired} |
| 62 | + <div class="text-4xl text-center font-serif font-bold mb-2 text-blue-dark-50"> |
| 63 | + Let's try this again. |
| 64 | + </div> |
| 65 | + <div class="text-lg text-center"> |
| 66 | + This log-in link isn't currently valid.<br />Try logging in with your school email |
| 67 | + address again. |
| 68 | + </div> |
| 69 | + {:else} |
| 70 | + <div class="text-4xl text-center font-serif font-bold mb-2 text-blue-dark-50"> |
| 71 | + {form?.error ? 'We could not sign you in.' : 'Welcome to PingPong'} |
| 72 | + </div> |
| 73 | + <div class="text-lg text-center"> |
| 74 | + {form?.error |
| 75 | + ? 'Please make sure you are using the correct email address and try again.' |
| 76 | + : 'Use your school email address to log in.'} |
| 77 | + </div> |
| 78 | + {/if} |
| 79 | + </div> |
48 | 80 | <form on:submit={loginWithMagicLink}> |
49 | 81 | <ButtonGroup class="w-full rounded-full bg-blue-light-50 shadow-inner p-4"> |
50 | | - <InputAddon class="rounded-none border-none bg-transparent text-blue-light-40"> |
| 82 | + <InputAddon class="rounded-none border-none bg-transparent text-blue-dark-30"> |
51 | 83 | <EnvelopeSolid /> |
52 | 84 | </InputAddon> |
53 | 85 | <Input |
|
57 | 89 | placeholder="you@school.edu" |
58 | 90 | name="email" |
59 | 91 | id="email" |
60 | | - class="bg-transparent border-none" |
| 92 | + class="bg-transparent border-none text-md" |
61 | 93 | ></Input> |
62 | 94 | <Button |
63 | 95 | pill |
64 | | - class="p-3 px-6 mr-2 rounded-full bg-orange text-white hover:bg-orange-dark" |
| 96 | + class="p-3 px-6 mr-2 rounded-full bg-orange-dark hover:bg-orange text-white text-md py-2 px-4" |
65 | 97 | type="submit" |
66 | 98 | disabled={$loggingIn}>Login</Button |
67 | 99 | > |
68 | 100 | </ButtonGroup> |
69 | | - {#if form?.error} |
70 | | - <div class="p-2"> |
71 | | - <P class="text-orange">We could not sign you in.</P> |
72 | | - <P class="text-orange" |
73 | | - >Please make sure you are using the correct email address and try again. |
74 | | - </P> |
75 | | - </div> |
76 | | - {:else} |
77 | | - <Helper class="my-2 text-black text-sm">Log in with your school email address.</Helper> |
78 | | - {/if} |
79 | 101 | </form> |
80 | 102 | {/if} |
81 | 103 | </div> |
|
0 commit comments