diff --git a/src/components/gui/gui.jsx b/src/components/gui/gui.jsx index ec2a75f4806..624f895f589 100644 --- a/src/components/gui/gui.jsx +++ b/src/components/gui/gui.jsx @@ -82,6 +82,7 @@ const GUIComponent = props => { rubyTabVisible, stageSizeMode, tipsLibraryVisible, + rubyCode, vm, ...componentProps } = omit(props, 'dispatch'); @@ -257,7 +258,7 @@ const GUIComponent = props => { {soundsTabVisible ? : null} - {rubyTabVisible ? : null} + {rubyTabVisible ? : null} {backpackOptions.visible ? ( @@ -319,6 +320,7 @@ GUIComponent.propTypes = { stageSizeMode: PropTypes.oneOf(Object.keys(STAGE_SIZE_MODES)), targetIsStage: PropTypes.bool, tipsLibraryVisible: PropTypes.bool, + rubyCode: PropTypes.string, vm: PropTypes.instanceOf(VM).isRequired }; GUIComponent.defaultProps = { diff --git a/src/containers/gui.jsx b/src/containers/gui.jsx index 7b7d9471d6b..502587916fb 100644 --- a/src/containers/gui.jsx +++ b/src/containers/gui.jsx @@ -122,7 +122,8 @@ const mapStateToProps = state => ({ ), soundsTabVisible: state.scratchGui.editorTab.activeTabIndex === SOUNDS_TAB_INDEX, rubyTabVisible: state.scratchGui.editorTab.activeTabIndex === RUBY_TAB_INDEX, - tipsLibraryVisible: state.scratchGui.modals.tipsLibrary + tipsLibraryVisible: state.scratchGui.modals.tipsLibrary, + rubyCode: state.scratchGui.rubyCode }); const mapDispatchToProps = dispatch => ({ diff --git a/src/containers/ruby-tab.jsx b/src/containers/ruby-tab.jsx index 299a977fdd8..c140c3696e5 100644 --- a/src/containers/ruby-tab.jsx +++ b/src/containers/ruby-tab.jsx @@ -6,6 +6,10 @@ import 'brace/mode/ruby'; import 'brace/theme/clouds'; export class RubyTab extends React.Component { + constructor (props) { + super(props); + } + render(){ return( ) } -} \ No newline at end of file +} diff --git a/src/reducers/gui.js b/src/reducers/gui.js index 7d98ae2f3f7..54b3025f671 100644 --- a/src/reducers/gui.js +++ b/src/reducers/gui.js @@ -15,6 +15,7 @@ import stageSizeReducer, {stageSizeInitialState} from './stage-size'; import targetReducer, {targetsInitialState} from './targets'; import toolboxReducer, {toolboxInitialState} from './toolbox'; import vmReducer, {vmInitialState} from './vm'; +import rubyCodeReducer, {rubyCodeInitialState} from './ruby-code'; import throttle from 'redux-throttle'; const guiMiddleware = compose(applyMiddleware(throttle(300, {leading: true, trailing: true}))); @@ -35,7 +36,8 @@ const guiInitialState = { monitorLayout: monitorLayoutInitialState, targets: targetsInitialState, toolbox: toolboxInitialState, - vm: vmInitialState + vm: vmInitialState, + rubyCode: rubyCodeInitialState }; const initPlayer = function (currentState) { @@ -75,6 +77,7 @@ const guiReducer = combineReducers({ monitorLayout: monitorLayoutReducer, targets: targetReducer, toolbox: toolboxReducer, + rubyCode: rubyCodeReducer, vm: vmReducer }); diff --git a/src/reducers/ruby-code.js b/src/reducers/ruby-code.js new file mode 100644 index 00000000000..6bfbb85ea26 --- /dev/null +++ b/src/reducers/ruby-code.js @@ -0,0 +1,13 @@ +const initialState = { + rubyCode: `p 'hello World'` +}; + +const reducer = function (state, action) { + if (typeof state === 'undefined') state = initialState; + return state; +}; + +export { + reducer as default, + initialState as rubyCodeInitialState +};