Skip to content

Commit 0041c95

Browse files
committed
fix: user profile types.
1 parent 745ec1f commit 0041c95

File tree

4 files changed

+64
-64
lines changed

4 files changed

+64
-64
lines changed

platforms/pictique/src/lib/fragments/Profile/Profile.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
onerror={() => {
2828
profileData.avatarUrl = '/images/user.png';
2929
}}
30-
alt={profileData.username}
30+
alt={profileData.handle}
3131
class="h-20 w-20 rounded-full object-cover"
3232
/>
3333
<div class="flex-1">
@@ -65,7 +65,7 @@
6565
<li class="mb-6 list-none" onclick={() => handleSinglePost(post)}>
6666
<Post
6767
avatar={profileData.avatarUrl || 'https://picsum.photos/200/200'}
68-
username={profileData?.name ?? profileData?.username}
68+
username={profileData?.name ?? profileData?.handle}
6969
imgUris={post.imgUris ?? []}
7070
text={post.caption}
7171
time={post.time ? new Date(post.time).toLocaleDateString() : ''}
Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,81 @@
1-
import type { SVGAttributes } from 'svelte/elements';
1+
import type { SVGAttributes } from "svelte/elements";
22

33
export interface ISvgProps extends SVGAttributes<SVGElement> {
4-
size?: number | string;
5-
color?: string;
4+
size?: number | string;
5+
color?: string;
66
}
77

88
export type CommentType = {
9-
commentId: string;
10-
name: string;
11-
userImgSrc: string;
12-
comment: string;
13-
isUpVoted: boolean;
14-
isDownVoted: boolean;
15-
upVotes: number;
16-
time: string;
17-
replies: CommentType[];
9+
commentId: string;
10+
name: string;
11+
userImgSrc: string;
12+
comment: string;
13+
isUpVoted: boolean;
14+
isDownVoted: boolean;
15+
upVotes: number;
16+
time: string;
17+
replies: CommentType[];
1818
};
1919

2020
export type PostData = {
21-
createdAt: string | number | Date;
22-
id: string;
23-
avatar: string;
24-
userId: string;
25-
username: string;
26-
imgUris: string[];
27-
caption: string;
28-
time: string;
29-
count: {
30-
likes: number;
31-
comments: number;
32-
};
21+
createdAt: string | number | Date;
22+
id: string;
23+
avatar: string;
24+
userId: string;
25+
username: string;
26+
imgUris: string[];
27+
caption: string;
28+
time: string;
29+
count: {
30+
likes: number;
31+
comments: number;
32+
};
3333
};
3434

3535
export interface Post {
36-
id: string;
37-
text: string;
38-
images: string[];
39-
author: {
40-
id: string;
41-
handle: string;
42-
name: string;
43-
avatarUrl: string;
44-
};
45-
createdAt: string;
46-
likedBy: userProfile[];
47-
comments: {
48-
id: string;
49-
text: string;
50-
author: {
51-
id: string;
52-
handle: string;
53-
name: string;
54-
avatarUrl: string;
55-
};
56-
createdAt: string;
57-
}[];
36+
id: string;
37+
text: string;
38+
images: string[];
39+
author: {
40+
id: string;
41+
handle: string;
42+
name: string;
43+
avatarUrl: string;
44+
};
45+
createdAt: string;
46+
likedBy: userProfile[];
47+
comments: {
48+
id: string;
49+
text: string;
50+
author: {
51+
id: string;
52+
handle: string;
53+
name: string;
54+
avatarUrl: string;
55+
};
56+
createdAt: string;
57+
}[];
5858
}
5959

6060
export type userProfile = {
61-
userId: string;
62-
username: string;
63-
avatarUrl: string;
64-
totalPosts: number;
65-
followers: number;
66-
following: number;
67-
userBio: string;
68-
posts: PostData[];
61+
id: string;
62+
handle: string;
63+
description: string;
64+
name: string;
65+
avatarUrl: string;
66+
totalPosts: number;
67+
followers: number;
68+
following: number;
69+
posts: PostData[];
6970
};
7071

7172
export type Image = {
72-
url: string;
73-
alt: string;
73+
url: string;
74+
alt: string;
7475
};
7576

7677
export type GroupInfo = {
77-
id: string;
78-
name: string;
79-
avatar: string;
78+
id: string;
79+
name: string;
80+
avatar: string;
8081
};

platforms/pictique/src/routes/(protected)/home/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
</li>
150150
{/each}
151151
<MessageInput
152-
class="fixed start-0 bottom-4 mt-4 w-full px-5"
152+
class="fixed bottom-4 start-0 mt-4 w-full px-5"
153153
variant="comment"
154154
src="https://www.gravatar.com/avatar/2c7d99fe281ecd3bcd65ab915bac6dd5?s=250"
155155
bind:value={commentValue}

platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
async function handleMessage() {
4848
try {
4949
await apiClient.post('/api/chats/', {
50-
name: profile?.username,
50+
name: profile?.handle,
5151
participantIds: [profileId]
5252
});
5353
goto('/messages');
@@ -62,7 +62,6 @@
6262
selectedPost.value = post;
6363
// goto("/profile/post");
6464
}
65-
6665
onMount(fetchProfile);
6766
</script>
6867

0 commit comments

Comments
 (0)