This file contains hidden or 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
| //src/index.js | |
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import router from './router'; | |
| import 'bootstrap/dist/css/bootstrap.css'; | |
| import 'bootstrap/dist/css/bootstrap-theme.css'; | |
| import './index.css' |
This file contains hidden or 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
| //src/localStorage.js | |
| export const loadState = () => { | |
| try{ | |
| const serializedState = localStorage.getItem('state'); | |
| if(serializedState === null){ | |
| return undefined; | |
| } | |
| return JSON.parse(serializedState) |
This file contains hidden or 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
| //src/router.js | |
| import React from 'react' | |
| import { Router, Route, hashHistory, IndexRoute } from 'react-router' | |
| import App from './components/App' | |
| import Landing from './components/Landing' | |
| import WhatIsARainyDayFund from './components/WhatIsARainyDayFund' | |
| import AssumptionsContainer from './components/AssumptionsContainer' | |
| import ExpensesContainer from './components/ExpensesContainer' |
This file contains hidden or 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
| //src/components/SavingsPlan.js | |
| import React from 'react'; | |
| import { FormControl, InputGroup } from 'react-bootstrap'; | |
| import {formatDollarValues, calcTotalExpenses} from '../helpers' | |
| const SavingsPlan = ({assumptions, expenses, monthlySavings, handleUpdateMonthlySavings}) => { | |
| if(assumptions.income === 0 || calcTotalExpenses(expenses) === 0){ |
This file contains hidden or 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
| //src/components/SavingsPlanContainer | |
| import SavingsPlan from './SavingsPlan' | |
| import { connect } from 'react-redux'; | |
| import {updateMonthlySavings} from '../actions' | |
| const mapStateToProps = (state) => { | |
| return { | |
| assumptions:state.assumptions, | |
| expenses: state.expenses, |
This file contains hidden or 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
| //src/components/TotalExpenses.js | |
| import React from 'react'; | |
| import {formatDollarValues, calcTotalExpenses} from '../helpers' | |
| const TotalExpenses = ({expenses}) => { | |
| return ( | |
| <div id="TotalExpenses"> | |
| <h3>Total Monthly Expenses</h3> |
This file contains hidden or 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
| //src/components/Expense.js | |
| import React from 'react'; | |
| import {FormControl, InputGroup } from 'react-bootstrap'; | |
| import {formatDollarValues} from '../helpers' | |
| const Expense = ({key, name, amount, id, updateExpenseName, updateExpenseAmount, removeExpense}) => { | |
| return ( | |
| <li className="expense-item"> |
This file contains hidden or 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
| //src/components/Expenses.js | |
| import React, { Component } from 'react'; | |
| import { Link } from 'react-router' | |
| import { Button } from 'react-bootstrap'; | |
| import Expense from './Expense' | |
| import TotalExpenses from './TotalExpenses' | |
| const Expenses = ({expenses, handleAddExpense, handleRemoveExpense, handleUpdateExpenseName, handleUpdateExpenseAmount}) => { |
This file contains hidden or 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
| //src/components/ExpensesContainer | |
| import Expenses from './Expenses' | |
| import { connect } from 'react-redux'; | |
| import {addExpense, removeExpense, updateExpenseName, updateExpenseAmount} from '../actions' | |
| const mapStateToProps = (state) => { | |
| return { | |
| expenses: state.expenses, | |
| } |
This file contains hidden or 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
| //src/components/Assumptions.js | |
| import React from 'react'; | |
| import {Link} from 'react-router' | |
| import { FormGroup, Row, ControlLabel, FormControl, Button, InputGroup } from 'react-bootstrap'; | |
| import {formatDollarValues} from '../helpers' | |
| const Assumptions = ({assumptions, handleUpdateIncomeSources, handleUpdateIncome, handleUpdateSavings}) => { | |
| return ( |