It's fair to say that the file structure of the app could be simplified a bit, such that:
We don't have to think so much about where things are and where things go; it's predictable
Things that are related in nature are related in name/location; it's logical
Things are only as nested/separated as they need to be; it's simple
The scope of this issue is to simplify the app file structure by moving components and redux towards the top level. We can keep minimal module separations for components, but we can put all of the redux stuff together.
Suggestion
Here's a suggestion for what the file structure could look like (NB this is ignoring several existing directories such as scripts for brevity's sake):
/*
* src
* index.js
*
* components
* app
* App.jsx
* GasStation
* ...routes
* ...everything
* core
* ActionForm
* pages
* ...just page components
*
* data (import resolution: `~data`)
* blueprints
* service
* ...etc
*
* immutable (import resolution: `~immutable`)
* state
* ...records
*
* lib (import resolution: `~lib`)
* colonyNetwork
* database
* ...etc
*
* redux (import resolution: `~redux`)
* app
* index.js
* createReduxStore.js
* createRootReducerStore.js
* createPromiseListener.js
* history.js
*
* actionCreators
* index.js
* colony.js
* // Contains all the action creators for actions prefixed with
* // the file name (capitalised), e.g. colonyFetch => COLONY_FETCH
* ...etc
*
* actionTypes
* index.js
* colony.js
* // Contains all the actions prefixed with the file name
* // (capitalised), e.g. COLONY_FETCH, COLONY_CREATE, etc.
* ...etc
*
* context
* index.js
* rootContext.js
* ...etc
*
* reducers
* colonies.js
* colonyNames.js
* currentUserActivities.js
* currentUserProfile.js
* currentWallet.js
* domains.js
* tasks.js
* tokens.js
* transactions.js
* usernames.js
* users.js
*
* sagas
* index.js
* setupUserContext.js // same as now
* wallet.js // same as now
* colony.js
* // Contains sagas taken by actions prefixed with the file name
* // (capitalised), e.g. `takeEvery(COLONY_FETCH, colonyFetchSaga)`
*
* selectors
* // Each file mirrors the files in `reducers`
* index.js
* colonies.js
* colonyNames.js
* currentUserActivities.js
* currentUserProfile.js
* currentWallet.js
* domains.js
* tasks.js
* tokens.js
* transactions.js
* usernames.js
* users.js
*/
It might be preferable to tackle this issue after the state simplification #841 is completed.
It's fair to say that the file structure of the app could be simplified a bit, such that:
The scope of this issue is to simplify the app file structure by moving components and redux towards the top level. We can keep minimal module separations for components, but we can put all of the redux stuff together.
Suggestion
Here's a suggestion for what the file structure could look like (NB this is ignoring several existing directories such as
scripts
for brevity's sake):It might be preferable to tackle this issue after the state simplification #841 is completed.