chore: add comments, setup instructions

This commit is contained in:
Kyle Gill
2019-05-29 20:50:22 -06:00
parent 477dc9e22c
commit 4dbe7ea49d
17 changed files with 91 additions and 20 deletions

View File

@@ -116,6 +116,7 @@ class Day extends React.Component {
}
componentDidUpdate(prevProps) {
// check if a new route was hit, to save the entry and load the next one
if (this.props.uri !== prevProps.uri) {
const [
,

View File

@@ -79,6 +79,8 @@ class Search extends Component {
}
}
// all entries for a user are fetched this scales poorly but is much
// simpler than an API key and setting up an index for Algolia
getEntries = async _ => {
const { firebase, authUser } = this.props
const entriesRef = await firebase.db
@@ -86,13 +88,7 @@ class Search extends Component {
.where("userId", "==", authUser.uid)
.get()
const entries = entriesRef.docs.map(doc => doc.data()).reverse()
// const sortedEntries = entries.sort((a, b) => {
// return (
// new Date(b.year, b.month - 1, b.day) -
// new Date(a.year, a.month - 1, a.day)
// )
// })
// console.log(sortedEntries)
this.setState({ entries, allEntries: entries, loading: false })
}