From 7d1538a35ecb41391a28e6e8d815e6463dd378a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Mon, 5 Sep 2022 04:23:05 +0200 Subject: [PATCH] Display an info tooltip if URLs cannot be copied --- .../snapshots/show/[commitSha].vue | 21 +++++++++++++++++-- plugins/primevue.ts | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/pages/playlists/[playlistId]/snapshots/show/[commitSha].vue b/pages/playlists/[playlistId]/snapshots/show/[commitSha].vue index 91fdd1b..40ed135 100644 --- a/pages/playlists/[playlistId]/snapshots/show/[commitSha].vue +++ b/pages/playlists/[playlistId]/snapshots/show/[commitSha].vue @@ -11,7 +11,8 @@ const route = useRoute(); const toast = useToast(); const { copy } = useClipboard(); -const { canCopyToClipboard } = useCanCopyToClipboard(); +const { isSupported, clipboardWirtePermission, canCopyToClipboard } = + useCanCopyToClipboard(); const playlistId = route.params.playlistId as string; const commitSha = route.params.commitSha as string; @@ -46,6 +47,14 @@ const totalTrackDuration = computed(() => ) ); +const copyTrackUrlsTooltip = computed(() => + !isSupported.value + ? "Your browser doesn't support this feature" + : clipboardWirtePermission.value !== 'granted' + ? 'You need to grant this website permission to copy to clipboard' + : null +); + const numberFormatter = new Intl.NumberFormat('en-US'); const humanizeNumber = (num: number) => numberFormatter.format(num); @@ -86,12 +95,20 @@ const copyTrackUrls = async () => {