Skip to content

Commit 67f393d

Browse files
committed
Allow to pass custom options to method filter
1 parent 1b2c990 commit 67f393d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/app/components/Transactions/RuntimeTransactionTypeFilter.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FC } from 'react'
22
import { getRuntimeTxMethodOptions } from '../RuntimeTransactionMethod'
33
import { useTranslation } from 'react-i18next'
4-
import { Select } from '../Select'
4+
import { Select, SelectOptionBase } from '../Select'
55
import Typography from '@mui/material/Typography'
66
import { Layer } from '../../../oasis-nexus/api'
77

@@ -28,14 +28,20 @@ export const RuntimeTransactionTypeFilter: FC<{
2828
value: string
2929
setValue: (value: string) => void
3030
expand?: boolean
31-
}> = ({ layer, value, setValue, expand }) => {
31+
customOptions?: SelectOptionBase[]
32+
}> = ({ layer, value, setValue, expand, customOptions }) => {
3233
const { t } = useTranslation()
34+
const defaultOptions = [{ value: 'any', label: 'Any' }]
35+
const options = customOptions
36+
? [...defaultOptions, ...customOptions]
37+
: [...defaultOptions, ...getRuntimeTxMethodOptions(t, layer)]
38+
3339
return (
3440
<Select
3541
className={expand ? 'expand' : undefined}
3642
light={true}
3743
label={<FilterLabel />}
38-
options={[{ value: 'any', label: 'Any' }, ...getRuntimeTxMethodOptions(t, layer)]}
44+
options={options}
3945
value={value}
4046
handleChange={setValue as any}
4147
/>

0 commit comments

Comments
 (0)