1
1
import { useContext , useMemo } from 'react'
2
2
3
- import { useRegisterActions } from 'kbar'
4
3
import Select , { OnChangeValue } from 'react-select'
5
4
6
5
import { EthereumContext } from 'context/ethereumContext'
7
6
8
- import { Button , Label } from 'components/ui'
7
+ import { Label } from 'components/ui'
9
8
10
9
import { CodeType } from './types'
11
10
12
11
type Props = {
13
12
codeType : string | undefined
14
- isRunDisabled : boolean
15
13
onCodeTypeChange : ( option : OnChangeValue < any , any > ) => void
16
- onRun : ( ) => void
17
14
}
18
15
19
16
const codeLangOptions = Object . keys ( CodeType ) . map ( ( lang ) => ( {
20
17
value : lang ,
21
18
label : lang ,
22
19
} ) )
23
20
24
- const EditorHeader = ( {
25
- codeType,
26
- onCodeTypeChange,
27
- onRun,
28
- isRunDisabled,
29
- } : Props ) => {
21
+ const EditorHeader = ( { codeType, onCodeTypeChange } : Props ) => {
30
22
const { selectedFork } = useContext ( EthereumContext )
31
23
32
- const actions = [
33
- {
34
- id : 'run' ,
35
- name : 'Run' ,
36
- shortcut : [ 'r' ] ,
37
- keywords : 'execution run' ,
38
- section : 'Execution' ,
39
- perform : onRun ,
40
- subtitle : 'Start execution' ,
41
- } ,
42
- ]
43
-
44
- const codeTypeOption = useMemo (
24
+ const codeTypeValue = useMemo (
45
25
( ) => ( {
46
26
value : codeType ,
47
27
label : codeType ,
48
28
} ) ,
49
29
[ codeType ] ,
50
30
)
51
31
52
- useRegisterActions ( actions , [ onRun ] )
53
-
54
32
return (
55
33
< div className = "flex justify-between items-center w-full" >
56
34
< h3 className = "font-semibold text-md hidden xl:block" >
@@ -62,20 +40,11 @@ const EditorHeader = ({
62
40
< Select
63
41
onChange = { onCodeTypeChange }
64
42
options = { codeLangOptions }
65
- value = { codeTypeOption }
43
+ value = { codeTypeValue }
66
44
isSearchable = { false }
67
45
classNamePrefix = "select"
68
46
menuPlacement = "auto"
69
47
/>
70
-
71
- < Button
72
- onClick = { onRun }
73
- disabled = { isRunDisabled }
74
- size = "sm"
75
- className = "ml-3"
76
- >
77
- Run
78
- </ Button >
79
48
</ div >
80
49
</ div >
81
50
)
0 commit comments