initializing appConfig
This commit is contained in:
parent
4928e20eab
commit
2a00427c90
@ -1,20 +1,11 @@
|
|||||||
|
// External
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { BrowserRouter, HashRouter } from 'react-router-dom';
|
import { BrowserRouter, HashRouter } from 'react-router-dom';
|
||||||
import { ThemeWrapper } from '@ohif/ui';
|
import { ThemeWrapper } from '@ohif/ui';
|
||||||
import {
|
// Viewer Project
|
||||||
CommandsManager,
|
|
||||||
ExtensionManager,
|
|
||||||
ServicesManager,
|
|
||||||
HotkeysManager,
|
|
||||||
UINotificationService,
|
|
||||||
UIModalService,
|
|
||||||
UIDialogService,
|
|
||||||
MeasurementService,
|
|
||||||
utils,
|
|
||||||
redux as reduxOHIF,
|
|
||||||
} from '@ohif/core';
|
|
||||||
import routes from './routes';
|
import routes from './routes';
|
||||||
|
import appInit from './appInit.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ENV Variable to determine routing behavior
|
* ENV Variable to determine routing behavior
|
||||||
@ -23,33 +14,16 @@ const Router = JSON.parse(process.env.USE_HASH_ROUTER)
|
|||||||
? HashRouter
|
? HashRouter
|
||||||
: BrowserRouter;
|
: BrowserRouter;
|
||||||
|
|
||||||
const commandsManagerConfig = {
|
|
||||||
/** Used by commands to inject `viewports` from "redux" */
|
|
||||||
getAppState: () => store.getState(),
|
|
||||||
/** Used by commands to determine active context */
|
|
||||||
getActiveContexts: () => getActiveContexts(store.getState()),
|
|
||||||
};
|
|
||||||
const commandsManager = new CommandsManager(commandsManagerConfig);
|
|
||||||
const servicesManager = new ServicesManager();
|
|
||||||
// const hotkeysManager = new HotkeysManager(commandsManager, servicesManager);
|
|
||||||
const extensionManager = new ExtensionManager({
|
|
||||||
commandsManager,
|
|
||||||
servicesManager,
|
|
||||||
appConfig,
|
|
||||||
api: {
|
|
||||||
contexts: CONTEXTS,
|
|
||||||
hooks: {
|
|
||||||
useAppContext,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
extensionManager.registerExtensions(/* Array of Extensions */);
|
|
||||||
|
|
||||||
function App({ config, defaultExtensions }) {
|
function App({ config, defaultExtensions }) {
|
||||||
const appConfig = {
|
const {
|
||||||
...(typeof config === 'function' ? config({ servicesManager }) : config),
|
appConfig,
|
||||||
};
|
commandsManager,
|
||||||
|
extensionManager,
|
||||||
|
servicesManager,
|
||||||
|
} = appInit(config, defaultExtensions);
|
||||||
|
|
||||||
|
// TODO: Expose configuration w/ context?
|
||||||
|
// See: `setConfiguration` in master
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Router basename={appConfig.routerBasename}>
|
<Router basename={appConfig.routerBasename}>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user