Merge pull request #3817 from ethereum/ethsToaster

show toaster only when etherscan plugin is active
pull/3833/head
yann300 1 year ago committed by GitHub
commit b1a5709074
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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 ( return (
<AppContext.Consumer> <AppContext.Consumer>
{({ apiKey, clientInstance, setAPIKey }) => { {({ 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 return <Formik
initialValues={{ apiKey }} initialValues={{ apiKey }}
validate={(values) => { validate={(values) => {

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

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

Loading…
Cancel
Save