import React, { ReactElement, useState } from 'react' import { TextField, Button, CircularProgress, Container } from '@material-ui/core' interface Props { defaultHost?: string hostName: string } export default function ConnectToHost(props: Props): ReactElement { const [hostInputVisible, toggleHostInputVisibility] = useState(false) const [connectingToHost, setConnectingToHost] = useState(false) const [host, setHost] = useState('') const handleNewHostConnection = () => { if (host) { setConnectingToHost(true) sessionStorage.setItem(props.hostName, host) toggleHostInputVisibility(!hostInputVisible) window.location.reload() } } return (
{ // FIXME: this should be broken up /* eslint-disable no-nested-ternary */ hostInputVisible ? (
setHost(e.target.value)} style={{ marginRight: '15px', minWidth: '300px' }} />
) : connectingToHost ? ( ) : ( ) /* eslint-enable no-nested-ternary */ }
) }