Skip to content

Commit 5d00433

Browse files
committed
implement notification onClick
1 parent cf91ce0 commit 5d00433

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

src/components/SetupPage/index.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,18 @@ import DatasetJSONEditor from "../DatasetJSONEditor"
1818
import useInterface from "../../hooks/use-interface"
1919
import useSample from "../../hooks/use-sample"
2020
import Protip from "./Protip"
21-
import { useToasts } from "../Toasts"
2221

2322
const noop = () => {}
2423

2524
export default ({ onClearLabelData }) => {
2625
const { iface, updateInterface } = useInterface()
2726
const { sample } = useSample(0)
28-
const { addToast } = useToasts()
2927
const [currentTab, setTab] = useState(iface?.type ? "configure" : "datatype")
3028

3129
return (
3230
<div>
3331
<Box padding="8px" paddingBottom="0px">
34-
<Tabs
35-
value={currentTab}
36-
onChange={(e, newTab) => {
37-
addToast("Couldn't load plugin: ", "error", () => {
38-
console.log("passed click")
39-
})
40-
setTab(newTab)
41-
}}
42-
>
32+
<Tabs value={currentTab} onChange={(e, newTab) => setTab(newTab)}>
4333
<Tab icon={<CategoryIcon />} label="Data Type" value="datatype" />
4434
<Tab
4535
disabled={!iface?.type}

src/components/Toasts/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export const ToastProvider = ({ children }) => {
130130
const addToast = (
131131
message: string,
132132
messageType: string = "info",
133-
onClick: function = null
133+
onClick: function
134134
) => changeToasts({ type: "add", message, messageType, onClick })
135135

136136
return (
@@ -176,11 +176,7 @@ export const Notification = ({ type, message, onClick, onClose }) => {
176176
<paper
177177
className={classes.notificationPaper}
178178
style={{ position: "relative", cursor: "pointer" }}
179-
onClick={() => {
180-
if (onClick) {
181-
onClick()
182-
}
183-
}}
179+
onClick={onClick}
184180
>
185181
<div className={classNames(classes.icon, type)}>
186182
<Icon fontSize="large" style={{ padding: 12 }} />

0 commit comments

Comments
 (0)