Skip to content

Commit f8988dc

Browse files
committed
fix: demo name continue button
1 parent f945c2f commit f8988dc

File tree

3 files changed

+148
-146
lines changed

3 files changed

+148
-146
lines changed

infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
11
<script lang="ts">
2-
import { cn } from "$lib/utils";
3-
import { CupertinoPane } from "cupertino-pane";
4-
import type { Snippet } from "svelte";
5-
import { swipe } from "svelte-gestures";
6-
import type { HTMLAttributes } from "svelte/elements";
2+
import { cn } from "$lib/utils";
3+
import { CupertinoPane } from "cupertino-pane";
4+
import type { Snippet } from "svelte";
5+
import { swipe } from "svelte-gestures";
6+
import type { HTMLAttributes } from "svelte/elements";
77
8-
interface IDrawerProps extends HTMLAttributes<HTMLDivElement> {
9-
isPaneOpen?: boolean;
10-
children?: Snippet;
11-
handleSwipe?: (isOpen: boolean | undefined) => void;
12-
dismissible?: boolean;
13-
}
14-
15-
let drawerElem: HTMLDivElement;
16-
let pane: CupertinoPane;
8+
interface IDrawerProps extends HTMLAttributes<HTMLDivElement> {
9+
isPaneOpen?: boolean;
10+
children?: Snippet;
11+
handleSwipe?: (isOpen: boolean | undefined) => void;
12+
dismissible?: boolean;
13+
}
1714
18-
let {
19-
isPaneOpen = $bindable(),
20-
children = undefined,
21-
handleSwipe,
22-
dismissible = true,
23-
...restProps
24-
}: IDrawerProps = $props();
15+
let drawerElem: HTMLDivElement;
16+
let pane: CupertinoPane;
2517
26-
// Disabled click outside behavior to prevent white screen issues
27-
// const handleClickOutside = () => {
28-
// pane?.destroy({ animate: true });
29-
// isPaneOpen = false;
30-
// };
18+
let {
19+
isPaneOpen = $bindable(),
20+
children = undefined,
21+
handleSwipe,
22+
dismissible = true,
23+
...restProps
24+
}: IDrawerProps = $props();
3125
32-
// Initialize pane only once when element is available
33-
$effect(() => {
34-
if (!drawerElem) return;
35-
pane = new CupertinoPane(drawerElem, {
36-
fitHeight: true,
37-
backdrop: true,
38-
backdropOpacity: dismissible ? 0.5 : 0.8,
39-
backdropBlur: true,
40-
bottomClose: dismissible,
41-
buttonDestroy: false,
42-
showDraggable: dismissible,
43-
upperThanTop: true,
44-
breaks: {
45-
bottom: { enabled: true, height: 250 },
46-
},
47-
initialBreak: "bottom",
48-
});
26+
// Disabled click outside behavior to prevent white screen issues
27+
// const handleClickOutside = () => {
28+
// pane?.destroy({ animate: true });
29+
// isPaneOpen = false;
30+
// };
4931
50-
return () => pane?.destroy();
32+
// Initialize pane only once when element is available
33+
$effect(() => {
34+
if (!drawerElem) return;
35+
pane = new CupertinoPane(drawerElem, {
36+
fitHeight: true,
37+
backdrop: true,
38+
backdropOpacity: dismissible ? 0.5 : 0.8,
39+
backdropBlur: true,
40+
bottomClose: dismissible,
41+
buttonDestroy: false,
42+
showDraggable: dismissible,
43+
upperThanTop: true,
44+
breaks: {
45+
bottom: { enabled: true, height: 250 },
46+
},
47+
initialBreak: "bottom",
5148
});
5249
53-
// Handle open/close state separately
54-
$effect(() => {
55-
if (!pane) return;
50+
return () => pane?.destroy();
51+
});
5652
57-
if (isPaneOpen) {
58-
pane.present({ animate: true });
59-
} else {
60-
pane.destroy({ animate: true });
61-
}
62-
});
53+
// Handle open/close state separately
54+
$effect(() => {
55+
if (!pane) return;
56+
57+
if (isPaneOpen) {
58+
pane.present({ animate: true });
59+
} else {
60+
pane.destroy({ animate: true });
61+
}
62+
});
6363
</script>
6464

6565
<div

infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte

Lines changed: 90 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,102 @@
11
<script lang="ts">
2-
import { goto } from "$app/navigation";
3-
import { SettingsNavigationBtn } from "$lib/fragments";
4-
import type { GlobalState } from "$lib/global";
5-
import { runtime } from "$lib/global/runtime.svelte";
6-
import { ButtonAction, Drawer } from "$lib/ui";
7-
import {
8-
Key01Icon,
9-
LanguageSquareIcon,
10-
Link02Icon,
11-
PinCodeIcon,
12-
Shield01Icon,
13-
} from "@hugeicons/core-free-icons";
14-
import { getContext } from "svelte";
15-
16-
const getGlobalState = getContext<() => GlobalState>("globalState");
17-
const setGlobalState =
18-
getContext<(value: GlobalState) => void>("setGlobalState");
19-
let globalState = getGlobalState();
20-
21-
let isDeleteConfirmationOpen = $state(false);
22-
let isFinalConfirmationOpen = $state(false);
23-
24-
// Hidden eVault profile retry functionality
25-
let tapCount = $state(0);
26-
let lastTapTime = $state(0);
27-
let isRetrying = $state(false);
28-
let retryMessage = $state("");
29-
30-
function showDeleteConfirmation() {
31-
isDeleteConfirmationOpen = true;
2+
import { goto } from "$app/navigation";
3+
import { SettingsNavigationBtn } from "$lib/fragments";
4+
import type { GlobalState } from "$lib/global";
5+
import { runtime } from "$lib/global/runtime.svelte";
6+
import { ButtonAction, Drawer } from "$lib/ui";
7+
import {
8+
Key01Icon,
9+
LanguageSquareIcon,
10+
Link02Icon,
11+
PinCodeIcon,
12+
Shield01Icon,
13+
} from "@hugeicons/core-free-icons";
14+
import { getContext } from "svelte";
15+
16+
const getGlobalState = getContext<() => GlobalState>("globalState");
17+
const setGlobalState =
18+
getContext<(value: GlobalState) => void>("setGlobalState");
19+
let globalState = getGlobalState();
20+
21+
let isDeleteConfirmationOpen = $state(false);
22+
let isFinalConfirmationOpen = $state(false);
23+
24+
// Hidden eVault profile retry functionality
25+
let tapCount = $state(0);
26+
let lastTapTime = $state(0);
27+
let isRetrying = $state(false);
28+
let retryMessage = $state("");
29+
30+
function showDeleteConfirmation() {
31+
isDeleteConfirmationOpen = true;
32+
}
33+
34+
function confirmDelete() {
35+
isDeleteConfirmationOpen = false;
36+
isFinalConfirmationOpen = true;
37+
}
38+
39+
async function nukeWallet() {
40+
const newGlobalState = await globalState.reset();
41+
setGlobalState(newGlobalState);
42+
globalState = newGlobalState;
43+
goto("/onboarding");
44+
}
45+
46+
function cancelDelete() {
47+
isDeleteConfirmationOpen = false;
48+
isFinalConfirmationOpen = false;
49+
}
50+
51+
async function handleVersionTap() {
52+
const now = Date.now();
53+
54+
// Reset counter if more than 3 seconds between taps
55+
if (now - lastTapTime > 3000) {
56+
tapCount = 0;
3257
}
3358
34-
function confirmDelete() {
35-
isDeleteConfirmationOpen = false;
36-
isFinalConfirmationOpen = true;
37-
}
38-
39-
async function nukeWallet() {
40-
const newGlobalState = await globalState.reset();
41-
setGlobalState(newGlobalState);
42-
globalState = newGlobalState;
43-
goto("/onboarding");
44-
}
59+
tapCount++;
60+
lastTapTime = now;
4561
46-
function cancelDelete() {
47-
isDeleteConfirmationOpen = false;
48-
isFinalConfirmationOpen = false;
62+
// Show tap count feedback (only visible to user)
63+
if (tapCount >= 5) {
64+
retryMessage = `Taps: ${tapCount}/10`;
4965
}
5066
51-
async function handleVersionTap() {
52-
const now = Date.now();
53-
54-
// Reset counter if more than 3 seconds between taps
55-
if (now - lastTapTime > 3000) {
56-
tapCount = 0;
57-
}
58-
59-
tapCount++;
60-
lastTapTime = now;
61-
62-
// Show tap count feedback (only visible to user)
63-
if (tapCount >= 5) {
64-
retryMessage = `Taps: ${tapCount}/10`;
65-
}
66-
67-
// Trigger eVault profile retry after 10 taps
68-
if (tapCount === 10) {
69-
isRetrying = true;
70-
retryMessage = "Retrying eVault profile setup...";
71-
72-
try {
73-
await globalState.vaultController.retryProfileCreation();
74-
retryMessage =
75-
"✅ eVault profile setup completed successfully!";
76-
77-
// Reset after success
78-
setTimeout(() => {
79-
tapCount = 0;
80-
retryMessage = "";
81-
isRetrying = false;
82-
}, 3000);
83-
} catch (error) {
84-
console.error("Failed to retry eVault profile setup:", error);
85-
retryMessage =
86-
"❌ Failed to setup eVault profile. Check console for details.";
87-
88-
// Reset after error
89-
setTimeout(() => {
90-
tapCount = 0;
91-
retryMessage = "";
92-
isRetrying = false;
93-
}, 5000);
94-
}
67+
// Trigger eVault profile retry after 10 taps
68+
if (tapCount === 10) {
69+
isRetrying = true;
70+
retryMessage = "Retrying eVault profile setup...";
71+
72+
try {
73+
await globalState.vaultController.retryProfileCreation();
74+
retryMessage = "✅ eVault profile setup completed successfully!";
75+
76+
// Reset after success
77+
setTimeout(() => {
78+
tapCount = 0;
79+
retryMessage = "";
80+
isRetrying = false;
81+
}, 3000);
82+
} catch (error) {
83+
console.error("Failed to retry eVault profile setup:", error);
84+
retryMessage =
85+
"❌ Failed to setup eVault profile. Check console for details.";
86+
87+
// Reset after error
88+
setTimeout(() => {
89+
tapCount = 0;
90+
retryMessage = "";
91+
isRetrying = false;
92+
}, 5000);
9593
}
9694
}
95+
}
9796
98-
$effect(() => {
99-
runtime.header.title = "Settings";
100-
});
97+
$effect(() => {
98+
runtime.header.title = "Settings";
99+
});
101100
</script>
102101

103102
<main>

infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,11 @@ onMount(async () => {
349349
placeholder="Enter your demo name for ePassport"
350350
/>
351351
<div class="flex justify-center whitespace-nowrap my-[2.3svh]">
352-
<ButtonAction class="w-full" callback={handleFinalSubmit}
353-
>Continue</ButtonAction
352+
<ButtonAction
353+
variant={demoName.length === 0 ? "soft" : "solid"}
354+
disabled={demoName.length === 0}
355+
class="w-full"
356+
callback={handleFinalSubmit}>Continue</ButtonAction
354357
>
355358
</div>
356359
{:else}

0 commit comments

Comments
 (0)