From 7a7b14fba3a4b4e88bb7445e95bf8f5783998f49 Mon Sep 17 00:00:00 2001 From: Senad Uka Date: Sun, 21 Dec 2014 09:05:40 +0100 Subject: [PATCH] changed structure - now no longer using flux-react but flux and react separately --- .DS_Store | Bin 6148 -> 6148 bytes README.md | 2 +- app/.DS_Store | Bin 6148 -> 12292 bytes app/App.js | 55 -------------------------- app/Store.js | 18 --------- app/actions.js | 5 --- app/actions/.DS_Store | Bin 0 -> 6148 bytes app/assets/index.html | 1 - app/components/ChooseFile.react.js | 12 ++++++ app/components/SpreadSheet.react.js | 17 ++++++++ app/constants/CsvEditorConstants.js | 14 +++++++ app/dispatcher/CsvEditorDispatcher.js | 32 +++++++++++++++ app/main.js | 4 +- package.json | 4 +- styles/main.css | 11 +++++- 15 files changed, 91 insertions(+), 84 deletions(-) delete mode 100644 app/App.js delete mode 100644 app/Store.js delete mode 100644 app/actions.js create mode 100644 app/actions/.DS_Store create mode 100644 app/components/ChooseFile.react.js create mode 100644 app/components/SpreadSheet.react.js create mode 100644 app/constants/CsvEditorConstants.js create mode 100644 app/dispatcher/CsvEditorDispatcher.js diff --git a/.DS_Store b/.DS_Store index c3e082633be237ff97fc78368c89e3b41db24cca..8b4eed041ab11f7015afdaa3b0d390bde4dd5caa 100644 GIT binary patch delta 371 zcmZoMXfc=|#>B)qu~2NHo}wr_0|Nsi1A_oVaY0f}eiD#(C#hgFBja+$dXN+|Ln1=~ zLqSqGvUE;nafyM!4Mrwr7FITP4o)s0$6z1`rD4=+AOq^<6xrhBoFt%|L2995Wx+*xIr(|%K#`5}9CJ*u~2NHo}vgV0|Nsi1A_oVa!yiyeh!eyz&f!|gOPReKPIuwTFiG@ mHZNfAVA{;i!OsEIwRs}*cjn3bB8H3%lWlmUH^+#qUIb-`fwkINfC(@GCU6!AV9b`uS}^YGqg*lpCh%Vp zklzOzS!&&As#SeDP^c*YbOp^Sp^kZg^0AH9jiy?aEBe&42Vq==nPLd-j^nm8ht`dz zTD3a~?M}j+S(q7$P-lmqt;|W(wQ|V>m_U|*oV%}*LoG_kpPau(E{@2T=`QjH^3rI8 zGGp!b<0Cgv)<4~&z>kwkh)Xq-RRZpH*ep)KmPnx-5d$?eWA;G ze_Vdc-ulaCHw>ciIgUuL!Zb#@MlVhmL&h+_!){}w5^6*__{7-Sz;6~#PHn}>pKQIj z6}Z5rPuxP}4(Uk6uZ=aBOlK;JA16*+K*TdX6S4ep#$s6-463y%!nb{MCX^p$L;2~8 zLc2JWGSqYLeNY6JP>NfC(@GCcp%k025#WOn?b6 N0Vco%n7}_J@C*7;D3SmG delta 153 zcmZokXfcprU|?W$DortDU=RQ@Ie-{MGqg=C6q~50D9Q+A12IsngrPX4I5{UNKR;(; zp}G`Ef{h`Op%@5LktG>77ACPTX6N7#WCj@o)XNPdT!FZ4W8rt^$^0_9oFL5yfS6&j U4UaSr6U1JSQy4bK^UPod09nQxApigX diff --git a/app/App.js b/app/App.js deleted file mode 100644 index 9f9f7a8..0000000 --- a/app/App.js +++ /dev/null @@ -1,55 +0,0 @@ -/** @jsx React.DOM */ -var React = require('react'); -var Store = require('./Store.js'); -var actions = require('./actions.js'); - -var App = React.createClass({ - getInitialState: function () { - return { - messages: Store.getMessages(), - newMessage: '' - }; - }, - componentWillMount: function () { - Store.addChangeListener(this.changeState); - }, - componentWillUnmount: function () { - Store.removeChangeListener(this.changeState); - }, - changeState: function () { - this.setState({ - messages: Store.getMessages() - }); - }, - addMessage: function (event) { - event.preventDefault(); - var input = this.refs.newMessage.getDOMNode(); - actions.addMessage(input.value); - this.setState({ - newMessage: '' - }); - }, - updateNewMessage: function (event) { - this.setState({ - newMessage: event.target.value - }); - }, - renderMessages: function (message) { - return ( -
{message}
- ); - }, - render: function() { - return ( -
- {this.state.messages.map(this.renderMessages)} -
- -
-
- ); - } - -}); - -module.exports = App; diff --git a/app/Store.js b/app/Store.js deleted file mode 100644 index 7a7c0db..0000000 --- a/app/Store.js +++ /dev/null @@ -1,18 +0,0 @@ -var flux = require('flux-react'); -var actions = require('./actions.js'); - -module.exports = flux.createStore({ - messages: [], - actions: [ - actions.addMessage - ], - addMessage: function (message) { - this.messages.push(message); - this.emitChange(); - }, - exports: { - getMessages: function () { - return this.messages; - } - } -}); \ No newline at end of file diff --git a/app/actions.js b/app/actions.js deleted file mode 100644 index 1b98484..0000000 --- a/app/actions.js +++ /dev/null @@ -1,5 +0,0 @@ -var flux = require('flux-react'); - -module.exports = flux.createActions([ - 'addMessage' -]); \ No newline at end of file diff --git a/app/actions/.DS_Store b/app/actions/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a881c353273a65a42ab3c3f7b09f4f97f7b21e96 GIT binary patch literal 6148 zcmeH~y-Gwe5QWd^A`61t(lVu$;2XqcEv)wiblnA!g%yAL+xc?7)Ah`cV2rjFGIN=n zWHOU*za|L)S-fs8fC0dqu8KEpdeeFJ&JH4?Dz?T0p09WNyY+6r?y`RlXzdX$@yPES zZT&DcW(%BP#mpycaf=Q6_v~%)($_Nkoqk4_X|mdEl0Xtj0!bhVBmq0K6~p{EVI+Yh zkOaOF;GG_Yu3AG!R}E=gukWfeRWw~ zv7Nb2>@4v@5!;>dV(F0Tnr#wD0xf|<9}ar{U(tVg|F=asN&-pXUlEYma+t0K#$_nFL_1#%&VcJtCcfu<U$N&HU literal 0 HcmV?d00001 diff --git a/app/assets/index.html b/app/assets/index.html index 99448bc..437509a 100644 --- a/app/assets/index.html +++ b/app/assets/index.html @@ -5,7 +5,6 @@ - diff --git a/app/components/ChooseFile.react.js b/app/components/ChooseFile.react.js new file mode 100644 index 0000000..87403a0 --- /dev/null +++ b/app/components/ChooseFile.react.js @@ -0,0 +1,12 @@ +var React = require('react'); + +var ChooseFile = React.createClass({ + + render: function() { + return ( + + ); + } +}); + +module.exports = ChooseFile; \ No newline at end of file diff --git a/app/components/SpreadSheet.react.js b/app/components/SpreadSheet.react.js new file mode 100644 index 0000000..caba7ff --- /dev/null +++ b/app/components/SpreadSheet.react.js @@ -0,0 +1,17 @@ +/** @jsx React.DOM */ +var React = require('react'); +var ChooseFile = require('./ChooseFile.react'); + +var SpreadSheet = React.createClass({ + + render: function() { + return ( +
+ +
+ ); + } + +}); + +module.exports = SpreadSheet; diff --git a/app/constants/CsvEditorConstants.js b/app/constants/CsvEditorConstants.js new file mode 100644 index 0000000..6acea8d --- /dev/null +++ b/app/constants/CsvEditorConstants.js @@ -0,0 +1,14 @@ +var keyMirror = require('keymirror'); + +module.exports = { + + ActionTypes: keyMirror({ + CREATE_MESSAGE: null + }), + + PayloadSources: keyMirror({ + BACKEND_ACTION: null, + VIEW_ACTION: null + }) + +}; diff --git a/app/dispatcher/CsvEditorDispatcher.js b/app/dispatcher/CsvEditorDispatcher.js new file mode 100644 index 0000000..458f849 --- /dev/null +++ b/app/dispatcher/CsvEditorDispatcher.js @@ -0,0 +1,32 @@ + +var Constants = require('../constants/CsvEditorConstants'); + +var CsvEditorDispatcher = assign(new Dispatcher(), { + + /** + * @param {object} action The details of the action, including the action's + * type and additional data coming from the server. + */ + handleBackendAction: function(action) { + var payload = { + source: PayloadSources.BACKEND_ACTION, + action: action + }; + this.dispatch(payload); + }, + + /** + * @param {object} action The details of the action, including the action's + * type and additional data coming from the view. + */ + handleViewAction: function(action) { + var payload = { + source: PayloadSources.VIEW_ACTION, + action: action + }; + this.dispatch(payload); + } + +}); + +module.exports = CsvEditorDispatcher; \ No newline at end of file diff --git a/app/main.js b/app/main.js index f5b9c1d..6ceaaea 100644 --- a/app/main.js +++ b/app/main.js @@ -1,4 +1,4 @@ /** @jsx React.DOM */ var React = require('react'); -var App = require('./App.js'); -React.render(, document.body); \ No newline at end of file +var SpreadSheet = require('./components/SpreadSheet.react'); +React.render(, document.body); diff --git a/package.json b/package.json index f59ecdf..0d1105a 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,9 @@ "gulp-connect": "~2.2.0" }, "dependencies": { - "flux-react": "^2.6.0", + "flux": "^2.0.0", + "keymirror": "~0.1.0", + "object-assign": "^1.0.0", "react": "^0.12.0" } } diff --git a/styles/main.css b/styles/main.css index a93b78e..ac03615 100644 --- a/styles/main.css +++ b/styles/main.css @@ -1,3 +1,12 @@ body { background-color: #EAEAEA; -} \ No newline at end of file +} + +.red-button { + background-color: white; + font-size: 2em; + font-color: red; + border-color: red; + border: 1px; +} +