diff --git a/.gitignore b/.gitignore index 1b3b3bf7..c6c5feec 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,7 @@ dist/* # Editors /#* *~ + +# generated translation files +/translations +/locale diff --git a/locale/messages.json b/locale/messages.json deleted file mode 100644 index 490c8631..00000000 --- a/locale/messages.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "en": { - "paint.brushMode.brush": "Brush", - "paint.eraserMode.eraser": "Eraser" - } -} \ No newline at end of file diff --git a/src/containers/brush-mode.jsx b/src/containers/brush-mode.jsx index 44c6a90e..e751030f 100644 --- a/src/containers/brush-mode.jsx +++ b/src/containers/brush-mode.jsx @@ -74,8 +74,8 @@ BrushMode.propTypes = { }; const mapStateToProps = state => ({ - brushModeState: state.brushMode, - isBrushModeActive: state.mode === Modes.BRUSH + brushModeState: state.scratchPaint.brushMode, + isBrushModeActive: state.scratchPaint.mode === Modes.BRUSH }); const mapDispatchToProps = dispatch => ({ changeBrushSize: brushSize => { diff --git a/src/containers/eraser-mode.jsx b/src/containers/eraser-mode.jsx index c8ad4a3b..af932329 100644 --- a/src/containers/eraser-mode.jsx +++ b/src/containers/eraser-mode.jsx @@ -70,8 +70,8 @@ EraserMode.propTypes = { }; const mapStateToProps = state => ({ - eraserModeState: state.eraserMode, - isEraserModeActive: state.mode === Modes.ERASER + eraserModeState: state.scratchPaint.eraserMode, + isEraserModeActive: state.scratchPaint.mode === Modes.ERASER }); const mapDispatchToProps = dispatch => ({ changeBrushSize: brushSize => { diff --git a/src/containers/line-mode.jsx b/src/containers/line-mode.jsx index dd9216e8..9b61546c 100644 --- a/src/containers/line-mode.jsx +++ b/src/containers/line-mode.jsx @@ -281,8 +281,8 @@ LineMode.propTypes = { }; const mapStateToProps = state => ({ - lineModeState: state.lineMode, - isLineModeActive: state.mode === Modes.LINE + lineModeState: state.scratchPaint.lineMode, + isLineModeActive: state.scratchPaint.mode === Modes.LINE }); const mapDispatchToProps = dispatch => ({ changeLineWidth: lineWidth => { diff --git a/src/index.js b/src/index.js index 6611b719..b7d91a70 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,7 @@ import PaintEditor from './containers/paint-editor.jsx'; +import ScratchPaintReducer from './reducers/scratch-paint-reducer'; -export default PaintEditor; +export { + PaintEditor as default, + ScratchPaintReducer +}; diff --git a/src/playground/playground.jsx b/src/playground/playground.jsx index 7249b454..9f68704a 100644 --- a/src/playground/playground.jsx +++ b/src/playground/playground.jsx @@ -3,8 +3,8 @@ import ReactDOM from 'react-dom'; import PaintEditor from '..'; import {Provider} from 'react-redux'; import {createStore} from 'redux'; -import reducer from '../reducers/combine-reducers'; -import {intlInitialState, IntlProvider} from '../reducers/intl.js'; +import reducer from './reducers/combine-reducers'; +import {intlInitialState, IntlProvider} from './reducers/intl.js'; const appTarget = document.createElement('div'); document.body.appendChild(appTarget); diff --git a/src/playground/reducers/combine-reducers.js b/src/playground/reducers/combine-reducers.js new file mode 100644 index 00000000..e3182b5e --- /dev/null +++ b/src/playground/reducers/combine-reducers.js @@ -0,0 +1,8 @@ +import {combineReducers} from 'redux'; +import intlReducer from './intl'; +import {ScratchPaintReducer} from '../..'; + +export default combineReducers({ + intl: intlReducer, + scratchPaint: ScratchPaintReducer +}); diff --git a/src/reducers/intl.js b/src/playground/reducers/intl.js similarity index 94% rename from src/reducers/intl.js rename to src/playground/reducers/intl.js index 51bce5e5..a9d43eda 100644 --- a/src/reducers/intl.js +++ b/src/playground/reducers/intl.js @@ -2,7 +2,7 @@ import {addLocaleData} from 'react-intl'; import {updateIntl as superUpdateIntl} from 'react-intl-redux'; import {IntlProvider, intlReducer} from 'react-intl-redux'; -import locales from '../locale.js'; +import locales from '../../locale.js'; Object.keys(locales).forEach(locale => { // TODO: will need to handle locales not in the default intl - see www/custom-locales diff --git a/src/reducers/combine-reducers.js b/src/reducers/scratch-paint-reducer.js similarity index 70% rename from src/reducers/combine-reducers.js rename to src/reducers/scratch-paint-reducer.js index cc1b15c8..4f06e1bd 100644 --- a/src/reducers/combine-reducers.js +++ b/src/reducers/scratch-paint-reducer.js @@ -1,12 +1,12 @@ import {combineReducers} from 'redux'; -import intlReducer from './intl'; import modeReducer from './modes'; import brushModeReducer from './brush-mode'; import eraserModeReducer from './eraser-mode'; +import lineModeReducer from './line-mode'; export default combineReducers({ - intl: intlReducer, mode: modeReducer, brushMode: brushModeReducer, - eraserMode: eraserModeReducer + eraserMode: eraserModeReducer, + lineMode: lineModeReducer }); diff --git a/translations/en.json b/translations/en.json deleted file mode 100644 index 46b77f95..00000000 --- a/translations/en.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "paint.brushMode.brush": { - "message": "Brush", - "description": "Label for the brush tool" - }, - "paint.eraserMode.eraser": { - "message": "Eraser", - "description": "Label for the eraser tool" - } -} diff --git a/translations/messages/src/components/brush-mode.json b/translations/messages/src/components/brush-mode.json deleted file mode 100644 index fb8440ae..00000000 --- a/translations/messages/src/components/brush-mode.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "id": "paint.brushMode.brush", - "description": "Label for the brush tool", - "defaultMessage": "Brush" - } -] \ No newline at end of file diff --git a/translations/messages/src/components/eraser-mode.json b/translations/messages/src/components/eraser-mode.json deleted file mode 100644 index 5ba35343..00000000 --- a/translations/messages/src/components/eraser-mode.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "id": "paint.eraserMode.eraser", - "description": "Label for the eraser tool", - "defaultMessage": "Eraser" - } -] diff --git a/translations/messages/src/components/line-mode.json b/translations/messages/src/components/line-mode.json deleted file mode 100644 index 8c9c98e1..00000000 --- a/translations/messages/src/components/line-mode.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "id": "paint.lineMode.line", - "description": "Label for the line tool, which draws straight line segments", - "defaultMessage": "Line" - } -] \ No newline at end of file