-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding a new layout to the menu app * updating flow for new design * updating styles and adding more layout * fixing broken menu item model select * adding links to the menu item stuff * adjusing bootstrap css * adding some basic CSS * adding better working to the menu groups * format date in the history table * adding hooks to the news page from the menu page * fixing some lint issues and adding a no menu items page * removing end date and auto updating complete date * adding a seperate component to the UI for the news page * code cleanup * code cleanup * fixing lint issues
- Loading branch information
Showing
36 changed files
with
490 additions
and
406 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
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import moment from 'moment' | ||
import OnTheMenu from './OnTheMenu' | ||
|
||
const FullMenu = ({ menuItems, completeMenuItem, editMenuItem }) => { | ||
let nextWeek = moment().add(1, 'week').startOf('week').format('MMMM D'); | ||
let thisWeek = moment().startOf('week').format('MMMM D'); | ||
let lastWeek = moment().subtract(1, 'week').startOf('week').format('MMMM D'); | ||
|
||
let groups = menuItems.reduce((acc, menuItem) => { | ||
let date = menuItem.start_date; | ||
let weekStart = moment(date).startOf('week').format('MMMM D'); | ||
let weekEnd = moment(date).endOf('week').format('MMMM D'); | ||
|
||
let title = weekStart + ' - ' + weekEnd; | ||
if (thisWeek === weekStart) { | ||
title = 'This Week (' + title + ')' | ||
} else if (nextWeek === weekStart) { | ||
title = 'Next Week (' + title + ')' | ||
} else if (lastWeek === weekStart) { | ||
title = 'Last Week (' + title + ')' | ||
} | ||
|
||
if (typeof acc[title] === 'undefined') { | ||
acc[title] = []; | ||
} | ||
acc[title].push(menuItem); | ||
return acc; | ||
}, {}); | ||
|
||
if (menuItems.length > 0) { | ||
return ( | ||
<div className="col-xs-12 recipes"> | ||
{Object.keys(groups).map((key) => ( | ||
<div key={key} className="row"> | ||
<h3 className="page-header">{key}</h3> | ||
<OnTheMenu | ||
completeMenuItem={completeMenuItem} | ||
editMenuItem={editMenuItem} | ||
menuItems={groups[key]} | ||
/> | ||
</div> | ||
))} | ||
</div> | ||
) | ||
} | ||
|
||
return ( | ||
<div className="col-xs-12 recipes"> | ||
<div className="row"> | ||
<h3 className="page-header">Nothings on the Menu</h3> | ||
<a onClick={() => editMenuItem(0)}>Add one now</a> | ||
</div> | ||
</div> | ||
) | ||
}; | ||
|
||
FullMenu.propTypes = { | ||
menuItems: PropTypes.array.isRequired, | ||
completeMenuItem: PropTypes.func.isRequired, | ||
editMenuItem: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default FullMenu |
This file was deleted.
Oops, something went wrong.
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,34 @@ | ||
import React from 'react' | ||
|
||
import Tabs from '../components/Tabs' | ||
import Status from '../containers/Status' | ||
|
||
require("../css/menu.scss"); | ||
|
||
class MenuLayout extends React.Component { | ||
render() { | ||
return ( | ||
<div className="container menu-planner"> | ||
<div className="row"> | ||
<div className="col-xs-12"> | ||
<Status/> | ||
</div> | ||
</div> | ||
<div className="row"> | ||
<div className="col-sm-12 col-md-2"> | ||
<Tabs | ||
activeTab={this.props.tab} | ||
changeTab={this.props.changeTab} | ||
onMenuItemShow={this.props.onMenuItemShow} | ||
/> | ||
</div> | ||
<div className="col-sm-12 col-md-10 content"> | ||
{this.props.children} | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default MenuLayout |
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,40 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import ListRecipes from '../../browse/components/ListRecipes' | ||
|
||
const OnTheMenu = ({ menuItems, completeMenuItem, editMenuItem }) => ( | ||
<ListRecipes | ||
format="col-xs-12 col-sm-6 col-md-4 col-lg-3" | ||
data={menuItems.map(x => {return {...x.recipe_data, menuItemId: x.id}})} | ||
footer={(recipe) => ( | ||
<div className="row recipe-card-news-footer"> | ||
<div className="col-xs-6"> | ||
<button | ||
className="menu-complete-btn btn btn-success" | ||
title="Complete the Recipe" | ||
onClick={() => completeMenuItem(recipe.menuItemId)} | ||
> | ||
<span className="glyphicon glyphicon-ok" aria-hidden="true"/> | ||
</button> | ||
</div> | ||
<div className="col-xs-6"> | ||
<button | ||
className="menu-edit-btn btn btn-warning" | ||
title="Edit the Menu Item" | ||
onClick={() => editMenuItem(recipe.menuItemId)} | ||
> | ||
<span className="glyphicon glyphicon-pencil" aria-hidden="true"/> | ||
</button> | ||
</div> | ||
</div> | ||
)} | ||
/> | ||
); | ||
|
||
OnTheMenu.propTypes = { | ||
menuItems: PropTypes.array.isRequired, | ||
completeMenuItem: PropTypes.func.isRequired, | ||
editMenuItem: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default OnTheMenu |
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Link } from 'react-router-dom' | ||
import moment from 'moment' | ||
|
||
const RecipeEvent = ({ stats }) => ( | ||
<table className="table table-hover"> | ||
<thead> | ||
<tr> | ||
<th>Recipe</th> | ||
<th>Count</th> | ||
<th>Last Made</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{stats.map(row => ( | ||
<tr key={row.slug}> | ||
<th><Link to={'/recipe/' + row.slug}>{row.title}</Link></th> | ||
<th>{row.num_menuitems}</th> | ||
<th>{moment(row.last_made).format('ddd, MMMM D, YYYY')}</th> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
|
||
RecipeEvent.propTypes = { | ||
stats: PropTypes.array.isRequired, | ||
}; | ||
|
||
export default RecipeEvent |
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,24 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import TC from '../constants/TabConstants.js' | ||
|
||
const Tab = ({ changeTab, activeTab, onMenuItemShow }) => ( | ||
<ul className="nav nav-pills nav-stacked"> | ||
<li role="presentation" onClick={() => changeTab(TC.OnTheMenu)} className={activeTab === TC.OnTheMenu ? "active" : ""}> | ||
<a>On The Menu</a> | ||
</li> | ||
<li role="presentation" onClick={() => changeTab(TC.Stats)} className={activeTab === TC.Stats ? "active" : ""}> | ||
<a>History</a> | ||
</li> | ||
<li role="presentation" onClick={() => onMenuItemShow(0)}> | ||
<a>New Menu Item</a> | ||
</li> | ||
</ul> | ||
); | ||
|
||
Tab.propTypes = { | ||
changeTab: PropTypes.func, | ||
activeTab: PropTypes.string, | ||
}; | ||
|
||
export default Tab |
Oops, something went wrong.