From 1063fbcb10b8edc9ceb9804f89f762c526f0cfc0 Mon Sep 17 00:00:00 2001
From: "julia.kirschenheuter" <julia.kirschenheuter@nextcloud.com>
Date: Wed, 7 Dec 2022 17:29:58 +0100
Subject: Replace custom tooltips with native one in vue components and views

Signed-off-by: julia.kirschenheuter <julia.kirschenheuter@nextcloud.com>
---
 .../src/components/SharingEntryLink.vue            | 54 ++++++----------------
 1 file changed, 13 insertions(+), 41 deletions(-)

(limited to 'apps/files_sharing/src/components/SharingEntryLink.vue')

diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index 524b1279b18..1d9e2b6e211 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -40,11 +40,10 @@
 			class="sharing-entry__copy">
 			<NcActionLink :href="shareLink"
 				target="_blank"
-				:aria-label="t('files_sharing', 'Copy public link to clipboard')"
+				:title="copyLinkTooltip"
+				:aria-label="copyLinkTooltip"
 				:icon="copied && copySuccess ? 'icon-checkmark-color' : 'icon-clippy'"
-				@click.stop.prevent="copyLink">
-				{{ clipboardTooltip }}
-			</NcActionLink>
+				@click.stop.prevent="copyLink" />
 		</NcActions>
 
 		<!-- pending actions -->
@@ -74,13 +73,8 @@
 				@uncheck="onPasswordDisable">
 				{{ t('files_sharing', 'Password protection') }}
 			</NcActionCheckbox>
+
 			<NcActionInput v-if="pendingPassword || share.password"
-				v-tooltip.auto="{
-					content: errors.password,
-					show: errors.password,
-					trigger: 'manual',
-					defaultContainer: '#app-sidebar'
-				}"
 				class="share-link-password"
 				:value.sync="share.password"
 				:disabled="saving"
@@ -129,12 +123,6 @@
 				<template v-if="share.canEdit && canReshare">
 					<!-- Custom Label -->
 					<NcActionInput ref="label"
-						v-tooltip.auto="{
-							content: errors.label,
-							show: errors.label,
-							trigger: 'manual',
-							defaultContainer: '.app-sidebar'
-						}"
 						:class="{ error: errors.label }"
 						:disabled="saving"
 						:aria-label="t('files_sharing', 'Share label')"
@@ -167,14 +155,9 @@
 							? t('files_sharing', 'Password protection (enforced)')
 							: t('files_sharing', 'Password protect') }}
 					</NcActionCheckbox>
+
 					<NcActionInput v-if="isPasswordProtected"
 						ref="password"
-						v-tooltip.auto="{
-							content: errors.password,
-							show: errors.password,
-							trigger: 'manual',
-							defaultContainer: '#app-sidebar'
-						}"
 						class="share-link-password"
 						:class="{ error: errors.password}"
 						:disabled="saving"
@@ -233,14 +216,9 @@
 						@uncheck="queueUpdate('note')">
 						{{ t('files_sharing', 'Note to recipient') }}
 					</NcActionCheckbox>
+
 					<NcActionTextEditable v-if="hasNote"
 						ref="note"
-						v-tooltip.auto="{
-							content: errors.note,
-							show: errors.note,
-							trigger: 'manual',
-							defaultContainer: '#app-sidebar'
-						}"
 						:class="{ error: errors.note}"
 						:disabled="saving"
 						:placeholder="t('files_sharing', 'Enter a note for the share recipient')"
@@ -286,10 +264,10 @@
 			<!-- Create new share -->
 			<NcActionButton v-else-if="canReshare"
 				class="new-share-link"
+				:title="t('files_sharing', 'Create a new share link')"
+				:aria-label="t('files_sharing', 'Create a new share link')"
 				:icon="loading ? 'icon-loading-small' : 'icon-add'"
-				@click.prevent.stop="onNewLinkShare">
-				{{ t('files_sharing', 'Create a new share link') }}
-			</NcActionButton>
+				@click.prevent.stop="onNewLinkShare" />
 		</NcActions>
 
 		<!-- loading indicator to replace the menu -->
@@ -312,7 +290,6 @@ import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator'
 import NcActionTextEditable from '@nextcloud/vue/dist/Components/NcActionTextEditable'
 import NcActions from '@nextcloud/vue/dist/Components/NcActions'
 import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar'
-import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
 
 import ExternalShareAction from './ExternalShareAction.vue'
 import SharePermissionsEditor from './SharePermissionsEditor.vue'
@@ -337,10 +314,6 @@ export default {
 		SharePermissionsEditor,
 	},
 
-	directives: {
-		Tooltip,
-	},
-
 	mixins: [SharesMixin],
 
 	props: {
@@ -558,18 +531,18 @@ export default {
 		},
 
 		/**
-		 * Clipboard v-tooltip message
+		 * Tooltip message for copy button
 		 *
 		 * @return {string}
 		 */
-		clipboardTooltip() {
+		copyLinkTooltip() {
 			if (this.copied) {
 				if (this.copySuccess) {
 					return ''
 				}
 				return t('files_sharing', 'Cannot copy, please copy the link manually')
 			}
-			return t('files_sharing', 'Copy to clipboard')
+			return t('files_sharing', 'Copy public link to clipboard')
 		},
 
 		/**
@@ -730,6 +703,7 @@ export default {
 					// otherwise the user needs to copy/paste the password before finishing the share.
 					component.copyLink()
 				}
+				showSuccess(t('sharing', 'Link share created'))
 
 			} catch (data) {
 				const message = data?.response?.data?.ocs?.meta?.message
@@ -767,7 +741,6 @@ export default {
 			if (typeof this.share.newLabel === 'string') {
 				this.share.label = this.share.newLabel
 				this.$delete(this.share, 'newLabel')
-				showSuccess(t('files_sharing', 'Share label saved'))
 				this.queueUpdate('label')
 			}
 		},
@@ -835,7 +808,6 @@ export default {
 		onPasswordSubmit() {
 			if (this.hasUnsavedPassword) {
 				this.share.password = this.share.newPassword.trim()
-				showSuccess(t('files_sharing', 'Share password saved'))
 				this.queueUpdate('password')
 			}
 		},
-- 
cgit v1.2.3

