Skip to content

Commit a0ff772

Browse files
grv-saini-20sosweetham
authored andcommitted
fix: added a text area
1 parent 25613d5 commit a0ff772

File tree

7 files changed

+94
-102
lines changed

7 files changed

+94
-102
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,13 @@
1010
callback: () => void;
1111
}
1212
13-
const {
14-
avatar,
15-
name,
16-
unread = false,
17-
callback,
18-
...restProps
19-
}: IGroupProps = $props();
13+
const { avatar, name, unread = false, callback, ...restProps }: IGroupProps = $props();
2014
</script>
2115

2216
<button
2317
{...restProps}
2418
class={cn([
25-
'relative flex w-full cursor-pointer items-center gap-3 rounded-lg py-4 px-2',
19+
'relative flex w-full cursor-pointer items-center gap-3 rounded-lg px-2 py-4',
2620
restProps.class
2721
])}
2822
onclick={callback}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<img
3939
width="24px"
4040
height="24px"
41-
class="flex aspect-square size-10 items-center justify-center rounded-full md:size-12 object-cover"
41+
class="flex aspect-square size-10 items-center justify-center rounded-full object-cover md:size-12"
4242
src={profileSrc}
4343
alt=""
4444
/>

platforms/pictique/src/lib/fragments/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export { default as Comment } from './Comment/Comment.svelte';
1717
export { default as SettingsDeleteButton } from './SettingsDeleteButton/SettingsDeleteButton.svelte';
1818
export { default as UserRequest } from './UserRequest/UserRequest.svelte';
1919
export { default as UploadedPostView } from './UploadedPostView/UploadedPostView.svelte';
20-
export { default as Group } from "./Group/Group.svelte";
20+
export { default as Group } from './Group/Group.svelte';

