* Add single viewport configuration * Multiple viewport configuration * Improve performance by using independent set methods * Add jump to slice command * Add context configuration * Cache panel visibility * Fix sync between vtk and cornerstone * Remove apis index * Add approach * Add loading to update volumes * Fix broken configuration * Bump vtk version * Use loading label * Update cy tests after vtk loading label changed * Remove loading for segs
34 lines
917 B
JavaScript
34 lines
917 B
JavaScript
import React, { useContext } from 'react';
|
|
import { useSelector } from 'react-redux';
|
|
import { getActiveContexts } from '../store/layout/selectors.js';
|
|
|
|
let AppContext = React.createContext({});
|
|
|
|
export const CONTEXTS = {
|
|
CORNERSTONE: 'ACTIVE_VIEWPORT::CORNERSTONE',
|
|
VTK: 'ACTIVE_VIEWPORT::VTK'
|
|
};
|
|
|
|
export const useAppContext = () => useContext(AppContext);
|
|
|
|
export const AppProvider = ({ children, config }) => {
|
|
const activeContexts = useSelector(state => getActiveContexts(state));
|
|
|
|
return (
|
|
<AppContext.Provider value={{ appConfig: config, activeContexts }}>
|
|
{children}
|
|
</AppContext.Provider>
|
|
);
|
|
};
|
|
|
|
export const withAppContext = Component => {
|
|
return function WrappedComponent(props) {
|
|
const { appConfig, activeContexts } = useAppContext();
|
|
return (
|
|
<Component {...props} appConfig={appConfig} activeContexts={activeContexts} />
|
|
);
|
|
};
|
|
};
|
|
|
|
export default AppContext;
|