fix(webapp): show hint that message is being saved (#8690)

* Show hint that message is being saved

* Translate transmitting message
This commit is contained in:
Max 2025-06-19 14:40:11 +02:00 committed by GitHub
parent 2b457a5823
commit 252b4a037f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 50 additions and 11 deletions

View File

@ -69,6 +69,14 @@
</div>
</div>
<div
v-for="message in messages.filter((m) => m.isUploading)"
:slot="'message_' + message._id"
v-bind:key="message._id"
>
{{ $t('chat.transmitting') }}
</div>
<div v-for="room in rooms" :slot="'room-list-avatar_' + room.id" :key="room.id">
<div
v-if="room.avatar"
@ -394,6 +402,35 @@ export default {
if (filesToUpload && filesToUpload.length > 0) {
mutationVariables.files = filesToUpload
}
// Immediately add new message
const localMessage = {
...messageDetails,
_id: 'new',
seen: false,
saved: false,
date: new Date(),
senderId: this.currentUser.id,
files:
messageDetails.files?.map((file) => ({
...file,
url: URL.createObjectURL(new Blob([file.blob], { type: file.type })),
})) ?? [],
// Custom property
isUploading: true,
}
this.messages = [...this.messages, localMessage]
const roomIndex = this.rooms.findIndex((r) => r.id === roomId)
if (roomIndex !== -1) {
const changedRoom = { ...this.rooms[roomIndex] }
changedRoom.lastMessage.content = content
// Move changed room to the top of the list
changedRoom.index = changedRoom.lastMessage.date
this.rooms = [changedRoom, ...this.rooms.filter((r) => r.id !== roomId)]
}
try {
const { data } = await this.$apollo.mutate({
mutation: createMessageMutation(),
@ -401,17 +438,10 @@ export default {
})
const createdMessagePayload = data.CreateMessage
if (createdMessagePayload) {
const roomIndex = this.rooms.findIndex((r) => r.id === roomId)
if (roomIndex !== -1) {
const changedRoom = { ...this.rooms[roomIndex] }
changedRoom.lastMessage.content = createdMessagePayload.content.trim().substring(0, 30)
changedRoom.lastMessage.date = createdMessagePayload.date
// Move changed room to the top of the list
changedRoom.index = createdMessagePayload.date
this.rooms = [changedRoom, ...this.rooms.filter((r) => r.id !== roomId)]
}
if (createdMessagePayload && roomIndex !== -1) {
const changedRoom = { ...this.rooms[roomIndex] }
changedRoom.lastMessage.content = createdMessagePayload.content.trim().substring(0, 30)
changedRoom.lastMessage.date = createdMessagePayload.date
}
} catch (error) {
this.$toast.error(error.message)

View File

@ -130,6 +130,7 @@
"roomEmpty": "Keinen Raum selektiert",
"roomsEmpty": "Keine Räume",
"search": "Chat-Räume filtern",
"transmitting": "Nachricht wird übertragen ...",
"typeMessage": "Nachricht schreiben",
"userProfileButton": {
"label": "Chat",

View File

@ -130,6 +130,7 @@
"roomEmpty": "No room selected",
"roomsEmpty": "No rooms",
"search": "Filter chat rooms",
"transmitting": "Transmitting message ...",
"typeMessage": "Type message",
"userProfileButton": {
"label": "Chat",

View File

@ -130,6 +130,7 @@
"roomEmpty": null,
"roomsEmpty": null,
"search": "Filtrar salas de chat",
"transmitting": null,
"typeMessage": null,
"userProfileButton": {
"label": null,

View File

@ -130,6 +130,7 @@
"roomEmpty": null,
"roomsEmpty": null,
"search": "Filtrer les salons de chat",
"transmitting": null,
"typeMessage": null,
"userProfileButton": {
"label": null,

View File

@ -130,6 +130,7 @@
"roomEmpty": null,
"roomsEmpty": null,
"search": null,
"transmitting": null,
"typeMessage": null,
"userProfileButton": {
"label": null,

View File

@ -130,6 +130,7 @@
"roomEmpty": null,
"roomsEmpty": null,
"search": null,
"transmitting": null,
"typeMessage": null,
"userProfileButton": {
"label": null,

View File

@ -130,6 +130,7 @@
"roomEmpty": null,
"roomsEmpty": null,
"search": null,
"transmitting": null,
"typeMessage": null,
"userProfileButton": {
"label": null,

View File

@ -130,6 +130,7 @@
"roomEmpty": null,
"roomsEmpty": null,
"search": null,
"transmitting": null,
"typeMessage": null,
"userProfileButton": {
"label": null,

View File

@ -130,6 +130,7 @@
"roomEmpty": null,
"roomsEmpty": null,
"search": null,
"transmitting": null,
"typeMessage": null,
"userProfileButton": {
"label": null,