From ead0017b8614c6ef82cfc1146f7db013e352f667 Mon Sep 17 00:00:00 2001 From: Jeremy Douglass Date: Sat, 18 Apr 2020 17:04:44 -0700 Subject: [PATCH 1/8] update default version of p5.js to 1.0.1 --- client/modules/IDE/reducers/files.js | 4 ++-- server/scripts/examples.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/modules/IDE/reducers/files.js b/client/modules/IDE/reducers/files.js index f5b92f5e..3707cce5 100644 --- a/client/modules/IDE/reducers/files.js +++ b/client/modules/IDE/reducers/files.js @@ -13,8 +13,8 @@ const defaultHTML = ` - - + + diff --git a/server/scripts/examples.js b/server/scripts/examples.js index 7e11fe3d..7bd907d7 100644 --- a/server/scripts/examples.js +++ b/server/scripts/examples.js @@ -11,8 +11,8 @@ const defaultHTML = ` - - + + From ca8c71139f0aa142ec9d6f26564073629cd0aa82 Mon Sep 17 00:00:00 2001 From: Jeremy Douglass Date: Sat, 9 May 2020 22:17:16 -0700 Subject: [PATCH 2/8] update p5.js to 1.0.1 in createDefaultFiles.js --- server/domain-objects/createDefaultFiles.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/domain-objects/createDefaultFiles.js b/server/domain-objects/createDefaultFiles.js index 9164c12a..60671081 100644 --- a/server/domain-objects/createDefaultFiles.js +++ b/server/domain-objects/createDefaultFiles.js @@ -10,9 +10,9 @@ const defaultHTML = ` - - - + + + From 8acd6ec189323995df3cebd3945576a0f3ba67d1 Mon Sep 17 00:00:00 2001 From: ghalestrilo Date: Thu, 30 Jul 2020 14:30:45 -0300 Subject: [PATCH 3/8] :ok_hand: move hoc to components folder --- client/components/useAsModal.jsx | 10 ++++++++++ client/modules/IDE/pages/MobileIDEView.jsx | 2 +- client/utils/custom-hooks.js | 11 +---------- 3 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 client/components/useAsModal.jsx diff --git a/client/components/useAsModal.jsx b/client/components/useAsModal.jsx new file mode 100644 index 00000000..1afa0d30 --- /dev/null +++ b/client/components/useAsModal.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { useModalBehavior } from '../utils/custom-hooks'; + +export default (component) => { + const [visible, trigger, setRef] = useModalBehavior(); + + const wrapper = () =>
{visible && component}
; // eslint-disable-line + + return [trigger, wrapper]; +}; diff --git a/client/modules/IDE/pages/MobileIDEView.jsx b/client/modules/IDE/pages/MobileIDEView.jsx index 9f5cd8f1..d7f7da77 100644 --- a/client/modules/IDE/pages/MobileIDEView.jsx +++ b/client/modules/IDE/pages/MobileIDEView.jsx @@ -31,7 +31,7 @@ import Console from '../components/Console'; import { remSize } from '../../../theme'; // import OverlayManager from '../../../components/OverlayManager'; import ActionStrip from '../../../components/mobile/ActionStrip'; -import { useAsModal } from '../../../utils/custom-hooks'; +import useAsModal from '../../../components/useAsModal'; import { PreferencesIcon } from '../../../common/icons'; import Dropdown from '../../../components/Dropdown'; diff --git a/client/utils/custom-hooks.js b/client/utils/custom-hooks.js index 2776b5bf..1a0978d1 100644 --- a/client/utils/custom-hooks.js +++ b/client/utils/custom-hooks.js @@ -1,4 +1,4 @@ -import React, { useEffect, useRef, useMemo, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; export const noop = () => {}; @@ -40,12 +40,3 @@ export const useModalBehavior = (hideOverlay) => { return [visible, trigger, setRef]; }; - -// TODO: This is HOC, not a hook. Where do we put it? -export const useAsModal = (component) => { - const [visible, trigger, setRef] = useModalBehavior(); - - const wrapper = () => (
{visible && component}
); // eslint-disable-line - - return [trigger, wrapper]; -}; From 82258073680222356bf680e7880114df4b2b5d78 Mon Sep 17 00:00:00 2001 From: ghalestrilo Date: Thu, 30 Jul 2020 14:36:34 -0300 Subject: [PATCH 4/8] :ok_hand: subst left/right props with align prop on --- client/components/Dropdown.jsx | 13 +++++++------ client/modules/IDE/pages/MobileIDEView.jsx | 8 ++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/client/components/Dropdown.jsx b/client/components/Dropdown.jsx index 5ca33ab1..bd2169b8 100644 --- a/client/components/Dropdown.jsx +++ b/client/components/Dropdown.jsx @@ -16,6 +16,9 @@ const DropdownWrapper = styled.ul` right: ${props => (props.right ? 0 : 'initial')}; left: ${props => (props.left ? 0 : 'initial')}; + ${props => (props.align === 'right' && 'right: 0;')} + ${props => (props.align === 'left' && 'left: 0;')} + text-align: left; width: ${remSize(180)}; @@ -57,8 +60,8 @@ const DropdownWrapper = styled.ul` // TODO: Add Icon to the left of the items in the menu // const MaybeIcon = (Element, label) => Element && ; -const Dropdown = ({ items, right, left }) => ( - +const Dropdown = ({ items, align }) => ( + {/* className="nav__items-left" */} {items && items.map(({ title, icon, href }) => (
  • @@ -73,8 +76,7 @@ const Dropdown = ({ items, right, left }) => ( ); Dropdown.propTypes = { - right: PropTypes.bool, - left: PropTypes.bool, + align: PropTypes.oneOf(['left', 'right']), items: PropTypes.arrayOf(PropTypes.shape({ action: PropTypes.func, icon: PropTypes.func, @@ -84,8 +86,7 @@ Dropdown.propTypes = { Dropdown.defaultProps = { items: [], - right: false, - left: false, + align: null }; export default Dropdown; diff --git a/client/modules/IDE/pages/MobileIDEView.jsx b/client/modules/IDE/pages/MobileIDEView.jsx index d7f7da77..badeda6b 100644 --- a/client/modules/IDE/pages/MobileIDEView.jsx +++ b/client/modules/IDE/pages/MobileIDEView.jsx @@ -57,7 +57,7 @@ const MobileIDEView = (props) => { const { preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage, selectedFile, updateFileContent, files, - closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges, + closeEditorOptions, showEditorOptions, startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console, showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch } = props; @@ -65,7 +65,7 @@ const MobileIDEView = (props) => { const [tmController, setTmController] = useState(null); // eslint-disable-line - const [triggerNavDropdown, NavDropDown] = useAsModal(); + const [triggerNavDropdown, NavDropDown] = useAsModal(); return ( @@ -213,10 +213,6 @@ MobileIDEView.propTypes = { showEditorOptions: PropTypes.func.isRequired, - showKeyboardShortcutModal: PropTypes.func.isRequired, - - setUnsavedChanges: PropTypes.func.isRequired, - startRefreshSketch: PropTypes.func.isRequired, stopSketch: PropTypes.func.isRequired, From 5e8d4813a66bb0d643a68f8fab829bfb8287d818 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Thu, 30 Jul 2020 13:45:13 -0400 Subject: [PATCH 5/8] [#1396] Update p5.js version to 1.1.9 --- client/modules/IDE/reducers/files.js | 4 ++-- server/domain-objects/createDefaultFiles.js | 5 ++--- server/scripts/examples.js | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/client/modules/IDE/reducers/files.js b/client/modules/IDE/reducers/files.js index 3707cce5..7710074d 100644 --- a/client/modules/IDE/reducers/files.js +++ b/client/modules/IDE/reducers/files.js @@ -13,8 +13,8 @@ const defaultHTML = ` - - + + diff --git a/server/domain-objects/createDefaultFiles.js b/server/domain-objects/createDefaultFiles.js index 60671081..b901caaf 100644 --- a/server/domain-objects/createDefaultFiles.js +++ b/server/domain-objects/createDefaultFiles.js @@ -10,9 +10,8 @@ const defaultHTML = ` - - - + + diff --git a/server/scripts/examples.js b/server/scripts/examples.js index a4e71955..251630f7 100644 --- a/server/scripts/examples.js +++ b/server/scripts/examples.js @@ -11,8 +11,8 @@ const defaultHTML = ` - - + + From ab93a4c85dddc85c1b3cea950b8343f11a218b7d Mon Sep 17 00:00:00 2001 From: ghalestrilo Date: Thu, 30 Jul 2020 16:16:47 -0300 Subject: [PATCH 6/8] :ok_hand: make dropdown list toggle on enter/click --- client/utils/custom-hooks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/utils/custom-hooks.js b/client/utils/custom-hooks.js index 1a0978d1..9b9e24e2 100644 --- a/client/utils/custom-hooks.js +++ b/client/utils/custom-hooks.js @@ -22,7 +22,7 @@ export const useModalBehavior = (hideOverlay) => { // Return values const setRef = (r) => { ref.current = r; }; const [visible, setVisible] = useState(true); - const trigger = () => setVisible(true); + const trigger = () => setVisible(!visible); const hide = () => setVisible(false); From 05e43c70b788ffb1d7f0aa22ed566bdaa9b91f22 Mon Sep 17 00:00:00 2001 From: ov Date: Fri, 31 Jul 2020 14:20:42 +0100 Subject: [PATCH 7/8] Minimal Viable Navigation Menu (#1510) * Minimal Viable Navigation Menu Translation with new namespace I18Next configuration leaning on default separator and namespace Broom: i18n + debug:false * Minimal Viable Navigation Menu Test entry for Toolbar.test.jsx * Translation.json : Changes in translation for new namespace About : broom About lines 17-26 Nav component : changes in keys KeyboardShortcutModal.jsx: Key now in Common * Voice Over Labels in Preferences:index Labels included in translations.json * Voice Over Labels in Preferences:index Labels included in translations.json * Voice Over Labels in Preferences:index Labels included in translations.json * Voice Over Labels in Preferences:index Labels included in translations.json Snapshot updated npm run test -- -u * translations.json ARIA labels adjacent to respective label Updated names to call the labels Common namespace without currently used entries * Update Nav.jsx Missing Common.p5logoARIA key * Update Toolbar.test.jsx Deleting commented line 78 * Update in keys Co-authored-by: Andrew Nicolaou --- client/components/Nav.jsx | 82 +++--- .../__test__/__snapshots__/Nav.test.jsx.snap | 1 - client/i18n.js | 3 +- client/modules/IDE/actions/project.js | 16 +- client/modules/IDE/components/About.jsx | 32 +-- .../IDE/components/KeyboardShortcutModal.jsx | 28 +- .../IDE/components/Preferences/index.jsx | 90 +++---- client/modules/IDE/components/Toast.jsx | 2 +- client/modules/IDE/components/Toolbar.jsx | 9 +- .../modules/IDE/components/Toolbar.test.jsx | 1 + client/modules/IDE/pages/IDEView.jsx | 23 +- translations/locales/en-US/translations.json | 237 ++++++++++------- translations/locales/es-419/translations.json | 243 +++++++++++------- 13 files changed, 444 insertions(+), 323 deletions(-) diff --git a/client/components/Nav.jsx b/client/components/Nav.jsx index 4c27d6fa..16617112 100644 --- a/client/components/Nav.jsx +++ b/client/components/Nav.jsx @@ -100,11 +100,11 @@ class Nav extends React.PureComponent { const { unsavedChanges, warnIfUnsavedChanges } = this.props; if (!unsavedChanges) { this.props.showToast(1500); - this.props.setToastText('Opened new sketch.'); + this.props.setToastText('Toast.OpenedNewSketch'); this.props.newProject(); } else if (warnIfUnsavedChanges && warnIfUnsavedChanges()) { this.props.showToast(1500); - this.props.setToastText('Opened new sketch.'); + this.props.setToastText('Toast.OpenedNewSketch'); this.props.newProject(); } this.setDropdown('none'); @@ -172,7 +172,7 @@ class Nav extends React.PureComponent { handleLangSelection(event) { i18next.changeLanguage(event.target.value); this.props.showToast(1500); - this.props.setToastText('LangChange'); + this.props.setToastText('Toast.LangChange'); this.setDropdown('none'); } @@ -240,13 +240,13 @@ class Nav extends React.PureComponent { return (
    • - +
    • @@ -258,7 +258,7 @@ class Nav extends React.PureComponent { return (
      • - +
        • @@ -281,7 +281,7 @@ class Nav extends React.PureComponent { onFocus={this.handleFocusForFile} onBlur={this.handleBlur} > - {this.props.t('New')} + {this.props.t('Nav.File.New')} { getConfig('LOGIN_ENABLED') && (!this.props.project.owner || this.isUserOwner()) && @@ -291,7 +291,7 @@ class Nav extends React.PureComponent { onFocus={this.handleFocusForFile} onBlur={this.handleBlur} > - {this.props.t('Save')} + {this.props.t('Common.Save')} {metaKeyName}+S } @@ -302,7 +302,7 @@ class Nav extends React.PureComponent { onFocus={this.handleFocusForFile} onBlur={this.handleBlur} > - {this.props.t('Duplicate')} + {this.props.t('Nav.File.Duplicate')} } { this.props.project.id && @@ -312,7 +312,7 @@ class Nav extends React.PureComponent { onFocus={this.handleFocusForFile} onBlur={this.handleBlur} > - {this.props.t('Share')} + {this.props.t('Nav.File.Share')} } { this.props.project.id && @@ -322,7 +322,7 @@ class Nav extends React.PureComponent { onFocus={this.handleFocusForFile} onBlur={this.handleBlur} > - {this.props.t('Download')} + {this.props.t('Nav.File.Download')} } { this.props.user.authenticated && @@ -333,7 +333,7 @@ class Nav extends React.PureComponent { onBlur={this.handleBlur} onClick={this.setDropdownForNone} > - {this.props.t('Open')} + {this.props.t('Nav.File.Open')} } {getConfig('UI_COLLECTIONS_ENABLED') && @@ -346,7 +346,7 @@ class Nav extends React.PureComponent { onBlur={this.handleBlur} onClick={this.setDropdownForNone} > - {this.props.t('AddToCollection')} + {this.props.t('Nav.File.AddToCollection')} } { getConfig('EXAMPLES_ENABLED') && @@ -357,7 +357,7 @@ class Nav extends React.PureComponent { onBlur={this.handleBlur} onClick={this.setDropdownForNone} > - {this.props.t('Examples')} + {this.props.t('Nav.File.Examples')} }
        @@ -373,7 +373,7 @@ class Nav extends React.PureComponent { } }} > - {this.props.t('Edit')} + {this.props.t('Nav.Edit.Title')}