all toasters removed

pull/5370/head
Aniket-Engg 1 year ago committed by Aniket
parent 12b3db7db0
commit bad9b18e58
  1. 25
      apps/etherscan/src/app/views/CaptureKeyView.tsx
  2. 5
      apps/etherscan/src/app/views/HomeView.tsx
  3. 5
      apps/etherscan/src/app/views/ReceiptsView.tsx

@ -1,4 +1,4 @@
import React from "react"
import React, { useState } from "react"
import { Formik, ErrorMessage, Field } from "formik"
import { useNavigate, useLocation } from "react-router-dom"
@ -9,15 +9,14 @@ import { SubmitButton } from "../components"
export const CaptureKeyView: React.FC = () => {
const location = useLocation()
const navigate = useNavigate()
const [msg, setMsg] = useState("")
return (
<AppContext.Consumer>
{({ apiKey, clientInstance, setAPIKey }) => {
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
if (!apiKey) setMsg('Please add API key to continue. It should be 34 characters long')
return (
<div>
<Formik
initialValues={{ apiKey }}
validate={(values) => {
const errors = {} as any
@ -32,7 +31,6 @@ export const CaptureKeyView: React.FC = () => {
const apiKey = values.apiKey
if (apiKey.length === 34) {
setAPIKey(values.apiKey)
clientInstance.call('notification' as any, 'toast', 'API key saved successfully!!!')
navigate((location && location.state ? location.state : '/'))
}
}}
@ -59,11 +57,20 @@ export const CaptureKeyView: React.FC = () => {
</div>
<div>
<SubmitButton text="Save" dataId="save-api-key" disable={ errors && errors.apiKey ? true : false } />
<SubmitButton text="Save" dataId="save-api-key" disable={errors && errors.apiKey ? true : false } />
</div>
</form>
)}
</Formik>
<div
data-id="api-key-result"
className="text-primary mt-4 text-center"
style={{fontSize: "0.8em"}}
dangerouslySetInnerHTML={{ __html: msg }}
/>
</div>
)
}}
</AppContext.Consumer>
)

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