chore: Refactor widget (#5621)

This commit is contained in:
David Kubeš 2022-10-14 05:43:11 +02:00 committed by GitHub
parent e310230f62
commit a6960dc2d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 31 additions and 55 deletions

View file

@ -104,8 +104,7 @@ export default {
) {
return false;
}
if (!this.message.content) return false;
return true;
return this.message.content;
},
readableTime() {
const { created_at: createdAt = '' } = this.message;

View file

@ -54,9 +54,9 @@ export default {
},
async onFileUpload(file) {
if (this.globalConfig.directUploadsEnabled) {
this.onDirectFileUpload(file);
await this.onDirectFileUpload(file);
} else {
this.onIndirectFileUpload(file);
await this.onIndirectFileUpload(file);
}
},
async onDirectFileUpload(file) {

View file

@ -7,7 +7,12 @@
class="flex items-start"
:class="[avatarUrl ? 'justify-between' : 'justify-end']"
>
<img v-if="avatarUrl" class="h-12 rounded-full" :src="avatarUrl" />
<img
v-if="avatarUrl"
class="h-12 rounded-full"
:src="avatarUrl"
alt="Avatar"
/>
<header-actions :show-popout-button="showPopoutButton" />
</div>
<h2

View file

@ -209,9 +209,7 @@ export default {
min-height: $space-large;
max-height: 2.4 * $space-mega;
resize: none;
padding: 0;
padding-top: $space-smaller;
padding-bottom: $space-smaller;
padding: $space-smaller 0;
margin-top: $space-small;
margin-bottom: $space-small;
}

View file

@ -49,8 +49,7 @@ export default {
: decodeURI(this.fileName);
},
fileName() {
const filename = this.url.substring(this.url.lastIndexOf('/') + 1);
return filename;
return this.url.substring(this.url.lastIndexOf('/') + 1);
},
},
methods: {

View file

@ -118,13 +118,10 @@ export default {
const isUserEmailAvailable = !!this.currentUser.email;
const isUserPhoneNumberAvailable = !!this.currentUser.phone_number;
return this.preChatFields.filter(field => {
if (
return !(
(isUserEmailAvailable && field.name === 'emailAddress') ||
(isUserPhoneNumberAvailable && field.name === 'phoneNumber')
) {
return false;
}
return true;
);
});
},
enabledPreChatFields() {

View file

@ -13,7 +13,7 @@
}}
</div>
<div class="text-xs leading-4 mt-1">
{{ replyWaitMeessage }}
{{ replyWaitMessage }}
</div>
</div>
<available-agents v-if="isOnline" :agents="availableAgents" />
@ -75,7 +75,7 @@ export default {
}
return anyAgentOnline;
},
replyWaitMeessage() {
replyWaitMessage() {
const { workingHoursEnabled } = this.channelConfig;
if (this.isOnline) {

View file

@ -107,13 +107,12 @@ export default {
.clear-button {
background: transparent;
color: $color-woot;
padding: 0;
border: 0;
font-weight: $font-weight-bold;
font-size: $font-size-medium;
transition: all 0.3s var(--ease-in-cubic);
margin-left: $space-smaller;
padding-right: $space-one;
padding: 0 $space-one 0 0;
&:hover {
transform: translateX($space-smaller);