From f68b3a888ddfa682b29d53f1f0a642ce3e47c1bc Mon Sep 17 00:00:00 2001 From: Dawid Sowa Date: Tue, 11 Jun 2024 14:37:48 +0200 Subject: [PATCH] fix: hide popover after login --- .../src/modules/connect-button/connect-button.module.ts | 9 ++++++++- .../dapp-toolkit/src/modules/connect-button/subjects.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/dapp-toolkit/src/modules/connect-button/connect-button.module.ts b/packages/dapp-toolkit/src/modules/connect-button/connect-button.module.ts index 3945ad57..0550803e 100644 --- a/packages/dapp-toolkit/src/modules/connect-button/connect-button.module.ts +++ b/packages/dapp-toolkit/src/modules/connect-button/connect-button.module.ts @@ -194,6 +194,10 @@ export const ConnectButtonModule = ( tap((items) => (connectButtonElement.requestItems = items)), ) + const showPopoverMenu$ = subjects.showPopoverMenu.pipe( + tap((value) => (connectButtonElement.showPopoverMenu = value)), + ) + const accounts$ = subjects.accounts.pipe( tap((items) => (connectButtonElement.accounts = items)), ) @@ -220,6 +224,7 @@ export const ConnectButtonModule = ( theme$, mode$, connected$, + showPopoverMenu$, requestItems$, loggedInTimestamp$, isMobile$, @@ -295,6 +300,7 @@ export const ConnectButtonModule = ( setLoggedInTimestamp: (value: string) => subjects.loggedInTimestamp.next(value), setConnected: (value: boolean) => subjects.connected.next(value), + setShowPopoverMenu: (value: boolean) => subjects.showPopoverMenu.next(value), setRequestItems: (items: RequestItem[]) => subjects.requestItems.next(items), setAccounts: (accounts: Account[]) => subjects.accounts.next(accounts), @@ -377,7 +383,8 @@ export const ConnectButtonModule = ( isConnect: true, oneTime: false, }), - ), + ) + .map(() => subjects.showPopoverMenu.next(false)), ), ) .subscribe(), diff --git a/packages/dapp-toolkit/src/modules/connect-button/subjects.ts b/packages/dapp-toolkit/src/modules/connect-button/subjects.ts index c76e571a..476860af 100644 --- a/packages/dapp-toolkit/src/modules/connect-button/subjects.ts +++ b/packages/dapp-toolkit/src/modules/connect-button/subjects.ts @@ -17,6 +17,7 @@ export const ConnectButtonSubjects = () => ({ loggedInTimestamp: new BehaviorSubject(''), isMobile: new BehaviorSubject(isMobile()), isWalletLinked: new BehaviorSubject(false), + showPopoverMenu: new BehaviorSubject(false), isExtensionAvailable: new BehaviorSubject(false), fullWidth: new BehaviorSubject(false), activeTab: new BehaviorSubject<'sharing' | 'requests'>('sharing'),