update AttachmentsPresenter

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-09-27 19:00:01 +02:00
parent bfc81b562c
commit 7199b20f6c
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
2 changed files with 16 additions and 8 deletions

View File

@ -32,12 +32,12 @@
<tbody>
{#each Object.values(files) as file}
<tr class="tr-body">
<td class="item flex-row-center">
<td class="item flex-row-center" on:click={() => {
closeTooltip()
showPopup(PDFViewer, { file: file.file }, 'right')
}}>
<div class="flex-center file-icon">pdf</div>
<div class="flex-col flex-grow" style="cursor: pointer" on:click={() => {
closeTooltip()
showPopup(PDFViewer, { file: file.file }, 'right')
}}>
<div class="flex-col flex-grow">
<div class="overflow-label caption-color">{trimFilename(file.name)}</div>
<div class="overflow-label file-desc">{file.type}</div>
</div>
@ -66,7 +66,7 @@
&:first-child { border-top: none; }
}
.item { padding: .75rem 1rem .75rem 0; }
.item { padding: .75rem 1rem .75rem 0; cursor: pointer; }
.file-icon {
margin-right: 1.25rem;
width: 2rem;

View File

@ -17,7 +17,7 @@
<script lang="ts">
import type { Bag } from '@anticrm/core'
import type { Attachment } from '@anticrm/chunter'
import { IconFile, Link, Tooltip, showPopup } from '@anticrm/ui'
import { IconFile, Link, Tooltip, IconAttachment } from '@anticrm/ui'
import { PDFViewer } from '@anticrm/presentation'
import AttachmentPopup from './AttachmentPopup.svelte'
@ -25,10 +25,18 @@
</script>
{#if Object.keys(value.attachments).length === 1}
<!-- {#if Object.keys(value.attachments).length === 1}
<Link label={Object.values(value.attachments)[0].name} href={'#'} icon={IconFile} on:click={ () => { showPopup(PDFViewer, { file: Object.values(value.attachments)[0].file }, 'right') } }/>
{:else if Object.keys(value.attachments).length > 1}
<Tooltip label={'Attachments (' + Object.values(value.attachments).length + ')'} component={AttachmentPopup} props={{ files: value.attachments }}>
<Link label={Object.values(value.attachments).length + ' files'} href={'#'} icon={IconFile} />
</Tooltip>
{/if} -->
{#if Object.keys(value.attachments).length > 0}
<Tooltip label={'Attachments (' + Object.values(value.attachments).length + ')'} component={AttachmentPopup} props={{ files: value.attachments }}>
<div class="flex-row-center">
<IconAttachment size="small"/>&nbsp;{Object.keys(value.attachments).length}
</div>
</Tooltip>
{/if}