Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion platforms/dreamSync/client/src/pages/wishlist-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default function WishlistEditor() {
<Sparkles className="w-8 h-8 text-blue-400" />
</div>
<p className="text-lg text-gray-300">
Welcome back, <span className="font-semibold text-white">{user?.firstName || user?.email || 'User'}</span>!
Welcome back, <span className="font-semibold text-white">{user?.name|| user?.email || 'User'}</span>!
</p>
<p className="text-sm text-gray-400 mt-2">
{existingWishlist ? 'Edit your wishlist' : 'Create and share your dreams, goals, and what you can offer to the world'}
Expand Down
1 change: 1 addition & 0 deletions platforms/dreamSync/shared/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
30 changes: 8 additions & 22 deletions platforms/pictique/src/lib/fragments/Profile/Profile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,26 @@
handleFollow,
handleSinglePost,
handleMessage,
isFollowing = $bindable(false)
isFollowing = $bindable(false),
didFollowed = $bindable(false)
}: {
variant: 'user' | 'other';
profileData: userProfile;
handleSinglePost: (post: PostData) => void;
handleFollow: () => Promise<void>;
handleMessage: () => Promise<void>;
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;
}
</script>

Expand All @@ -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'
: ''}"
>
<div class="flex items-center justify-center gap-2">
{#if requestSent}
{#if didFollowed}
<HugeiconsIcon icon={Tick01Icon} size={16} />
<span>Followed</span>
<span>Following</span>
{:else if isFollowing}
<span class="flex gap-0.5">
<span class="animate-bounce">.</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<userProfile>(`/api/users/${ownerId}`);
Expand All @@ -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;
}
Expand Down Expand Up @@ -99,6 +107,7 @@
{:else if profile}
<Profile
bind:isFollowing
bind:didFollowed
variant={ownerId === profileId ? 'user' : 'other'}
profileData={profile}
handleSinglePost={(post) => handlePostClick(post)}
Expand Down