From 27380091417b1cef4126fee61c4036218c93f791 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Thu, 19 Dec 2024 16:42:29 +0100 Subject: [PATCH] feat: introduce PollManager Signed-off-by: Maksim Sukharev --- src/PublicShareAuthSidebar.vue | 3 + src/PublicShareSidebar.vue | 3 + src/components/NewMessage/NewMessage.vue | 44 ------------- .../NewMessage/NewMessageAttachments.vue | 8 ++- .../PollViewer/PollDraftHandler.vue | 8 +-- src/components/PollViewer/PollEditor.vue | 9 +-- src/components/PollViewer/PollManager.vue | 66 +++++++++++++++++++ src/views/FilesSidebarChatView.vue | 3 + src/views/MainView.vue | 3 + 9 files changed, 93 insertions(+), 54 deletions(-) create mode 100644 src/components/PollViewer/PollManager.vue diff --git a/src/PublicShareAuthSidebar.vue b/src/PublicShareAuthSidebar.vue index e0976aff082..a1020d3d952 100644 --- a/src/PublicShareAuthSidebar.vue +++ b/src/PublicShareAuthSidebar.vue @@ -14,6 +14,7 @@ + @@ -30,6 +31,7 @@ import { t } from '@nextcloud/l10n' import CallView from './components/CallView/CallView.vue' import ChatView from './components/ChatView.vue' import MediaSettings from './components/MediaSettings/MediaSettings.vue' +import PollManager from './components/PollViewer/PollManager.vue' import PollViewer from './components/PollViewer/PollViewer.vue' import TopBar from './components/TopBar/TopBar.vue' import TransitionWrapper from './components/UIShared/TransitionWrapper.vue' @@ -51,6 +53,7 @@ export default { CallView, ChatView, MediaSettings, + PollManager, PollViewer, TopBar, TransitionWrapper, diff --git a/src/PublicShareSidebar.vue b/src/PublicShareSidebar.vue index 42124922432..dda3c90476a 100644 --- a/src/PublicShareSidebar.vue +++ b/src/PublicShareSidebar.vue @@ -25,6 +25,7 @@ + @@ -44,6 +45,7 @@ import CallFailedDialog from './components/CallView/CallFailedDialog.vue' import CallView from './components/CallView/CallView.vue' import ChatView from './components/ChatView.vue' import MediaSettings from './components/MediaSettings/MediaSettings.vue' +import PollManager from './components/PollViewer/PollManager.vue' import PollViewer from './components/PollViewer/PollViewer.vue' import CallButton from './components/TopBar/CallButton.vue' import TopBar from './components/TopBar/TopBar.vue' @@ -71,6 +73,7 @@ export default { MediaSettings, NcButton, NcLoadingIcon, + PollManager, PollViewer, TopBar, TransitionWrapper, diff --git a/src/components/NewMessage/NewMessage.vue b/src/components/NewMessage/NewMessage.vue index 7d504d25454..bb9499220ca 100644 --- a/src/components/NewMessage/NewMessage.vue +++ b/src/components/NewMessage/NewMessage.vue @@ -29,7 +29,6 @@ :can-create-poll="canCreatePoll" @open-file-upload="openFileUploadWindow" @handle-file-share="showFilePicker = true" - @toggle-poll-editor="togglePollEditor" @update-new-file-dialog="updateNewFileDialog" /> @@ -152,17 +151,6 @@ - - - - - { - this.$refs.pollEditor?.fillPollEditorFromDraft(id, isPollEditorOpened) - // Wait for editor to be mounted and filled before unmounting drafts dialog - this.togglePollDraftHandler() - }) - }, - - togglePollDraftHandler() { - this.showPollDraftHandler = !this.showPollDraftHandler - }, - focusInput() { if (this.isMobileDevice) { return diff --git a/src/components/NewMessage/NewMessageAttachments.vue b/src/components/NewMessage/NewMessageAttachments.vue index 741bdbd7799..b33d49dbaa0 100644 --- a/src/components/NewMessage/NewMessageAttachments.vue +++ b/src/components/NewMessage/NewMessageAttachments.vue @@ -45,7 +45,7 @@ + @click="showPollEditor"> @@ -119,7 +119,7 @@ export default { }, }, - emits: ['update-new-file-dialog', 'toggle-poll-editor', 'open-file-upload', 'handle-file-share'], + emits: ['update-new-file-dialog', 'open-file-upload', 'handle-file-share'], computed: { fileTemplateOptions() { @@ -139,6 +139,10 @@ export default { showSmartPicker() { EventBus.emit('smart-picker-open') }, + + showPollEditor() { + EventBus.emit('poll-editor-open', { id: null, fromDrafts: false }) + }, }, } diff --git a/src/components/PollViewer/PollDraftHandler.vue b/src/components/PollViewer/PollDraftHandler.vue index bec69f26fe7..e9186a18343 100644 --- a/src/components/PollViewer/PollDraftHandler.vue +++ b/src/components/PollViewer/PollDraftHandler.vue @@ -27,7 +27,7 @@ draft @click="openPollEditor" /> -