Skip to content
Snippets Groups Projects
Commit 3442f237 authored by Jack Reed's avatar Jack Reed Committed by Chris Beer
Browse files

Make the sequence select an uncontrolled component

parent f7a1fee6
No related branches found
No related tags found
No related merge requests found
...@@ -27,10 +27,6 @@ export class WindowSideBarCanvasPanel extends Component { ...@@ -27,10 +27,6 @@ export class WindowSideBarCanvasPanel extends Component {
this.handleSequenceChange = this.handleSequenceChange.bind(this); this.handleSequenceChange = this.handleSequenceChange.bind(this);
this.handleVariantChange = this.handleVariantChange.bind(this); this.handleVariantChange = this.handleVariantChange.bind(this);
this.state = {
sequenceSelectionOpened: false,
};
this.containerRef = React.createRef(); this.containerRef = React.createRef();
} }
...@@ -51,8 +47,6 @@ export class WindowSideBarCanvasPanel extends Component { ...@@ -51,8 +47,6 @@ export class WindowSideBarCanvasPanel extends Component {
const { windowId, canvases } = this.props; const { windowId, canvases } = this.props;
const firstCanvasId = canvases[0].id; const firstCanvasId = canvases[0].id;
setCanvas(windowId, firstCanvasId); setCanvas(windowId, firstCanvasId);
this.setState({ sequenceSelectionOpened: false });
} }
/** @private */ /** @private */
...@@ -67,7 +61,6 @@ export class WindowSideBarCanvasPanel extends Component { ...@@ -67,7 +61,6 @@ export class WindowSideBarCanvasPanel extends Component {
*/ */
render() { render() {
const { const {
canvases,
classes, classes,
collection, collection,
id, id,
...@@ -75,13 +68,11 @@ export class WindowSideBarCanvasPanel extends Component { ...@@ -75,13 +68,11 @@ export class WindowSideBarCanvasPanel extends Component {
sequenceId, sequenceId,
sequences, sequences,
t, t,
toggleDraggingEnabled,
variant, variant,
showToc, showToc,
windowId, windowId,
} = this.props; } = this.props;
const { sequenceSelectionOpened } = this.state;
let listComponent; let listComponent;
if (variant === 'tableOfContents') { if (variant === 'tableOfContents') {
...@@ -125,15 +116,6 @@ export class WindowSideBarCanvasPanel extends Component { ...@@ -125,15 +116,6 @@ export class WindowSideBarCanvasPanel extends Component {
value={sequenceId} value={sequenceId}
onChange={this.handleSequenceChange} onChange={this.handleSequenceChange}
name="sequenceId" name="sequenceId"
open={sequenceSelectionOpened}
onOpen={(e) => {
toggleDraggingEnabled();
this.setState({ sequenceSelectionOpened: true });
}}
onClose={(e) => {
toggleDraggingEnabled();
this.setState({ sequenceSelectionOpened: false });
}}
classes={{ select: classes.select }} classes={{ select: classes.select }}
className={classes.selectEmpty} className={classes.selectEmpty}
> >
...@@ -190,7 +172,6 @@ WindowSideBarCanvasPanel.propTypes = { ...@@ -190,7 +172,6 @@ WindowSideBarCanvasPanel.propTypes = {
showMultipart: PropTypes.func.isRequired, showMultipart: PropTypes.func.isRequired,
showToc: PropTypes.bool, showToc: PropTypes.bool,
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
toggleDraggingEnabled: PropTypes.func.isRequired,
updateSequence: PropTypes.func.isRequired, updateSequence: PropTypes.func.isRequired,
updateVariant: PropTypes.func.isRequired, updateVariant: PropTypes.func.isRequired,
variant: PropTypes.oneOf(['item', 'thumbnail', 'tableOfContents']).isRequired, variant: PropTypes.oneOf(['item', 'thumbnail', 'tableOfContents']).isRequired,
...@@ -198,7 +179,6 @@ WindowSideBarCanvasPanel.propTypes = { ...@@ -198,7 +179,6 @@ WindowSideBarCanvasPanel.propTypes = {
}; };
WindowSideBarCanvasPanel.defaultProps = { WindowSideBarCanvasPanel.defaultProps = {
canvases: [],
collection: null, collection: null,
sequenceId: null, sequenceId: null,
sequences: [], sequences: [],
......
...@@ -6,7 +6,6 @@ import { withPlugins } from '../extend/withPlugins'; ...@@ -6,7 +6,6 @@ import { withPlugins } from '../extend/withPlugins';
import * as actions from '../state/actions'; import * as actions from '../state/actions';
import { WindowSideBarCanvasPanel } from '../components/WindowSideBarCanvasPanel'; import { WindowSideBarCanvasPanel } from '../components/WindowSideBarCanvasPanel';
import { import {
getCanvases,
getCompanionWindow, getCompanionWindow,
getDefaultSidebarVariant, getDefaultSidebarVariant,
getSequenceTreeStructure, getSequenceTreeStructure,
...@@ -47,7 +46,6 @@ const mapDispatchToProps = (dispatch, { id, windowId }) => ({ ...@@ -47,7 +46,6 @@ const mapDispatchToProps = (dispatch, { id, windowId }) => ({
showMultipart: () => dispatch( showMultipart: () => dispatch(
actions.addOrUpdateCompanionWindow(windowId, { content: 'collection', position: 'right' }), actions.addOrUpdateCompanionWindow(windowId, { content: 'collection', position: 'right' }),
), ),
toggleDraggingEnabled: () => dispatch(actions.toggleDraggingEnabled()),
updateSequence: sequenceId => dispatch( updateSequence: sequenceId => dispatch(
actions.updateWindow(windowId, { sequenceId }), actions.updateWindow(windowId, { sequenceId }),
), ),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment