chore: Update file chip

This commit is contained in:
iamsivin
2025-01-24 23:42:06 +05:30
parent 78220565a9
commit 123f0cb61f
3 changed files with 22 additions and 9 deletions
@@ -20,7 +20,7 @@ const isEmpty = computed(() => {
<template>
<BaseBubble class="px-4 py-3" data-bubble-name="text">
<div class="gap-3 flex flex-col">
<div class="gap-4 flex flex-col">
<span v-if="isEmpty" class="text-n-slate-11">
{{ $t('CONVERSATION.NO_CONTENT') }}
</span>
@@ -89,10 +89,12 @@ const files = computed(() => {
</div>
<div v-if="files.length" :class="classToApply">
<FileChip
v-for="attachment in files"
:key="attachment.id"
:attachment="attachment"
/>
<div className="grid grid-cols-2 xl:grid-cols-3 gap-3">
<FileChip
v-for="attachment in files"
:key="attachment.id"
:attachment="attachment"
/>
</div>
</div>
</template>
@@ -27,6 +27,11 @@ const fileType = computed(() => {
return fileName.value.split('.').pop();
});
const fileNameWithoutExt = computed(() => {
const parts = fileName.value.split('.');
return parts.slice(0, -1).join('.') || fileName.value;
});
const textColorClass = computed(() => {
const colorMap = {
'7z': 'dark:text-[#EDEEF0] text-[#2F265F]',
@@ -53,11 +58,17 @@ const textColorClass = computed(() => {
<template>
<div
class="h-9 bg-n-alpha-white gap-2 items-center flex px-2 rounded-lg border border-n-container"
class="h-9 bg-n-alpha-white gap-2 overflow-hidden items-center flex px-2 rounded-lg border border-n-container"
>
<FileIcon class="flex-shrink-0" :file-type="fileType" />
<span class="mr-1 max-w-32 truncate" :class="textColorClass">
{{ fileName }}
<span
:class="textColorClass"
class="inline-flex items-center text-sm overflow-hidden"
>
<span class="truncate min-w-6">
{{ fileNameWithoutExt }}
</span>
<span class="flex-shrink-0 whitespace-nowrap">.{{ fileType }}</span>
</span>
<a
v-tooltip="t('CONVERSATION.DOWNLOAD')"