Skip to content

Commit

Permalink
Added shortcut link to deposit assets to connected address
Browse files Browse the repository at this point in the history
  • Loading branch information
joemarct committed Dec 20, 2024
1 parent 29ded70 commit cc389fc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
23 changes: 17 additions & 6 deletions src/components/walletconnect/SessionInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
<q-avatar class="q-mr-sm">
<q-badge :color="sessionType==='proposal'? 'warning': 'green'"></q-badge>
</q-avatar>
<slot name="account">
<span v-if="account" class="text-caption">
{{ addressDisplayFormatter ? addressDisplayFormatter(account.replace('bch:', '')) : shortenAddressForDisplay(account.replace('bch:', '')) }} <q-badge color="grey" size="sm">{{ addressDisplayFormat }}</q-badge>
</span>
<slot name="account">
<div @click="copyToClipboard" style="z-index: 1000;">
<span v-if="account" class="text-caption">
{{ addressDisplayFormatter ? addressDisplayFormatter(account.replace('bch:', '')) : shortenAddressForDisplay(account.replace('bch:', '')) }}
<q-icon name="fas fa-copy" style="font-size: 14px;" />
</span>
</div>
</slot>
</q-chip>
<slot name="top-right">
<div @click="copyToClipboard" @mousedown.stop.prevent>
<q-icon name="fas fa-copy" style="font-size: 14px;" />
<div @click="selectAssetToSend(account.replace('bch:', ''))" @mousedown.stop.prevent style="font-family: 'Rubik', sans-serif; font-size: 13px; z-index: 1000; cursor: pointer;">
<span>Deposit</span>&nbsp;
<q-icon name="fas fa-arrows-down-to-line" style="font-size: 14px;" />
</div>
</slot>
</div>
Expand Down Expand Up @@ -69,6 +73,7 @@
<script setup>
import { computed, inject } from 'vue'
import { useQuasar } from 'quasar'
import { useRouter } from "vue-router";
import PeerInfo from './PeerInfo.vue'
import { shortenAddressForDisplay } from '../../utils/address-utils'
import { toTokenAddress } from 'src/marketplace/escrow/utils'
Expand Down Expand Up @@ -111,8 +116,14 @@ const account = computed(() => {
})
const $q = useQuasar()
const $router = useRouter()
const $copyText = inject('$copyText')
async function selectAssetToSend(address) {
const tokenAddress = toTokenAddress(address)
$router.push('/send/select-asset/?address=' + tokenAddress + '&back-path=/apps/wallet-connect')
}
async function copyToClipboard() {
if (account.value) {
try {
Expand Down
9 changes: 7 additions & 2 deletions src/pages/transaction/select-asset-send.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div id="app-container" :class="getDarkModeClass(darkMode)">
<header-nav :title="$t('Send')" backnavpath="/"></header-nav>
<header-nav :title="$t('Send')" :backnavpath="!backPath ? '/' : backPath"></header-nav>
<q-tabs
dense
v-if="enableSmartBCH"
Expand Down Expand Up @@ -102,6 +102,10 @@ export default {
address: {
type: String,
default: ''
},
backPath: {
type: String,
default: null
}
},
components: {
Expand Down Expand Up @@ -214,7 +218,8 @@ export default {
assetId: asset.id,
tokenType: 1,
network: this.selectedNetwork,
address: this.address
address: this.address,
backPath: this.backPath
}
this.$router.push({
name: 'transaction-send',
Expand Down
4 changes: 2 additions & 2 deletions src/pages/transaction/send.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div id="app-container" :class="getDarkModeClass(darkMode)">
<header-nav
:title="$t('Send') + ' ' + (asset.symbol || name || '')"
:backnavpath="backPath"
:backnavpath="!backPath ? '/' : backPath"
></header-nav>
<q-banner
v-if="assetId.startsWith('slp/')"
Expand Down Expand Up @@ -465,7 +465,7 @@ export default {
},
backPath: {
type: String,
default: '/'
default: null
}
},
data () {
Expand Down

0 comments on commit cc389fc

Please sign in to comment.