import React from 'react'; import { connect } from 'react-redux'; import classnames from 'classnames'; import translate from 'translations'; import { navigationLinks, Theme } from 'config'; import NavigationLink from 'components/NavigationLink'; import NetworkSelect from './NetworkSelect'; import LanguageSelect from './LanguageSelect'; import NetworkStatus from './NetworkStatus'; import { changeTheme, getTheme } from 'features/config'; import { AppState } from 'features/reducers'; import './ElectronNav.scss'; interface StateProps { theme: ReturnType; } interface ActionProps { changeTheme: typeof changeTheme; } type Props = StateProps & ActionProps; interface State { panelContent: React.ReactElement | null; isPanelOpen: boolean; } class ElectronNav extends React.Component { public state: State = { panelContent: null, isPanelOpen: false }; public render() { const { panelContent, isPanelOpen } = this.state; return (
Alpha Release
    {navigationLinks.map(link => ( ))}
{panelContent}
); } private openLanguageSelect = () => { const panelContent = ; this.setState({ panelContent, isPanelOpen: true }); }; private openNodeSelect = () => { const panelContent = ; this.setState({ panelContent, isPanelOpen: true }); }; private closePanel = () => { const { panelContent } = this.state; // Start closing panel this.setState({ isPanelOpen: false }); // Remove content when out of sight setTimeout(() => { if (this.state.panelContent === panelContent) { this.setState({ panelContent: null }); } }, 300); }; private toggleTheme = () => { const theme = this.props.theme === Theme.LIGHT ? Theme.DARK : Theme.LIGHT; this.props.changeTheme(theme); }; } export default connect( (state: AppState) => ({ theme: getTheme(state) }), { changeTheme } )(ElectronNav);