diff --git a/client/components/Nav.js b/client/components/Nav.js index ad51f760..975e3ceb 100644 --- a/client/components/Nav.js +++ b/client/components/Nav.js @@ -21,8 +21,8 @@ function Nav(props) { Save -
  • - +
  • + Duplicate
  • diff --git a/client/constants.js b/client/constants.js index 29f60645..f71c2317 100644 --- a/client/constants.js +++ b/client/constants.js @@ -44,6 +44,10 @@ export const CONSOLE_EVENT = 'CONSOLE_EVENT'; export const EXPAND_CONSOLE = 'EXPAND_CONSOLE'; export const COLLAPSE_CONSOLE = 'COLLAPSE_CONSOLE'; +export const UPDATE_LINT_MESSAGE = 'UPDATE_LINT_MESSAGE'; +export const CLEAR_LINT_MESSAGE = 'CLEAR_LINT_MESSAGE'; +export const UPDATE_LINENUMBER = 'UPDATE_LINENUMBER'; + export const SHOW_FILE_OPTIONS = 'SHOW_FILE_OPTIONS'; export const HIDE_FILE_OPTIONS = 'HIDE_FILE_OPTIONS'; @@ -53,6 +57,7 @@ export const SHOW_EDIT_FILE_NAME = 'SHOW_EDIT_FILE_NAME'; export const HIDE_EDIT_FILE_NAME = 'HIDE_EDIT_FILE_NAME'; export const SET_AUTOSAVE = 'SET_AUTOSAVE'; +export const SET_LINT_WARNING = 'SET_LINT_WARNING'; export const SET_PREFERENCES = 'SET_PREFERENCES'; // eventually, handle errors more specifically and better diff --git a/client/modules/IDE/actions/editorAccessibility.js b/client/modules/IDE/actions/editorAccessibility.js new file mode 100644 index 00000000..3311d943 --- /dev/null +++ b/client/modules/IDE/actions/editorAccessibility.js @@ -0,0 +1,23 @@ +import * as ActionTypes from '../../../constants'; + +export function updateLintMessage(severity, line, message) { + return { + type: ActionTypes.UPDATE_LINT_MESSAGE, + severity, + line, + message + }; +} + +export function clearLintMessage() { + return { + type: ActionTypes.CLEAR_LINT_MESSAGE + }; +} + +export function updateLineNumber(lineNumber) { + return { + type: ActionTypes.UPDATE_LINENUMBER, + lineNumber + }; +} 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/actions/preferences.js b/client/modules/IDE/actions/preferences.js index ab8d2c5c..82ea107a 100644 --- a/client/modules/IDE/actions/preferences.js +++ b/client/modules/IDE/actions/preferences.js @@ -100,3 +100,21 @@ export function setAutosave(value) { } }; } + +export function setLintWarning(value) { + return (dispatch, getState) => { + dispatch({ + type: ActionTypes.SET_LINT_WARNING, + value + }); + const state = getState(); + if (state.user.authenticated) { + const formParams = { + preferences: { + lintWarning: value + } + }; + updatePreferences(formParams, dispatch); + } + }; +} diff --git a/client/modules/IDE/components/Console.js b/client/modules/IDE/components/Console.js index d201f557..52b33d58 100644 --- a/client/modules/IDE/components/Console.js +++ b/client/modules/IDE/components/Console.js @@ -55,7 +55,7 @@ class Console extends React.Component { }); return ( -
    +

    console

    +class NewFileModal extends React.Component { + componentDidMount() { + document.getElementById('name').focus(); + } + render() { + const modalClass = classNames({ + modal: true, + 'modal--reduced': !this.props.canUploadMedia + }); + return ( +
    +
    +
    +

    Add File

    + +
    + + {(() => { + if (this.props.canUploadMedia) { + return ( +
    +

    OR

    + +
    + ); + } + return ''; + })()}
    - - {(() => { - if (props.canUploadMedia) { - return ( -
    -

    OR

    - -
    - ); - } - return ''; - })()} -
    - - ); + + ); + } } NewFileModal.propTypes = { diff --git a/client/modules/IDE/components/Preferences.js b/client/modules/IDE/components/Preferences.js index 06e240ed..59f13c0a 100644 --- a/client/modules/IDE/components/Preferences.js +++ b/client/modules/IDE/components/Preferences.js @@ -28,6 +28,11 @@ class Preferences extends React.Component { this.props.setAutosave(value); } + handleLintWarning(event) { + const value = event.target.value === 'true'; + this.props.setLintWarning(value); + } + render() { const preferencesContainerClass = classNames({ preferences: true, @@ -49,6 +54,14 @@ class Preferences extends React.Component { preference__option: true, 'preference__option--selected': !this.props.autosave }); + let lintWarningOnClass = classNames({ + preference__option: true, + 'preference__option--selected': this.props.lintWarning + }); + let lintWarningOffClass = classNames({ + preference__option: true, + 'preference__option--selected': !this.props.lintWarning + }); return (
    @@ -77,6 +90,7 @@ class Preferences extends React.Component { className="preference__value" aria-live="status" aria-live="polite" + aria-atomic="true" role="status" value={this.props.fontSize} onChange={this.handleUpdateFont} @@ -106,6 +120,7 @@ class Preferences extends React.Component { className="preference__value" aria-live="status" aria-live="polite" + aria-atomic="true" role="status" value={this.props.indentationAmount} onChange={this.handleUpdateIndentation} @@ -139,6 +154,21 @@ class Preferences extends React.Component { >Off
    +
    +

    Lint Warning Sound

    +
    + + +
    +
    ); } @@ -155,7 +185,9 @@ Preferences.propTypes = { isTabIndent: PropTypes.bool.isRequired, setFontSize: PropTypes.func.isRequired, autosave: PropTypes.bool.isRequired, - setAutosave: PropTypes.func.isRequired + setAutosave: PropTypes.func.isRequired, + lintWarning: PropTypes.bool.isRequired, + setLintWarning: PropTypes.func.isRequired }; export default Preferences; diff --git a/client/modules/IDE/components/PreviewFrame.js b/client/modules/IDE/components/PreviewFrame.js index 9eb33041..edbfeb0e 100644 --- a/client/modules/IDE/components/PreviewFrame.js +++ b/client/modules/IDE/components/PreviewFrame.js @@ -33,7 +33,7 @@ const hijackConsoleScript = `