- {#each images as image, index (index)}
-
-
-

-
-
- {/each}
+
+ {#each uploadItems as item, index (index)}
+
+
+

+
+
+ {/each}
+
+
+ {#if remainingSize > 0}
+
+ {/if}
+
+
+ {#if uploadItems.length > 1}
+
+
+
+ {formatSize(totalSize)} / {formatSize(MAX_TOTAL_SIZE)}
+
+ {formatSize(remainingSize)} remaining
+
+
+
= 90}
+ class:bg-yellow-500={usagePercentage >= 70 && usagePercentage < 90}
+ class:bg-green-500={usagePercentage < 70}
+ style="width: {Math.min(usagePercentage, 100)}%"
+ >
+
{/if}
-
-
-
+
+
+{#snippet Cross()}
+
+{/snippet}
diff --git a/platforms/pictique/src/lib/fragments/MessageInput/MessageInput.svelte b/platforms/pictique/src/lib/fragments/MessageInput/MessageInput.svelte
index 0d62120e8..28a2deb9f 100644
--- a/platforms/pictique/src/lib/fragments/MessageInput/MessageInput.svelte
+++ b/platforms/pictique/src/lib/fragments/MessageInput/MessageInput.svelte
@@ -1,5 +1,6 @@
@@ -40,15 +54,18 @@
bind:value
{placeholder}
onkeydown={(e) => {
- if (e.key === 'Enter') handleSend();
+ if (e.key === 'Enter' && !isDisabled) handleSubmit();
}}
/>
-
-
-
+
+
diff --git a/platforms/pictique/src/lib/fragments/SideBar/SideBar.svelte b/platforms/pictique/src/lib/fragments/SideBar/SideBar.svelte
index 0805f0199..c4aaf04c7 100644
--- a/platforms/pictique/src/lib/fragments/SideBar/SideBar.svelte
+++ b/platforms/pictique/src/lib/fragments/SideBar/SideBar.svelte
@@ -15,7 +15,7 @@
}
let {
activeTab = $bindable('home'),
- profileSrc = 'images/user.png',
+ profileSrc = '/images/user.png',
handlePost,
...restProps
}: ISideBarProps = $props();
@@ -164,7 +164,7 @@
/>
Profile
diff --git a/platforms/pictique/src/lib/fragments/UploadedPostView/UploadedPostView.svelte b/platforms/pictique/src/lib/fragments/UploadedPostView/UploadedPostView.svelte
index 49e6b4f9a..cd268434f 100644
--- a/platforms/pictique/src/lib/fragments/UploadedPostView/UploadedPostView.svelte
+++ b/platforms/pictique/src/lib/fragments/UploadedPostView/UploadedPostView.svelte
@@ -22,23 +22,18 @@
- {#each images as image, i (i)}
-
+ {#each images as image, i (image.url)}
+
callback(i)}
/>
{/each}
diff --git a/platforms/pictique/src/lib/stores/posts.ts b/platforms/pictique/src/lib/stores/posts.ts
index dbbc7e806..05345aa69 100644
--- a/platforms/pictique/src/lib/stores/posts.ts
+++ b/platforms/pictique/src/lib/stores/posts.ts
@@ -72,10 +72,17 @@ export const createPost = async (text: string, images: string[]) => {
try {
isLoading.set(true);
error.set(null);
- const response = await apiClient.post('/api/posts', {
+
+ const payload = {
text,
images: images.map((img) => img)
- });
+ };
+
+ // Log payload size for debugging
+ const payloadSize = new Blob([JSON.stringify(payload)]).size;
+ console.log(`Payload size: ${(payloadSize / 1024).toFixed(2)} KB (${images.length} images)`);
+
+ const response = await apiClient.post('/api/posts', payload);
resetFeed();
await fetchFeed(1, 10, false);
return response.data;
diff --git a/platforms/pictique/src/lib/types.ts b/platforms/pictique/src/lib/types.ts
index b48eaafdf..4ff512dcd 100644
--- a/platforms/pictique/src/lib/types.ts
+++ b/platforms/pictique/src/lib/types.ts
@@ -73,6 +73,7 @@ export type userProfile = {
export type Image = {
url: string;
alt: string;
+ size?: number;
};
export type GroupInfo = {
diff --git a/platforms/pictique/src/lib/utils/fileValidation.ts b/platforms/pictique/src/lib/utils/fileValidation.ts
new file mode 100644
index 000000000..6dd51ae23
--- /dev/null
+++ b/platforms/pictique/src/lib/utils/fileValidation.ts
@@ -0,0 +1,37 @@
+export const formatSize = (bytes: number): string => {
+ if (bytes < 1024) return `${bytes}B`;
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
+ return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
+};
+
+export interface FileValidationResult {
+ valid: boolean;
+ error?: string;
+}
+
+export const validateFileSize = (
+ file: File,
+ maxFileSize: number,
+ currentTotal?: number,
+ maxTotalSize?: number
+): FileValidationResult => {
+ // Validate individual file size
+ if (file.size > maxFileSize) {
+ return {
+ valid: false,
+ error: `Image must be smaller than ${formatSize(maxFileSize)}`
+ };
+ }
+
+ // Validate total size if applicable
+ if (currentTotal !== undefined && maxTotalSize !== undefined) {
+ if (currentTotal + file.size > maxTotalSize) {
+ return {
+ valid: false,
+ error: `Adding this image would exceed the total limit of ${formatSize(maxTotalSize)}`
+ };
+ }
+ }
+
+ return { valid: true };
+};
diff --git a/platforms/pictique/src/routes/(protected)/group/[id]/+page.svelte b/platforms/pictique/src/routes/(protected)/group/[id]/+page.svelte
index 76048abff..31d27cd0d 100644
--- a/platforms/pictique/src/routes/(protected)/group/[id]/+page.svelte
+++ b/platforms/pictique/src/routes/(protected)/group/[id]/+page.svelte
@@ -133,7 +133,7 @@