Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
Fix isWorkoutDay banner (patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Cuadra committed Sep 22, 2018
1 parent 48fd234 commit b9e0ea3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,14 @@ function shouldWorkout({
workoutOnFriday,
workoutOnSaturday,
];
return weekdays[moment().day()];
return weekdays[moment().day()] || false;
}
class Layout extends Component {
constructor(props) {
super(props);

const {
isWorkoutDay,
menu,
macrosRest,
macrosWorkout,
Expand All @@ -94,7 +95,7 @@ class Layout extends Component {

this.state = {
drawerIsOpen: false,
isWorkoutDay: shouldWorkout(settings),
isWorkoutDay,
macrosRest,
macrosWorkout,
menu,
Expand All @@ -115,6 +116,7 @@ class Layout extends Component {

componentDidMount() {
const {
isWorkoutDay,
macrosRest,
macrosWorkout,
menu,
Expand All @@ -125,7 +127,7 @@ class Layout extends Component {
} = loadLocalValues();

this.setState({
isWorkoutDay: shouldWorkout(settings),
isWorkoutDay,
macrosRest,
macrosWorkout,
menu,
Expand Down
2 changes: 1 addition & 1 deletion src/plan/Plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Plan extends React.Component {

const hasRecipesMinimum = recipes.size < RECIPES_MINIMUM;

const styleBanner = isWorkoutDay ? { style: { display: 'none' } } : {};
const styleBanner = isWorkoutDay ? {} : { style: { display: 'none' } };
return (
<div className="plan">
<div className="banner text-center" {...styleBanner}>
Expand Down

0 comments on commit b9e0ea3

Please sign in to comment.