From c9ce27bb77d2b6417e84b4e2a0698c4a2c347d2b Mon Sep 17 00:00:00 2001 From: NICK BRAIN Date: Mon, 25 Nov 2024 12:22:12 +0200 Subject: [PATCH] use common samples for now --- .../Components/Pages/FavoritesPage.razor | 2 +- My1kWordsEe/Components/Pages/Word.razor | 22 +++++++------------ .../Services/Cqs/AddSampleSentenceCommand.cs | 6 ++--- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/My1kWordsEe/Components/Pages/FavoritesPage.razor b/My1kWordsEe/Components/Pages/FavoritesPage.razor index 208e332..48dca13 100644 --- a/My1kWordsEe/Components/Pages/FavoritesPage.razor +++ b/My1kWordsEe/Components/Pages/FavoritesPage.razor @@ -46,7 +46,7 @@ foreach (var wordPair in favorites.Words) { var word = wordPair.Value; -
+
diff --git a/My1kWordsEe/Components/Pages/Word.razor b/My1kWordsEe/Components/Pages/Word.razor index 7890795..fbc1540 100644 --- a/My1kWordsEe/Components/Pages/Word.razor +++ b/My1kWordsEe/Components/Pages/Word.razor @@ -59,11 +59,6 @@ if (favorites.Result.IsSuccess) { Favorites = favorites.Result; - var favoriteWords = favorites.Result.Value.Words; - if (favoriteWords.ContainsKey(EeWord)) - { - return favoriteWords[EeWord]; - } } } @@ -114,6 +109,8 @@ private string Error => WordMetadata.Value.Error; private bool IsLoggedIn => User?.Identity?.IsAuthenticated ?? false; + + private bool IsFavorite => IsDataLoadedOk && IsLoggedIn && Favorites.HasValue && Favorites.Value.IsSuccess && Favorites.Value.Value.Words.ContainsKey(EeWord.ToLower()); }