Skip to content

Commit

Permalink
Merge branch 'master' into web3-1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgepigdaniel committed Oct 13, 2017
2 parents 1f11e0e + 4430bea commit 7af5c36
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 126 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module.exports = {
'react/prop-types': 0,
'react/no-render-return-value': 0,
'no-confusing-arrow': 0,
'no-else-return': 0,
'no-underscore-dangle': 0,
'no-plusplus': 0,
camelcase: 1,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"express": "^4.15.2",
"fetch-everywhere": "^1.0.5",
"history": "^4.6.3",
"immutable": "^3.8.2",
"react": "^15.4.2",
"react-datetime": "^2.10.2",
"react-dom": "^15.4.2",
Expand Down
3 changes: 0 additions & 3 deletions src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'

import DevTools from './DevTools'
import Sidebar from './Sidebar'
import Switcher from './Switcher'

Expand All @@ -12,6 +11,4 @@ export default () =>
<Sidebar />
<Switcher />
</div>

<DevTools />
</div>
100 changes: 8 additions & 92 deletions src/components/Home.js
Original file line number Diff line number Diff line change
@@ -1,102 +1,18 @@
import React from 'react'

import styles from '../css/Home'

const Home = () =>
<div className={styles.home}>
<h1>HOME</h1>

<h2>
NOTE: The top set of links are real links made like this:
</h2>

<span style={{ color: 'rgb(200,200,200)', marginTop: 20 }}>
HREF STRING:
</span>
<span>{"<Link to='/list/db-graphql'>DB & GRAPHQL</Link>"}</span>

<span style={{ color: 'rgb(200,200,200)', marginTop: 20 }}>
PATH SEGMENTS:
</span>
<span>{"<Link to={['list', 'react-redux']}>REACT & REDUX</Link>"}</span>

<span style={{ color: 'rgb(200,200,200)', marginTop: 20 }}>ACTION:</span>
<span>
{"<Link to={{ type: 'LIST', payload: {slug: 'fp'} }}>FP</Link>"}
</span>

<h1 style={{ margin: 20 }}>EVENT HANDLERS DISPATCH ACTION</h1>

<pre>
{`
onClick: () => dispatch({
type: 'LIST',
payload: { category: 'react-redux' }
})
`}
</pre>

<div>
<span style={{ color: '#c5af8f', display: 'inline' }}>DIRECTIONS: </span>
<span className={styles.directions}>
{`inspect the sidebar tabs to see the top set are real <a> tag links and the
bottom set not, yet the address bar changes for both. The decision is up to you.
When using the <Link /> component, if you provide an action as the \`href\` prop, you never
need to worry if you change the static path segments (e.g: \`/list\`) in the routes passed
to \`connectRoutes\`. ALSO: DON'T FORGET TO USE THE BROWSER BACK/NEXT BUTTONS TO SEE THAT WORKING TOO!`}
</span>
<img
alt='gnome'
src='https://people.gnome.org/~engagement/logos/GnomeLogoHorizontal.svg'
/>
</div>
<div>
<h2> Welcome to GNOME blockchains demo </h2>
</div>

<h1 style={{ marginTop: 25 }}>LINKS ABOUT REDUX-FIRST ROUTER:</h1>

{'> '}
<a
className={styles.articleLinks}
target='_blank'
href='https://medium.com/faceyspacey/server-render-like-a-pro-w-redux-first-router-in-10-steps-b27dd93859de'
rel='noopener noreferrer'
>
Server-Render Like A Pro in 10 Steps /w Redux-First Router 🚀
</a>

<br />
<br />

{'> '}
<a
className={styles.articleLinks}
target='_blank'
href='https://medium.com/faceyspacey/redux-first-router-lookin-sexy-on-code-sandbox-d9d9bea15053'
rel='noopener noreferrer'
>
Things To Pay Attention To In This Demo
</a>

<br />
<br />

{'> '}
<a
className={styles.articleLinks}
target='_blank'
href='https://medium.com/faceyspacey/pre-release-redux-first-router-a-step-beyond-redux-little-router-cd2716576aea'
rel='noopener noreferrer'
>
Pre Release: Redux-First Router — A Step Beyond Redux-Little-Router
</a>

<br />
<br />

{'> '}
<a
className={styles.articleLinks}
target='_blank'
href='https://medium.com/faceyspacey/redux-first-router-data-fetching-solving-the-80-use-case-for-async-middleware-14529606c262'
rel='noopener noreferrer'
>
Redux-First Router data-fetching: solving the 80% use case for async
Middleware
</a>
</div>

export default Home
12 changes: 12 additions & 0 deletions src/components/Issue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React, { PureComponent } from 'react'
import { connect } from 'react-redux'
import { selectCurrentIssue } from '../selectors/issues'

const Issue = () => <div />

export default connect(
state => ({
vote: selectCurrentIssue(state),
}),
dispatch => ({})
)(Issue)
36 changes: 7 additions & 29 deletions src/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import styles from '../css/Sidebar'

const Sidebar = ({ onClick, path }) =>
<div className={styles.sidebar}>
<h2>SEO-FRIENDLY LINKS</h2>

<NavLink activeClassName={styles.active} exact to='/'>HOME</NavLink>

Expand All @@ -26,34 +25,6 @@ const Sidebar = ({ onClick, path }) =>
FP
</NavLink>

<div style={{ height: 20 }} />
<h2>EVENT HANDLERS</h2>

<span className={active(path, '/')} onClick={() => onClick('HOME')}>
HOME
</span>

<span
className={active(path, '/list/db-graphql')}
onClick={() => onClick('LIST', 'db-graphql')}
>
DB & GRAPHQL
</span>

<span
className={active(path, '/list/react-redux')}
onClick={() => onClick('LIST', 'react-redux')}
>
REACT & REDUX
</span>

<span
className={active(path, '/list/fp')}
onClick={() => onClick('LIST', 'fp')}
>
FP
</span>

<div style={{ height: 14 }} />

<NavLink
Expand All @@ -63,6 +34,13 @@ const Sidebar = ({ onClick, path }) =>
Create Meeting Agenda{' '}
</NavLink>

<NavLink
activeClassName={styles.active}
to={{ type: 'ISSUE', payload: { issueId: 1 } }}
>
Vote on meeting 1{' '}
</NavLink>

</div>

const active = (currentPath, path) =>
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import createHistory from 'history/createBrowserHistory'
import AppContainer from 'react-hot-loader/lib/AppContainer'

import App from './components/App'
import configureStore from './configureStore'
import counter from './contracts/counter.sol'
Expand All @@ -14,7 +15,11 @@ const render = App => {
const root = document.getElementById('root')

ReactDOM.render(
<AppContainer>
<AppContainer
errorReporter={({ error }) => {
throw error
}}
>
<Provider store={store}>
<App />
</Provider>
Expand Down
1 change: 1 addition & 0 deletions src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export { default as user } from './user'
export { default as title } from './title'
export { default as actions } from './actions'
export { default as jwToken } from './jwToken'
export { default as issues } from './issues'
15 changes: 15 additions & 0 deletions src/reducers/issues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { fromJS } from 'immutable'

const updaters = new Map([
['@@redux/INIT', state => fromJS(state)],
['@@INIT', state => fromJS(state)],
])

export default (state = fromJS({}), action) => {
if (updaters.has(action.type)) {
return updaters.get(action.type)(state, action)
}
else {
return state
}
}
1 change: 1 addition & 0 deletions src/reducers/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const components = {
VIDEO: 'Video',
ADMIN: 'Admin',
LOGIN: 'Login',
ISSUE: 'Issue',
[NOT_FOUND]: 'NotFound',
}

Expand Down
4 changes: 3 additions & 1 deletion src/reducers/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export default (state = 'RFR Demo', action = {}) => {
case 'LOGIN':
return 'RFR Login'
case 'ADMIN':
return 'RFR Admin'
return 'Create issue'
case 'ISSUE':
return 'Issue 1' // TODO the speicfic issue
default:
return state
}
Expand Down
3 changes: 3 additions & 0 deletions src/routesMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export default {
path: '/admin', // TRY: visit this path or dispatch ADMIN
role: 'admin', // + change jwToken to 'real' in server/index.js
},
ISSUE: {
path: '/issues/:issueId',
},
}

// DON'T GO DOWN THERE!
Expand Down
11 changes: 11 additions & 0 deletions src/selectors/issues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createSelector } from 'reselect'

import { selectLocation } from './location'

const selectIssues = state => state.issues

export const selectCurrentIssue = createSelector(
selectIssues,
selectLocation,
(issues, location) => issues.get(location.payload.issueId)
)
1 change: 1 addition & 0 deletions src/selectors/location.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const selectLocation = state => state.location

0 comments on commit 7af5c36

Please sign in to comment.