From 9564fcd63c47f45b72ed29333ed280bb2d68bd41 Mon Sep 17 00:00:00 2001 From: sualko Date: Mon, 21 Mar 2022 11:23:54 +0100 Subject: [PATCH] fix: add feedback to send file action --- ts/filelist.scss | 11 +++++++++++ ts/filelist.ts | 10 +++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 ts/filelist.scss diff --git a/ts/filelist.scss b/ts/filelist.scss new file mode 100644 index 0000000..3a3b1c0 --- /dev/null +++ b/ts/filelist.scss @@ -0,0 +1,11 @@ +#bbb-file-action { + button.success { + background-color: var(--color-success); + border-color: var(--color-success-hover); + color: var(--color-primary-text); + + &:hover { + background-color: var(--color-success-hover); + } + } +} \ No newline at end of file diff --git a/ts/filelist.ts b/ts/filelist.ts index c0d2572..0c71863 100644 --- a/ts/filelist.ts +++ b/ts/filelist.ts @@ -3,6 +3,7 @@ import { generateOcsUrl, generateUrl } from '@nextcloud/router'; import { showSuccess, showWarning, showError } from '@nextcloud/dialogs'; import '@nextcloud/dialogs/styles/toast'; import { api } from './Common/Api'; +import './filelist.scss'; type OC_Dialogs_Message = (content: string, title: string, dialogType: 'notice' | 'alert' | 'warn' | 'none', buttons?: number, callback?: () => void, modal?: boolean, allowHtml?: boolean) => Promise; type ExtendedDialogs = typeof OC.dialogs & { message: OC_Dialogs_Message }; @@ -95,14 +96,17 @@ async function openDialog(fileId: number, filename: string) { button.prop('disabled', room.running); } button.text(room.running ? t('bbb', 'Send to') : t('bbb', 'Start with')); - button.addClass('primary'); + button.addClass(room.running ? 'success' : 'primary'); button.attr('type', 'button'); button.on('click', (ev) => { ev.preventDefault(); - sendFile(fileId, filename, room.uid); + table.find('button').prop('disabled', true); + $(ev.target).addClass('icon-loading-small'); - container.parents('.oc-dialog').find('.oc-dialog-close').trigger('click'); + sendFile(fileId, filename, room.uid).then(() => { + container.parents('.oc-dialog').find('.oc-dialog-close').trigger('click'); + }); }); row.append($('').append(button));