From 4d343e7f87ac0c29406c76260f8c57c316bdfd5c Mon Sep 17 00:00:00 2001 From: Paul Valerie GOMA Date: Fri, 25 Jul 2025 18:31:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20File=20component=20update?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/file/VFile.vue | 84 +++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 34 deletions(-) diff --git a/src/components/file/VFile.vue b/src/components/file/VFile.vue index c0cd0a3..1a6fcff 100644 --- a/src/components/file/VFile.vue +++ b/src/components/file/VFile.vue @@ -69,22 +69,22 @@ const onRemoveTemplatingFile = (file: File, removeFileCallback: (index: number) }; const getFileIconClass = (file: File) => { - const type = file.name.toLowerCase(); - if (type.endsWith('.pdf')) return 'ri-file-pdf-2-line'; - if (type.endsWith('.doc') || type.endsWith('.docx')) return 'ri-file-word-2-line'; - if (type.endsWith('.xls') || type.endsWith('.xlsx')) return 'ri-file-excel-2-line'; - if (type.endsWith('.txt')) return 'ri-file-text-line'; - if (type.endsWith('.zip') || type.endsWith('.rar')) return 'ri-file-zip-line'; + const type = file?.name.toLowerCase(); + if (type?.endsWith('.pdf')) return 'ri-file-pdf-2-line'; + if (type?.endsWith('.doc') || type?.endsWith('.docx')) return 'ri-file-word-2-line'; + if (type?.endsWith('.xls') || type?.endsWith('.xlsx')) return 'ri-file-excel-2-line'; + if (type?.endsWith('.txt')) return 'ri-file-text-line'; + if (type?.endsWith('.zip') || type?.endsWith('.rar')) return 'ri-file-zip-line'; return 'ri-file-line'; // icône générique }; const getFileIconColor = (file: File) => { - const type = file.name.toLowerCase(); - if (type.endsWith('.pdf')) return 'var(--border-plain-error)'; // rouge - if (type.endsWith('.doc') || type.endsWith('.docx')) return 'var(--border-plain-blue-france)'; // bleu - if (type.endsWith('.xls') || type.endsWith('.xlsx')) return 'var(--border-plain-success)'; // vert - if (type.endsWith('.txt')) return 'var(--border-plain-grey)'; // gris - if (type.endsWith('.zip') || type.endsWith('.rar')) return 'var(--illustration-color-850-tournesol-default)'; // jaune + const type = file?.name.toLowerCase(); + if (type?.endsWith('.pdf')) return 'var(--border-plain-error)'; // rouge + if (type?.endsWith('.doc') || type?.endsWith('.docx')) return 'var(--border-plain-blue-france)'; // bleu + if (type?.endsWith('.xls') || type?.endsWith('.xlsx')) return 'var(--border-plain-success)'; // vert + if (type?.endsWith('.txt')) return 'var(--border-plain-grey)'; // gris + if (type?.endsWith('.zip') || type?.endsWith('.rar')) return 'var(--illustration-color-850-tournesol-default)'; // jaune return 'var(--border-plain-blue-france)'; // bleu marine }; @@ -109,24 +109,37 @@ const getImagePreview = (file: File) => { class="advanced-file" :title="`Fichier : ${props.file.name}`" :style="{border: borderColor}" + :class="[styles['text-body-XS-mention-text-Medium']]" > +
- - {{ props.file.name }} + + {{ props.file?.name }} -
{{ formatSize(props.file.size) }}
+ {{ formatSize(props.file?.size ?? 0) }} { v-if="advanced && status === 'pending'" :value="props.progress" :show-value="false" - style="width: 100%; margin-top: 0.5rem;" - /> -
{ />
- {{ props.file.name }} - {{ formatSize(props.file.size) }} + {{ props.file?.name }} + {{ formatSize(props.file?.size ?? 0) }}
+
@@ -180,6 +188,11 @@ img{ height: auto; } +.button{ + display: flex; + align-self: self-end; +} + .advanced-file{ border-radius: 3px; width: fit-content; @@ -187,6 +200,7 @@ img{ flex-direction: column; justify-content: space-between; align-items: center; + padding-bottom: 0.25rem; } .simple-file{ @@ -197,10 +211,12 @@ img{ } .file-name{ - max-width: 7.5rem; + width: 6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + margin: 0rem 0.5rem; + text-align: center; } .file-info{