-
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.
- Loading branch information
1 parent
3f10c5d
commit 8b8d7eb
Showing
19 changed files
with
119 additions
and
74 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
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,14 @@ | ||
import axios from 'axios'; | ||
import * as CONST from '../constants/constants'; | ||
|
||
function fetchMonth(date){ | ||
const url = `http://supseasonal.herokuapp.com/api/months${date}` | ||
return axios.get(url).then(response => response.data); | ||
} | ||
|
||
const monthlyIngredients = (date) => { | ||
return { | ||
type:CONST.MONTH_INGREDIENTS, | ||
payload: fetchMonth(date) | ||
} | ||
} |
File renamed without changes.
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,27 @@ | ||
import React , { Component } from 'react'; | ||
import SeasonalBox from './seasonal_box'; | ||
import NavBar from '../navbar'; | ||
import {Link} from 'react-router-dom'; | ||
import { connect } from 'react-redux' | ||
|
||
|
||
const mapStateToProps = (state, ownProps) => { | ||
return { | ||
date: state.date | ||
} | ||
} | ||
|
||
class Availability extends Component { | ||
render(){ | ||
return ( | ||
<div> | ||
<NavBar /> | ||
<h2>Seasonal Ingredients for {this.props.date}</h2> | ||
<div><Link to='/recipes'>Get the recipes for {this.props.date}</Link></div> | ||
<SeasonalBox /> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default connect(mapStateToProps)(Availability) |
File renamed without changes.
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,3 +1,3 @@ | ||
const months = [{key: 'jan', value: 'jan', text: 'January'},{key: 'feb', value: 'feb', text: 'February'}, {key: 'mar', value: 'mar', text: 'March'}, {key: 'apr', value: 'apr', text: 'April'}, {key: 'may', value: 'may', text: 'May'}, {key: 'jun', value: 'jun', text: 'June'}, {key: 'jul', value: 'jul', text: 'July'}, {key: 'aug', value: 'aug', text: 'August'}, {key: 'sep', value: 'sep', text: 'September'}, {key: 'oct', value: 'oct', text: 'October'}, {key: 'nov', value: 'nov', text: 'November'}, {key: 'dec', value: 'dec', text: 'December'}] | ||
const months = [{ value: 'jan', text: 'January'},{ value: 'feb', text: 'February'}, { value: 'mar', text: 'March'}, { value: 'apr', text: 'April'}, { value: 'may', text: 'May'}, { value: 'jun', text: 'June'}, { value: 'jul', text: 'July'}, { value: 'aug', text: 'August'}, { value: 'sep', text: 'September'}, { value: 'oct', text: 'October'}, { value: 'nov', text: 'November'}, { value: 'dec', text: 'December'}] | ||
|
||
export default months |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React , { Component } from 'react'; | ||
import { Dropdown } from 'semantic-ui-react' | ||
|
||
const mapStateToProps | ||
|
||
const DropdownIngredientsSelection = () => {( | ||
<Dropdown placeholder='Select A Month' fluid selection options={friendOptions} /> | ||
)} | ||
|
||
|
||
class IngredientsDropdown extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<div> | ||
<Dropdown className="collapsible" trigger={ | ||
<Button>Select A Food!</Button> | ||
}> | ||
<NavItem>Food 1</NavItem> | ||
<NavItem>Food 2</NavItem> | ||
<NavItem>Food 3</NavItem> | ||
</Dropdown> | ||
</div> | ||
<div> | ||
<IngredientSearch /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default IngredientsDropdown |
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
File renamed without changes.
File renamed without changes.
Empty file.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
Empty file.
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,4 @@ | ||
export const MONTH_INGREDIENTS = 'MONTH_INGREDIENTS'; | ||
export const DATE_CHANGE = 'DATE_CHANGE'; | ||
export const GET_RECIPE = 'GET_RECIPE'; | ||
export const ENTER_INGREDIENTS = 'ENTER_INGREDIENTS'; |
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,38 +1,25 @@ | ||
|
||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
// import { Provider } from 'react-redux'; | ||
// import { createStore, applyMiddleware } from 'redux'; | ||
|
||
|
||
import App from './components/app'; | ||
import reducers from './reducers'; | ||
import IngredientAvail from './components/ingredient_availability_box.js'; | ||
import RecipeInfobox from './components/recipe_infobox.js'; | ||
import RecipeSideList from './components/recipe_side_list.js'; | ||
import MonthDropdown from './components/month_dropdown'; | ||
import IngredientsDropdown from './components/ingredients_dropdown' | ||
import promiseMiddleware from 'redux-promise-middleware'; | ||
import { applyMiddleware } from 'redux'; | ||
import thunkMiddleware from 'redux-thunk'; | ||
|
||
|
||
|
||
// const createStoreWithMiddleware = applyMiddleware()(createStore); | ||
const store = createStore( | ||
reducers, | ||
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), | ||
applyMiddleware(thunkMiddleware, promiseMiddleware()) | ||
); | ||
|
||
ReactDOM.render( | ||
// <Provider store={createStoreWithMiddleware(reducers)}> | ||
<App /> | ||
// {/* // <div> | ||
// // <MonthDropdown /> | ||
// // <IngredientsDropdown /> | ||
// // </div> */} | ||
// | ||
// | ||
// {/* <App /> */} | ||
// | ||
// {/* probably have to rename enteredIngredient to specified name on ingredients_dropdown*/} | ||
// // <IngredientAvail ingredient={this.state.enteredIngredient}/> | ||
// {/* <RecipeInfobox /> */} | ||
// {/* <RecipeSideList /> */} | ||
|
||
// </Provider> | ||
<Provider store={store}> | ||
<App /> | ||
</Provider> | ||
, document.querySelector('.app')); | ||
|
||
if (module.hot) { | ||
module.hot.accept() | ||
} |
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,14 @@ | ||
import * as CONST from '../constants/constants'; | ||
|
||
const date = (state = '', action) => { | ||
switch (action.type) { | ||
case CONST.DATE_CHANGE: | ||
return action.date | ||
case CONST.MONTH_INGREDIENTS: | ||
return action.payload | ||
default: | ||
return state | ||
} | ||
} | ||
|
||
export default date |