Skip to content

Commit

Permalink
use common samples for now (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicklausBrain authored Nov 25, 2024
1 parent 6989093 commit 52c9fa1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion My1kWordsEe/Components/Pages/FavoritesPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
foreach (var wordPair in favorites.Words)
{
var word = wordPair.Value;
<div class="col col-12 col-sm-6">
<div class="col col-12 col-sm-6 p-1">
<Card>
<CardBody>
<CardTitle>
Expand Down
22 changes: 8 additions & 14 deletions My1kWordsEe/Components/Pages/Word.razor
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@
if (favorites.Result.IsSuccess)
{
Favorites = favorites.Result;
var favoriteWords = favorites.Result.Value.Words;
if (favoriteWords.ContainsKey(EeWord))
{
return favoriteWords[EeWord];
}
}
}

Expand Down Expand Up @@ -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());
}

<script>
Expand All @@ -128,16 +125,13 @@
<h1>
@EeWord

@if (IsDataLoadedOk && IsLoggedIn)
@if (IsFavorite)
{
@if (Favorites.Value.Value.Words.ContainsKey(EeWord.ToLower()))
{
<i role="button" class="bi bi-star-fill" @onclick="RemoveFromFavorites"></i>
}
else
{
<i role="button" class="bi bi-star" @onclick="AddToFavorites"></i>
}
<i role="button" class="bi bi-star-fill" @onclick="RemoveFromFavorites"></i>
}
else
{
<i role="button" class="bi bi-star" @onclick="AddToFavorites"></i>
}

@if (IsDataLoadedOk && Value.EeAudioUrl != null)
Expand Down
6 changes: 3 additions & 3 deletions My1kWordsEe/Services/Cqs/AddSampleSentenceCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public async Task<Result<SampleWord>> Invoke(SampleWord word)
}).ToArray()
};

await this.azureBlobService.SaveWordData(updatedWordData);

return Result.Success(updatedWordData);
return (await this.azureBlobService
.SaveWordData(updatedWordData))
.Bind(r => Result.Success(updatedWordData));
}

private Task<Result<Uri>> GenerateImage(Sentence sentence) =>
Expand Down

0 comments on commit 52c9fa1

Please sign in to comment.