Skip to content

Commit 5c983f4

Browse files
committed
chore: stats fix
1 parent 37701ad commit 5c983f4

File tree

8 files changed

+752
-519
lines changed

8 files changed

+752
-519
lines changed

infrastructure/eid-wallet/src-tauri/gen/android/.idea/deploymentTargetSelector.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
14.9 MB
Binary file not shown.

infrastructure/eid-wallet/src/lib/global/controllers/evault.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,56 @@ export class VaultController {
4545
#client: GraphQLClient | null = null;
4646
#endpoint: string | null = null;
4747
#userController: UserController;
48+
#profileCreationStatus: "idle" | "loading" | "success" | "failed" = "idle";
4849

4950
constructor(store: Store, userController: UserController) {
5051
this.#store = store;
5152
this.#userController = userController;
5253
}
5354

55+
/**
56+
* Get the current profile creation status
57+
*/
58+
get profileCreationStatus() {
59+
return this.#profileCreationStatus;
60+
}
61+
62+
/**
63+
* Set the profile creation status
64+
*/
65+
set profileCreationStatus(status: "idle" | "loading" | "success" | "failed") {
66+
this.#profileCreationStatus = status;
67+
}
68+
69+
/**
70+
* Retry profile creation
71+
*/
72+
async retryProfileCreation(): Promise<void> {
73+
const vault = await this.vault;
74+
if (!vault?.ename) {
75+
throw new Error("No vault data available for profile creation");
76+
}
77+
78+
this.profileCreationStatus = "loading";
79+
80+
try {
81+
const userData = await this.#userController.user;
82+
const displayName = userData?.name || vault.ename;
83+
84+
await this.createUserProfileInEVault(
85+
vault.ename,
86+
displayName,
87+
vault.ename
88+
);
89+
90+
this.profileCreationStatus = "success";
91+
} catch (error) {
92+
console.error("Failed to create UserProfile in eVault (retry):", error);
93+
this.profileCreationStatus = "failed";
94+
throw error;
95+
}
96+
}
97+
5498
/**
5599
* Resolve eVault endpoint from registry
56100
*/
@@ -151,6 +195,9 @@ export class VaultController {
151195
if (resolvedUser?.ename) {
152196
this.#store.set("vault", resolvedUser);
153197

198+
// Set loading status
199+
this.profileCreationStatus = "loading";
200+
154201
// Get user data for display name
155202
const userData = await this.#userController.user;
156203
const displayName = userData?.name || resolvedUser.ename;
@@ -161,19 +208,25 @@ export class VaultController {
161208
displayName,
162209
resolvedUser.ename
163210
);
211+
this.profileCreationStatus = "success";
164212
} catch (error) {
165213
console.error("Failed to create UserProfile in eVault:", error);
214+
this.profileCreationStatus = "failed";
166215
// Don't throw here to avoid breaking the vault setting
167216
}
168217
}
169218
})
170219
.catch((error) => {
171220
console.error("Failed to set vault:", error);
221+
this.profileCreationStatus = "failed";
172222
});
173223
} else {
174224
if (vault?.ename) {
175225
this.#store.set("vault", vault);
176226

227+
// Set loading status
228+
this.profileCreationStatus = "loading";
229+
177230
// Get user data for display name and create UserProfile
178231
(async () => {
179232
try {
@@ -185,6 +238,7 @@ export class VaultController {
185238
displayName,
186239
vault.ename
187240
);
241+
this.profileCreationStatus = "success";
188242
} catch (error) {
189243
console.error("Failed to get user data or create UserProfile:", error);
190244
// Fallback to using ename as display name
@@ -194,8 +248,10 @@ export class VaultController {
194248
vault.ename,
195249
vault.ename
196250
);
251+
this.profileCreationStatus = "success";
197252
} catch (fallbackError) {
198253
console.error("Failed to create UserProfile in eVault (fallback):", fallbackError);
254+
this.profileCreationStatus = "failed";
199255
}
200256
}
201257
})();
Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
<script lang="ts">
2-
import { clickOutside, 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 { clickOutside, 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-
}
8+
interface IDrawerProps extends HTMLAttributes<HTMLDivElement> {
9+
isPaneOpen?: boolean;
10+
children?: Snippet;
11+
handleSwipe?: (isOpen: boolean | undefined) => void;
12+
}
1313
14-
let drawerElem: HTMLDivElement;
15-
let pane: CupertinoPane;
14+
let drawerElem: HTMLDivElement;
15+
let pane: CupertinoPane;
1616
17-
let {
18-
isPaneOpen = $bindable(),
19-
children = undefined,
20-
handleSwipe,
21-
...restProps
22-
}: IDrawerProps = $props();
17+
let {
18+
isPaneOpen = $bindable(),
19+
children = undefined,
20+
handleSwipe,
21+
...restProps
22+
}: IDrawerProps = $props();
2323
24-
const handleClickOutside = () => {
25-
pane?.destroy({ animate: true });
26-
isPaneOpen = false;
27-
};
24+
const handleClickOutside = () => {
25+
pane?.destroy({ animate: true });
26+
isPaneOpen = false;
27+
};
2828
29-
$effect(() => {
30-
if (!drawerElem) return;
31-
pane = new CupertinoPane(drawerElem, {
32-
fitHeight: true,
33-
backdrop: true,
34-
backdropOpacity: 0.5,
35-
backdropBlur: true,
36-
bottomClose: true,
37-
buttonDestroy: false,
38-
showDraggable: true,
39-
upperThanTop: true,
40-
breaks: {
41-
bottom: { enabled: true, height: 250 },
42-
},
43-
initialBreak: "bottom",
44-
});
29+
$effect(() => {
30+
if (!drawerElem) return;
31+
pane = new CupertinoPane(drawerElem, {
32+
fitHeight: true,
33+
backdrop: true,
34+
backdropOpacity: 0.5,
35+
backdropBlur: true,
36+
bottomClose: true,
37+
buttonDestroy: false,
38+
showDraggable: true,
39+
upperThanTop: true,
40+
breaks: {
41+
bottom: { enabled: true, height: 250 },
42+
},
43+
initialBreak: "bottom",
44+
});
4545
46-
if (isPaneOpen) {
47-
pane.present({ animate: true });
48-
} else {
49-
pane.destroy({ animate: true });
50-
}
46+
if (isPaneOpen) {
47+
pane.present({ animate: true });
48+
} else {
49+
pane.destroy({ animate: true });
50+
}
5151
52-
return () => pane.destroy();
53-
});
52+
return () => pane.destroy();
53+
});
5454
</script>
5555

5656
<div
@@ -87,7 +87,7 @@ $effect(() => {
8787
}
8888
8989
:global(.move) {
90-
display: none !important;
90+
display: none !important;
9191
margin-block: 6px !important;
9292
}
9393
</style>

0 commit comments

Comments
 (0)