Skip to content
Snippets Groups Projects
Commit f00f045c authored by Johannes Baiter's avatar Johannes Baiter Committed by Chris Beer
Browse files

Fix canvas label display in ViewerInfo.

The component would always get be passed an `undefined` prop for the
label, since the selector in the container used the `canvasIdx` to
select the label, but the selector expected the identifier.  This was
missed in #2851 when the canvas identifier was passed to components that
were missing it.
Additionally, this commit removes the `canvasLabel` prop from the
`WindowCanvasNavigationControls` container, since the label is never
used in the actual component. (#3258)
parent 5cf97947
Branches
Tags
No related merge requests found
...@@ -4,7 +4,9 @@ import { withTranslation } from 'react-i18next'; ...@@ -4,7 +4,9 @@ import { withTranslation } from 'react-i18next';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import { withPlugins } from '../extend/withPlugins'; import { withPlugins } from '../extend/withPlugins';
import { ViewerInfo } from '../components/ViewerInfo'; import { ViewerInfo } from '../components/ViewerInfo';
import { getCanvasLabel, getCanvases, getCanvasIndex } from '../state/selectors'; import {
getCanvasLabel, getCanvases, getCanvasIndex, getVisibleCanvasIds
} from '../state/selectors';
/** /**
* mapStateToProps - to hook up connect * mapStateToProps - to hook up connect
...@@ -15,12 +17,13 @@ const mapStateToProps = (state, props) => { ...@@ -15,12 +17,13 @@ const mapStateToProps = (state, props) => {
const { windowId } = props; const { windowId } = props;
const canvases = getCanvases(state, { windowId }); const canvases = getCanvases(state, { windowId });
const canvasIndex = getCanvasIndex(state, { windowId }); const canvasIndex = getCanvasIndex(state, { windowId });
const canvasId = getVisibleCanvasIds(state, { windowId })[0];
return { return {
canvasCount: canvases.length, canvasCount: canvases.length,
canvasIndex, canvasIndex,
canvasLabel: getCanvasLabel(state, { canvasLabel: getCanvasLabel(state, {
canvasIndex, canvasId,
windowId, windowId,
}), }),
}; };
......
...@@ -4,19 +4,11 @@ import { withSize } from 'react-sizeme'; ...@@ -4,19 +4,11 @@ import { withSize } from 'react-sizeme';
import { withStyles } from '@material-ui/core'; import { withStyles } from '@material-ui/core';
import { fade } from '@material-ui/core/styles/colorManipulator'; import { fade } from '@material-ui/core/styles/colorManipulator';
import { withPlugins } from '../extend/withPlugins'; import { withPlugins } from '../extend/withPlugins';
import { import { getWorkspace } from '../state/selectors';
getCurrentCanvas,
getCanvasLabel,
getWorkspace,
} from '../state/selectors';
import { WindowCanvasNavigationControls } from '../components/WindowCanvasNavigationControls'; import { WindowCanvasNavigationControls } from '../components/WindowCanvasNavigationControls';
/** */ /** */
const mapStateToProps = (state, { windowId }) => ({ const mapStateToProps = (state, { windowId }) => ({
canvasLabel: getCanvasLabel(state, {
canvasId: (getCurrentCanvas(state, { windowId }) || {}).id,
windowId,
}),
visible: getWorkspace(state).focusedWindowId === windowId, visible: getWorkspace(state).focusedWindowId === windowId,
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment