From 99477584ed8f293e2df70da65f73306ab1138a4c Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Mon, 19 Jun 2023 15:55:46 +0530 Subject: [PATCH] show toaster only when etherscan plugin is active --- apps/etherscan/src/app/views/CaptureKeyView.tsx | 6 +++++- apps/etherscan/src/app/views/HomeView.tsx | 6 +++++- apps/etherscan/src/app/views/ReceiptsView.tsx | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/etherscan/src/app/views/CaptureKeyView.tsx b/apps/etherscan/src/app/views/CaptureKeyView.tsx index 16969705f4..22e9c65baa 100644 --- a/apps/etherscan/src/app/views/CaptureKeyView.tsx +++ b/apps/etherscan/src/app/views/CaptureKeyView.tsx @@ -12,7 +12,11 @@ export const CaptureKeyView: React.FC = () => { return ( {({ apiKey, clientInstance, setAPIKey }) => { - if (!apiKey && clientInstance && clientInstance.call) clientInstance.call('notification' as any, 'toast', 'Please add API key to continue') + if (!apiKey && clientInstance && clientInstance.call) { + clientInstance.call('sidePanel' as any, 'currentFocus').then((current) => { + if (current === 'etherscan') clientInstance.call('notification' as any, 'toast', 'Please add API key to continue') + }) + } return { diff --git a/apps/etherscan/src/app/views/HomeView.tsx b/apps/etherscan/src/app/views/HomeView.tsx index 14070ee6e0..1379ff480d 100644 --- a/apps/etherscan/src/app/views/HomeView.tsx +++ b/apps/etherscan/src/app/views/HomeView.tsx @@ -12,7 +12,11 @@ export const HomeView: React.FC = () => { return ( {({ apiKey, clientInstance, setReceipts, receipts, contracts }) => { - if (!apiKey && clientInstance && clientInstance.call) clientInstance.call('notification' as any, 'toast', 'Please add API key to continue') + if (!apiKey && clientInstance && clientInstance.call) { + clientInstance.call('sidePanel' as any, 'currentFocus').then((current) => { + if (current === 'etherscan') clientInstance.call('notification' as any, 'toast', 'Please add API key to continue') + }) + } return !apiKey ? ( { return ( {({ apiKey, clientInstance, receipts, setReceipts }) => { - if (!apiKey && clientInstance && clientInstance.call) clientInstance.call('notification' as any, 'toast', 'Please add API key to continue') + if (!apiKey && clientInstance && clientInstance.call) { + clientInstance.call('sidePanel' as any, 'currentFocus').then((current) => { + if (current === 'etherscan') clientInstance.call('notification' as any, 'toast', 'Please add API key to continue') + }) + } return !apiKey ? (