Skip to content

Commit a79aa1c

Browse files
committed
chore(types): fixed vercel build
1 parent fa61b4b commit a79aa1c

13 files changed

Lines changed: 174 additions & 122 deletions

File tree

components/ChainSelector.tsx

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
import { useContext, useEffect, useMemo, useState, useCallback } from 'react';
1+
import { useContext, useEffect, useMemo, useState, useCallback } from 'react'
22

3-
import { useRegisterActions, Action } from 'kbar';
4-
import { useRouter } from 'next/router';
5-
import Select, { OnChangeValue, components } from 'react-select';
3+
import { useRegisterActions, Action } from 'kbar'
4+
import { useRouter } from 'next/router'
5+
import Select, { OnChangeValue, components } from 'react-select'
66

7-
import { EthereumContext } from 'context/ethereumContext';
7+
import { EthereumContext } from 'context/ethereumContext'
88

9-
import { CURRENT_FORK } from 'util/constants';
10-
import { toKeyIndex } from 'util/string';
9+
import { CURRENT_FORK } from 'util/constants'
10+
import { toKeyIndex } from 'util/string'
1111

12-
import { Icon, Label } from 'components/ui';
12+
import { Icon, Label } from 'components/ui'
1313

14-
const useBuildForkActions = (forkOptions: any[], handleForkChange: { (option: any): void; (arg0: any): any; }) => {
14+
interface ForkOption {
15+
label: string;
16+
}
17+
18+
19+
type HandleForkChange = (option: ForkOption) => void;
20+
21+
22+
const useBuildForkActions = (
23+
forkOptions: ForkOption[],
24+
handleForkChange: HandleForkChange
25+
) => {
1526
return useMemo(() => {
1627
const forkIds = forkOptions.map((option, index) => toKeyIndex('fork', index));
1728

@@ -41,36 +52,37 @@ const useBuildForkActions = (forkOptions: any[], handleForkChange: { (option: an
4152

4253

4354

55+
4456
const ChainOption = (props: any) => {
45-
const { data, children } = props;
46-
const isCurrent = data.value === CURRENT_FORK;
57+
const { data, children } = props
58+
const isCurrent = data.value === CURRENT_FORK
4759

4860
return (
4961
<components.Option {...props}>
5062
{children}
5163
{isCurrent && <Label>Live</Label>}
5264
</components.Option>
53-
);
54-
};
65+
)
66+
}
5567

5668
const ChainSelector = () => {
57-
const { forks, selectedFork, onForkChange } = useContext(EthereumContext);
58-
const [forkValue, setForkValue] = useState(null);
59-
const router = useRouter();
69+
const { forks, selectedFork, onForkChange } = useContext(EthereumContext)
70+
const [forkValue, setForkValue] = useState(null)
71+
const router = useRouter()
6072

61-
const forkOptions = useMemo(() => forks.map((fork) => ({ value: fork.name, label: fork.name })), [forks]);
73+
const forkOptions = useMemo(() => forks.map((fork) => ({ value: fork.name, label: fork.name })), [forks])
6274

6375
const handleForkChange = useCallback((option: OnChangeValue<any, any>) => {
64-
setForkValue(option);
65-
onForkChange(option.value);
76+
setForkValue(option)
77+
onForkChange(option.value)
6678

67-
router.query.fork = option.value;
68-
router.push(router);
69-
}, [onForkChange, router]);
79+
router.query.fork = option.value
80+
router.push(router)
81+
}, [onForkChange, router])
7082

71-
const actions = useBuildForkActions(forkOptions, handleForkChange);
83+
const actions = useBuildForkActions(forkOptions, handleForkChange)
7284

73-
useRegisterActions(actions, [actions]);
85+
useRegisterActions(actions, [actions])
7486

7587
return (
7688
<div className="flex justify-end items-center rounded">
@@ -89,8 +101,8 @@ const ChainSelector = () => {
89101
</div>
90102
)}
91103
</div>
92-
);
93-
};
104+
)
105+
}
94106

95107

96-
export default ChainSelector;
108+
export default ChainSelector

