cugos / dropchop

:fork_and_knife: browser-based spatial operations
http://dropchop.io
MIT License
252 stars 67 forks source link

Dropchop w/ React.js + Redux #268

Open alukach opened 7 years ago

alukach commented 7 years ago

I've been doing some work with React.js and Redux and have been really enjoying it. In Redux, you are serializing and storing the entire app state into a single object. This serves well when you have the same data represented in multiple places. Additionally, there is the concept of Actions that you send through a Reducer which alters the app's state.

I feel like the concepts fit in well with Dropchop. The actions could apply easily to data operations (eg "Buffer" or "Load from URL"). Storing the entire app state in a single object would make it easy to do things like sync data between the map and layerlist (this may not be a super big win, but could be helpful if you were doing something like toggling visibility or syncing the map's layer order with the layer list's layer order). Finally, by there are some new features that would be super easy such as storing the app state in localstorage allowing state to persist between sessions or storing state in an observable that can be rewound making for easy undo/redo.

This project hasn't been touch for quite some time. Any thoughts regarding me taking a stab at refactoring it to fit the architecture? I've done a quick test with this and it's been going pretty quickly.

mapsam commented 7 years ago

Sounds good to me @alukach! Excited to follow along. Want to work off a react branch for now? We may be able to set up react.dropchop.io so you can work off a real domain.

alukach commented 7 years ago

Great, glad to have the support. If you'd like to follow along (or participate), I've created a branch here: https://github.com/cugos/dropchop/tree/react-redux . I've basically nuked everything and will be porting features over through PRs. I'll be branching off of react-redux and creating feature branches prepended with react/, such as https://github.com/cugos/dropchop/tree/react/modal-form. Perhaps I should create an in-progress PR so people can comment on code if they're interested in getting involved.

Not sure if we can serve two gh-pages from the same repo? I'm okay with just running the local server now.