Skip to content

Commit

Permalink
vue-clipboard2 -> useClipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
pbkompasz committed Aug 30, 2023
1 parent 89761aa commit 265837b
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 22 deletions.
8 changes: 6 additions & 2 deletions components/collection/HeroButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
</template>

<NeoDropdownItem
v-clipboard:copy="currentCollectionUrl"
@click="toast(`${$i18n.t('toast.urlCopy')}`)">
@click="
toast(`${$i18n.t('toast.urlCopy')}`)
copy(currentCollectionUrl)
">
{{ $i18n.t('share.copyLink') }}
</NeoDropdownItem>
<NeoDropdownItem @click="QRModalActive = true">
Expand Down Expand Up @@ -124,6 +126,8 @@ const { urlPrefix } = usePrefix()
const { $i18n } = useNuxtApp()
const { toast } = useToast()

const { copy } = useClipboard()

const collectionId = computed(() => route.params.id)
const currentCollectionUrl = computed(
() =>
Expand Down
7 changes: 5 additions & 2 deletions components/collection/unlockable/UnlockableHeroButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
</template>

<NeoDropdownItem
v-clipboard:copy="currentUrl"
@click="toast(`${$i18n.t('toast.urlCopy')}`)">
@click="
toast(`${$i18n.t('toast.urlCopy')}`)
copy(currentUrl)
">
{{ $i18n.t('share.copyLink') }}
</NeoDropdownItem>
<NeoDropdownItem @click="QRModalActive = true">
Expand Down Expand Up @@ -52,6 +54,7 @@ import {
NeoModal,
} from '@kodadot1/brick'
const { copy } = useClipboard()
const { $i18n } = useNuxtApp()
const currentUrl = computed(() => window.location.href)
Expand Down
7 changes: 6 additions & 1 deletion components/common/ConnectWallet/WalletAssetIdentity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
:prefix="urlPrefix"
variant="button" />
<div class="is-flex is-flex-direction-column">
<a v-clipboard:copy="account" @click="toast('Copied to clipboard')">
<a
@click="
toast('Copied to clipboard')
copy(account)
">
<NeoIcon icon="copy" />
</a>
<hr class="my-1" />
Expand All @@ -23,6 +27,7 @@ import { useIdentityStore } from '@/stores/identity'
import { useShoppingCartStore } from '@/stores/shoppingCart'
import useIdentity from '@/components/identity/utils/useIdentity'
const { copy } = useClipboard()
const identityStore = useIdentityStore()
const shoppingCartStore = useShoppingCartStore()
const { urlPrefix } = usePrefix()
Expand Down
7 changes: 5 additions & 2 deletions components/gallery/GalleryItemButton/GalleryItemShareBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
</template>

<NeoDropdownItem
v-clipboard:copy="realworldFullPathShare"
@click="toast(String($t('toast.urlCopy')))">
@click="
toast(String($t('toast.urlCopy')))
copy(realworldFullPathShare)
">
Copy Link
</NeoDropdownItem>
<NeoDropdownItem @click="isModalActive = true">QR Code</NeoDropdownItem>
Expand Down Expand Up @@ -47,6 +49,7 @@ import { isMobileDevice } from '@/utils/extension'
const QRCode = () => import('@/components/shared/QRCode.vue')
const { copy } = useClipboard()
const route = useRoute()
const { $i18n } = useNuxtApp()
const { toast } = useToast()
Expand Down
8 changes: 6 additions & 2 deletions components/identity/module/IdentityLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
</a>
<a
v-if="showClipboard"
v-clipboard:copy="address"
@click="toast('Copied to clipboard')">
@click="
toast('Copied to clipboard')
address ? copy(String(address)) : null
">
<svg
width="13"
height="13"
Expand All @@ -33,6 +35,8 @@ const props = defineProps<{
address?: Address
showClipboard?: boolean
}>()
const { copy } = useClipboard()
const { toast } = useToast()
const { urlPrefix } = usePrefix()
Expand Down
8 changes: 6 additions & 2 deletions components/identity/module/IdentityPopoverHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
>
</nuxt-link>
<NeoIcon
v-clipboard:copy="address"
icon="copy"
class="has-text-link is-clickable"
data-cy="identity-clipboard"
@click.native="toast('Copied to clipboard')" />
@click.native="
toast('Copied to clipboard')
copy(String(address))
" />
</div>
<a
v-if="identity?.twitter"
Expand All @@ -36,6 +38,8 @@ const address = inject('address')
const shortenedAddress = inject('shortenedAddress')

const identity = inject<{ [x: string]: string }>('identity')

const { copy } = useClipboard()
const { urlPrefix } = usePrefix()
const { toast } = useToast()
</script>
Expand Down
8 changes: 6 additions & 2 deletions components/profile/ProfileDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@

<div class="divider" />
<NeoButton
v-clipboard:copy="id"
variant="text"
:label="$t('share.copyAddress')"
no-shadow
@click.native="toast(`${$i18n.t('general.copyToClipboard')}`)" />
@click.native="
toast(`${$i18n.t('general.copyToClipboard')}`)
copy(id)
" />
<div class="divider" />
<NeoButton
variant="text"
Expand Down Expand Up @@ -165,6 +167,8 @@ const { toast } = useToast()
const { replaceUrl } = useReplaceUrl()
const { accountId } = useAuth()
const { urlPrefix } = usePrefix()
const { copy } = useClipboard()
const tabs = ['owned', 'created', 'collections', 'activity']
const switchToTab = (tab: string) => {
Expand Down
14 changes: 10 additions & 4 deletions components/transfer/Transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
</template>

<NeoDropdownItem
v-clipboard:copy="generatePaymentLink(accountId)"
@click="toast(`${$i18n.t('toast.urlCopy')}`)">
@click="
toast(`${$i18n.t('toast.urlCopy')}`)
copy(generatePaymentLink(accountId))
">
<NeoIcon icon="sack-dollar" pack="fa" class="mr-2" />{{
$t('transfers.payMeLink')
}}
Expand All @@ -48,9 +50,11 @@
<Identity :address="accountId" hide-identity-popover />
</span>
<a
v-clipboard:copy="accountId"
class="ml-2"
@click="toast(`${$i18n.t('general.copyToClipboard')}`)">
@click="
toast(`${$i18n.t('general.copyToClipboard')}`)
copy(accountId)
">
<NeoIcon icon="copy" />
</a>
</div>
Expand Down Expand Up @@ -278,6 +282,8 @@ const { initTransactionLoader, isLoading, resolveStatus, status } =
const { toast } = useToast()
const isTransferModalVisible = ref(false)
const { copy } = useClipboard({ source: accountId })
export type TargetAddress = {
address?: string
usd?: number | string
Expand Down
1 change: 0 additions & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ export default defineNuxtConfig({
'~/plugins/globalVariables',
'~/plugins/pwa',
'~/plugins/vueAudioVisual',
'~/plugins/vueClipboard',
'~/plugins/vueSocialSharing',
'~/plugins/vueTippy',
'~/plugins/safeHref',
Expand Down
4 changes: 0 additions & 4 deletions plugins/vueClipboard.ts

This file was deleted.

0 comments on commit 265837b

Please sign in to comment.