From 71985c325b7a414cf353fb4c5b39980bc06a3cbb Mon Sep 17 00:00:00 2001 From: Zoe <62722391+juls0730@users.noreply.github.com> Date: Mon, 2 Mar 2026 00:12:01 -0600 Subject: [PATCH] feat: improve file upload and diplay stuff --- app/components/Attachment/Display.vue | 58 ++++++-- app/components/Attachment/Preview.vue | 2 +- app/components/ChatInput.vue | 9 +- app/components/FileSelector.vue | 190 ++++++++++++++++++++------ 4 files changed, 200 insertions(+), 59 deletions(-) diff --git a/app/components/Attachment/Display.vue b/app/components/Attachment/Display.vue index 115e74d..8a8da56 100644 --- a/app/components/Attachment/Display.vue +++ b/app/components/Attachment/Display.vue @@ -4,17 +4,59 @@ const props = defineProps<{ id: string; name: string; mimeType: string; - status?: 'pending' | 'uploaded'; + status?: 'uploading' | 'uploaded' | 'error'; url: string; + progress?: number; } }>(); + +const isImage = computed(() => props.file.mimeType.startsWith('image/')); +const isVideo = computed(() => props.file.mimeType.startsWith('video/')); +const isAudio = computed(() => props.file.mimeType.startsWith('audio/')); +const isPdf = computed(() => props.file.mimeType === 'application/pdf'); + +const fileIcon = computed(() => { + if (isImage.value) return 'i-mynaui-image'; + if (isVideo.value) return 'i-mynaui-video'; + if (isAudio.value) return 'i-mynaui-music'; + if (isPdf.value) return 'i-tabler-file-type-pdf'; + if (props.file.mimeType.includes('text')) return 'i-mynaui-file-text'; + if (props.file.mimeType.includes('zip') || props.file.mimeType.includes('archive')) return 'i-mynaui-archive'; + return 'i-mynaui-file'; +}); + +const fileExtension = computed(() => { + const parts = props.file.name.split('.'); + return parts.length > 1 ? parts.pop()?.toUpperCase() : 'FILE'; +}); \ No newline at end of file +
+ +
+ diff --git a/app/components/Attachment/Preview.vue b/app/components/Attachment/Preview.vue index ad30729..1b11de8 100644 --- a/app/components/Attachment/Preview.vue +++ b/app/components/Attachment/Preview.vue @@ -6,7 +6,7 @@ const props = defineProps<{ id: string; name: string; mimeType: string; - status: 'pending' | 'uploaded'; + status: 'uploading' | 'uploaded' | 'error'; url: string; } }>(); diff --git a/app/components/ChatInput.vue b/app/components/ChatInput.vue index 9422ba4..a304eab 100644 --- a/app/components/ChatInput.vue +++ b/app/components/ChatInput.vue @@ -13,8 +13,9 @@ const files = ref<{ id: string; name: string; mimeType: string; - status: 'pending' | 'uploaded'; + status: 'uploading' | 'uploaded' | 'error'; url: string; + progress: number; }[]>([]); const inputValue = defineModel({ required: false, default: { content: '', fileIds: [] } }); const textAreaValue = ref(''); @@ -189,7 +190,7 @@ onUnmounted(() => {
-
+
@@ -207,9 +208,7 @@ onUnmounted(() => {
- +