Hide "Link ethereum address" from profile menu if wallet is disabled
This commit is contained in:
parent
17e52b7b85
commit
d84ff0256b
2 changed files with 12 additions and 3 deletions
|
@ -15,6 +15,10 @@ export function ethereumAddressMatch(address1: string, address2: string): boolea
|
||||||
return address1.toLowerCase() === address2.toLowerCase()
|
return address1.toLowerCase() === address2.toLowerCase()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasEthereumWallet(): boolean {
|
||||||
|
return Boolean((window as any).ethereum)
|
||||||
|
}
|
||||||
|
|
||||||
export function getWeb3Provider(): Web3Provider {
|
export function getWeb3Provider(): Web3Provider {
|
||||||
const provider = (window as any).ethereum
|
const provider = (window as any).ethereum
|
||||||
return new Web3Provider(provider)
|
return new Web3Provider(provider)
|
||||||
|
|
|
@ -41,12 +41,12 @@
|
||||||
Atom feed
|
Atom feed
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="isCurrentUser()">
|
<li v-if="canVerifyEthereumAddress()">
|
||||||
<button
|
<button
|
||||||
title="Verify ethereum address"
|
title="Link ethereum address"
|
||||||
@click="hideProfileMenu(); onVerifyEthereumAddress()"
|
@click="hideProfileMenu(); onVerifyEthereumAddress()"
|
||||||
>
|
>
|
||||||
Verify ethereum address
|
Link ethereum address
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="canManageSubscriptions()">
|
<li v-if="canManageSubscriptions()">
|
||||||
|
@ -221,6 +221,7 @@ import { useEthereumAddressVerification } from "@/composables/ethereum-address-v
|
||||||
import { BACKEND_URL } from "@/constants"
|
import { BACKEND_URL } from "@/constants"
|
||||||
import { useInstanceInfo } from "@/store/instance"
|
import { useInstanceInfo } from "@/store/instance"
|
||||||
import { useCurrentUser } from "@/store/user"
|
import { useCurrentUser } from "@/store/user"
|
||||||
|
import { hasEthereumWallet } from "@/utils/ethereum"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
|
@ -418,6 +419,10 @@ const feedUrl = $computed<string>(() => {
|
||||||
return `${BACKEND_URL}/feeds/${profile.username}`
|
return `${BACKEND_URL}/feeds/${profile.username}`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function canVerifyEthereumAddress(): boolean {
|
||||||
|
return isCurrentUser() && hasEthereumWallet()
|
||||||
|
}
|
||||||
|
|
||||||
async function onVerifyEthereumAddress() {
|
async function onVerifyEthereumAddress() {
|
||||||
if (!profile || !isCurrentUser()) {
|
if (!profile || !isCurrentUser()) {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue