2019-01-03 17:14:25 +03:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { Provider } from 'react-redux';
|
2020-10-26 02:32:04 +03:00
|
|
|
import { Store } from 'redux';
|
2021-08-31 01:18:02 +03:00
|
|
|
import { Persistor } from 'redux-persist';
|
|
|
|
import { PersistGate } from 'redux-persist/integration/react';
|
2019-01-03 17:14:25 +03:00
|
|
|
import configureStore from './store/configureStore';
|
|
|
|
import { CONNECT_REQUEST } from './constants/socketActionTypes';
|
|
|
|
import App from './containers/App';
|
2020-10-26 02:32:04 +03:00
|
|
|
import { StoreState } from './reducers';
|
2021-11-06 20:28:35 +03:00
|
|
|
import { StoreAction } from './actions';
|
2020-10-26 02:32:04 +03:00
|
|
|
|
2022-01-10 18:41:53 +03:00
|
|
|
export class Root extends Component {
|
2020-10-26 02:32:04 +03:00
|
|
|
store?: Store<StoreState, StoreAction>;
|
2021-08-31 01:18:02 +03:00
|
|
|
persistor?: Persistor;
|
2019-01-03 17:14:25 +03:00
|
|
|
|
2020-08-01 21:21:04 +03:00
|
|
|
UNSAFE_componentWillMount() {
|
2021-09-06 21:29:41 +03:00
|
|
|
const { store, persistor } = configureStore(
|
|
|
|
(store: Store<StoreState, StoreAction>) => {
|
|
|
|
if (store.getState().connection.type !== 'disabled') {
|
|
|
|
store.dispatch({
|
|
|
|
type: CONNECT_REQUEST,
|
|
|
|
});
|
|
|
|
}
|
2023-07-12 21:03:20 +03:00
|
|
|
},
|
2021-09-06 21:29:41 +03:00
|
|
|
);
|
2021-08-31 01:18:02 +03:00
|
|
|
this.store = store;
|
|
|
|
this.persistor = persistor;
|
2019-01-03 17:14:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
if (!this.store) return null;
|
|
|
|
return (
|
|
|
|
<Provider store={this.store}>
|
2021-11-06 20:28:35 +03:00
|
|
|
<PersistGate loading={null} persistor={this.persistor!}>
|
2021-08-31 01:18:02 +03:00
|
|
|
<App />
|
|
|
|
</PersistGate>
|
2019-01-03 17:14:25 +03:00
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-10 18:41:53 +03:00
|
|
|
export * from './actions';
|
|
|
|
export { default as DispatcherButton } from './components/buttons/DispatcherButton';
|
|
|
|
export { default as ExportButton } from './components/buttons/ExportButton';
|
|
|
|
export { default as ImportButton } from './components/buttons/ImportButton';
|
|
|
|
export { default as PrintButton } from './components/buttons/PrintButton';
|
|
|
|
export { default as SliderButton } from './components/buttons/SliderButton';
|
|
|
|
export { default as Header } from './components/Header';
|
|
|
|
export { default as MonitorSelector } from './components/MonitorSelector';
|
|
|
|
export { default as Settings } from './components/Settings';
|
|
|
|
export { default as TopButtons } from './components/TopButtons';
|
|
|
|
export { default as DevTools } from './containers/DevTools';
|
|
|
|
export { default as Dispatcher } from './containers/monitors/Dispatcher';
|
|
|
|
export { default as SliderMonitor } from './containers/monitors/Slider';
|
|
|
|
export * from './constants/actionTypes';
|
|
|
|
export * from './constants/socketActionTypes';
|
|
|
|
export * from './middlewares/api';
|
|
|
|
export * from './middlewares/exportState';
|
|
|
|
export * from './reducers';
|
|
|
|
export * from './reducers/connection';
|
|
|
|
export * from './reducers/instances';
|
|
|
|
export * from './reducers/monitor';
|
|
|
|
export * from './reducers/notification';
|
|
|
|
export * from './reducers/reports';
|
|
|
|
export * from './reducers/section';
|
|
|
|
export * from './reducers/socket';
|
|
|
|
export * from './reducers/theme';
|
2023-04-11 15:21:40 +03:00
|
|
|
export * from './reducers/stateTreeSettings';
|
2022-01-10 18:41:53 +03:00
|
|
|
export * from './utils/monitorActions';
|
|
|
|
export * from './utils/stringifyJSON';
|