|
1 | 1 | <script lang="ts">
|
2 |
| - import { goto } from "$app/navigation"; |
3 |
| - import {ButtonAction, InputPin,Drawer} from "$lib/ui"; |
4 |
| - import { CircleLock01Icon, FaceIdIcon } from "@hugeicons/core-free-icons"; |
5 |
| - import { HugeiconsIcon } from "@hugeicons/svelte"; |
6 |
| - |
7 |
| - let pin = $state(""); |
8 |
| - let repeatPin = $state(""); |
9 |
| - let firstStep = $state(true); |
10 |
| - let showDrawer = $state(false); |
11 |
| - let isBiometricScreen = $state(false); |
12 |
| - let isBiometricsAdded = $state(false); |
13 |
| - let isError = $state(false); |
| 2 | +import { goto } from "$app/navigation"; |
| 3 | +import { ButtonAction, InputPin, Drawer } from "$lib/ui"; |
| 4 | +import { CircleLock01Icon, FaceIdIcon } from "@hugeicons/core-free-icons"; |
| 5 | +import { HugeiconsIcon } from "@hugeicons/svelte"; |
14 | 6 |
|
15 |
| - const handleFirstStep = async() => { |
16 |
| - if(pin.length === 4) firstStep = false; |
17 |
| - } |
| 7 | +let pin = $state(""); |
| 8 | +let repeatPin = $state(""); |
| 9 | +let firstStep = $state(true); |
| 10 | +let showDrawer = $state(false); |
| 11 | +let isBiometricScreen = $state(false); |
| 12 | +let isBiometricsAdded = $state(false); |
| 13 | +let isError = $state(false); |
18 | 14 |
|
19 |
| - const handleConfirm = async() => { |
20 |
| - //confirm pin logic goes here |
21 |
| - if(pin.length === 4 && repeatPin.length ===4 && pin === repeatPin) showDrawer = true; |
22 |
| - } |
| 15 | +const handleFirstStep = async () => { |
| 16 | + if (pin.length === 4) firstStep = false; |
| 17 | +}; |
23 | 18 |
|
24 |
| - const handleNext = async() => { |
25 |
| - //handle next logic goes here |
26 |
| - isBiometricScreen = true; |
27 |
| - } |
| 19 | +const handleConfirm = async () => { |
| 20 | + //confirm pin logic goes here |
| 21 | + if (pin.length === 4 && repeatPin.length === 4 && pin === repeatPin) |
| 22 | + showDrawer = true; |
| 23 | +}; |
28 | 24 |
|
29 |
| - const handleSkip = async() => { |
30 |
| - // handle skip biometics logic goes here |
31 |
| - } |
| 25 | +const handleNext = async () => { |
| 26 | + //handle next logic goes here |
| 27 | + isBiometricScreen = true; |
| 28 | +}; |
32 | 29 |
|
33 |
| - const handleSetupBiometrics = async() => { |
34 |
| - //handle setup biometrics logic goes here |
35 |
| - isBiometricsAdded = true |
36 |
| - } |
| 30 | +const handleSkip = async () => { |
| 31 | + // handle skip biometics logic goes here |
| 32 | +}; |
37 | 33 |
|
38 |
| - const handleEnableBiometrics = async() => { |
39 |
| - //handle enable biometrics logic goes here |
40 |
| - } |
| 34 | +const handleSetupBiometrics = async () => { |
| 35 | + //handle setup biometrics logic goes here |
| 36 | + isBiometricsAdded = true; |
| 37 | +}; |
41 | 38 |
|
42 |
| - const handleBiometricsAdded = async() => { |
43 |
| - //handle logic when biometrics added successfully |
44 |
| - goto("/review"); |
45 |
| - } |
| 39 | +const handleEnableBiometrics = async () => { |
| 40 | + //handle enable biometrics logic goes here |
| 41 | +}; |
46 | 42 |
|
47 |
| - $effect(() => { |
48 |
| - if(repeatPin && repeatPin.length === 4 && pin !== repeatPin) isError = true; |
49 |
| - else isError = false; |
50 |
| - }) |
| 43 | +const handleBiometricsAdded = async () => { |
| 44 | + //handle logic when biometrics added successfully |
| 45 | + goto("/review"); |
| 46 | +}; |
| 47 | +
|
| 48 | +$effect(() => { |
| 49 | + if (repeatPin && repeatPin.length === 4 && pin !== repeatPin) isError = true; |
| 50 | + else isError = false; |
| 51 | +}); |
51 | 52 | </script>
|
52 | 53 |
|
53 | 54 | {#if firstStep}
|
|
65 | 66 | <h1 class="text-3xl text-black font-semibold mb-[1vh]">Re-enter your pin</h1>
|
66 | 67 | <p class="text-base text-black-700 font-normal mb-[14vh]">Confirm by entering pin again</p>
|
67 | 68 | <InputPin bind:pin={repeatPin} {isError}/>
|
68 |
| - <p class={`text-base font-normal text-red-900 mt-[3.4vh] ${isError ? "block" : "hidden"}`}>Your PIN does not match, try again.</p> |
| 69 | + <p class={`text-base font-normal text-danger mt-[3.4vh] ${isError ? "block" : "hidden"}`}>Your PIN does not match, try again.</p> |
69 | 70 | </section>
|
70 | 71 | <ButtonAction class="w-full" callback={handleConfirm}>Confirm</ButtonAction>
|
71 | 72 | </main>
|
|
74 | 75 |
|
75 | 76 | <Drawer bind:isPaneOpen={showDrawer} isCancelRequired={true}>
|
76 | 77 | {#if !isBiometricScreen}
|
77 |
| - <div class="relative bg-gray-900 w-[72px] h-[72px] rounded-[24px] flex justify-center items-center mb-[2.3vh]"> |
| 78 | + <div class="relative bg-gray w-[72px] h-[72px] rounded-[24px] flex justify-center items-center mb-[2.3vh]"> |
78 | 79 | <span class="relative z-[1]">
|
79 | 80 | <HugeiconsIcon icon={CircleLock01Icon} color="var(--color-primary)"/>
|
80 | 81 | </span>
|
|
85 | 86 | <p class="text-black-700 text-base font-normal mt-[0.5vh] mb-[2.3vh]">Your PIN has been created. You’ll use it to access your digital entity securely.</p>
|
86 | 87 | <ButtonAction class="w-full" callback={handleNext}>Next</ButtonAction>
|
87 | 88 | {:else}
|
88 |
| - <div class="relative bg-gray-900 w-[72px] h-[72px] rounded-[24px] flex justify-center items-center mb-[2.3vh]"> |
| 89 | + <div class="relative bg-gray w-[72px] h-[72px] rounded-[24px] flex justify-center items-center mb-[2.3vh]"> |
89 | 90 | <span class="relative z-[1]">
|
90 | 91 | <HugeiconsIcon icon={FaceIdIcon} color="var(--color-primary)" />
|
91 | 92 | </span>
|
|
0 commit comments