Add visual feedback when clicking translate #423

Open
ilja wants to merge 1 commit from ilja/akkoma-fe:provide_visual_feedback_when_clicking_translate_button into develop
Contributor

In a status, we can choose to translate the status (assuming there's a translator enabled on the backend).

It will translate, in practice generally according to detected language, and also provide an option to override the source language.

Translating can take a while, and there wasn't really a visual feedback when it was translating.

Now the translate button will be dissabled while translating.


While translating (button is disabled):

image

When not translating (button is not disabled):

image

In a status, we can choose to translate the status (assuming there's a translator enabled on the backend). It will translate, in practice generally according to detected language, and also provide an option to override the source language. Translating can take a while, and there wasn't really a visual feedback when it was translating. Now the translate button will be dissabled while translating. --- While translating (button is disabled): ![image](/attachments/c12fb334-e32a-41f2-be43-20f41761b5a7) When not translating (button is not disabled): ![image](/attachments/edf3989d-361c-43b0-9fac-0184963fada3)
5.4 KiB
5.6 KiB
ilja added 1 commit 2024-10-14 12:50:10 +00:00
Add visual feedback when clicking translate
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
4339f32448
In a status, we can choose to translate the status (assuming there's a translator enabled on the backend)

It will translate, in practice generally according to detected language, and also provide an option to override the source language.

Translating can take a while, and there wasn't really a visual feedback when it was translating.
Now the translate button will be dissabled while translating.
Oneric reviewed 2024-10-14 18:28:44 +00:00
@ -139,0 +139,4 @@
this.translating = true
this.$store.dispatch(
'translateStatus', { id: this.status.id, language: translateTo, from: this.translateFrom }
).then(() => { this.translating = false })
Member

If my limited JS knowledge doesn’t let me down here, this will lead to translating getting stuck at true if an error occurs during the dispatch promise. Replacing .then(...) with .finally(...) avoids this, or you may want to add a separate branch for errors to also visually indicate the failure

If my limited JS knowledge doesn’t let me down here, this will lead to `translating` getting stuck at `true` if an error occurs during the dispatch promise. Replacing `.then(...)` with `.finally(...)` avoids this, or you may want to add a separate branch for errors to also visually indicate the failure

yep you're correct - .then isnt' called if the previous branch errors

yep you're correct - `.then` isnt' called if the previous branch errors
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u provide_visual_feedback_when_clicking_translate_button:ilja-provide_visual_feedback_when_clicking_translate_button
git checkout ilja-provide_visual_feedback_when_clicking_translate_button
Sign in to join this conversation.
No description provided.