From 0dd4623523ea4ef39db068c65578a75c1ecddb1a Mon Sep 17 00:00:00 2001 From: Karishma Chadha Date: Tue, 3 Jul 2018 23:03:09 -0400 Subject: [PATCH] Allow specifying variables as local vs. global. Pass var names from VM to scratch-blocks for checking for conflicts in all sprites when attempting to create a global var. --- src/components/prompt/prompt.css | 20 +++++-- src/components/prompt/prompt.jsx | 89 +++++++++++++++++++++++++------- src/containers/blocks.jsx | 9 +++- src/containers/prompt.jsx | 12 ++++- 4 files changed, 103 insertions(+), 27 deletions(-) diff --git a/src/components/prompt/prompt.css b/src/components/prompt/prompt.css index 34a8f5a21..78e3ecb27 100644 --- a/src/components/prompt/prompt.css +++ b/src/components/prompt/prompt.css @@ -15,7 +15,7 @@ margin: 0 0 0.75rem; } -.input { +.variable-name-text-input { margin-bottom: 1.5rem; width: 100%; border: 1px solid $ui-black-transparent; @@ -26,6 +26,20 @@ font-size: .875rem; } +.info-message { + font-weight: normal; + font-size: .875rem; + margin-bottom: 1.5rem; + text-align: center; +} + +.options-row { + display: flex; + font-weight: normal; + justify-content: space-between; + margin-bottom: 1.5rem; +} + .button-row { font-weight: bolder; text-align: right; @@ -58,10 +72,6 @@ margin: 0 0 1rem; } -.hide-more-options { - display: none; -} - .more-options-accordion { width: 60%; margin: 0 auto; diff --git a/src/components/prompt/prompt.jsx b/src/components/prompt/prompt.jsx index 4feffeb0c..20e6af85e 100644 --- a/src/components/prompt/prompt.jsx +++ b/src/components/prompt/prompt.jsx @@ -11,10 +11,26 @@ import styles from './prompt.css'; import dropdownIcon from './icon--dropdown-caret.svg'; const messages = defineMessages({ + forAllSpritesMessage: { + defaultMessage: 'For all sprites', + description: 'Option message when creating a variable for making it available to all sprites', + id: 'gui.gui.variableScopeOptionAllSprites' + }, + forThisSpriteMessage: { + defaultMessage: 'For this sprite only', + description: 'Option message when creating a varaible for making it only available to the current sprite', + id: 'gui.gui.variableScopeOptionSpriteOnly' + }, moreOptionsMessage: { defaultMessage: 'More Options', description: 'Dropdown message for variable/list options', id: 'gui.gui.variablePrompt' + }, + availableToAllSpritesMessage: { + defaultMessage: 'This variable will be available to all sprites.', + description: 'A message that displays in a variable modal when the stage is selected indicating ' + + 'that the variable being created will available to all sprites.', + id: 'gui.gui.variablePromptAllSpritesMessage' } }); @@ -31,29 +47,64 @@ const PromptComponent = props => ( - - -
- - -
-
-
+ {props.showMoreOptions ? +
+ {props.isStage ? +
+ +
: + + + + } + + +
+ + +
+
+
+
: null} +