Merge pull request 'Add visual feedback when clicking translate' (#423) from ilja/akkoma-fe:provide_visual_feedback_when_clicking_translate_button into develop
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Reviewed-on: #423
This commit is contained in:
floatingghost 2025-01-05 15:51:47 +00:00
commit ad6bb47003
2 changed files with 7 additions and 2 deletions

View file

@ -41,7 +41,8 @@ const StatusContent = {
postLength: this.status.text.length, postLength: this.status.text.length,
parseReadyDone: false, parseReadyDone: false,
renderMisskeyMarkdown, renderMisskeyMarkdown,
translateFrom: null translateFrom: null,
translating: false
} }
}, },
computed: { computed: {
@ -135,7 +136,10 @@ const StatusContent = {
}, },
translateStatus () { translateStatus () {
const translateTo = this.$store.getters.mergedConfig.translationLanguage || this.$store.state.instance.interfaceLanguage const translateTo = this.$store.getters.mergedConfig.translationLanguage || this.$store.state.instance.interfaceLanguage
this.$store.dispatch('translateStatus', { id: this.status.id, language: translateTo, from: this.translateFrom }) this.translating = true
this.$store.dispatch(
'translateStatus', { id: this.status.id, language: translateTo, from: this.translateFrom }
).finally(() => { this.translating = false })
} }
} }
} }

View file

@ -91,6 +91,7 @@
{{ ' ' }} {{ ' ' }}
<button <button
class="btn button-default" class="btn button-default"
:disabled="translating"
@click="translateStatus" @click="translateStatus"
> >
{{ $t('status.translate') }} {{ $t('status.translate') }}