diff --git a/.idea/advreact_1610.iml b/.idea/advreact_1610.iml
deleted file mode 100644
index 24643cc..0000000
--- a/.idea/advreact_1610.iml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 97626ba..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 0bbcd65..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 24eb271..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index ea0c7c2..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 1e71037..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,600 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- appName
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
- DEFINITION_ORDER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- project
-
-
- true
-
-
-
- DIRECTORY
-
- false
-
-
-
-
-
-
-
-
-
- 1508430913430
-
-
- 1508430913430
-
-
-
- 1508432208309
-
-
-
- 1508432208309
-
-
- 1508433489973
-
-
-
- 1508433489973
-
-
- 1508434605855
-
-
-
- 1508434605855
-
-
- 1508435576680
-
-
-
- 1508435576680
-
-
- 1508436481516
-
-
-
- 1508436481516
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/App.js b/src/components/App.js
index f70a4ed..ebe4317 100644
--- a/src/components/App.js
+++ b/src/components/App.js
@@ -3,6 +3,7 @@ import {Route} from 'react-router-dom'
import ProtectedRoute from './common/ProtectedRoute'
import AdminPage from './routes/Admin'
import AuthPage from './routes/Auth'
+import PeoplePage from "./routes/People";
class App extends Component {
static propTypes = {
@@ -15,6 +16,7 @@ class App extends Component {
Hello world
+
)
}
diff --git a/src/components/people/PeopleAddForm.js b/src/components/people/PeopleAddForm.js
new file mode 100644
index 0000000..0dde225
--- /dev/null
+++ b/src/components/people/PeopleAddForm.js
@@ -0,0 +1,43 @@
+import React, { Component } from 'react'
+import {reduxForm, Field} from 'redux-form'
+import emailValidator from 'email-validator'
+import ErrorField from '../common/ErrorField'
+
+class PeopleAdd extends Component {
+ static propTypes = {
+
+ };
+
+ render() {
+ return (
+
+ )
+ }
+}
+
+const validate = ({ firstName, lastName, email }) => {
+ const errors = {}
+
+ if (!firstName) errors.password = 'first name is a required field'
+ if (!lastName) errors.password = 'last name is a required field'
+ if (!email) errors.email = 'email is a required field'
+
+ if (email && !emailValidator.validate(email)) errors.email = 'invalid email'
+
+ return errors
+}
+
+export default reduxForm({
+ form: 'people',
+ validate
+})(PeopleAdd)
\ No newline at end of file
diff --git a/src/components/routes/People.js b/src/components/routes/People.js
new file mode 100644
index 0000000..e39b9ff
--- /dev/null
+++ b/src/components/routes/People.js
@@ -0,0 +1,29 @@
+import React, { Component } from 'react'
+import {connect} from 'react-redux'
+import PeopleAddForm from "../people/PeopleAddForm";
+import {peopleAdd} from '../../ducks/people'
+
+class People extends Component {
+ static propTypes = {
+
+ };
+
+ render() {
+
+ return (
+
+ )
+
+ }
+
+ handleSubmit = ({firstName, lastName, email}) => {
+ const { peopleAdd } = this.props;
+
+ peopleAdd({firstName, lastName, email})
+ }
+}
+
+export default connect(null, { peopleAdd })(People)
\ No newline at end of file
diff --git a/src/config.js b/src/config.js
index 2782a0b..56aed58 100644
--- a/src/config.js
+++ b/src/config.js
@@ -1,12 +1,12 @@
import firebase from 'firebase'
-export const appName = 'advreact-1610'
+export const appName = 'advreact-1610-2ebfd'
firebase.initializeApp({
- apiKey: "AIzaSyB31xpTtp4Jln_hb2kAbE4PGf6Mi8EgLyA",
+ apiKey: "AIzaSyBV76QnVGHeCXf3WSN1cnoYrjAyQ661oYA",
authDomain: `${appName}.firebaseapp.com`,
databaseURL: `https://${appName}.firebaseio.com`,
projectId: appName,
- storageBucket: "",
- messagingSenderId: "397157634637"
+ storageBucket: `${appName}.appspot.com`,
+ messagingSenderId: "546203183060"
})
\ No newline at end of file
diff --git a/src/ducks/people.js b/src/ducks/people.js
new file mode 100644
index 0000000..6e06454
--- /dev/null
+++ b/src/ducks/people.js
@@ -0,0 +1,48 @@
+import {appName} from '../config'
+import {Record, List} from 'immutable'
+
+/**
+ * Constants
+ * */
+export const moduleName = 'people'
+const prefix = `${appName}/${moduleName}`
+
+export const PEOPLE_ADD = `${prefix}/PEOPLE_ADD`
+
+
+/**
+ * Reducer
+ * */
+const ReducerState = Record({
+ entities: new List([])
+})
+
+export const ReducerRecord = Record({
+ id: null,
+ firstName: '',
+ lastName: '',
+ email: ''
+})
+
+export default function reducer(state = new ReducerState(), action) {
+ const {type, payload} = action
+ switch (type) {
+ case PEOPLE_ADD:
+ return state.update('entities', entities => entities.push(new ReducerRecord(payload.people)))
+ default:
+ return state
+ }
+}
+
+/**
+ * Action Creators
+ * */
+
+export function peopleAdd(people) {
+ return {
+ type: PEOPLE_ADD,
+ payload: {
+ people: {...people, id: Math.random() }
+ },
+ }
+}
\ No newline at end of file
diff --git a/src/redux/reducer.js b/src/redux/reducer.js
index 34143fe..cc6e0aa 100644
--- a/src/redux/reducer.js
+++ b/src/redux/reducer.js
@@ -2,8 +2,10 @@ import {combineReducers} from 'redux'
import {routerReducer as router} from 'react-router-redux'
import {reducer as form} from 'redux-form'
import authReducer, {moduleName as authModule} from '../ducks/auth'
+import peopleReducer, {moduleName as peopleModule} from '../ducks/people'
export default combineReducers({
router, form,
- [authModule]: authReducer
+ [authModule]: authReducer,
+ [peopleModule]: peopleReducer
})
\ No newline at end of file