components/KBar/Results.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import { useMemo } from 'react'
2-
32
import { KBarResults, useMatches } from 'kbar'
4-
53
import ResultItem from './ResultItem'
64

75
const NO_GROUP = 'none'
86

97
const Results = () => {
10-
const groups = useMatches()
11-
const flattened = useMemo(
12-
() =>
13-
groups.reduce((acc: any, curr: any) => {
14-
acc.push(curr.name)
15-
acc.push(...curr.actions)
16-
return acc
17-
}, []),
18-
[groups],
19-
)
8+
const { results } = useMatches()
9+
10+
const flattened = useMemo(() => {
11+
return results.reduce((acc: any[], curr: any) => {
12+
if (typeof curr === 'string') {
13+
acc.push(curr)
14+
} else {
15+
acc.push(curr.name)
16+
acc.push(...curr.actions)
17+
}
18+
return acc
19+
}, [])
20+
}, [results])
2021

2122
return (
2223
<KBarResults

components/Reference/DocRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const DocRow = ({
137137
>
138138
contribute?
139139
</a>{' '}
140-
;)
140+
)
141141
</div>
142142
)}
143143
</div>

components/Reference/Filters.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ const Filters = ({ onSetFilter, isPrecompiled = false, isTransactionType = false
2525
const filterByOptions = useMemo(() => {
2626
if (isTransactionType) {
2727

28-
return [{ label: 'Type', value: 'type' }, { label: 'Name', value: 'name' }, { label: 'Description', value: 'description' }];
28+
return [{ label: 'Type', value: 'type' }, { label: 'Name', value: 'name' }, { label: 'Description', value: 'description' }]
2929
} else {
3030
return [
3131
{ label: !isPrecompiled ? 'Opcode' : 'Address', value: 'opcodeOrAddress' },
3232
{ label: 'Name', value: 'name' },
3333
{ label: 'Description', value: 'description' },
34-
];
34+
]
3535
}
36-
}, [isPrecompiled, isTransactionType]);
36+
}, [isPrecompiled, isTransactionType])
3737

3838
const inputRef = useRef<HTMLInputElement>(null)
3939

components/Reference/Header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ type Props = {
1212
const ReferenceHeader = ({ isPrecompiled, isTransactionType }: Props) => {
1313
const { selectedFork } = useContext(EthereumContext)
1414

15-
let title = 'Instructions';
16-
if (isPrecompiled) title = 'Precompiled Contracts';
17-
if (isTransactionType) title = 'Transaction Types';
15+
let title = 'Instructions'
16+
if (isPrecompiled) title = 'Precompiled Contracts'
17+
if (isTransactionType) title = 'Transaction Types'
1818

1919
return (
2020
<H2 className="pb-8 md:pb-0 inline-flex items-center">

components/Reference/columns.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { Row } from 'react-table';
2-
import { StackBox } from 'components/ui';
1+
import { Row } from 'react-table'
2+
import { StackBox } from 'components/ui'
33

44
const filter = (rows: Row[], id: string, filterValue: string) => {
5-
const re = new RegExp(`${filterValue}`, 'i');
5+
const re = new RegExp(`${filterValue}`, 'i')
66
return rows.filter((row: any) => {
7-
const value = row.original[id]; // Ensure row.original[id] exists
8-
return value && value.match(re);
9-
});
10-
};
7+
const value = row.original[id] // Ensure row.original[id] exists
8+
return value && value.match(re)
9+
})
10+
}
1111

1212
const columns = (isPrecompiled: boolean, isTransactionType: boolean = false) => {
1313
if (isTransactionType) {
@@ -55,7 +55,7 @@ const columns = (isPrecompiled: boolean, isTransactionType: boolean = false) =>
5555
</div>
5656
),
5757
},
58-
];
58+
]
5959
}
6060

6161
return [
@@ -106,7 +106,7 @@ const columns = (isPrecompiled: boolean, isTransactionType: boolean = false) =>
106106
accessor: 'description',
107107
className: 'hidden md:table-cell',
108108
},
109-
];
110-
};
109+
]
110+
}
111111

