Skip to content

Commit 2e9f445

Browse files
committed
all toasters removed
1 parent 1984e60 commit 2e9f445

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

apps/etherscan/src/app/views/CaptureKeyView.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react"
1+
import React, { useState } from "react"
22

33
import { Formik, ErrorMessage, Field } from "formik"
44
import { useNavigate, useLocation } from "react-router-dom"
@@ -9,15 +9,14 @@ import { SubmitButton } from "../components"
99
export const CaptureKeyView: React.FC = () => {
1010
const location = useLocation()
1111
const navigate = useNavigate()
12+
const [msg, setMsg] = useState("")
1213
return (
1314
<AppContext.Consumer>
1415
{({ apiKey, clientInstance, setAPIKey }) => {
15-
if (!apiKey && clientInstance && clientInstance.call) {
16-
clientInstance.call('sidePanel' as any, 'currentFocus').then((current) => {
17-
if (current === 'etherscan') clientInstance.call('notification' as any, 'toast', 'Please add API key to continue')
18-
})
19-
}
20-
return <Formik
16+
if (!apiKey) setMsg('Please add API key to continue. It should be 34 characters long')
17+
return (
18+
<div>
19+
<Formik
2120
initialValues={{ apiKey }}
2221
validate={(values) => {
2322
const errors = {} as any
@@ -32,7 +31,6 @@ export const CaptureKeyView: React.FC = () => {
3231
const apiKey = values.apiKey
3332
if (apiKey.length === 34) {
3433
setAPIKey(values.apiKey)
35-
clientInstance.call('notification' as any, 'toast', 'API key saved successfully!!!')
3634
navigate((location && location.state ? location.state : '/'))
3735
}
3836
}}
@@ -59,11 +57,20 @@ export const CaptureKeyView: React.FC = () => {
5957
</div>
6058

6159
<div>
62-
<SubmitButton text="Save" dataId="save-api-key" disable={ errors && errors.apiKey ? true : false } />
60+
<SubmitButton text="Save" dataId="save-api-key" disable={errors && errors.apiKey ? true : false } />
6361
</div>
6462
</form>
6563
)}
6664
</Formik>
65+
66+
<div
67+
data-id="api-key-result"
68+
className="text-primary mt-4 text-center"
69+
style={{fontSize: "0.8em"}}
70+
dangerouslySetInnerHTML={{ __html: msg }}
71+
/>
72+
</div>
73+
)
6774
}}
6875
</AppContext.Consumer>
6976
)

apps/etherscan/src/app/views/HomeView.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ export const HomeView: React.FC = () => {
1111
return (
1212
<AppContext.Consumer>
1313
{({ apiKey, clientInstance, setReceipts, receipts, contracts }) => {
14-
if (!apiKey && clientInstance && clientInstance.call) {
15-
clientInstance.call('sidePanel' as any, 'currentFocus').then((current) => {
16-
if (current === 'etherscan') clientInstance.call('notification' as any, 'toast', 'Please add API key to continue')
17-
})
18-
}
1914
return !apiKey ? (
2015
<Navigate
2116
to={{

apps/etherscan/src/app/views/ReceiptsView.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ export const ReceiptsView: React.FC = () => {
6464
return (
6565
<AppContext.Consumer>
6666
{({ apiKey, clientInstance, receipts, setReceipts }) => {
67-
if (!apiKey && clientInstance && clientInstance.call) {
68-
clientInstance.call('sidePanel' as any, 'currentFocus').then((current) => {
69-
if (current === 'etherscan') clientInstance.call('notification' as any, 'toast', 'Please add API key to continue')
70-
})
71-
}
7267
return !apiKey ? (
7368
<Navigate
7469
to={{

0 commit comments

Comments
 (0)