From 52554d0d69157643ac4b6ab77e9e02aa425676cf Mon Sep 17 00:00:00 2001 From: NICK BRAIN Date: Sun, 1 Dec 2024 14:16:18 +0200 Subject: [PATCH] + list favorite sentences --- .../Components/Layout/GameComposite.razor | 14 ++++---------- My1kWordsEe/Components/Layout/SampleV2.razor | 15 ++++----------- .../Components/Pages/FavoritesPage.razor | 19 +++++++++++++++++-- .../Pages/Games/ListenToEeGamePage.razor | 8 -------- .../Pages/Games/TranslateToEnGamePage.razor | 8 -------- My1kWordsEe/wwwroot/app.css | 5 +++++ 6 files changed, 30 insertions(+), 39 deletions(-) diff --git a/My1kWordsEe/Components/Layout/GameComposite.razor b/My1kWordsEe/Components/Layout/GameComposite.razor index ed4e8514..181b6adb 100644 --- a/My1kWordsEe/Components/Layout/GameComposite.razor +++ b/My1kWordsEe/Components/Layout/GameComposite.razor @@ -16,6 +16,7 @@ { public string Title { get; set; } } + class GameCompositeModel { public Slide[] Slides { get; set; } = new Slide[] { }; @@ -24,9 +25,10 @@ public Slide CurrentSlide { get; set; } } + GameCompositeModel Game = new(); - private void OnNext() { }// Game.NextSlide(); + private void OnNext() { } // Game.NextSlide(); private void OnPrevious() { } //Game.PrevSlide(); @@ -34,9 +36,8 @@ private Task OnSubmit() { - return Task.CompletedTask; - } //=> { }; Game.CurrentSlide.Submit(CheckEnTranslationCommand); + } } @@ -49,13 +50,6 @@ }) - -

GameComposite

diff --git a/My1kWordsEe/Components/Layout/SampleV2.razor b/My1kWordsEe/Components/Layout/SampleV2.razor index df1e0873..435a1921 100644 --- a/My1kWordsEe/Components/Layout/SampleV2.razor +++ b/My1kWordsEe/Components/Layout/SampleV2.razor @@ -22,10 +22,10 @@ public required SampleSentence Sample { get; init; } [Parameter] - public required Func AddToFavorites { get; init; } + public Func? AddToFavorites { get; init; } [Parameter] - public required Func RemoveFromFavorites { get; init; } + public Func? RemoveFromFavorites { get; init; } [Parameter] public bool IsFavorite { get; init; } @@ -94,13 +94,6 @@ }; - - @@ -120,13 +113,13 @@ @if (IsLoggedIn) {
  • - @if (IsFavorite) + @if (IsFavorite && RemoveFromFavorites != null) { } - else + else if (AddToFavorites != null) {