diff --git a/src/components/WindowTopBar.js b/src/components/WindowTopBar.js index a36cd1dcc2ff569dd77d2705f3d9d59a08b58642..f7b6ba338e06299aadb71e87e0e569e46848143f 100644 --- a/src/components/WindowTopBar.js +++ b/src/components/WindowTopBar.js @@ -4,6 +4,7 @@ import Typography from '@material-ui/core/Typography'; import IconButton from '@material-ui/core/IconButton'; import MenuIcon from '@material-ui/icons/MenuSharp'; import CloseIcon from '@material-ui/icons/CloseSharp'; +import FullscreenIcon from '@material-ui/icons/FullscreenSharp'; import Toolbar from '@material-ui/core/Toolbar'; import AppBar from '@material-ui/core/AppBar'; import classNames from 'classnames'; @@ -17,6 +18,14 @@ import ns from '../config/css-ns'; * WindowTopBar */ export class WindowTopBar extends Component { + /** + * maximizeWindow + * @return + */ + maximizeWindow() { + console.log('maximized!') + } + /** * render * @return @@ -41,6 +50,14 @@ export class WindowTopBar extends Component { </Typography> <WindowTopBarButtons windowId={windowId} /> <WindowTopMenuButton className={ns('window-menu-btn')} windowId={windowId} /> + <IconButton + color="inherit" + className={ns('window-maximize')} + aria-label={t('maximizeWindow')} + onClick={this.maximizeWindow} + > + <FullscreenIcon /> + </IconButton> <IconButton color="inherit" className={ns('window-close')} diff --git a/src/components/WorkspaceMosaic.js b/src/components/WorkspaceMosaic.js index 629081a2cfbc29f794c069ed448b10d47f4343da..7a7de1ac26447e6df211eba1c17faea54a8a3421 100644 --- a/src/components/WorkspaceMosaic.js +++ b/src/components/WorkspaceMosaic.js @@ -47,6 +47,7 @@ export class WorkspaceMosaic extends React.Component { */ determineWorkspaceLayout() { const { windows, workspace } = this.props; + console.log(windows); const windowKeys = Object.keys(windows).sort(); const leaveKeys = getLeaves(workspace.layout); // Check every window is in the layout, and all layout windows are present @@ -91,7 +92,7 @@ export class WorkspaceMosaic extends React.Component { return ( <Mosaic renderTile={this.tileRenderer} - initialValue={workspace.layout || this.determineWorkspaceLayout()} + initialValue={this.determineWorkspaceLayout() || workspace.layout} onChange={this.mosaicChange} className="mirador-mosaic" zeroStateView={this.zeroStateView} diff --git a/src/containers/Workspace.js b/src/containers/Workspace.js index ea8c5b444a8b9d3a4522dbaedc25bb17af9febd5..d0eaac1dae210b8127c0e8b4cea1a96a7b10b198 100644 --- a/src/containers/Workspace.js +++ b/src/containers/Workspace.js @@ -1,5 +1,6 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; +import pickBy from 'lodash/pickBy'; import { Workspace } from '../components/Workspace'; /** @@ -11,7 +12,10 @@ const mapStateToProps = state => ( { isWorkspaceControlPanelVisible: state.config.workspaceControlPanel.enabled, workspaceType: state.config.workspace.type, - windows: state.windows, + windows: pickBy(state.windows, window => window.displayable === true), + // Object.keys(state.windows) + // .map(id => state.windows[id]) + // .filter(window => window.displayable === true), } ); diff --git a/src/state/actions/action-types.js b/src/state/actions/action-types.js index 117eda9052691186eea6ead2d20257607cc8c702..f3a2ddf1f535ed62cf3129e76eb58c4da298b121 100644 --- a/src/state/actions/action-types.js +++ b/src/state/actions/action-types.js @@ -8,6 +8,7 @@ const ActionTypes = { SET_WORKSPACE_FULLSCREEN: 'SET_WORKSPACE_FULLSCREEN', ADD_MANIFEST: 'ADD_MANIFEST', ADD_WINDOW: 'ADD_WINDOW', + MAXIMIZE_WINDOW: 'MAXIMIZE_WINDOW', NEXT_CANVAS: 'NEXT_CANVAS', PREVIOUS_CANVAS: 'PREVIOUS_CANVAS', SET_CANVAS: 'SET_CANVAS', diff --git a/src/state/actions/window.js b/src/state/actions/window.js index afb5c766f61eaea98e0ec3b6c4edca3861826e80..3f2df733f92b3261c518e47b1d64107b4b1943a8 100644 --- a/src/state/actions/window.js +++ b/src/state/actions/window.js @@ -30,10 +30,20 @@ export function addWindow(options) { companionWindowIds: [], rotation: null, view: 'single', + displayable: true, }; return { type: ActionTypes.ADD_WINDOW, window: { ...defaultOptions, ...options } }; } +/** + * maximizeWindow + * @param {String} windowId + * @memberof ActionCreators + */ +export function maximizeWindow(windowId) { + return { type: ActionTypes.MAXIMIZE_WINDOW, windowId }; +} + /** */ export function updateWindow(id, payload) { return { type: ActionTypes.UPDATE_WINDOW, id, payload }; diff --git a/src/state/reducers/windows.js b/src/state/reducers/windows.js index 7a1739f8e481d9380bd89d709ea843be247a481c..d025bf1f14a58b6728cf9c0d9b126b5b9cc39f7e 100644 --- a/src/state/reducers/windows.js +++ b/src/state/reducers/windows.js @@ -9,6 +9,15 @@ export const windowsReducer = (state = {}, action) => { case ActionTypes.ADD_WINDOW: return { ...state, [action.window.id]: action.window }; + case ActionTypes.MAXIMIZE_WINDOW: + return Object.keys(state).reduce((object, key) => { + if (key !== action.windowId) { + object[key] = state[key]; + object[key].displayable = false; + } + return object; + }, {}); + case ActionTypes.UPDATE_WINDOW: return updateIn(state, [action.id], orig => merge(orig, action.payload));