diff --git a/packages/ui/src/components/Progress.svelte b/packages/ui/src/components/Progress.svelte index ff0dfcee03..b66a2d4f02 100644 --- a/packages/ui/src/components/Progress.svelte +++ b/packages/ui/src/components/Progress.svelte @@ -14,18 +14,29 @@ --> -
-
+
+
diff --git a/plugins/attachment-resources/src/components/AttachmentPreview.svelte b/plugins/attachment-resources/src/components/AttachmentPreview.svelte new file mode 100644 index 0000000000..684efb9a3d --- /dev/null +++ b/plugins/attachment-resources/src/components/AttachmentPreview.svelte @@ -0,0 +1,77 @@ + + + + +
+ {#if type === 'image'} +
{ + closeTooltip() + showPopup(PDFViewer, { file: value.file, name: value.name, contentType: value.type }, 'right') + }}> + {value.name} +
+ {:else if type === 'audio'} + + {:else if type === 'video'} +
+ +
+ {:else} +
+ +
+ {/if} +
+ + diff --git a/plugins/attachment-resources/src/components/AudioPlayer.svelte b/plugins/attachment-resources/src/components/AudioPlayer.svelte new file mode 100644 index 0000000000..8bfd34521a --- /dev/null +++ b/plugins/attachment-resources/src/components/AudioPlayer.svelte @@ -0,0 +1,56 @@ + + + + +
+
+ +
+
+ +
+
+ + + \ No newline at end of file diff --git a/plugins/attachment-resources/src/components/Photos.svelte b/plugins/attachment-resources/src/components/Photos.svelte index 640f43322d..634995b96b 100644 --- a/plugins/attachment-resources/src/components/Photos.svelte +++ b/plugins/attachment-resources/src/components/Photos.svelte @@ -87,7 +87,7 @@ const el: HTMLElement = ev.currentTarget as HTMLElement el.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' }) if (item !== undefined) { - showPopup(PDFViewer, { file: item.file, name: item.name }, 'right') + showPopup(PDFViewer, { file: item.file, name: item.name, contentType: item.type }, 'right') } else { inputFile.click() } @@ -134,7 +134,7 @@ > {#each images as image (image._id)}
{ click(ev, image) }} @@ -178,8 +178,8 @@ cursor: pointer; img { - width: 5rem; - height: 5rem; + min-width: 5rem; + min-height: 5rem; } } diff --git a/plugins/attachment-resources/src/components/icons/Pause.svelte b/plugins/attachment-resources/src/components/icons/Pause.svelte new file mode 100644 index 0000000000..1cba8460f0 --- /dev/null +++ b/plugins/attachment-resources/src/components/icons/Pause.svelte @@ -0,0 +1,29 @@ + + + + + + + + + + + + + diff --git a/plugins/attachment-resources/src/components/icons/Play.svelte b/plugins/attachment-resources/src/components/icons/Play.svelte new file mode 100644 index 0000000000..83c4428e1a --- /dev/null +++ b/plugins/attachment-resources/src/components/icons/Play.svelte @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/plugins/attachment-resources/src/utils.ts b/plugins/attachment-resources/src/utils.ts index b1be1f17b5..341cfec351 100644 --- a/plugins/attachment-resources/src/utils.ts +++ b/plugins/attachment-resources/src/utils.ts @@ -67,3 +67,20 @@ export async function deleteFile (id: string): Promise { throw new Error('Failed to delete file') } } + +export function getType (type: string): 'image' | 'video' | 'audio' | 'pdf' | 'other' { + if (type.startsWith('image/')) { + return 'image' + } + if (type.startsWith('audio/')) { + return 'audio' + } + if (type.startsWith('video/')) { + return 'video' + } + if (type.includes('application/pdf')) { + return 'pdf' + } + + return 'other' +}