Skip to content

Commit

Permalink
fix(NewMessageNewFileDialog): add visual indicator of loading
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Jun 10, 2024
1 parent 38516e3 commit 5c60e59
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/NewMessage/NewMessageNewFileDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@

<div class="new-text-file__buttons">
<NcButton type="primary"
:disabled="loading"
@click="handleCreateNewFile">
<template v-if="loading" #icon>
<NcLoadingIcon />
</template>
{{ t('spreed', 'Create file') }}
</NcButton>
</div>
Expand All @@ -71,6 +75,7 @@
import { showError } from '@nextcloud/dialogs'

import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'

Expand All @@ -84,9 +89,10 @@ export default {

components: {
NcButton,
NewMessageTemplatePreview,
NcLoadingIcon,
NcModal,
NcTextField,
NewMessageTemplatePreview,
},

props: {
Expand Down Expand Up @@ -118,6 +124,7 @@ export default {
newFileTitle: t('spreed', 'New file'),
newFileError: '',
checked: -1,
loading: false,
}
},

Expand Down Expand Up @@ -201,6 +208,7 @@ export default {

// Create text file and share it to a conversation
async handleCreateNewFile() {
this.loading = true
this.newFileError = ''
let filePath = this.$store.getters.getAttachmentFolder() + '/' + this.newFileTitle.replace('/', '')

Expand All @@ -226,10 +234,12 @@ export default {
} else {
showError(t('spreed', 'Error while creating file'))
}
this.loading = false
return
}

await shareFile(filePath, this.token, '', '')
this.loading = false

this.openViewer(filePath, [fileData], fileData)

Expand Down

0 comments on commit 5c60e59

Please sign in to comment.