Skip to content

Commit b8b9527

Browse files
authored
Merge pull request #55 from t-kazu/feature/rubyCode-props
rubyCodeに関するリファクタリングを行いました
2 parents 18bc65e + ab5ca3d commit b8b9527

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

src/components/gui/gui.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,7 @@ GUIComponent.propTypes = {
349349
onToggleLoginOpen: PropTypes.func,
350350
onUpdateProjectTitle: PropTypes.func,
351351
renderLogin: PropTypes.func,
352-
rubyCode: PropTypes.shape({
353-
rubyCode: PropTypes.string
354-
}),
352+
rubyCode: PropTypes.string,
355353
rubyTabVisible: PropTypes.bool,
356354
soundsTabVisible: PropTypes.bool,
357355
stageSizeMode: PropTypes.oneOf(Object.keys(STAGE_SIZE_MODES)),

src/containers/gui.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const mapStateToProps = state => ({
109109
soundsTabVisible: state.scratchGui.editorTab.activeTabIndex === SOUNDS_TAB_INDEX,
110110
tipsLibraryVisible: state.scratchGui.modals.tipsLibrary,
111111
rubyTabVisible: state.scratchGui.editorTab.activeTabIndex === RUBY_TAB_INDEX,
112-
rubyCode: state.scratchGui.rubyCode,
112+
rubyCode: state.scratchGui.rubyCode.code,
113113
vm: state.scratchGui.vm
114114
});
115115

src/containers/ruby-tab.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ const RubyTab = ({rubyCode}) => (
1919
showInvisibles: true
2020
}}
2121
theme="clouds"
22-
value={rubyCode.rubyCode}
22+
value={rubyCode}
2323
width="100%"
2424
/>
2525
);
2626

2727
RubyTab.propTypes = {
28-
rubyCode: PropTypes.shape({
29-
rubyCode: PropTypes.string
30-
})
28+
rubyCode: PropTypes.string
3129
};
3230

3331
export default RubyTab;

src/reducers/ruby-code.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
const UPDATE_RUBYCODE = 'smalruby3-gui/navigation/UPDATE_RUBYCODE';
22

33
const initialState = {
4-
rubyCode: ''
4+
code: ''
55
};
66

77
const reducer = function (state, action) {
88
if (typeof state === 'undefined') state = initialState;
99
switch (action.type) {
1010
case UPDATE_RUBYCODE:
1111
return {
12-
rubyCode: action.rubyCode
12+
code: action.code
1313
};
1414
default:
1515
return state;
@@ -19,7 +19,7 @@ const reducer = function (state, action) {
1919
const updateRubyCode = function (code) {
2020
return {
2121
type: UPDATE_RUBYCODE,
22-
rubyCode: code
22+
code: code
2323
};
2424
};
2525

0 commit comments

Comments
 (0)