|
12 | 12 | import { Layout } from '@appwrite.io/pink-svelte'; |
13 | 13 | import { Logins, resolvedProfile } from '$lib/profiles/index.svelte'; |
14 | 14 | import type { OAuthProvider } from '@appwrite.io/console'; |
| 15 | + import type { PageProps } from './$types.js'; |
15 | 16 |
|
16 | | - let mail: string, pass: string, disabled: boolean; |
| 17 | + let mail: string = $state(''), |
| 18 | + pass: string = $state(''), |
| 19 | + disabled: boolean = $state(false); |
17 | 20 |
|
18 | | - export let data; |
19 | | - const Unauthenticated = resolvedProfile.component.unauthenticated; |
| 21 | + let { data }: PageProps = $props(); |
| 22 | +
|
| 23 | + const profile = $derived(resolvedProfile); |
| 24 | + const Unauthenticated = $derived(profile.component.unauthenticated); |
20 | 25 |
|
21 | 26 | async function login() { |
22 | 27 | try { |
|
92 | 97 | </script> |
93 | 98 |
|
94 | 99 | <svelte:head> |
95 | | - <title>Sign in - {resolvedProfile.platform}</title> |
| 100 | + <title>Sign in - {profile.platform}</title> |
96 | 101 | </svelte:head> |
97 | 102 |
|
98 | 103 | <Unauthenticated coupon={data?.couponData} campaign={data?.campaign}> |
99 | 104 | <svelte:fragment slot="title">Sign in</svelte:fragment> |
100 | 105 | <svelte:fragment> |
101 | 106 | <Form onSubmit={login}> |
102 | 107 | <Layout.Stack> |
103 | | - {#if resolvedProfile.logins.includes(Logins.EMAIL)} |
| 108 | + {#if profile.logins.includes(Logins.EMAIL)} |
104 | 109 | <InputEmail |
105 | 110 | id="email" |
106 | 111 | label="Email" |
|
117 | 122 | <Button fullWidth submit {disabled}>Sign in</Button> |
118 | 123 | <span class="with-separators eyebrow-heading-3">or</span> |
119 | 124 | {/if} |
120 | | - {#if resolvedProfile.logins.includes(Logins.GITHUB)} |
| 125 | + {#if profile.logins.includes(Logins.GITHUB)} |
121 | 126 | <Button |
122 | 127 | secondary |
123 | 128 | fullWidth |
124 | | - on:click={() => onOauthLogin(resolvedProfile.oauthProviders.github)} |
| 129 | + on:click={() => onOauthLogin(profile.oauthProviders.github)} |
125 | 130 | {disabled}> |
126 | 131 | <span class="icon-github" aria-hidden="true"></span> |
127 | 132 | <span class="text">Sign in with GitHub</span> |
128 | 133 | </Button> |
129 | 134 | {/if} |
130 | | - {#if resolvedProfile.logins.includes(Logins.GOOGLE)} |
| 135 | + {#if profile.logins.includes(Logins.GOOGLE)} |
131 | 136 | <Button |
132 | 137 | secondary |
133 | 138 | fullWidth |
134 | | - on:click={() => onOauthLogin(resolvedProfile.oauthProviders.google)} |
| 139 | + on:click={() => onOauthLogin(profile.oauthProviders.google)} |
135 | 140 | {disabled}> |
136 | 141 | <span class="icon-google" aria-hidden="true"></span> |
137 | 142 | <span class="text">Sign in with Google</span> |
|
141 | 146 | </Form> |
142 | 147 | </svelte:fragment> |
143 | 148 | <svelte:fragment slot="links"> |
144 | | - {#if resolvedProfile.logins.includes(Logins.EMAIL)} |
| 149 | + {#if profile.logins.includes(Logins.EMAIL)} |
145 | 150 | <li class="inline-links-item"> |
146 | 151 | <a href={`${base}/recover`}><span class="text">Forgot password?</span></a> |
147 | 152 | </li> |
|
0 commit comments