|
4 | 4 | authorizationContextStore, |
5 | 5 | authorizationStore, |
6 | 6 | } from "$lib/stores/authorization.store"; |
7 | | - import Button from "$lib/components/ui/Button.svelte"; |
8 | | - import { ArrowRightIcon } from "@lucide/svelte"; |
9 | 7 | import { getDapps } from "$lib/legacy/flows/dappsExplorer/dapps"; |
10 | 8 | import { decodeJWT, findConfig } from "$lib/utils/openID"; |
11 | 9 | import { AuthFlow } from "$lib/flows/authFlow.svelte"; |
|
25 | 23 | DirectOpenIdEvents, |
26 | 24 | directOpenIdFunnel, |
27 | 25 | } from "$lib/utils/analytics/DirectOpenIdFunnel"; |
| 26 | + import { draw, fade, scale } from "svelte/transition"; |
| 27 | + import { cubicOut } from "svelte/easing"; |
| 28 | + import { triggerDropWaveAnimation } from "$lib/utils/animation-dispatcher"; |
| 29 | + import Logo from "$lib/components/ui/Logo.svelte"; |
28 | 30 |
|
29 | 31 | const dapps = getDapps(); |
30 | 32 | const dapp = $derived( |
|
33 | 35 | ), |
34 | 36 | ); |
35 | 37 |
|
| 38 | + let animateTransitions = $state(false); |
| 39 | +
|
36 | 40 | const createAttributesListener = |
37 | 41 | (issuer: string) => async (request: JsonRequest) => { |
38 | 42 | if (request.id === undefined || request.method !== "ii_attributes") { |
|
139 | 143 | if (config === undefined) { |
140 | 144 | return; |
141 | 145 | } |
| 146 | + // Animate transitions and background |
| 147 | + animateTransitions = true; |
| 148 | + triggerDropWaveAnimation(); |
| 149 | +
|
| 150 | + // Authenticate and respond to requests |
142 | 151 | directOpenIdFunnel.addProperties({ |
143 | 152 | openid_issuer: config.issuer, |
144 | 153 | }); |
|
170 | 179 | </script> |
171 | 180 |
|
172 | 181 | <div class="flex min-h-[100dvh] flex-col items-center justify-center px-8"> |
173 | | - {#if dapp?.logoSrc !== undefined} |
174 | | - <img |
175 | | - src={dapp.logoSrc} |
176 | | - alt={$t`${dapp.name} logo`} |
177 | | - class={[ |
178 | | - "mb-10 h-16 max-w-50 object-contain", |
179 | | - dapp.logoDarkSrc !== undefined && "dark:hidden", |
180 | | - ]} |
181 | | - /> |
182 | | - {#if dapp.logoDarkSrc !== undefined} |
183 | | - <img |
184 | | - src={dapp.logoDarkSrc} |
185 | | - alt={$t`${dapp.name} logo`} |
186 | | - class="mb-10 hidden h-16 max-w-50 object-contain dark:block" |
187 | | - aria-hidden="true" |
188 | | - /> |
189 | | - {/if} |
| 182 | + {#if animateTransitions} |
| 183 | + <div |
| 184 | + transition:scale={{ duration: 500, easing: cubicOut, start: 0.9 }} |
| 185 | + class="flex flex-col items-center justify-center" |
| 186 | + > |
| 187 | + {#if dapp?.logoSrc !== undefined} |
| 188 | + <div class="relative"> |
| 189 | + <svg viewBox="0 0 92 92" width="92" height="92" class="mb-4"> |
| 190 | + <path |
| 191 | + d="M 46 1 H 71 A 20 20 0 0 1 91 21 V 71 A 20 20 0 0 1 71 91 H 21 A 20 20 0 0 1 1 71 V 21 A 20 20 0 0 1 21 1 H 46" |
| 192 | + class="stroke-fg-primary/10 fill-none stroke-2" |
| 193 | + /> |
| 194 | + <g |
| 195 | + transition:fade|global={{ |
| 196 | + duration: 500, |
| 197 | + easing: cubicOut, |
| 198 | + delay: 500, |
| 199 | + }} |
| 200 | + > |
| 201 | + <path |
| 202 | + transition:draw|global={{ |
| 203 | + duration: 6000, |
| 204 | + easing: cubicOut, |
| 205 | + delay: 500, |
| 206 | + }} |
| 207 | + d="M 46 1 H 71 A 20 20 0 0 1 91 21 V 71 A 20 20 0 0 1 71 91 H 21 A 20 20 0 0 1 1 71 V 21 A 20 20 0 0 1 21 1 H 46" |
| 208 | + stroke-linecap="round" |
| 209 | + class="stroke-fg-primary fill-none stroke-2" |
| 210 | + /> |
| 211 | + </g> |
| 212 | + </svg> |
| 213 | + <img |
| 214 | + src={dapp.logoSrc} |
| 215 | + alt={$t`${dapp.name} logo`} |
| 216 | + class="absolute inset-1 size-[84px] rounded-[18px] object-cover" |
| 217 | + /> |
| 218 | + </div> |
| 219 | + {:else} |
| 220 | + <svg viewBox="0 0 92 92" width="92" height="92" class="mb-4"> |
| 221 | + <circle |
| 222 | + cx="46" |
| 223 | + cy="46" |
| 224 | + r="45" |
| 225 | + stroke-width="2" |
| 226 | + class="stroke-fg-primary/10 fill-none stroke-2" |
| 227 | + /> |
| 228 | + <g |
| 229 | + transition:fade|global={{ |
| 230 | + duration: 500, |
| 231 | + easing: cubicOut, |
| 232 | + delay: 500, |
| 233 | + }} |
| 234 | + > |
| 235 | + <circle |
| 236 | + transition:draw|global={{ |
| 237 | + duration: 6000, |
| 238 | + easing: cubicOut, |
| 239 | + delay: 500, |
| 240 | + }} |
| 241 | + cx="46" |
| 242 | + cy="46" |
| 243 | + r="45" |
| 244 | + stroke-linecap="round" |
| 245 | + class="stroke-fg-primary origin-center -rotate-90 fill-none stroke-2" |
| 246 | + /> |
| 247 | + </g> |
| 248 | + </svg> |
| 249 | + {/if} |
| 250 | + <p class="text-text-primary mb-2 text-2xl font-medium"> |
| 251 | + {$t`Signing in securely`} |
| 252 | + </p> |
| 253 | + <a |
| 254 | + href={window.location.origin} |
| 255 | + target="_blank" |
| 256 | + class="text-text-secondary flex flex-row items-center gap-2 text-base" |
| 257 | + > |
| 258 | + <span>{$t`Powered by`}</span> |
| 259 | + <Logo class="text-text-secondary h-2" /> |
| 260 | + <span>{window.location.hostname}</span> |
| 261 | + </a> |
| 262 | + </div> |
190 | 263 | {/if} |
191 | | - <p class="text-text-secondary mb-1 text-xl font-semibold"> |
192 | | - {$t`Signing in securely`} |
193 | | - </p> |
194 | | - <p class="text-text-tertiary text-sm">{$t`This takes a few seconds.`}</p> |
195 | | - <div class="bg-bg-quaternary my-6 h-0.5 w-full max-w-74 rounded-full"> |
196 | | - <div class="bg-fg-brand-primary animate-grow h-full rounded-full"></div> |
197 | | - </div> |
198 | | - <p class="text-text-secondary text-base"> |
199 | | - {$t`Powered by Internet Identity`} |
200 | | - </p> |
201 | | - <Button |
202 | | - href={window.location.origin} |
203 | | - target="_blank" |
204 | | - variant="tertiary" |
205 | | - class="mt-10" |
206 | | - size="sm" |
207 | | - > |
208 | | - <span>{$t`How it works`}</span> |
209 | | - <ArrowRightIcon class="size-4" /> |
210 | | - </Button> |
211 | 264 | </div> |
212 | | - |
213 | | -<style> |
214 | | - @keyframes grow { |
215 | | - from { |
216 | | - width: 0; |
217 | | - } |
218 | | - to { |
219 | | - width: 100%; |
220 | | - } |
221 | | - } |
222 | | -
|
223 | | - .animate-grow { |
224 | | - animation: grow 6s ease-out forwards; |
225 | | - } |
226 | | -</style> |
|
0 commit comments