import React, { Suspense, lazy, useState } from 'react'; import Route from 'containers/Route'; import AppInfo from 'components/AppInfo'; import TabList from 'components/TabList'; import cn from 'classnames'; const Modals = lazy(() => import('components/modals')); const Chat = lazy(() => import('containers/Chat')); const Connect = lazy(() => import('containers/Connect')); const Settings = lazy(() => import('containers/Settings')); const App = ({ connected, tab, channels, servers, privateChats, showTabList, select, push, hideMenu, openModal, newVersionAvailable, hasOpenModals }) => { const [renderModals, setRenderModals] = useState(false); if (!renderModals && hasOpenModals) { setRenderModals(true); } const mainClass = cn('main-container', { 'off-canvas': showTabList }); const handleClick = () => { if (showTabList) { hideMenu(); } }; return (
{!connected && ( Connection lost, attempting to reconnect... )} {newVersionAvailable && ( A new version of dispatch just got installed, reload to start using it! )}
...
}> ...
} > {renderModals && }
); }; export default App;