diff --git a/platforms/dreamSync/client/src/pages/wishlist-editor.tsx b/platforms/dreamSync/client/src/pages/wishlist-editor.tsx
index a9548bc33..a77269882 100644
--- a/platforms/dreamSync/client/src/pages/wishlist-editor.tsx
+++ b/platforms/dreamSync/client/src/pages/wishlist-editor.tsx
@@ -113,7 +113,7 @@ export default function WishlistEditor() {
- Welcome back, {user?.firstName || user?.email || 'User'}!
+ Welcome back, {user?.name|| user?.email || 'User'}!
{existingWishlist ? 'Edit your wishlist' : 'Create and share your dreams, goals, and what you can offer to the world'}
diff --git a/platforms/dreamSync/shared/schema.ts b/platforms/dreamSync/shared/schema.ts
index e8206fe03..d001947d3 100644
--- a/platforms/dreamSync/shared/schema.ts
+++ b/platforms/dreamSync/shared/schema.ts
@@ -302,6 +302,7 @@ export type GroupSuggestion = Suggestion;
// Extended types for API responses
export type UserWithProfile = User & {
+ name?:string;
profile?: Profile;
skills?: Skill[];
interests?: Interest[];
diff --git a/platforms/pictique/src/lib/fragments/Profile/Profile.svelte b/platforms/pictique/src/lib/fragments/Profile/Profile.svelte
index ff68d8214..dc571a660 100644
--- a/platforms/pictique/src/lib/fragments/Profile/Profile.svelte
+++ b/platforms/pictique/src/lib/fragments/Profile/Profile.svelte
@@ -12,7 +12,8 @@
handleFollow,
handleSinglePost,
handleMessage,
- isFollowing = $bindable(false)
+ isFollowing = $bindable(false),
+ didFollowed = $bindable(false)
}: {
variant: 'user' | 'other';
profileData: userProfile;
@@ -20,31 +21,17 @@
handleFollow: () => Promise;
handleMessage: () => Promise;
isFollowing: boolean;
+ didFollowed: boolean;
} = $props();
let imgPosts = $derived(profileData.posts.filter((e) => e.imgUris && e.imgUris.length > 0));
- let requestSent = $state(false);
const btnScale = new Spring(1, { stiffness: 0.2, damping: 0.4 });
async function wrappedFollow() {
- if (isFollowing || requestSent) return;
-
btnScale.target = 0.95;
-
- try {
- await handleFollow();
-
- requestSent = true;
- btnScale.target = 1;
-
- setTimeout(() => {
- requestSent = false;
- }, 2000);
- } catch (e) {
- console.error(e);
- btnScale.target = 1;
- }
+ await handleFollow();
+ btnScale.target = 1;
}
@@ -69,15 +56,14 @@
variant={'primary'}
size="sm"
callback={wrappedFollow}
- disabled={isFollowing || requestSent}
- class="min-w-[110px] transition-all duration-500 {requestSent
+ class="min-w-[110px] transition-all duration-500 {didFollowed
? 'opacity-80'
: ''}"
>
- {#if requestSent}
+ {#if didFollowed}
-
Followed
+
Following
{:else if isFollowing}
.
diff --git a/platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte b/platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte
index 64ee1a797..a19ed7ef2 100644
--- a/platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte
+++ b/platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte
@@ -28,6 +28,7 @@
let loading = $state(true);
let ownerId: string | null = $derived(getAuthId());
let isFollowing = $state(false);
+ let didFollowed = $state(false);
let ownerProfile = $derived.by(async () => {
if (ownerId) {
const response = await apiClient.get(`/api/users/${ownerId}`);
@@ -52,10 +53,17 @@
async function handleFollow() {
try {
isFollowing = true;
- await apiClient.post(`/api/users/${profileId}/follow`);
- // await fetchProfile(); // Refresh profile to update follower count
+ const response = await apiClient.post(`/api/users/${profileId}/follow`);
+ if (response) {
+ didFollowed = true;
+ setTimeout(async () => {
+ await fetchProfile();
+ didFollowed = false;
+ }, 1000);
+ }
} catch (err) {
error = err instanceof Error ? err.message : 'Failed to follow user';
+ didFollowed = false;
} finally {
isFollowing = false;
}
@@ -99,6 +107,7 @@
{:else if profile}
handlePostClick(post)}