diff --git a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/+page.svelte b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/+page.svelte index 9b17a9969..b39ff02e5 100644 --- a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/+page.svelte +++ b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/+page.svelte @@ -84,13 +84,10 @@ onMount(() => { return () => { disposed = true; cleanup?.(); + cancelScan(); }; }); -onDestroy(async () => { - await cancelScan(); -}); - $effect(() => { console.log( "🔍 DEBUG: selectedBlindVoteOption changed to:", @@ -223,3 +220,9 @@ function handleRevealDrawerOpenChange(value: boolean) { onReveal={handleRevealVote} onOpenChange={handleRevealDrawerOpenChange} /> + + diff --git a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/AuthDrawer.svelte b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/AuthDrawer.svelte index e04f97418..b07a2fc17 100644 --- a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/AuthDrawer.svelte +++ b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/AuthDrawer.svelte @@ -1,5 +1,4 @@ - -
-
+{#if internalOpen} +
- -
+ class="flex flex-col justify-between min-h-full w-full max-w-md mx-auto" + > +
+
+
+
+ +
-

Code scanned!

-

You're trying to access the following site

+

Code scanned!

+

+ Please review the connection details below. +

-
-

Platform Name

-

- {platform ?? "Unable to get name"} -

-
+
+ + + + + -
-

Website URL

-

- {hostname ?? scannedContent} -

-
+ + + + +
+
+ Platform Name +
+
+ {platform ?? "Unable to get name"} +
+
+
+ Website URL +
+
+ {hostname ?? scannedContent} +
+
+
- {#if authError} -
-
-
- - - -
-
-

Error

-
- {authError} +
+
+ + + +
+
+

+ Error +

+
+ {authError} +
+
+
+ {/if} +
+ +
+
+ {#if authError} + + Okay + + {:else} + + Decline + + + {#if authLoading} + Authenticating... + {:else} + Confirm + {/if} + + {/if}
+ + {#if isSigningRequest === false} +
+

+ After confirmation, you may return to {platform} and continue there +

+
+ {/if}
- {/if} - -
- {#if authError} - - Okay - - {:else} - - Decline - - - {#if authLoading} - Authenticating... - {:else} - Confirm - {/if} - - {/if}
- - {#if isSigningRequest === false} -
-

- After confirmation, you may return to {platform} and continue - there -

-
- {/if} - - +{/if} diff --git a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/LoggedInDrawer.svelte b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/LoggedInDrawer.svelte index 25e59e340..bf198e5a8 100644 --- a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/LoggedInDrawer.svelte +++ b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/LoggedInDrawer.svelte @@ -1,5 +1,4 @@ - +{#if internalOpen} - -

You're logged in!

-

You're now connected to {platform}

+ class="flex flex-col justify-between min-h-full w-full max-w-md mx-auto" + > +
+
+
+
+ +
-
- {#if redirect && platform} -
-

- You may return to {platform} and continue there +

+ You're logged in! +

+

+ You're now connected to {platform ?? "the platform"}

+
+ {#if redirect && platform} +
+

+ You may return to {platform} and + continue there +

+
+ {/if} +
- {/if} - - Ok - +
+ + Ok + +
+
-
- +{/if} diff --git a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/RevealDrawer.svelte b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/RevealDrawer.svelte index a9010e566..e0c547f82 100644 --- a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/RevealDrawer.svelte +++ b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/RevealDrawer.svelte @@ -1,9 +1,7 @@ - - {#if revealSuccess && revealedVoteData} -
-

- You voted for: {revealedVoteData.chosenOption} -

-

- Poll ID: {revealedVoteData.pollId} -

-
- -
- - Okay - -
- {:else} +{#if internalOpen} +
-
-
- -
+
+
+
+
+ +
-

Reveal Your Blind Vote

-

- You're about to reveal your blind vote for poll: {revealPollId} -

+ {#if revealSuccess && revealedVoteData} +

+ Vote Decrypted +

+

+ Your selection has been successfully retrieved. +

-
-

- Note: Revealing your vote will show your choice locally - in this wallet. This action cannot be undone. -

-
+
+
+

+ Selection +

+

+ {revealedVoteData.chosenOption} +

+
+

+ Poll ID: {revealedVoteData.pollId} +

+
+
+ {:else} +

Reveal Your Blind Vote

+

+ Please review the request details below. +

+ +
+
+ + + + + + +
+
+ Poll ID +
+
+ {revealPollId ?? "Unknown"} +
+
+
+ +
+

+ Note: This action will decrypt your + choice locally. This cannot be undone and will be + visible on this screen. +

+
- {#if revealError} -
-

- {revealError} -

+ {#if revealError} +
+

+ {revealError} +

+
+ {/if} +
+ {/if}
- {/if} -
- - Cancel - - - {#if isRevealingVote} - Revealing... +
+ {#if revealSuccess} + + Okay + {:else} - Reveal Vote +
+ + Cancel + + + {isRevealingVote ? "Revealing..." : "Reveal"} + +
{/if} - +
- {/if} - - +
+{/if} diff --git a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/SigningDrawer.svelte b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/SigningDrawer.svelte index 387364a07..ef632003a 100644 --- a/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/SigningDrawer.svelte +++ b/infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/SigningDrawer.svelte @@ -1,9 +1,7 @@ - - {#if showSigningSuccess} -
-
-
- -
- -

- {#if isBlindVotingRequest} - Blind Vote Submitted Successfully! - {:else if signingData?.pollId} - Vote Signed Successfully! - {:else} - Message Signed Successfully! - {/if} -

-

- {#if isBlindVotingRequest} - Your blind vote has been submitted and is now completely hidden using - cryptographic commitments. - {:else if signingData?.pollId} - Your vote has been signed and submitted to the voting system. - {:else} - Your message has been signed and submitted successfully. - {/if} -

- -
- - Okay - -
- {:else} +{#if internalOpen} + +{/if} diff --git a/platforms/pictique/src/lib/fragments/Profile/Profile.svelte b/platforms/pictique/src/lib/fragments/Profile/Profile.svelte index 8e890c837..ff68d8214 100644 --- a/platforms/pictique/src/lib/fragments/Profile/Profile.svelte +++ b/platforms/pictique/src/lib/fragments/Profile/Profile.svelte @@ -1,23 +1,51 @@
@@ -36,7 +64,33 @@
{#if variant === 'other'}
- +
+ +
{/if} diff --git a/platforms/pictique/src/lib/stores/posts.ts b/platforms/pictique/src/lib/stores/posts.ts index 59513762d..dbbc7e806 100644 --- a/platforms/pictique/src/lib/stores/posts.ts +++ b/platforms/pictique/src/lib/stores/posts.ts @@ -1,6 +1,6 @@ -import type { Post } from "$lib/types"; -import { apiClient } from "$lib/utils/axios"; -import { get, writable } from "svelte/store"; +import type { Post } from '$lib/types'; +import { apiClient } from '$lib/utils/axios'; +import { get, writable } from 'svelte/store'; export const posts = writable([]); export const isLoading = writable(false); @@ -14,88 +14,84 @@ export const openCreatePostModal = () => isCreatePostModalOpen.set(true); export const closeCreatePostModal = () => isCreatePostModalOpen.set(false); export const resetFeed = () => { - currentPage.set(1); - hasMore.set(true); - posts.set([]); + currentPage.set(1); + hasMore.set(true); + posts.set([]); }; export const fetchFeed = async (page = 1, limit = 10, append = false) => { - try { - if (append) { - isLoadingMore.set(true); - } else { - isLoading.set(true); - } - error.set(null); - const response = await apiClient.get( - `/api/posts/feed?page=${page}&limit=${limit}`, - ); - const responseData = response.data; + try { + if (append) { + isLoadingMore.set(true); + } else { + isLoading.set(true); + } + error.set(null); + const response = await apiClient.get(`/api/posts/feed?page=${page}&limit=${limit}`); + const responseData = response.data; - // Handle both direct response and nested data structure - const newPosts = responseData.posts || responseData.data?.posts || []; - const responsePage = responseData.page || page; - const total = responseData.total || 0; - const totalPages = responseData.totalPages || Math.ceil(total / limit); + // Handle both direct response and nested data structure + const newPosts = responseData.posts || responseData.data?.posts || []; + const responsePage = responseData.page || page; + const total = responseData.total || 0; + const totalPages = responseData.totalPages || Math.ceil(total / limit); - if (append) { - posts.update((existingPosts) => [...existingPosts, ...newPosts]); - } else { - posts.set(newPosts); - } + if (append) { + posts.update((existingPosts) => [...existingPosts, ...newPosts]); + } else { + posts.set(newPosts); + } - currentPage.set(responsePage); - hasMore.set(newPosts.length === limit && responsePage < totalPages); - } catch (err) { - error.set(err instanceof Error ? err.message : "Failed to fetch feed"); - hasMore.set(false); - } finally { - if (append) { - isLoadingMore.set(false); - } else { - isLoading.set(false); - } - } + currentPage.set(responsePage); + hasMore.set(newPosts.length === limit && responsePage < totalPages); + } catch (err) { + error.set(err instanceof Error ? err.message : 'Failed to fetch feed'); + hasMore.set(false); + } finally { + if (append) { + isLoadingMore.set(false); + } else { + isLoading.set(false); + } + } }; export const loadMoreFeed = async () => { - const page = get(currentPage); - const more = get(hasMore); - const loading = get(isLoading) || get(isLoadingMore); + const page = get(currentPage); + const more = get(hasMore); + const loading = get(isLoading) || get(isLoadingMore); - if (!more || loading) { - return; - } + if (!more || loading) { + return; + } - await fetchFeed(page + 1, 10, true); + await fetchFeed(page + 1, 10, true); }; export const createPost = async (text: string, images: string[]) => { - try { - isLoading.set(true); - error.set(null); - const response = await apiClient.post("/api/posts", { - text, - images: images.map((img) => img), - }); - resetFeed(); - await fetchFeed(1, 10, false); - return response.data; - } catch (err) { - error.set(err instanceof Error ? err.message : "Failed to create post"); - throw err; - } finally { - isLoading.set(false); - } + try { + isLoading.set(true); + error.set(null); + const response = await apiClient.post('/api/posts', { + text, + images: images.map((img) => img) + }); + resetFeed(); + await fetchFeed(1, 10, false); + return response.data; + } catch (err) { + error.set(err instanceof Error ? err.message : 'Failed to create post'); + throw err; + } finally { + isLoading.set(false); + } }; export const toggleLike = async (postId: string) => { - try { - const response = await apiClient.post(`/api/posts/${postId}/like`); - return response.data; - } catch (err) { - throw new Error( - err instanceof Error ? err.message : "Failed to toggle like", - ); - } + try { + const response = await apiClient.post(`/api/posts/${postId}/like`); + return response.data; + } catch (err) { + throw new Error(err instanceof Error ? err.message : 'Failed to toggle like'); + } }; diff --git a/platforms/pictique/src/routes/(protected)/messages/[id]/+page.svelte b/platforms/pictique/src/routes/(protected)/messages/[id]/+page.svelte index 0dd46be13..e508ad4e6 100644 --- a/platforms/pictique/src/routes/(protected)/messages/[id]/+page.svelte +++ b/platforms/pictique/src/routes/(protected)/messages/[id]/+page.svelte @@ -164,17 +164,17 @@ const { data: chatsData } = await apiClient.get<{ chats: Chat[]; }>(`/api/chats?page=1&limit=100`); - + const chat = chatsData.chats.find((c) => c.id === id); if (chat && userId) { const members = chat.participants.filter((u) => u.id !== userId); const isGroup = members.length > 1; - + // For 2-person chats, show the other person's name, not the group name const displayName = isGroup ? chat.name || members.map((m) => m.name ?? m.handle ?? m.ename).join(', ') : members[0]?.name || members[0]?.handle || members[0]?.ename || 'Unknown User'; - + heading.set(displayName); } } catch (error) { diff --git a/platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte b/platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte index 791c4348e..64ee1a797 100644 --- a/platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte +++ b/platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte @@ -27,6 +27,7 @@ let error = $state(null); let loading = $state(true); let ownerId: string | null = $derived(getAuthId()); + let isFollowing = $state(false); let ownerProfile = $derived.by(async () => { if (ownerId) { const response = await apiClient.get(`/api/users/${ownerId}`); @@ -50,10 +51,13 @@ async function handleFollow() { try { + isFollowing = true; await apiClient.post(`/api/users/${profileId}/follow`); - await fetchProfile(); // Refresh profile to update follower count + // await fetchProfile(); // Refresh profile to update follower count } catch (err) { error = err instanceof Error ? err.message : 'Failed to follow user'; + } finally { + isFollowing = false; } } @@ -94,6 +98,7 @@
{:else if profile} handlePostClick(post)}