From 739620ec5965a146a451ee667c2b15ab6c6d7a2f Mon Sep 17 00:00:00 2001 From: anish Date: Mon, 9 Oct 2017 22:02:51 +1100 Subject: [PATCH 1/3] Addding gnome logo --- src/components/App.js | 3 -- src/components/Home.js | 100 +++----------------------------------- src/components/Sidebar.js | 29 ----------- src/index.js | 1 + 4 files changed, 9 insertions(+), 124 deletions(-) diff --git a/src/components/App.js b/src/components/App.js index 5e62533..73b2737 100755 --- a/src/components/App.js +++ b/src/components/App.js @@ -1,6 +1,5 @@ import React from 'react' -import DevTools from './DevTools' import Sidebar from './Sidebar' import Switcher from './Switcher' @@ -12,6 +11,4 @@ export default () => - - diff --git a/src/components/Home.js b/src/components/Home.js index 08fe3f0..11ac0bc 100755 --- a/src/components/Home.js +++ b/src/components/Home.js @@ -1,102 +1,18 @@ import React from 'react' + import styles from '../css/Home' const Home = () =>
-

HOME

- -

- NOTE: The top set of links are real links made like this: -

- - - HREF STRING: - - {"DB & GRAPHQL"} - - - PATH SEGMENTS: - - {"REACT & REDUX"} - - ACTION: - - {"FP"} - - -

EVENT HANDLERS DISPATCH ACTION

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

Welcome to GNOME blockchains demo

- -

LINKS ABOUT REDUX-FIRST ROUTER:

- - {'> '} -
- Server-Render Like A Pro in 10 Steps /w Redux-First Router 🚀 - - -
-
- - {'> '} - - Things To Pay Attention To In This Demo - - -
-
- - {'> '} - - Pre Release: Redux-First Router — A Step Beyond Redux-Little-Router - - -
-
- - {'> '} - - Redux-First Router data-fetching: solving the 80% use case for async - Middleware -
export default Home diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index 34944b1..a328664 100755 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -7,7 +7,6 @@ import styles from '../css/Sidebar' const Sidebar = ({ onClick, path }) =>
-

SEO-FRIENDLY LINKS

HOME @@ -26,34 +25,6 @@ const Sidebar = ({ onClick, path }) => FP -
-

EVENT HANDLERS

- - onClick('HOME')}> - HOME - - - onClick('LIST', 'db-graphql')} - > - DB & GRAPHQL - - - onClick('LIST', 'react-redux')} - > - REACT & REDUX - - - onClick('LIST', 'fp')} - > - FP - -
Date: Tue, 10 Oct 2017 19:58:46 +1100 Subject: [PATCH 2/3] Add sidebar item for meetings, and page titles --- src/components/Sidebar.js | 7 +++++++ src/reducers/title.js | 4 +++- src/routesMap.js | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index a328664..84d1eaf 100755 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -34,6 +34,13 @@ const Sidebar = ({ onClick, path }) => Create Meeting Agenda{' '} + + Vote on meeting 1{' '} + +
const active = (currentPath, path) => diff --git a/src/reducers/title.js b/src/reducers/title.js index aad79e5..d6d2728 100644 --- a/src/reducers/title.js +++ b/src/reducers/title.js @@ -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 } diff --git a/src/routesMap.js b/src/routesMap.js index a1806c9..6292341 100644 --- a/src/routesMap.js +++ b/src/routesMap.js @@ -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! From 599f2fec12e4fb11c943817dd0add32136384dd2 Mon Sep 17 00:00:00 2001 From: Daniel Playfair Cal Date: Tue, 10 Oct 2017 23:57:56 +1100 Subject: [PATCH 3/3] Add issues page --- .eslintrc.js | 1 + package.json | 1 + src/components/Issue.js | 12 ++++++++++++ src/index.js | 6 +++++- src/reducers/index.js | 1 + src/reducers/issues.js | 15 +++++++++++++++ src/reducers/page.js | 1 + src/selectors/issues.js | 11 +++++++++++ src/selectors/location.js | 1 + yarn.lock | 4 ++++ 10 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/components/Issue.js create mode 100644 src/reducers/issues.js create mode 100644 src/selectors/issues.js create mode 100644 src/selectors/location.js diff --git a/.eslintrc.js b/.eslintrc.js index 8579271..49841b6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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, diff --git a/package.json b/package.json index 5cc4895..b83eb94 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,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", diff --git a/src/components/Issue.js b/src/components/Issue.js new file mode 100644 index 0000000..d856498 --- /dev/null +++ b/src/components/Issue.js @@ -0,0 +1,12 @@ +import React, { PureComponent } from 'react' +import { connect } from 'react-redux' +import { selectCurrentIssue } from '../selectors/issues' + +const Issue = () =>
+ +export default connect( + state => ({ + vote: selectCurrentIssue(state), + }), + dispatch => ({}) +)(Issue) diff --git a/src/index.js b/src/index.js index 0344a39..cd4ad6a 100644 --- a/src/index.js +++ b/src/index.js @@ -15,7 +15,11 @@ const render = App => { const root = document.getElementById('root') ReactDOM.render( - + { + throw error + }} + > diff --git a/src/reducers/index.js b/src/reducers/index.js index 4d802d7..4b5c8a6 100755 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -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' diff --git a/src/reducers/issues.js b/src/reducers/issues.js new file mode 100644 index 0000000..1409622 --- /dev/null +++ b/src/reducers/issues.js @@ -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 + } +} diff --git a/src/reducers/page.js b/src/reducers/page.js index c661527..2fba3ad 100644 --- a/src/reducers/page.js +++ b/src/reducers/page.js @@ -8,6 +8,7 @@ const components = { VIDEO: 'Video', ADMIN: 'Admin', LOGIN: 'Login', + ISSUE: 'Issue', [NOT_FOUND]: 'NotFound', } diff --git a/src/selectors/issues.js b/src/selectors/issues.js new file mode 100644 index 0000000..3d40a29 --- /dev/null +++ b/src/selectors/issues.js @@ -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) +) diff --git a/src/selectors/location.js b/src/selectors/location.js new file mode 100644 index 0000000..2c6ecdb --- /dev/null +++ b/src/selectors/location.js @@ -0,0 +1 @@ +export const selectLocation = state => state.location diff --git a/yarn.lock b/yarn.lock index de38dd8..4c2191e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3108,6 +3108,10 @@ ignore@^3.2.0: version "3.2.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.6.tgz#26e8da0644be0bb4cb39516f6c79f0e0f4ffe48c" +immutable@^3.8.2: + version "3.8.2" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"