platforms/pictique/src/lib/store/store.svelte.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ export const uploadedImages: { value: Image[] | null } = $state({
2323
export const audience: { value: string } = $state({
2424
value: 'Everyone'
2525
});
26-

platforms/pictique/src/lib/stores/posts.ts

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ import { apiClient } from '$lib/utils/axios';
33
import { goto } from '$app/navigation';
44

55
export interface Post {
6-
id: string;
7-
text: string;
8-
images: string[];
9-
author: {
10-
id: string;
11-
handle: string;
12-
name: string;
13-
avatarUrl: string;
14-
};
15-
createdAt: string;
16-
likedBy: string[];
17-
comments: {
18-
id: string;
19-
text: string;
20-
author: {
21-
id: string;
22-
handle: string;
23-
name: string;
24-
avatarUrl: string;
25-
};
26-
createdAt: string;
27-
}[];
6+
id: string;
7+
text: string;
8+
images: string[];
9+
author: {
10+
id: string;
11+
handle: string;
12+
name: string;
13+
avatarUrl: string;
14+
};
15+
createdAt: string;
16+
likedBy: string[];
17+
comments: {
18+
id: string;
19+
text: string;
20+
author: {
21+
id: string;
22+
handle: string;
23+
name: string;
24+
avatarUrl: string;
25+
};
26+
createdAt: string;
27+
}[];
2828
}
2929

3030
export const posts = writable<Post[]>([]);
@@ -36,41 +36,41 @@ export const openCreatePostModal = () => isCreatePostModalOpen.set(true);
3636
export const closeCreatePostModal = () => isCreatePostModalOpen.set(false);
3737

3838
export const fetchFeed = async (page = 1, limit = 10_000) => {
39-
try {
40-
isLoading.set(true);
41-
error.set(null);
42-
const response = await apiClient.get(`/api/posts/feed?page=${page}&limit=${limit}`);
43-
posts.set(response.data);
44-
} catch (err) {
45-
error.set(err instanceof Error ? err.message : 'Failed to fetch feed');
46-
} finally {
47-
isLoading.set(false);
48-
}
39+
try {
40+
isLoading.set(true);
41+
error.set(null);
42+
const response = await apiClient.get(`/api/posts/feed?page=${page}&limit=${limit}`);
43+
posts.set(response.data);
44+
} catch (err) {
45+
error.set(err instanceof Error ? err.message : 'Failed to fetch feed');
46+
} finally {
47+
isLoading.set(false);
48+
}
4949
};
5050

5151
export const createPost = async (text: string, images: string[]) => {
52-
try {
53-
isLoading.set(true);
54-
error.set(null);
55-
const response = await apiClient.post('/api/posts', {
56-
text,
57-
images: images.map((img) => img)
58-
});
59-
await fetchFeed(1);
60-
return response.data;
61-
} catch (err) {
62-
error.set(err instanceof Error ? err.message : 'Failed to create post');
63-
throw err;
64-
} finally {
65-
isLoading.set(false);
66-
}
52+
try {
53+
isLoading.set(true);
54+
error.set(null);
55+
const response = await apiClient.post('/api/posts', {
56+
text,
57+
images: images.map((img) => img)
58+
});
59+
await fetchFeed(1);
60+
return response.data;
61+
} catch (err) {
62+
error.set(err instanceof Error ? err.message : 'Failed to create post');
63+
throw err;
64+
} finally {
65+
isLoading.set(false);
66+
}
6767
};
6868

6969
export const toggleLike = async (postId: string) => {
70-
try {
71-
const response = await apiClient.post(`/api/posts/${postId}/like`);
72-
return response.data;
73-
} catch (err) {
74-
throw new Error(err instanceof Error ? err.message : 'Failed to toggle like');
75-
}
70+
try {
71+
const response = await apiClient.post(`/api/posts/${postId}/like`);
72+
return response.data;
73+
} catch (err) {
74+
throw new Error(err instanceof Error ? err.message : 'Failed to toggle like');
75+
}
7676
};
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
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 = {
2121
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-
};
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 type userProfile = {
36-
userId: string;
37-
username: string;
38-
avatarUrl: string;
39-
totalPosts: number;
40-
followers: number;
41-
following: number;
42-
userBio: string;
43-
posts: PostData[];
36+
userId: string;
37+
username: string;
38+
avatarUrl: string;
39+
totalPosts: number;
40+
followers: number;
41+
following: number;
42+
userBio: string;
43+
posts: PostData[];
4444
};
4545

4646
export type Image = {
47-
url: string;
48-
alt: string;
47+
url: string;
48+
alt: string;
4949
};

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { onMount } from 'svelte';
3-
import { ChatMessage, MessageInput, InputFile } from '$lib/fragments';
3+
import { ChatMessage, MessageInput } from '$lib/fragments';
44
import { Avatar, Button, Input, Label } from '$lib/ui';
55
import { goto } from '$app/navigation';
66
import { page } from '$app/state';
@@ -155,15 +155,13 @@
155155
class="w-[90vw] md:max-w-[30vw] z-50 absolute start-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%] p-4 border border-gray-400 rounded-3xl bg-white shadow-xl"
156156
>
157157
<div class="flex flex-col gap-6">
158-
<!-- Group Avatar with Edit Icon -->
159158
<div class="relative w-[96px] h-[96px] self-center">
160159
<img
161160
src={groupImageDataUrl || '/images/avatar-placeholder.png'}
162161
alt="Group Avatar"
163162
class="w-full h-full object-cover rounded-full border border-gray-300"
164163
/>
165164
{#if canEdit}
166-
<!-- Hidden file input trigger -->
167165
<input
168166
type="file"
169167
accept="image/*"
@@ -191,11 +189,12 @@
191189
{/if}
192190
</div>
193191

194-
<!-- Group Description -->
195192
<div>
196193
<Label>Description</Label>
197194
{#if canEdit}
198-
<Input type="text" placeholder="Edit group description" bind:value={groupDescription} />
195+
<!-- svelte-ignore element_invalid_self_closing_tag -->
196+
<textarea rows="2"
197+
maxlength="60" placeholder="Edit group description" class="w-full bg-grey py-3.5 px-6 text-[15px] text-black-800 font-geist font-normal placeholder:text-black-600 rounded-4xl outline-0 border border-transparent invalid:border-red invalid:text-red focus:invalid:text-black-800 focus:invalid:border-transparent" bind:value={groupDescription} />
199198
{:else}
200199
<p class="text-gray-700">{group.description}</p>
201200
{/if}

0 commit comments

Comments
 (0)