diff --git a/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-bar.tsx b/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-bar.tsx index 118ba1422e..5bea69856c 100644 --- a/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-bar.tsx +++ b/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-bar.tsx @@ -1,13 +1,12 @@ import { CustomTooltip } from '@remix-ui/helper' -import React, { useState, useEffect, useReducer, useRef, useContext } from 'react' // eslint-disable-line +import React, { useState, useEffect, useRef, useContext } from 'react' // eslint-disable-line import { FormattedMessage, useIntl } from 'react-intl' +import { listenOnNetworkAction } from '../actions/terminalAction' import { TerminalContext } from '../context/context' -import { initialState, registerCommandReducer } from '../reducers/terminalReducer' import { RemixUiTerminalProps } from '../types/terminalTypes' export const RemixUITerminalBar = (props: RemixUiTerminalProps) => { const { newstate: state, dispatch } = useContext(TerminalContext) - const [isVM, setIsVM] = useState(false) const intl = useIntl() const terminalMenu = useRef(null) @@ -28,11 +27,12 @@ export const RemixUITerminalBar = (props: RemixUiTerminalProps) => { } function listenOnNetwork(event: any): void { - throw new Error('Function not implemented.') + const isListening = event.target.checked + listenOnNetworkAction(props.plugin, isListening) } function setSearchInput(arg0: string): void { - throw new Error('Function not implemented.') + dispatch({ type: 'search', payload: arg0 }) } return (<> @@ -62,7 +62,7 @@ export const RemixUITerminalBar = (props: RemixUiTerminalProps) => { placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" - tooltipText={intl.formatMessage({ id: isVM ? 'terminal.listenVM' : 'terminal.listenTitle' })} + tooltipText={intl.formatMessage({ id: state.isVM ? 'terminal.listenVM' : 'terminal.listenTitle' })} >
@@ -71,7 +71,7 @@ export const RemixUITerminalBar = (props: RemixUiTerminalProps) => { id="listenNetworkCheck" onChange={listenOnNetwork} type="checkbox" - disabled={isVM} + disabled={state.isVM} />