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()
|
||||
}
|
||||
|
||||
export function hasEthereumWallet(): boolean {
|
||||
return Boolean((window as any).ethereum)
|
||||
}
|
||||
|
||||
export function getWeb3Provider(): Web3Provider {
|
||||
const provider = (window as any).ethereum
|
||||
return new Web3Provider(provider)
|
||||
|
|
|
@ -41,12 +41,12 @@
|
|||
Atom feed
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="isCurrentUser()">
|
||||
<li v-if="canVerifyEthereumAddress()">
|
||||
<button
|
||||
title="Verify ethereum address"
|
||||
title="Link ethereum address"
|
||||
@click="hideProfileMenu(); onVerifyEthereumAddress()"
|
||||
>
|
||||
Verify ethereum address
|
||||
Link ethereum address
|
||||
</button>
|
||||
</li>
|
||||
<li v-if="canManageSubscriptions()">
|
||||
|
@ -221,6 +221,7 @@ import { useEthereumAddressVerification } from "@/composables/ethereum-address-v
|
|||
import { BACKEND_URL } from "@/constants"
|
||||
import { useInstanceInfo } from "@/store/instance"
|
||||
import { useCurrentUser } from "@/store/user"
|
||||
import { hasEthereumWallet } from "@/utils/ethereum"
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
|
@ -418,6 +419,10 @@ const feedUrl = $computed<string>(() => {
|
|||
return `${BACKEND_URL}/feeds/${profile.username}`
|
||||
})
|
||||
|
||||
function canVerifyEthereumAddress(): boolean {
|
||||
return isCurrentUser() && hasEthereumWallet()
|
||||
}
|
||||
|
||||
async function onVerifyEthereumAddress() {
|
||||
if (!profile || !isCurrentUser()) {
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue