Skip to content

Commit 56e16aa

Browse files
Tair AsimAdrien Hamelin
Tair Asim
and
Adrien Hamelin
authored
feat: Add value and calldata fields for playground (#94)
Also fixes a log issue. Co-authored-by: Adrien Hamelin <[email protected]>
1 parent 9e91cad commit 56e16aa

File tree

5 files changed

+258
-147
lines changed

5 files changed

+258
-147
lines changed

components/Editor/Header.tsx

+4-35
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,34 @@
11
import { useContext, useMemo } from 'react'
22

3-
import { useRegisterActions } from 'kbar'
43
import Select, { OnChangeValue } from 'react-select'
54

65
import { EthereumContext } from 'context/ethereumContext'
76

8-
import { Button, Label } from 'components/ui'
7+
import { Label } from 'components/ui'
98

109
import { CodeType } from './types'
1110

1211
type Props = {
1312
codeType: string | undefined
14-
isRunDisabled: boolean
1513
onCodeTypeChange: (option: OnChangeValue<any, any>) => void
16-
onRun: () => void
1714
}
1815

1916
const codeLangOptions = Object.keys(CodeType).map((lang) => ({
2017
value: lang,
2118
label: lang,
2219
}))
2320

24-
const EditorHeader = ({
25-
codeType,
26-
onCodeTypeChange,
27-
onRun,
28-
isRunDisabled,
29-
}: Props) => {
21+
const EditorHeader = ({ codeType, onCodeTypeChange }: Props) => {
3022
const { selectedFork } = useContext(EthereumContext)
3123

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(
4525
() => ({
4626
value: codeType,
4727
label: codeType,
4828
}),
4929
[codeType],
5030
)
5131

52-
useRegisterActions(actions, [onRun])
53-
5432
return (
5533
<div className="flex justify-between items-center w-full">
5634
<h3 className="font-semibold text-md hidden xl:block">
@@ -62,20 +40,11 @@ const EditorHeader = ({
6240
<Select
6341
onChange={onCodeTypeChange}
6442
options={codeLangOptions}
65-
value={codeTypeOption}
43+
value={codeTypeValue}
6644
isSearchable={false}
6745
classNamePrefix="select"
6846
menuPlacement="auto"
6947
/>
70-
71-
<Button
72-
onClick={onRun}
73-
disabled={isRunDisabled}
74-
size="sm"
75-
className="ml-3"
76-
>
77-
Run
78-
</Button>
7948
</div>
8049
</div>
8150
)

0 commit comments

Comments
 (0)