Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
89 lines
2.3 KiB
Vue
89 lines
2.3 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import { formatBytes } from 'shared/helpers/FileHelper';
|
|
|
|
import Button from 'dashboard/components-next/button/Button.vue';
|
|
|
|
const props = defineProps({
|
|
attachments: {
|
|
type: Array,
|
|
default: () => [],
|
|
},
|
|
});
|
|
|
|
const emit = defineEmits(['removeAttachment']);
|
|
|
|
const nonRecordedAudioAttachments = computed(() => {
|
|
return props.attachments.filter(attachment => !attachment?.isRecordedAudio);
|
|
});
|
|
|
|
const recordedAudioAttachments = computed(() =>
|
|
props.attachments.filter(attachment => attachment.isRecordedAudio)
|
|
);
|
|
|
|
const onRemoveAttachment = itemIndex => {
|
|
emit(
|
|
'removeAttachment',
|
|
nonRecordedAudioAttachments.value
|
|
.filter((_, index) => index !== itemIndex)
|
|
.concat(recordedAudioAttachments.value)
|
|
);
|
|
};
|
|
|
|
const formatFileSize = file => {
|
|
const size = file.byte_size || file.size;
|
|
return formatBytes(size, 0);
|
|
};
|
|
|
|
const isTypeImage = file => {
|
|
const type = file.content_type || file.type;
|
|
return type.includes('image');
|
|
};
|
|
|
|
const fileName = file => {
|
|
return file.filename || file.name;
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex overflow-auto max-h-[12.5rem]">
|
|
<div
|
|
v-for="(attachment, index) in nonRecordedAudioAttachments"
|
|
:key="attachment.id"
|
|
class="flex items-center p-1 bg-n-slate-3 gap-1 rounded-md w-[15rem] mb-1"
|
|
>
|
|
<div class="max-w-[4rem] flex-shrink-0 w-6 flex items-center">
|
|
<img
|
|
v-if="isTypeImage(attachment.resource)"
|
|
class="object-cover w-6 h-6 rounded-sm"
|
|
:src="attachment.thumb"
|
|
/>
|
|
<span v-else class="relative w-6 h-6 text-lg text-left -top-px">
|
|
📄
|
|
</span>
|
|
</div>
|
|
<div class="max-w-3/5 min-w-[50%] overflow-hidden text-ellipsis">
|
|
<span
|
|
class="h-4 overflow-hidden text-sm font-medium text-ellipsis whitespace-nowrap"
|
|
>
|
|
{{ fileName(attachment.resource) }}
|
|
</span>
|
|
</div>
|
|
<div class="w-[30%] justify-center">
|
|
<span class="overflow-hidden text-xs text-ellipsis whitespace-nowrap">
|
|
{{ formatFileSize(attachment.resource) }}
|
|
</span>
|
|
</div>
|
|
<div class="flex items-center justify-center">
|
|
<Button
|
|
ghost
|
|
slate
|
|
xs
|
|
icon="i-lucide-x"
|
|
@click="onRemoveAttachment(index)"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|