enh: channel file upload

This commit is contained in:
Timothy Jaeryang Baek
2024-12-23 14:43:58 -07:00
parent b4d7268bed
commit ecd3b4ebd4
7 changed files with 477 additions and 25 deletions
@@ -23,6 +23,8 @@
import Pencil from '$lib/components/icons/Pencil.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Textarea from '$lib/components/common/Textarea.svelte';
import Image from '$lib/components/common/Image.svelte';
import FileItem from '$lib/components/common/FileItem.svelte';
export let message;
export let showUserProfile = true;
@@ -142,6 +144,27 @@
</Name>
{/if}
{#if (message?.data?.files ?? []).length > 0}
<div class="my-2.5 w-full flex overflow-x-auto gap-2 flex-wrap">
{#each message?.data?.files as file}
<div>
{#if file.type === 'image'}
<Image src={file.url} alt={file.name} imageClassName=" max-h-96 rounded-lg" />
{:else}
<FileItem
item={file}
url={file.url}
name={file.name}
type={file.type}
size={file?.size}
colorClassName="bg-white dark:bg-gray-850 "
/>
{/if}
</div>
{/each}
</div>
{/if}
{#if edit}
<div class="py-2">
<Textarea