Skip to content
Snippets Groups Projects
Commit b8ff4fd3 authored by Shaun Ellis's avatar Shaun Ellis
Browse files

WIP - attempt at saved layout

parent a780e720
Branches issue-1703-b
No related tags found
No related merge requests found
...@@ -14,12 +14,13 @@ export class Window extends Component { ...@@ -14,12 +14,13 @@ export class Window extends Component {
* Renders things * Renders things
*/ */
render() { render() {
const { manifest, window } = this.props; const { manifest, window, layout } = this.props;
if (!window) return <></>; if (!window) return <></>;
return ( return (
<div id={window.id} className={ns('window')}> <div id={window.id} className={ns('window')}>
<WindowTopBar <WindowTopBar
layout={layout}
windowId={window.id} windowId={window.id}
manifest={manifest} manifest={manifest}
/> />
...@@ -42,9 +43,11 @@ export class Window extends Component { ...@@ -42,9 +43,11 @@ export class Window extends Component {
Window.propTypes = { Window.propTypes = {
window: PropTypes.object, // eslint-disable-line react/forbid-prop-types window: PropTypes.object, // eslint-disable-line react/forbid-prop-types
manifest: PropTypes.object, // eslint-disable-line react/forbid-prop-types manifest: PropTypes.object, // eslint-disable-line react/forbid-prop-types
layout: PropTypes.object, // eslint-disable-line react/forbid-prop-types
}; };
Window.defaultProps = { Window.defaultProps = {
window: null, window: null,
manifest: null, manifest: null,
layout: null,
}; };
...@@ -8,7 +8,7 @@ import { getWindowManifest, getManifestTitle } from '../state/selectors'; ...@@ -8,7 +8,7 @@ import { getWindowManifest, getManifestTitle } from '../state/selectors';
import { WindowTopBar } from '../components/WindowTopBar'; import { WindowTopBar } from '../components/WindowTopBar';
/** mapStateToProps */ /** mapStateToProps */
const mapStateToProps = (state, { windowId }) => ({ const mapStateToProps = (state, { windowId, layout }) => ({
manifestTitle: getManifestTitle(getWindowManifest(state, windowId)), manifestTitle: getManifestTitle(getWindowManifest(state, windowId)),
maximized: state.windows[windowId].maximized, maximized: state.windows[windowId].maximized,
}); });
...@@ -18,9 +18,9 @@ const mapStateToProps = (state, { windowId }) => ({ ...@@ -18,9 +18,9 @@ const mapStateToProps = (state, { windowId }) => ({
* @memberof ManifestListItem * @memberof ManifestListItem
* @private * @private
*/ */
const mapDispatchToProps = (dispatch, { windowId }) => ({ const mapDispatchToProps = (dispatch, { windowId, layout }) => ({
closeWindow: () => dispatch(actions.closeWindow(windowId)), closeWindow: () => dispatch(actions.closeWindow(windowId)),
maximizeWindow: () => dispatch(actions.maximizeWindow(windowId)), maximizeWindow: () => dispatch(actions.maximizeWindow(windowId, layout)),
minimizeWindow: () => dispatch(actions.minimizeWindow(windowId)), minimizeWindow: () => dispatch(actions.minimizeWindow(windowId)),
toggleWindowSideBar: () => dispatch(actions.toggleWindowSideBar(windowId)), toggleWindowSideBar: () => dispatch(actions.toggleWindowSideBar(windowId)),
}); });
......
import { compose } from 'redux'; import { compose } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import pickBy from 'lodash/pickBy';
import { Workspace } from '../components/Workspace'; import { Workspace } from '../components/Workspace';
/** /**
...@@ -13,10 +12,7 @@ const mapStateToProps = state => ( ...@@ -13,10 +12,7 @@ const mapStateToProps = state => (
isWorkspaceControlPanelVisible: state.config.workspaceControlPanel.enabled, isWorkspaceControlPanelVisible: state.config.workspaceControlPanel.enabled,
workspaceType: state.config.workspace.type, workspaceType: state.config.workspace.type,
windows: state.windows, windows: state.windows,
// pickBy(state.windows, window => window.maximized === false), savedLayout: state.workspace.savedLayout,
// Object.keys(state.windows)
// .map(id => state.windows[id])
// .filter(window => window.displayable === true),
} }
); );
......
...@@ -31,6 +31,7 @@ const ActionTypes = { ...@@ -31,6 +31,7 @@ const ActionTypes = {
RECEIVE_INFO_RESPONSE: 'RECEIVE_INFO_RESPONSE', RECEIVE_INFO_RESPONSE: 'RECEIVE_INFO_RESPONSE',
RECEIVE_INFO_RESPONSE_FAILURE: 'RECEIVE_INFO_RESPONSE_FAILURE', RECEIVE_INFO_RESPONSE_FAILURE: 'RECEIVE_INFO_RESPONSE_FAILURE',
REMOVE_INFO_RESPONSE: 'REMOVE_INFO_RESPONSE', REMOVE_INFO_RESPONSE: 'REMOVE_INFO_RESPONSE',
SAVE_WORKSPACE_MOSAIC_LAYOUT: 'SAVE_WORKSPACE_MOSAIC_LAYOUT',
UPDATE_WORKSPACE_MOSAIC_LAYOUT: 'UPDATE_WORKSPACE_MOSAIC_LAYOUT', UPDATE_WORKSPACE_MOSAIC_LAYOUT: 'UPDATE_WORKSPACE_MOSAIC_LAYOUT',
UPDATE_VIEWPORT: 'UPDATE_VIEWPORT', UPDATE_VIEWPORT: 'UPDATE_VIEWPORT',
}; };
......
...@@ -40,8 +40,12 @@ export function addWindow(options) { ...@@ -40,8 +40,12 @@ export function addWindow(options) {
* @param {String} windowId * @param {String} windowId
* @memberof ActionCreators * @memberof ActionCreators
*/ */
export function maximizeWindow(windowId) { export function maximizeWindow(windowId, layout) {
return { type: ActionTypes.MAXIMIZE_WINDOW, windowId }; // return { type: ActionTypes.MAXIMIZE_WINDOW, windowId };
return (dispatch) => {
dispatch({ type: ActionTypes.MAXIMIZE_WINDOW, windowId });
dispatch({ type: ActionTypes.SAVE_WORKSPACE_MOSAIC_LAYOUT, layout });
};
} }
/** /**
......
...@@ -20,6 +20,16 @@ export function toggleZoomControls(showZoomControls) { ...@@ -20,6 +20,16 @@ export function toggleZoomControls(showZoomControls) {
return { type: ActionTypes.TOGGLE_ZOOM_CONTROLS, showZoomControls }; return { type: ActionTypes.TOGGLE_ZOOM_CONTROLS, showZoomControls };
} }
/**
* saveWorkspaceMosaicLayout - action creator
*
* @param {Object} layout
* @memberof ActionCreators
*/
export function saveWorkspaceMosaicLayout(layout) {
return { type: ActionTypes.SAVE_WORKSPACE_MOSAIC_LAYOUT, layout };
}
/** /**
* updateWorkspaceMosaicLayout - action creator * updateWorkspaceMosaicLayout - action creator
* *
......
...@@ -11,6 +11,8 @@ export const workspaceReducer = (state = {}, action) => { ...@@ -11,6 +11,8 @@ export const workspaceReducer = (state = {}, action) => {
return { ...state, isFullscreenEnabled: action.isFullscreenEnabled }; return { ...state, isFullscreenEnabled: action.isFullscreenEnabled };
case ActionTypes.TOGGLE_ZOOM_CONTROLS: case ActionTypes.TOGGLE_ZOOM_CONTROLS:
return { ...state, showZoomControls: action.showZoomControls }; return { ...state, showZoomControls: action.showZoomControls };
case ActionTypes.SAVE_WORKSPACE_MOSAIC_LAYOUT:
return { ...state, savedLayout: action.layout };
case ActionTypes.UPDATE_WORKSPACE_MOSAIC_LAYOUT: case ActionTypes.UPDATE_WORKSPACE_MOSAIC_LAYOUT:
return { ...state, layout: action.layout }; return { ...state, layout: action.layout };
case ActionTypes.SET_WORKSPACE_ADD_VISIBILITY: case ActionTypes.SET_WORKSPACE_ADD_VISIBILITY:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment