import React, { Component, Fragment } from 'react'; import { HashRouter, Route } from 'react-router-dom'; import PropTypes from 'prop-types'; import { withNamespaces } from 'react-i18next'; import LoadingBar from 'react-redux-loading-bar'; import 'react-table/react-table.css'; import '../ui/Tabler.css'; import '../ui/ReactTable.css'; import './index.css'; import Header from '../../containers/Header'; import Dashboard from '../../containers/Dashboard'; import Settings from '../../containers/Settings'; import Filters from '../../containers/Filters'; import Logs from '../../containers/Logs'; import SetupGuide from '../../containers/SetupGuide'; import Toasts from '../Toasts'; import Footer from '../ui/Footer'; import Status from '../ui/Status'; import UpdateTopline from '../ui/UpdateTopline'; import UpdateOverlay from '../ui/UpdateOverlay'; import EncryptionTopline from '../ui/EncryptionTopline'; import i18n from '../../i18n'; class App extends Component { componentDidMount() { this.props.getDnsStatus(); } componentDidUpdate(prevProps) { if (this.props.dashboard.language !== prevProps.dashboard.language) { this.setLanguage(); } } handleStatusChange = () => { this.props.enableDns(); }; handleUpdate = () => { this.props.getUpdate(); } setLanguage = () => { const { processing, language } = this.props.dashboard; if (!processing) { if (language) { i18n.changeLanguage(language); } } i18n.on('languageChanged', (lang) => { this.props.changeLanguage(lang); }); } render() { const { dashboard, encryption } = this.props; const updateAvailable = !dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable; return ( {updateAvailable && } {!encryption.processing && }
{!dashboard.processing && !dashboard.isCoreRunning &&
} {!dashboard.processing && dashboard.isCoreRunning && }