Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes and Layout Containers #38

Merged
merged 24 commits into from
Nov 9, 2016
Merged

Routes and Layout Containers #38

merged 24 commits into from
Nov 9, 2016

Conversation

okbel
Copy link
Contributor

@okbel okbel commented Nov 8, 2016

What does this PR do?

  • Adds an AppRouter with Route nesting
  • Abstracts into a LayoutContainer, and a Layout (UI) so we have a consistent layout wrapper
  • Breaks Header and Drawer into UI componentes etc

How do I test this PR?

  • Run npm run start and npm run build
  • Test that every route works as expected in http://localhost:3000

@coralproject/tech

@okbel okbel changed the title Community Routes and Layout Containers Nov 8, 2016
@@ -0,0 +1,23 @@
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra semicolon

@@ -0,0 +1,23 @@
import React from 'react';
import { Router, Route, Redirect, IndexRoute, browserHistory } from 'react-router';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra semicolon

</Route>
);

const AppRouter = () => <Router history={browserHistory} routes={routes} />;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra semicolon

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could just export default that function if you want


const AppRouter = () => <Router history={browserHistory} routes={routes} />;

export default AppRouter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra semicolon

render() {
return (
<div>
<h1>Community</h1>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad identation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also why is this not a stateless component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, because im developing it in another branch and I think its not going to be stateless


LayoutContainer.propTypes = {};

const mapStateToProps = state => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could just:

const mapStateToProps = () => ({ data: {} })

};
};

const mapDispatchToProps = (dispatch, ownProps) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

const mapDispatchToProps = dispatch => ({ dispatch })

dispatch
});

export default connect(mapStateToProps, mapDispatchToProps, null)(LayoutContainer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra semicolon abd probably the third param as null has no effect

@@ -63,7 +62,7 @@ class ModerationQueue extends React.Component {
console.log('moderation queue', styles)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this log?

new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production'),
'VERSION': JSON.stringify(require("./package.json").version)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the effect of stringifying a string? 🤔

Copy link
Contributor Author

@okbel okbel Nov 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduxjs/redux#809

"production" produces the value production
JSON.stringify("production") produces the value "production"
It should be the same as writing '"production"'

It's a common practice while using env vars

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, you use that instead of doing

`"${thevalue}"`

makes more sense not to involve a json parser for that IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can update those I wasn't sure about using es6 in webpack config

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node v6 has it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated! @impronunciable

@impronunciable
Copy link
Contributor

impronunciable commented Nov 8, 2016

please solve conflicts

@impronunciable impronunciable merged commit 890bacc into master Nov 9, 2016
@impronunciable impronunciable deleted the community branch November 9, 2016 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants