import { inject, observer } from 'mobx-react'; import { Component, type ReactElement } from 'react'; import { ThemeProvider } from 'react-jss'; import { Outlet } from 'react-router-dom'; import type { StoresProps } from '../../@types/ferdium-components.types'; import AppLayout from '../../components/layout/AppLayout'; import Sidebar from '../../components/layout/Sidebar'; import Services from '../../components/services/content/Services'; import AppLoader from '../../components/ui/AppLoader'; import { workspaceStore } from '../../features/workspaces'; import WorkspaceDrawer from '../../features/workspaces/components/WorkspaceDrawer'; interface IProps extends StoresProps {} @inject('stores', 'actions') @observer class AppLayoutContainer extends Component { render(): ReactElement { const { app, features, services, ui, settings, requests, user, router } = this.props.stores; /* HOTFIX for: [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[bound ]' TypeError: Cannot read properties of null (reading 'push') at RouterStore.push (store.js:25) at UserStore._requireAuthenticatedUser */ if (!user.isLoggedIn) { router.push('/auth/welcome'); } const { setActive, // handleIPCMessage, setWebviewReference, detachService, // openWindow, reorder, reload, toggleNotifications, toggleAudio, toggleDarkMode, deleteService, updateService, clearCache, hibernate, awake, } = this.props.actions.service; const { retryRequiredRequests } = this.props.actions.requests; const { installUpdate, toggleMuteApp, toggleCollapseMenu } = this.props.actions.app; const { openSettings, closeSettings, openDownloads } = this.props.actions.ui; const isLoadingFeatures = features.featuresRequest.isExecuting && !features.featuresRequest.wasExecuted; const isLoadingServices = services.allServicesRequest.isExecuting && services.allServicesRequest.isExecutingFirstTime; const isLoadingSettings = !settings.loaded; if (isLoadingSettings || isLoadingFeatures || isLoadingServices) { return ( ); } const workspacesDrawer = ( workspace ? workspaceStore.getWorkspaceServices(workspace).map(s => s.name) : services.all.map(s => s.name) } stores={this.props.stores} actions={this.props.actions} /> ); const sidebar = ( ); const servicesContainer = ( ); return ( ); } } export default AppLayoutContainer;