From eb2bce31191086201be777b8a961d9575f938d46 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 22 Nov 2023 13:04:23 +0100 Subject: [PATCH] [#149] Make attachments stand out more (#152) --- src/components/secret-display.vue | 49 ++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/src/components/secret-display.vue b/src/components/secret-display.vue index 34c2919..bcb465e 100644 --- a/src/components/secret-display.vue +++ b/src/components/secret-display.vue @@ -52,19 +52,28 @@

@@ -84,6 +93,7 @@ export default { data() { return { files: [], + hasDownloaded: {}, popover: null, secret: null, secretContentBlobURL: null, @@ -94,6 +104,23 @@ export default { methods: { bytesToHuman, + fasFileType(type) { + return [ + 'fas', + 'fa-fw', + 'me-2', + ...[ + { icon: ['fa-file-pdf'], match: /application\/pdf/ }, + { icon: ['fa-file-audio'], match: /^audio\// }, + { icon: ['fa-file-image'], match: /^image\// }, + { icon: ['fa-file-lines'], match: /^text\// }, + { icon: ['fa-file-video'], match: /^video\// }, + { icon: ['fa-file-zipper'], match: /^application\/(gzip|x-tar|zip)$/ }, + { icon: ['fa-file-circle-question'], match: /.*/ }, + ].filter(el => el.match.test(type))[0].icon, + ].join(' ') + }, + // requestSecret requests the encrypted secret from the backend requestSecret() { this.secretLoading = true @@ -129,7 +156,7 @@ export default { file.arrayBuffer() .then(ab => { const blobURL = window.URL.createObjectURL(new Blob([ab], { type: file.type })) - this.files.push({ name: file.name, size: ab.byteLength, url: blobURL }) + this.files.push({ name: file.name, size: ab.byteLength, type: file.type, url: blobURL }) }) }) this.secretLoading = false