3030 >
3131 <FormWallet :admin =" admin " >
3232 <template v-if =" !! config .public .EMBEDDED_WALLET_CLIENT " >
33- <small v-if =" !admin" >Dont have a wallet?</small >
34- <Btn type="secondary" size="large" @click =" openWallet " >
33+ <Btn class="relative" type="secondary" size="large" @click =" openWallet " >
3534 <span class =" mr-1" >▶◀</span > Apillon Embedded Wallet
35+ <Tag v-if =" ! admin " class="absolute -right-4 top-0 rotate-12 z-10" type="info">No setup needed</Tag >
3636 </Btn >
37- <small v-if =" !admin" >Connect your existing wallet to get started:</small >
3837 </template >
3938 </FormWallet >
4039 </modal >
4342<script lang="ts" setup>
4443import type { Size } from ' naive-ui/es/button/src/interface' ;
4544import { useAccountEffect , useChains } from ' @wagmi/vue' ;
46- import { EmbeddedWallet , useWallet } from ' @apillon/wallet-vue' ;
45+ import { EmbeddedWallet , useWallet , useAccount } from ' @apillon/wallet-vue' ;
4746
4847const props = defineProps ({
4948 admin: { type: Boolean , default: false },
@@ -53,6 +52,7 @@ const props = defineProps({
5352const config = useRuntimeConfig ();
5453const authStore = useAuthStore ();
5554const chains = useChains ();
55+ const { info } = useAccount ();
5656const { wallet } = useWallet ();
5757const { loading, modalWalletVisible, network, connected, walletAddress, disconnectWallet, initEmbeddedWallet, login } =
5858 useWalletConnect ();
@@ -70,9 +70,19 @@ watch(
7070 }
7171 }
7272);
73+ watch (
74+ () => info .activeWallet ?.address ,
75+ address => {
76+ if (address && props .admin ) {
77+ login ();
78+ }
79+ }
80+ );
7381
7482function openWallet() {
75- if (wallet .value ) {
83+ if (info .activeWallet ?.address && props .admin ) {
84+ login ();
85+ } else if (wallet .value ) {
7686 wallet .value .events .emit (' open' , true );
7787 modalWalletVisible .value = false ;
7888 }
0 commit comments