112-
export default columns;
112+
export default columns

components/Reference/index.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Link from 'next/link'
1414
import { useRouter } from 'next/router'
1515
import { useTable, useExpanded, useFilters, HeaderGroup } from 'react-table'
1616
import ReactTooltip from 'react-tooltip'
17-
import { IReferenceItem, IItemDocs, IGasDocs } from 'types'
17+
import { IReferenceItem, IItemDocs, IGasDocs} from 'types'
1818

1919
import {
2020
EthereumContext,
@@ -38,21 +38,20 @@ type CustomHeaderGroup = {
3838
const ReferenceTable = ({
3939
itemDocs,
4040
gasDocs,
41-
reference,
41+
reference,
4242
isPrecompiled = false,
4343
isTransactionType = false,
4444
}: {
4545
itemDocs: IItemDocs
4646
gasDocs: IGasDocs
47-
reference: IReferenceItem[]
48-
transactionTypes: IReferenceItem[]
47+
reference: IReferenceItem[]
4948
isPrecompiled?: boolean
5049
isTransactionType?: boolean
5150
}) => {
5251
const router = useRouter()
5352
const { forks, selectedFork, onForkChange } = useContext(EthereumContext)
5453
const data = useMemo(() => reference, [reference])
55-
const columns = useMemo(() => tableColumns(isPrecompiled, isTransactionType), [isPrecompiled, isTransactionType]);
54+
const columns = useMemo(() => tableColumns(isPrecompiled, isTransactionType), [isPrecompiled, isTransactionType])
5655
const rowRefs = useRef<HTMLTableRowElement[]>([])
5756
const [focusedOpcode, setFocusedOpcode] = useState<number | null>()
5857
const { width: screenWidth } = useWindowSize()

components/ThemeSelector.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const ThemeSelector = () => {
1212
name: 'Select theme…',
1313
shortcut: ['t'],
1414
keywords: 'theme appearance',
15-
section: 'Preferences',
16-
children: ['theme-light', 'theme-dark', 'theme-system'],
15+
section: 'Preferences',
1716
},
1817
{
1918
id: 'theme-light',

components/ui/Hamburger.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ export const Hamburger: React.FC<Props> = ({ isActive, onClick }) => (
2424

2525
<style jsx>{`
2626
.bar {
27-
width: 20px;
28-
height: 2px;
27+
width: 20px
28+
height: 2px
2929
}
3030
3131
.active .bar:nth-child(2) {
32-
opacity: 0;
32+
opacity: 0
3333
}
3434
3535
.active .bar:nth-child(1) {
36-
transform: translateY(6px) rotate(45deg);
36+
transform: translateY(6px) rotate(45deg)
3737
}
3838
3939
.active .bar:nth-child(3) {
40-
transform: translateY(-6px) rotate(-45deg);
40+
transform: translateY(-6px) rotate(-45deg)
4141
}
4242
`}</style>
4343
</button>

components/ui/StackBox.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React from 'react';
2-
import cn from 'classnames';
1+
import React from 'react'
2+
import cn from 'classnames'
33

44
type Props = {
5-
value?: string;
6-
showEmpty?: boolean;
7-
isFullWidth?: boolean;
8-
className?: string;
9-
};
5+
value?: string
6+
showEmpty?: boolean
7+
isFullWidth?: boolean
8+
className?: string
9+
}
1010

1111
export const StackBox: React.FC<Props> = ({
1212
value = '',
@@ -15,10 +15,10 @@ export const StackBox: React.FC<Props> = ({
1515
className,
1616
}) => {
1717
if (!showEmpty && value.trim().length === 0) {
18-
return null;
18+
return null
1919
}
2020

21-
const parts = value.split(/[^\\]\|/);
21+
const parts = value.split(/[^\\]\|/)
2222

2323
return (
2424
<>
@@ -36,5 +36,5 @@ export const StackBox: React.FC<Props> = ({
3636
</div>
3737
))}
3838
</>
39-
);
40-
};
39+
)
40+
}

0 commit comments

Comments
 (0)