diff --git a/client/constants.js b/client/constants.js index 50ca8f8e..d99a9784 100644 --- a/client/constants.js +++ b/client/constants.js @@ -42,5 +42,7 @@ export const CONSOLE_EVENT = 'CONSOLE_EVENT'; export const EXPAND_CONSOLE = 'EXPAND_CONSOLE'; export const COLLAPSE_CONSOLE = 'COLLAPSE_CONSOLE'; +export const TOGGLE_BEEP = 'TOGGLE_BEEP'; + // eventually, handle errors more specifically and better export const ERROR = 'ERROR'; diff --git a/client/modules/IDE/actions/editorHidden.js b/client/modules/IDE/actions/editorHidden.js new file mode 100644 index 00000000..d5cc4a92 --- /dev/null +++ b/client/modules/IDE/actions/editorHidden.js @@ -0,0 +1,7 @@ +import * as ActionTypes from '../../../constants'; + +export function toggleBeep() { + return { + type: ActionTypes.TOGGLE_BEEP + }; +} diff --git a/client/modules/IDE/actions/ide.js b/client/modules/IDE/actions/ide.js index 7628ff3f..1b8b18d8 100644 --- a/client/modules/IDE/actions/ide.js +++ b/client/modules/IDE/actions/ide.js @@ -79,4 +79,3 @@ export function closePreferences() { type: ActionTypes.CLOSE_PREFERENCES }; } - diff --git a/client/modules/IDE/components/Editor.js b/client/modules/IDE/components/Editor.js index 4469af07..2a7bbc28 100644 --- a/client/modules/IDE/components/Editor.js +++ b/client/modules/IDE/components/Editor.js @@ -44,7 +44,7 @@ class Editor extends React.Component { isVisible = true; } }); - if (isVisible) { + if (isVisible && this.props.enableBeep) { this.beep.play(); } }) @@ -109,6 +109,7 @@ class Editor extends React.Component { } Editor.propTypes = { + enableBeep: PropTypes.bool.isRequired, indentationAmount: PropTypes.number.isRequired, isTabIndent: PropTypes.bool.isRequired, updateFileContent: PropTypes.func.isRequired, diff --git a/client/modules/IDE/components/EditorHidden.js b/client/modules/IDE/components/EditorHidden.js new file mode 100644 index 00000000..e69de29b diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js index fe9eadbc..6edb48d6 100644 --- a/client/modules/IDE/pages/IDEView.js +++ b/client/modules/IDE/pages/IDEView.js @@ -12,6 +12,7 @@ import { connect } from 'react-redux'; import * as FileActions from '../actions/files'; import * as IDEActions from '../actions/ide'; import * as ProjectActions from '../actions/project'; +import * as EditorHiddenActions from '../actions/editorHidden'; import { getFile, getHTMLFile, getJSFiles, getCSSFiles } from '../reducers/files'; class IDEView extends React.Component { @@ -60,7 +61,9 @@ class IDEView extends React.Component {