mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 04:27:53 +00:00
* feat: Remove foundation * chore: Minor fix * Minor fix * Update _forms.scss * chore: More changes * chore: Minor fix * chore: Clean up * fix: font-weight * chore: More changes * chore: Setting page * chore: Editor fix * chore: Reports page * chore: More changes * chore: Minor changes * chore: More fixes * chore: More changes * chore: More changes * chore: More changes * chore: Minor fix * chore: More changes * chore: More changes * chore: More changes * chore: More changes * chore: Clean up * chore: Minor fix * chore: Clean ups * chore: Rename basic file * chore: Remove unused files * chore: Fix expanded input * Fix campaign rendering * chore: Clean up * chore: More changes * chore: Remove unused files * fix: Overflow issue * chore: Minor fix * chore: Clean up * chore: Minor fix * chore: Remove unused files * chore: Minor fix * chore: Minor fix * fix: autoprefixer start/end value has mixed support * chore: Minor fix * chore: Remove unused files * chore: Minor fix * chore: Minor fix * chore: Minor fix * Add responsive design to label settings * fix inbox view * chore: Minor fix * w-60% to w-2/3 * chore: Fix team * chore: Fix button * w-[34%] to w-1/3 * chore: Fix border * Add support mobile views in team page * chore: fix snackbar * chore: clean up * chore: Clean up * fix: loading state alignment * fix: alert styles * chore: Minor fix * fix: spacing for agent bot row * fix: layout * fix: layout for SLA * fix: checkbox * fix: SLA checkbox spacing * Update inbox settings pages * fix macros listing page layout * fix canned responses * chore: Fix bot page * chore: fix automation page * chore: fix agents page * chore: fix canned response editor * chore: Fix settings table * chore: fix settings layout * chore: Minor fix * fix: canned response table layou * fix: layout for table header for webhooks * fix: webhook row layout * fix: dashboard app modal layout * fix: add title to canned response truncated shortcode * fix: dashboard apps row layuot * fix: layouts hooks * fix: body color * fix: delete action color in portal locales * fix: text color for campagin title * fix: success button color --------- Co-authored-by: Pranav <pranav@chatwoot.com> Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com> Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
96 lines
2.5 KiB
Vue
96 lines
2.5 KiB
Vue
<template>
|
|
<div class="preview-item__wrap flex overflow-auto max-h-[12.5rem]">
|
|
<div
|
|
v-for="(attachment, index) in attachments"
|
|
:key="attachment.id"
|
|
class="preview-item flex items-center p-1 bg-slate-50 dark:bg-slate-800 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="image-thumb"
|
|
:src="attachment.thumb"
|
|
/>
|
|
<span v-else class="w-6 h-6 text-lg relative -top-px text-left">
|
|
📄
|
|
</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="item overflow-hidden text-xs text-ellipsis whitespace-nowrap"
|
|
>
|
|
{{ formatFileSize(attachment.resource) }}
|
|
</span>
|
|
</div>
|
|
<div class="flex items-center justify-center">
|
|
<woot-button
|
|
v-if="!isTypeAudio(attachment.resource)"
|
|
class="remove--attachment clear secondary"
|
|
icon="dismiss"
|
|
@click="() => onRemoveAttachment(index)"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import { formatBytes } from 'shared/helpers/FileHelper';
|
|
export default {
|
|
props: {
|
|
attachments: {
|
|
type: Array,
|
|
default: () => [],
|
|
},
|
|
removeAttachment: {
|
|
type: Function,
|
|
default: () => {},
|
|
},
|
|
},
|
|
methods: {
|
|
onRemoveAttachment(index) {
|
|
this.removeAttachment(index);
|
|
},
|
|
formatFileSize(file) {
|
|
const size = file.byte_size || file.size;
|
|
return formatBytes(size, 0);
|
|
},
|
|
isTypeImage(file) {
|
|
const type = file.content_type || file.type;
|
|
return type.includes('image');
|
|
},
|
|
isTypeAudio(file) {
|
|
const type = file.content_type || file.type;
|
|
return type.includes('audio');
|
|
},
|
|
fileName(file) {
|
|
return file.filename || file.name;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.image-thumb {
|
|
@apply w-6 h-6 object-cover rounded-sm;
|
|
}
|
|
|
|
.file-name-wrap,
|
|
.file-size-wrap {
|
|
@apply flex items-center py-0 px-1;
|
|
|
|
> .item {
|
|
@apply m-0 overflow-hidden text-xs font-medium;
|
|
}
|
|
}
|
|
|
|
.remove--attachment {
|
|
@apply w-6 h-6 rounded-md text-sm cursor-pointer hover:bg-slate-50 dark:hover:bg-slate-800;
|
|
}
|
|
</style>
|