Skip to content

Commit 0184932

Browse files
committed
format
1 parent 67972fc commit 0184932

8 files changed

Lines changed: 1545 additions & 1553 deletions

File tree

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

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,101 @@
11
<script lang="ts">
2-
import { goto } from "$app/navigation";
3-
import { Hero, IdentityCard } from "$lib/fragments";
4-
import type { GlobalState } from "$lib/global";
5-
import { Drawer, Toast } from "$lib/ui";
6-
import * as Button from "$lib/ui/Button";
7-
import {
8-
CircleArrowDataTransferDiagonalFreeIcons,
9-
QrCodeIcon,
10-
Settings02Icon,
11-
} from "@hugeicons/core-free-icons";
12-
import { HugeiconsIcon } from "@hugeicons/svelte";
13-
import { type Snippet, getContext, onMount } from "svelte";
14-
import { onDestroy } from "svelte";
15-
import { Shadow } from "svelte-loading-spinners";
16-
import QrCode from "svelte-qrcode";
17-
18-
let userData: Record<string, unknown> | undefined = $state(undefined);
19-
let greeting: string | undefined = $state(undefined);
20-
let ename: string | undefined = $state(undefined);
21-
let profileCreationStatus: "idle" | "loading" | "success" | "failed" =
22-
$state("idle");
23-
24-
let shareQRdrawerOpen = $state(false);
25-
let statusInterval: ReturnType<typeof setInterval> | undefined =
26-
$state(undefined);
27-
let showToast = $state(false);
28-
let toastMessage = $state("");
29-
30-
function shareQR() {
31-
alert("QR Code shared!");
32-
shareQRdrawerOpen = false;
2+
import { goto } from "$app/navigation";
3+
import { Hero, IdentityCard } from "$lib/fragments";
4+
import type { GlobalState } from "$lib/global";
5+
import { Drawer, Toast } from "$lib/ui";
6+
import * as Button from "$lib/ui/Button";
7+
import {
8+
CircleArrowDataTransferDiagonalFreeIcons,
9+
QrCodeIcon,
10+
Settings02Icon,
11+
} from "@hugeicons/core-free-icons";
12+
import { HugeiconsIcon } from "@hugeicons/svelte";
13+
import { type Snippet, getContext, onMount } from "svelte";
14+
import { onDestroy } from "svelte";
15+
import { Shadow } from "svelte-loading-spinners";
16+
import QrCode from "svelte-qrcode";
17+
18+
let userData: Record<string, unknown> | undefined = $state(undefined);
19+
let greeting: string | undefined = $state(undefined);
20+
let ename: string | undefined = $state(undefined);
21+
let profileCreationStatus: "idle" | "loading" | "success" | "failed" =
22+
$state("idle");
23+
24+
let shareQRdrawerOpen = $state(false);
25+
let statusInterval: ReturnType<typeof setInterval> | undefined =
26+
$state(undefined);
27+
let showToast = $state(false);
28+
let toastMessage = $state("");
29+
30+
function shareQR() {
31+
alert("QR Code shared!");
32+
shareQRdrawerOpen = false;
33+
}
34+
35+
async function copyEName() {
36+
if (!ename) return;
37+
try {
38+
await navigator.clipboard.writeText(ename);
39+
toastMessage = "eName copied to clipboard!";
40+
showToast = true;
41+
} catch (error) {
42+
console.error("Failed to copy eName:", error);
43+
toastMessage = "Failed to copy eName";
44+
showToast = true;
3345
}
46+
}
3447
35-
async function copyEName() {
36-
if (!ename) return;
37-
try {
38-
await navigator.clipboard.writeText(ename);
39-
toastMessage = "eName copied to clipboard!";
40-
showToast = true;
41-
} catch (error) {
42-
console.error("Failed to copy eName:", error);
43-
toastMessage = "Failed to copy eName";
44-
showToast = true;
45-
}
46-
}
47-
48-
function handleToastClose() {
49-
showToast = false;
50-
}
48+
function handleToastClose() {
49+
showToast = false;
50+
}
5151
52-
async function retryProfileCreation() {
53-
try {
54-
await globalState.vaultController.retryProfileCreation();
55-
} catch (error) {
56-
console.error("Retry failed:", error);
57-
}
52+
async function retryProfileCreation() {
53+
try {
54+
await globalState.vaultController.retryProfileCreation();
55+
} catch (error) {
56+
console.error("Retry failed:", error);
5857
}
58+
}
5959
60-
const globalState = getContext<() => GlobalState>("globalState")();
60+
const globalState = getContext<() => GlobalState>("globalState")();
6161
62-
onMount(() => {
63-
// Load initial data
64-
(async () => {
65-
const userInfo = await globalState.userController.user;
66-
const isFake = await globalState.userController.isFake;
67-
userData = { ...userInfo, isFake };
68-
const vaultData = await globalState.vaultController.vault;
69-
ename = vaultData?.ename;
70-
})();
62+
onMount(() => {
63+
// Load initial data
64+
(async () => {
65+
const userInfo = await globalState.userController.user;
66+
const isFake = await globalState.userController.isFake;
67+
userData = { ...userInfo, isFake };
68+
const vaultData = await globalState.vaultController.vault;
69+
ename = vaultData?.ename;
70+
})();
7171
72-
// Get initial profile creation status
72+
// Get initial profile creation status
7373
profileCreationStatus = globalState.vaultController.profileCreationStatus;
74-
console.log("status current", profileCreationStatus);
75-
76-
// Set up a watcher for profile creation status changes
77-
const checkStatus = () => {
78-
profileCreationStatus =
79-
globalState.vaultController.profileCreationStatus;
80-
};
81-
82-
// Check status periodically
83-
statusInterval = setInterval(checkStatus, 1000);
84-
85-
const currentHour = new Date().getHours();
86-
greeting =
87-
currentHour > 17
88-
? "Good Evening"
89-
: currentHour > 12
90-
? "Good Afternoon"
91-
: "Good Morning";
92-
});
93-
94-
onDestroy(() => {
95-
if (statusInterval) {
96-
clearInterval(statusInterval);
97-
}
98-
});
74+
console.log("status current", profileCreationStatus);
75+
76+
// Set up a watcher for profile creation status changes
77+
const checkStatus = () => {
78+
profileCreationStatus =
79+
globalState.vaultController.profileCreationStatus;
80+
};
81+
82+
// Check status periodically
83+
statusInterval = setInterval(checkStatus, 1000);
84+
85+
const currentHour = new Date().getHours();
86+
greeting =
87+
currentHour > 17
88+
? "Good Evening"
89+
: currentHour > 12
90+
? "Good Afternoon"
91+
: "Good Morning";
92+
});
93+
94+
onDestroy(() => {
95+
if (statusInterval) {
96+
clearInterval(statusInterval);
97+
}
98+
});
9999
</script>
100100

101101
{#if profileCreationStatus === "loading"}

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

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
<script lang="ts">
2-
import { goto } from "$app/navigation";
3-
import type { GlobalState } from "$lib/global";
4-
import { runtime } from "$lib/global/runtime.svelte";
5-
import { ButtonAction, Drawer, InputPin } from "$lib/ui";
6-
import { CircleLock01Icon } from "@hugeicons/core-free-icons";
7-
import { HugeiconsIcon } from "@hugeicons/svelte";
8-
import { getContext, onMount } from "svelte";
2+
import { goto } from "$app/navigation";
3+
import type { GlobalState } from "$lib/global";
4+
import { runtime } from "$lib/global/runtime.svelte";
5+
import { ButtonAction, Drawer, InputPin } from "$lib/ui";
6+
import { CircleLock01Icon } from "@hugeicons/core-free-icons";
7+
import { HugeiconsIcon } from "@hugeicons/svelte";
8+
import { getContext, onMount } from "svelte";
99
10-
let globalState: GlobalState | undefined = $state(undefined);
11-
let currentPin = $state("");
12-
let newPin = $state("");
13-
let repeatPin = $state("");
14-
let isError = $state(false);
15-
let showDrawer = $state(false);
10+
let globalState: GlobalState | undefined = $state(undefined);
11+
let currentPin = $state("");
12+
let newPin = $state("");
13+
let repeatPin = $state("");
14+
let isError = $state(false);
15+
let showDrawer = $state(false);
1616
17-
const handleClose = async () => {
18-
// close functionality goes here.
19-
showDrawer = false;
20-
goto("/settings");
21-
};
17+
const handleClose = async () => {
18+
// close functionality goes here.
19+
showDrawer = false;
20+
goto("/settings");
21+
};
2222
23-
const handleChangePIN = async () => {
23+
const handleChangePIN = async () => {
2424
if (newPin.length < 4 || repeatPin.length < 4 || currentPin.length < 4) {
25-
isError = true;
26-
return;
27-
}
25+
isError = true;
26+
return;
27+
}
2828
29-
if (newPin !== repeatPin) {
30-
isError = true;
31-
return;
32-
}
29+
if (newPin !== repeatPin) {
30+
isError = true;
31+
return;
32+
}
3333
34-
try {
35-
await globalState?.securityController.updatePin(
36-
newPin,
37-
repeatPin,
38-
currentPin,
39-
);
40-
isError = false;
41-
showDrawer = true;
42-
} catch (err) {
43-
console.error("Failed to update PIN:", err);
44-
isError = true;
45-
}
46-
};
34+
try {
35+
await globalState?.securityController.updatePin(
36+
newPin,
37+
repeatPin,
38+
currentPin,
39+
);
40+
isError = false;
41+
showDrawer = true;
42+
} catch (err) {
43+
console.error("Failed to update PIN:", err);
44+
isError = true;
45+
}
46+
};
4747
48-
$effect(() => {
49-
runtime.header.title = "Change PIN";
50-
if (repeatPin.length === 4 && newPin === repeatPin) isError = false;
51-
});
48+
$effect(() => {
49+
runtime.header.title = "Change PIN";
50+
if (repeatPin.length === 4 && newPin === repeatPin) isError = false;
51+
});
5252
53-
onMount(() => {
54-
globalState = getContext<() => GlobalState>("globalState")();
55-
if (!globalState) throw new Error("Global state is not defined");
56-
});
53+
onMount(() => {
54+
globalState = getContext<() => GlobalState>("globalState")();
55+
if (!globalState) throw new Error("Global state is not defined");
56+
});
5757
</script>
5858

5959
<main

0 commit comments

Comments
 (0)