diff --git a/app/controllers/index.js b/app/controllers/index.js new file mode 100644 index 0000000..be16633 --- /dev/null +++ b/app/controllers/index.js @@ -0,0 +1,23 @@ +import Controller from '@ember/controller'; +import { tracked } from "@glimmer/tracking"; +import { A } from '@ember/array'; +import { inject as service } from '@ember/service'; + +export default class IndexController extends Controller { + @service store; + @tracked items = A([]); + + constructor() { + super(...arguments); + this.assignExistingItems(); + } + + async assignExistingItems() { + let items = await this.store.peekAll('meal'); + this.items = items; + } + + get userHasMeals() { + return this.items.length >= 1; + } +} diff --git a/app/index.html b/app/index.html index eebbdb9..a8d54df 100644 --- a/app/index.html +++ b/app/index.html @@ -14,7 +14,7 @@ {{content-for "head-footer"}} -
+ {{content-for "body"}} diff --git a/app/templates/index.hbs b/app/templates/index.hbs index 73d371e..461797a 100644 --- a/app/templates/index.hbs +++ b/app/templates/index.hbs @@ -1 +1,17 @@ -Browser Recipes on the Left :) +{{#if this.userHasMeals}} ++ You can see more details of any meal by clicking on them. You may also reorder meals via drag and drop (or your keyboard). +
+{{else}} ++ Add some recipes to get started. +
+{{/if}} diff --git a/app/templates/meal.hbs b/app/templates/meal.hbs index 192a06a..9eb6472 100644 --- a/app/templates/meal.hbs +++ b/app/templates/meal.hbs @@ -1,4 +1,4 @@ -