Skip to content
Snippets Groups Projects
Unverified Commit 7a5cf65d authored by Jack Reed's avatar Jack Reed Committed by GitHub
Browse files

Merge pull request #2092 from ProjectMirador/window-sidebar-tabs

Remove the behavior where window sidebar buttons toggle panel state
parents b6a8a7bf dc12dcd8
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,6 @@ function createWrapper(props) {
return shallow(
<WindowSideBarButtons
addCompanionWindow={() => {}}
closeCompanionWindow={() => {}}
{...props}
/>,
);
......
......@@ -17,28 +17,12 @@ export class WindowSideBarButtons extends Component {
this.handleChange = this.handleChange.bind(this);
}
/**
* sideBarPanelCurrentlySelected - return if the given sideBarPanel is currently selected
* @return Boolean
*/
sideBarPanelCurrentlySelected(panelType) {
const { sideBarPanel } = this.props;
return sideBarPanel === panelType;
}
/** */
handleChange(event, value) {
const {
addCompanionWindow, closeCompanionWindow, sideBarPanelId,
} = this.props;
const { addCompanionWindow } = this.props;
if (this.sideBarPanelCurrentlySelected(value)) {
closeCompanionWindow(sideBarPanelId);
} else {
addCompanionWindow(value);
}
}
/**
* render
......@@ -63,9 +47,7 @@ export class WindowSideBarButtons extends Component {
<Tab
classes={{ root: classes.tab, selected: classes.tabSelected }}
aria-label={
this.sideBarPanelCurrentlySelected('info')
? t('closeCompanionWindow')
: t('openInfoCompanionWindow')
t('openInfoCompanionWindow')
}
icon={(
<InfoIcon />
......@@ -75,9 +57,7 @@ export class WindowSideBarButtons extends Component {
<Tab
classes={{ root: classes.tab, selected: classes.tabSelected }}
aria-label={
this.sideBarPanelCurrentlySelected('canvas_navigation')
? t('closeCanvasNavigationCompanionWindow')
: t('openCanvasNavigationCompanionWindow')
t('openCanvasNavigationCompanionWindow')
}
icon={(
<CanvasIndexIcon />
......@@ -87,9 +67,7 @@ export class WindowSideBarButtons extends Component {
<Tab
classes={{ root: classes.tab, selected: classes.tabSelected }}
aria-label={
this.sideBarPanelCurrentlySelected('annotations')
? t('closeAnnotationCompanionWindow')
: t('openAnnotationCompanionWindow')
t('openAnnotationCompanionWindow')
}
icon={(
<Badge color="error" invisible={!hasAnnotations} variant="dot">
......@@ -106,9 +84,7 @@ export class WindowSideBarButtons extends Component {
WindowSideBarButtons.propTypes = {
hasAnnotations: PropTypes.bool,
addCompanionWindow: PropTypes.func.isRequired,
closeCompanionWindow: PropTypes.func.isRequired,
sideBarPanel: PropTypes.string,
sideBarPanelId: PropTypes.string,
t: PropTypes.func,
classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
};
......@@ -116,7 +92,6 @@ WindowSideBarButtons.propTypes = {
WindowSideBarButtons.defaultProps = {
hasAnnotations: false,
sideBarPanel: 'closed',
sideBarPanelId: null,
t: key => key,
classes: {},
};
......@@ -22,9 +22,6 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({
addCompanionWindow: panelType => dispatch(
actions.popOutCompanionWindow(windowId, panelType, 'left'),
),
closeCompanionWindow: id => dispatch(
actions.updateCompanionWindow(windowId, id, { content: 'closed' }),
),
});
......@@ -39,7 +36,6 @@ const mapStateToProps = (state, { windowId }) => ({
['oa:commenting', 'sc:painting'],
).length > 0,
sideBarPanel: (getCompanionWindowForPosition(state, windowId, 'left') || {}).content,
sideBarPanelId: (getCompanionWindowForPosition(state, windowId, 'left') || {}).id,
});
/** */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment