Skip to content
Snippets Groups Projects
Commit d1be4ba3 authored by Jack Reed's avatar Jack Reed
Browse files

Remove need to keep exportable workspace state in local component state

parent 78eac658
No related branches found
No related tags found
No related merge requests found
import React, { Component, Children } from 'react'; import React, { Component } from 'react';
import Button from '@material-ui/core/Button'; import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog'; import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions'; import DialogActions from '@material-ui/core/DialogActions';
...@@ -11,15 +11,6 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'; ...@@ -11,15 +11,6 @@ import { CopyToClipboard } from 'react-copy-to-clipboard';
/** /**
*/ */
export class WorkspaceExport extends Component { export class WorkspaceExport extends Component {
/** */
constructor(props) {
super(props);
this.state = {
value: '',
};
}
/** /**
* @private * @private
*/ */
...@@ -50,6 +41,7 @@ export class WorkspaceExport extends Component { ...@@ -50,6 +41,7 @@ export class WorkspaceExport extends Component {
const { const {
children, container, handleClose, open, t, children, container, handleClose, open, t,
} = this.props; } = this.props;
const exportableState = this.exportableState();
return ( return (
<Dialog <Dialog
id="workspace-settings" id="workspace-settings"
...@@ -64,16 +56,15 @@ export class WorkspaceExport extends Component { ...@@ -64,16 +56,15 @@ export class WorkspaceExport extends Component {
<DialogContent> <DialogContent>
{children} {children}
<pre> <pre>
{this.exportableState()} {exportableState}
</pre> </pre>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<Button color="secondary" onClick={() => handleClose()}>{t('cancel')}</Button> <Button color="secondary" onClick={() => handleClose()}>{t('cancel')}</Button>
<CopyToClipboard <CopyToClipboard
// eslint-disable-next-line react/destructuring-assignment text={exportableState}
text={this.state.value}
> >
<Button variant="contained" color="secondary" onClick={() => this.setState({ value: this.exportableState() })}>{t('copy')}</Button> <Button variant="contained" color="secondary">{t('copy')}</Button>
</CopyToClipboard> </CopyToClipboard>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment