show toaster only when etherscan plugin is active

pull/3817/head
Aniket-Engg 1 year ago committed by yann300
parent 9e7b154961
commit 65995ebc07
  1. 6
      apps/etherscan/src/app/views/CaptureKeyView.tsx
  2. 6
      apps/etherscan/src/app/views/HomeView.tsx
  3. 6
      apps/etherscan/src/app/views/ReceiptsView.tsx

@ -12,7 +12,11 @@ export const CaptureKeyView: React.FC = () => {
return (
<AppContext.Consumer>
{({ 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 <Formik
initialValues={{ apiKey }}
validate={(values) => {

@ -12,7 +12,11 @@ export const HomeView: React.FC = () => {
return (
<AppContext.Consumer>
{({ 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 ? (
<Navigate
to={{

@ -64,7 +64,11 @@ export const ReceiptsView: React.FC = () => {
return (
<AppContext.Consumer>
{({ 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 ? (
<Navigate
to={{

Loading…
Cancel
Save