Skip to content

Commit

Permalink
feat: add message when meal plan is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
btoconnor authored and zanix committed Apr 1, 2024
1 parent 6368f58 commit 11d0427
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions MMM-MealieMenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@
color: #fff;
font-size: calc(var(--font-size-medium) - 0.3rem);
}

.MMM-MealieMenu .meal-empty {
text-align: center;
}
3 changes: 2 additions & 1 deletion MMM-MealieMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ Module.register("MMM-MealieMenu", {
getTemplateData () {
return {
phrases: {
loading: this.translate("LOADING")
loading: this.translate("LOADING"),
emptyMealPlan: this.translate("MEALIE_EMPTY_MEALPLAN")
},
hasError: Boolean(this.error),
error: this.error,
Expand Down
6 changes: 6 additions & 0 deletions MMM-MealieMenu.njk
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
</div>
</div>
{% endfor %}

{% if menu.meals | length == 0 %}
<div class="meal-empty">
{{ phrases.emptyMealPlan | safe }}
</div>
{% endif %}
</div>

<div class="meta-timestamp" id="{{ moduleTimestampIdPrefix + identifier }}" data-timestamp="{{ timestamp }}">
Expand Down
1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"FETCH_ERROR": "Fetch Error: There was an error fetching data from Mealie.",
"MEALIE_SUSPEND": "Function suspend - module: {name} with identifier: {identifier}",
"MEALIE_RESUME": "Function resume - module: {name} with identifier: {identifier}",
"MEALIE_EMPTY_MEALPLAN": "There are no meals planned.",
"MEAL_TYPES": {
"breakfast": "Breakfast",
"lunch": "Lunch",
Expand Down

0 comments on commit 11d0427

Please sign in to comment.