import * as React from 'react' import { MenuItem } from '@mui/material' import Select from '@mui/material/Select' import { SelectChangeEvent } from '@mui/material/Select/SelectInput' import { SxProps } from '@mui/system' import { MixnodeStatus, MixnodeStatusWithAll, } from '@/app/typeDefs/explorer-api' import { useIsMobile } from '@/app/hooks/useIsMobile' import { MixNodeStatus } from './Status' // TODO: replace with i18n const ALL_NODES = 'All nodes' interface MixNodeStatusDropdownProps { status?: MixnodeStatusWithAll sx?: SxProps onSelectionChanged?: (status?: MixnodeStatusWithAll) => void } export const MixNodeStatusDropdown: FCWithChildren< MixNodeStatusDropdownProps > = ({ status, onSelectionChanged, sx }) => { const isMobile = useIsMobile() const [statusValue, setStatusValue] = React.useState( status || MixnodeStatusWithAll.all ) const onChange = React.useCallback( (event: SelectChangeEvent) => { setStatusValue(event.target.value as MixnodeStatusWithAll) if (onSelectionChanged) { onSelectionChanged(event.target.value as MixnodeStatusWithAll) } }, [onSelectionChanged] ) return ( ) }