Skip to content

Commit bc567d3

Browse files
Merge pull request #54648 from nextcloud/fix/sharing-entry
fix(files_sharing): correctly apply icons and copy share link
2 parents da5c912 + d27f648 commit bc567d3

File tree

10 files changed

+37
-36
lines changed

10 files changed

+37
-36
lines changed

apps/files_sharing/src/components/SharingEntryLink.vue

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@
3030
<!-- clipboard -->
3131
<div>
3232
<NcActions v-if="share && (!isEmailShareType || isFileRequest) && share.token" ref="copyButton" class="sharing-entry__copy">
33-
<NcActionButton :aria-label="copyLinkTooltip"
34-
:title="copyLinkTooltip"
33+
<NcActionButton :aria-label="copyLinkLabel"
34+
:title="copySuccess ? t('files_sharing', 'Successfully copied public link') : undefined"
3535
:href="shareLink"
3636
@click.prevent="copyLink">
3737
<template #icon>
38-
<CheckIcon v-if="copied && copySuccess"
39-
:size="20"
40-
class="icon-checkmark-color" />
41-
<ClipboardIcon v-else :size="20" />
38+
<NcIconSvgWrapper class="sharing-entry__copy-icon"
39+
:class="{ 'sharing-entry__copy-icon--success': copySuccess }"
40+
:path="copySuccess ? mdiCheck : mdiContentCopy" />
4241
</template>
4342
</NcActionButton>
4443
</NcActions>
@@ -205,7 +204,7 @@
205204
</NcActions>
206205

207206
<!-- loading indicator to replace the menu -->
208-
<div v-else class="icon-loading-small sharing-entry__loading" />
207+
<NcLoadingIcon v-else class="sharing-entry__loading" />
209208

210209
<!-- Modal to open whenever we have a QR code -->
211210
<NcDialog v-if="showQRCode"
@@ -224,6 +223,7 @@
224223
</template>
225224

226225
<script>
226+
import { mdiCheck, mdiContentCopy } from '@mdi/js'
227227
import { showError, showSuccess } from '@nextcloud/dialogs'
228228
import { emit } from '@nextcloud/event-bus'
229229
import { t } from '@nextcloud/l10n'
@@ -241,14 +241,15 @@ import NcActionSeparator from '@nextcloud/vue/components/NcActionSeparator'
241241
import NcActions from '@nextcloud/vue/components/NcActions'
242242
import NcAvatar from '@nextcloud/vue/components/NcAvatar'
243243
import NcDialog from '@nextcloud/vue/components/NcDialog'
244+
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
245+
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
244246
245247
import Tune from 'vue-material-design-icons/Tune.vue'
246248
import IconCalendarBlank from 'vue-material-design-icons/CalendarBlankOutline.vue'
247249
import IconQr from 'vue-material-design-icons/Qrcode.vue'
248250
import ErrorIcon from 'vue-material-design-icons/Exclamation.vue'
249251
import LockIcon from 'vue-material-design-icons/LockOutline.vue'
250252
import CheckIcon from 'vue-material-design-icons/CheckBold.vue'
251-
import ClipboardIcon from 'vue-material-design-icons/ContentCopy.vue'
252253
import CloseIcon from 'vue-material-design-icons/Close.vue'
253254
import PlusIcon from 'vue-material-design-icons/Plus.vue'
254255
@@ -276,14 +277,15 @@ export default {
276277
NcActionSeparator,
277278
NcAvatar,
278279
NcDialog,
280+
NcIconSvgWrapper,
281+
NcLoadingIcon,
279282
VueQrcode,
280283
Tune,
281284
IconCalendarBlank,
282285
IconQr,
283286
ErrorIcon,
284287
LockIcon,
285288
CheckIcon,
286-
ClipboardIcon,
287289
CloseIcon,
288290
PlusIcon,
289291
SharingEntryQuickShareSelect,
@@ -303,11 +305,17 @@ export default {
303305
},
304306
},
305307
308+
setup() {
309+
return {
310+
mdiCheck,
311+
mdiContentCopy,
312+
}
313+
},
314+
306315
data() {
307316
return {
308317
shareCreationComplete: false,
309-
copySuccess: true,
310-
copied: false,
318+
copySuccess: false,
311319
defaultExpirationDateEnabled: false,
312320
313321
// Are we waiting for password/expiration date
@@ -539,17 +547,9 @@ export default {
539547
},
540548
541549
/**
542-
* Tooltip message for copy button
543-
*
544550
* @return {string}
545551
*/
546-
copyLinkTooltip() {
547-
if (this.copied) {
548-
if (this.copySuccess) {
549-
return ''
550-
}
551-
return t('files_sharing', 'Cannot copy, please copy the link manually')
552-
}
552+
copyLinkLabel() {
553553
return t('files_sharing', 'Copy public link of "{title}"', { title: this.title })
554554
},
555555
@@ -783,16 +783,13 @@ export default {
783783
showSuccess(t('files_sharing', 'Link copied'))
784784
// focus and show the tooltip
785785
this.$refs.copyButton.$el.focus()
786-
this.copySuccess = true
787-
this.copied = true
788786
} catch (error) {
789-
this.copySuccess = false
790-
this.copied = true
791-
console.error(error)
787+
logger.debug('Failed to automatically copy share link', { error })
788+
window.prompt(t('files_sharing', 'Your browser does not support copying, please copy the link manually:'), this.shareLink)
792789
} finally {
790+
this.copySuccess = true
793791
setTimeout(() => {
794792
this.copySuccess = false
795-
this.copied = false
796793
}, 4000)
797794
}
798795
},
@@ -967,9 +964,8 @@ export default {
967964
}
968965
}
969966
970-
.icon-checkmark-color {
971-
opacity: 1;
972-
color: var(--color-success);
967+
&__copy-icon--success {
968+
color: var(--color-border-success);
973969
}
974970
}
975971

dist/6894-6894.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

dist/6894-6894.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/6894-6894.js.map.license

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/9708-9708.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ SPDX-License-Identifier: MIT
22
SPDX-License-Identifier: ISC
33
SPDX-License-Identifier: GPL-3.0-or-later
44
SPDX-License-Identifier: BSD-3-Clause
5+
SPDX-License-Identifier: Apache-2.0
56
SPDX-License-Identifier: AGPL-3.0-or-later
67
SPDX-License-Identifier: (MPL-2.0 OR Apache-2.0)
78
SPDX-FileCopyrightText: string_decoder developers
@@ -37,6 +38,7 @@ SPDX-FileCopyrightText: Dr.-Ing. Mario Heiderich, Cure53 <mario@cure53.de> (http
3738
SPDX-FileCopyrightText: David Clark
3839
SPDX-FileCopyrightText: Christoph Wurst
3940
SPDX-FileCopyrightText: Chen Fengyuan
41+
SPDX-FileCopyrightText: Austin Andrews
4042
SPDX-FileCopyrightText: Arnout Kazemier
4143
SPDX-FileCopyrightText: Anthony Fu <https://github.com/antfu>
4244
SPDX-FileCopyrightText: Alkemics
@@ -53,6 +55,9 @@ This file is generated from multiple sources. Included packages:
5355
- @floating-ui/utils
5456
- version: 0.2.10
5557
- license: MIT
58+
- @mdi/js
59+
- version: 7.4.47
60+
- license: Apache-2.0
5661
- @nextcloud/auth
5762
- version: 2.5.2
5863
- license: GPL-3.0-or-later

dist/9708-9708.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/9708-9708.js.map.license

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9708-9708.js.license

dist/files_sharing-files_sharing_tab.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-files_sharing_tab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)