-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wired up redux firebase saga and bounded questions to app
- Loading branch information
Showing
18 changed files
with
463 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{ | ||
"single-quote": true, | ||
"arrow-parens": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default as App } from './App.js'; | ||
export { default as App } from "./App.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default as QuestionAnswer } from './QuestionAnswer.component'; | ||
export { default as QuestionAnswer } from "./QuestionAnswer.component"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
import React, { PureComponent } from 'react'; | ||
import React, { PureComponent } from "react"; | ||
|
||
import './Quiz.css'; | ||
import isEmptyObject from 'is-empty-object'; | ||
|
||
import { | ||
QuizQuestion, | ||
} from 'components'; | ||
|
||
import PropTypes from 'prop-types'; | ||
|
||
import "./Quiz.css"; | ||
|
||
export default class Quiz extends PureComponent { | ||
static propTypes = { | ||
questions: PropTypes.object, | ||
}; | ||
|
||
render() { | ||
return <div className={`Quiz`} />; | ||
const { questions } = this.props; | ||
|
||
return questions && !isEmptyObject(questions) ? ( | ||
<div className={`Quiz`}> | ||
{Object.values(questions).map((question) => ( | ||
<div key={question.id}> | ||
<QuizQuestion {...question} /> | ||
</div> | ||
))} | ||
</div> | ||
) : null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { connect } from 'react-redux' | ||
|
||
import { compose } from 'redux' | ||
|
||
import { firestoreConnect } from 'react-redux-firebase' | ||
|
||
import Quiz from './Quiz.component'; | ||
|
||
export default compose( | ||
firestoreConnect([ | ||
`questions`, | ||
]), | ||
connect( | ||
(state) => ({ | ||
questions: state.firestore.data.questions | ||
}) | ||
) | ||
)(Quiz) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default as Quiz } from './Quiz.component'; | ||
export { default as Quiz } from "./Quiz.container"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default as QuizQuestion } from './QuizQuestion.component'; | ||
export { default as QuizQuestion } from "./QuizQuestion.component"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export * from './App'; | ||
export * from './QuestionAnswer'; | ||
export * from './Questions'; | ||
export * from './Quiz'; | ||
export * from './QuizQuestion'; | ||
export * from "./App"; | ||
export * from "./QuestionAnswer"; | ||
export * from "./Quiz"; | ||
export * from "./QuizQuestion"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import 'reset-css'; | ||
import './index.css'; | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import "reset-css"; | ||
import "./index.css"; | ||
|
||
import { App } from 'components'; | ||
import { Provider } from "react-redux"; | ||
|
||
import registerServiceWorker from './registerServiceWorker'; | ||
import store from "store"; | ||
|
||
import { App } from "components"; | ||
|
||
import registerServiceWorker from "./registerServiceWorker"; | ||
|
||
ReactDOM.render( | ||
<Provider store={store}> | ||
<App /> | ||
</Provider>, | ||
document.getElementById(`root`) | ||
); | ||
|
||
ReactDOM.render(<App />, document.getElementById(`root`)); | ||
registerServiceWorker(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { createStore, combineReducers, compose } from "redux"; | ||
|
||
import { reactReduxFirebase } from "react-redux-firebase"; | ||
|
||
import { reduxFirestore, firestoreReducer } from "redux-firestore"; | ||
|
||
import firebase from "firebase"; | ||
|
||
import 'firebase/firestore'; | ||
|
||
// react-redux-firebase config | ||
const rrfConfig = { | ||
userProfile: `users`, | ||
useFirestoreForProfile: true, // Firestore for Profile instead of Realtime DB | ||
}; | ||
|
||
firebase.initializeApp({ | ||
apiKey: `AIzaSyBVRfPWkOwK2mWquD7-BP4r4v4pXYWL6l8`, | ||
authDomain: `dan-wilt-coaching-assessmen.firebaseapp.com`, | ||
databaseURL: `https://dan-wilt-coaching-assessmen.firebaseio.com`, | ||
projectId: `dan-wilt-coaching-assessmen`, | ||
storageBucket: `dan-wilt-coaching-assessmen.appspot.com`, | ||
messagingSenderId: `92351047707`, | ||
}); | ||
|
||
firebase.firestore(); | ||
|
||
const createStoreWithFirebase = compose( | ||
reactReduxFirebase(firebase, rrfConfig), // firebase instance as first argument | ||
reduxFirestore(firebase) // <- needed if using firestore | ||
)(createStore); | ||
|
||
const rootReducer = combineReducers({ | ||
firestore: firestoreReducer, // <- needed if using firestore | ||
}); | ||
|
||
export default createStoreWithFirebase(rootReducer, {}, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()); |
Oops, something went wrong.