diff options
author | Grigorii Shartsev <grigorii.shartsev@nextcloud.com> | 2023-03-12 21:12:39 +0100 |
---|---|---|
committer | Grigorii Shartsev <grigorii.shartsev@nextcloud.com> | 2023-03-21 15:10:00 +0100 |
commit | 3603b566bc5bab03b60f7361a3a7abb97bd4be1b (patch) | |
tree | 41ededd34645623862b33fed4c706de5f6f9a48d /src/components/CallView | |
parent | 6d887a87a749efbcd0d080f7b3d6e5ef22f27649 (diff) |
feat: add utils for generating absolute links and copy a chat link
- Add `generateAbsoluteUrl` util
- Add `copyLinkToConversation` method for copying conversation links to the clipboard with dialogs
- Remove unused
- Use dialogs on new conversation confirmation
Signed-off-by: Grigorii Shartsev <grigorii.shartsev@nextcloud.com>
Diffstat (limited to 'src/components/CallView')
-rw-r--r-- | src/components/CallView/shared/EmptyCallView.vue | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/components/CallView/shared/EmptyCallView.vue b/src/components/CallView/shared/EmptyCallView.vue index 662773910..81e2028a8 100644 --- a/src/components/CallView/shared/EmptyCallView.vue +++ b/src/components/CallView/shared/EmptyCallView.vue @@ -29,19 +29,17 @@ </p> <NcButton v-if="showLink" type="primary" - @click.stop.prevent="copyLinkToConversation"> + @click.stop.prevent="handleCopyLink"> {{ t('spreed', 'Copy link') }} </NcButton> </div> </template> <script> -import { showError, showSuccess } from '@nextcloud/dialogs' -import { generateUrl } from '@nextcloud/router' - import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' import { CONVERSATION, PARTICIPANT } from '../../../constants.js' +import { copyLinkToConversation } from '../../../services/urlService.js' export default { @@ -161,24 +159,13 @@ export default { showLink() { return this.isPublicConversation && !this.isPasswordRequestConversation && !this.isFileConversation }, - - linkToConversation() { - return window.location.protocol + '//' + window.location.host + generateUrl('/call/' + this.token) - }, - }, methods: { - async copyLinkToConversation() { - try { - await navigator.clipboard.writeText(this.linkToConversation) - showSuccess(t('spreed', 'Conversation link copied to clipboard')) - } catch (error) { - showError(t('spreed', 'The link could not be copied')) - } + async handleCopyLink() { + await copyLinkToConversation(this.token) }, }, - } </script> @@ -201,12 +188,13 @@ export default { width: 64px; margin: 0 auto 15px; } + button { margin: 4px auto; } h2, p { - color: #ffffff; + color: #FFFFFF; } &--sidebar { |