[CodeFactor] Apply fixes to commit 8d62550

This commit is contained in:
codefactor-io 2024-02-06 19:09:39 +00:00
parent 8d62550775
commit 1f38267626
No known key found for this signature in database
GPG key ID: B66B2D63282C190F
3 changed files with 40 additions and 21 deletions

View file

@ -2,13 +2,25 @@
<div class="row justify-content-start mb-2"> <div class="row justify-content-start mb-2">
<div :class="messageWidthClass"> <div :class="messageWidthClass">
<div class="card bg-light border-0 text-dark"> <div class="card bg-light border-0 text-dark">
<div
<div v-for="attachment in message.attachments" :key="attachment.id" class="card-header"> v-for="attachment in message.attachments"
<div class="btn-group w-100" role="group"> :key="attachment.id"
<button class="btn btn-light text-truncate" disabled>{{ attachment.name }}</button> class="card-header"
<button @click="downloadAttachment(attachment.hash_sha512, attachment.name)" class="btn btn-light w-25"><i class="bi bi-download strong"></i></button> >
<div class="btn-group w-100" role="group">
<button class="btn btn-light text-truncate" disabled>
{{ attachment.name }}
</button>
<button
@click="
downloadAttachment(attachment.hash_sha512, attachment.name)
"
class="btn btn-light w-25"
>
<i class="bi bi-download strong"></i>
</button>
</div>
</div> </div>
</div>
<div class="card-body"> <div class="card-body">
<p class="card-text">{{ message.body }}</p> <p class="card-text">{{ message.body }}</p>
@ -33,8 +45,6 @@
<i class="bi bi-info-circle"></i> <i class="bi bi-info-circle"></i>
</button> </button>
<button class="btn btn-outline-secondary border-0" @click="deleteMessage"> <button class="btn btn-outline-secondary border-0" @click="deleteMessage">
<i class="bi bi-trash"></i> <i class="bi bi-trash"></i>
</button> </button>
@ -92,7 +102,7 @@ export default {
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
// Creating a temporary anchor element to download the file // Creating a temporary anchor element to download the file
const anchor = document.createElement('a'); const anchor = document.createElement("a");
anchor.href = url; anchor.href = url;
anchor.download = fileName; anchor.download = fileName;
document.body.appendChild(anchor); document.body.appendChild(anchor);
@ -107,7 +117,6 @@ export default {
}, },
}, },
computed: { computed: {
messageWidthClass() { messageWidthClass() {
// Calculate a Bootstrap grid class based on message length // Calculate a Bootstrap grid class based on message length
// Adjust the logic as needed to fit your requirements // Adjust the logic as needed to fit your requirements

View file

@ -2,7 +2,6 @@
<div class="row justify-content-end mb-2"> <div class="row justify-content-end mb-2">
<!-- control area --> <!-- control area -->
<div class="col-auto p-0 m-0"> <div class="col-auto p-0 m-0">
<button <button
class="btn btn-outline-secondary border-0 me-1" class="btn btn-outline-secondary border-0 me-1"
@click="repeatMessage" @click="repeatMessage"
@ -27,14 +26,25 @@
<!-- message area --> <!-- message area -->
<div :class="messageWidthClass"> <div :class="messageWidthClass">
<div class="card bg-secondary text-white"> <div class="card bg-secondary text-white">
<div v-for="attachment in message.attachments" :key="attachment.id" class="card-header"> <div
<div class="btn-group w-100" role="group"> v-for="attachment in message.attachments"
<button class="btn btn-light text-truncate" disabled>{{ attachment.name }}</button> :key="attachment.id"
<button @click="downloadAttachment(attachment.hash_sha512, attachment.name)" class="btn btn-light w-25"><i class="bi bi-download strong"></i></button> class="card-header"
>
<div class="btn-group w-100" role="group">
<button class="btn btn-light text-truncate" disabled>
{{ attachment.name }}
</button>
<button
@click="
downloadAttachment(attachment.hash_sha512, attachment.name)
"
class="btn btn-light w-25"
>
<i class="bi bi-download strong"></i>
</button>
</div>
</div> </div>
</div>
<div class="card-body"> <div class="card-body">
<p class="card-text">{{ message.body }}</p> <p class="card-text">{{ message.body }}</p>
@ -137,7 +147,7 @@ export default {
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
// Creating a temporary anchor element to download the file // Creating a temporary anchor element to download the file
const anchor = document.createElement('a'); const anchor = document.createElement("a");
anchor.href = url; anchor.href = url;
anchor.download = fileName; anchor.download = fileName;
document.body.appendChild(anchor); document.body.appendChild(anchor);

View file

@ -78,7 +78,7 @@ function createSortedMessagesList(data: {
} }
export function newMessage(dxcall, body, attachments) { export function newMessage(dxcall, body, attachments) {
console.log(attachments) console.log(attachments);
sendFreedataMessage(dxcall, body, attachments); sendFreedataMessage(dxcall, body, attachments);
} }
@ -102,5 +102,5 @@ export function requestMessageInfo(id) {
} }
export async function getMessageAttachment(data_sha512) { export async function getMessageAttachment(data_sha512) {
return await getFreedataAttachmentBySha512(data_sha512) return await getFreedataAttachmentBySha512(data_sha512);
} }