integrate recipes in MyList and Favorite pages, fixed rating bugs in RecipeViews
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
60d3d6267c
commit
b213edb4ef
@ -1,16 +1,28 @@
|
||||
using Models;
|
||||
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
using Endpoint;
|
||||
using Models;
|
||||
using ShoopNCook.Views;
|
||||
|
||||
public partial class FavoritesPage : ContentPage
|
||||
{
|
||||
public FavoritesPage(Account account, IApp app)
|
||||
public FavoritesPage(Account account, IRecipesService service)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
//TODO
|
||||
//TODO this code can be factorised (see HomePage, MyListPage)
|
||||
service.LookupFavoritesOf(account).ForEach(info =>
|
||||
{
|
||||
RecipeViewLayout.Children.Add(new RecipeView(info, () =>
|
||||
{
|
||||
Recipe recipe = service.GetRecipe(info);
|
||||
AccountRecipeRate rate = service.GetRateOf(account, recipe);
|
||||
Shell.Current.Navigation.PushAsync(new RecipePage(recipe, rate, 1));
|
||||
}));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,24 @@
|
||||
using Endpoint;
|
||||
using Models;
|
||||
using ShoopNCook.Views;
|
||||
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class MyListPage : ContentPage
|
||||
{
|
||||
public MyListPage(Account account, IApp app)
|
||||
public MyListPage(Account account, IRecipesService service)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
service.LookupWeeklyListOf(account).ForEach(info =>
|
||||
{
|
||||
RecipesLayout.Children.Add(new StoredRecipeView(info.Item1, info.Item2, amount =>
|
||||
{
|
||||
Recipe recipe = service.GetRecipe(info.Item1);
|
||||
AccountRecipeRate rate = service.GetRateOf(account, recipe);
|
||||
Shell.Current.Navigation.PushAsync(new RecipePage(recipe, rate, amount));
|
||||
}));
|
||||
});
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in new issue