1 Commits

Author SHA1 Message Date
Penry 1ac9fb7e81 Fixed Workflow Syntax 2026-06-07 21:20:26 +02:00
4 changed files with 50 additions and 58 deletions
@@ -5,7 +5,7 @@
<MudCardMedia Image="@GlobalEntity.PicturePath" Height="400" Style="object-fit: contain;"/> <MudCardMedia Image="@GlobalEntity.PicturePath" Height="400" Style="object-fit: contain;"/>
</MudPaper> </MudPaper>
<MudCardContent> <MudCardContent>
<MudText Typo="Typo.h5" Style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">@GlobalEntity.Title</MudText> <MudText Typo="Typo.h5">@GlobalEntity.Title</MudText>
</MudCardContent> </MudCardContent>
<MudCardActions> <MudCardActions>
<MudTooltip Text="Add to shared List"> <MudTooltip Text="Add to shared List">
@@ -120,9 +120,6 @@
//Picture //Picture
private IBrowserFile? _pictureFile; private IBrowserFile? _pictureFile;
private string _pictureBase64;
private string? _pictureContentType;
private string? _pictureExtension;
private class GlobalEntityFormModel private class GlobalEntityFormModel
{ {
@@ -168,11 +165,8 @@
using var ms = new MemoryStream(); using var ms = new MemoryStream();
await stream.CopyToAsync(ms); await stream.CopyToAsync(ms);
_pictureContentType = _pictureFile.ContentType; var base64 = Convert.ToBase64String(ms.ToArray());
_pictureExtension = Path.GetExtension(_pictureFile.Name); _imagePreview = $"data:{_pictureFile.ContentType};base64,{base64}";
_pictureBase64 = Convert.ToBase64String(ms.ToArray());
_imagePreview = $"data:{_pictureFile.ContentType};base64,{_pictureBase64}";
} }
private void Cancel() => MudDialog.Cancel(); private void Cancel() => MudDialog.Cancel();
@@ -197,10 +191,13 @@
try try
{ {
string fileName = $"{Guid.NewGuid()}{_pictureExtension}"; string fileName = $"{Guid.NewGuid()}{Path.GetExtension(_pictureFile.Name)}";
string picturePath = Path.Combine("wwwroot", "Pictures", fileName); string picturePath = Path.Combine("wwwroot", "Pictures", fileName);
await File.WriteAllBytesAsync(picturePath, Convert.FromBase64String(_pictureBase64)); await using (var fs = File.Create(picturePath))
{
await _pictureFile.OpenReadStream(maxAllowedSize: 10_000_000).CopyToAsync(fs);
}
var entity = new GlobalEntity var entity = new GlobalEntity
{ {
@@ -151,7 +151,7 @@
private async Task OnNewEntity(GlobalEntity entity) private async Task OnNewEntity(GlobalEntity entity)
{ {
_globalEntities.Insert(0, entity); _globalEntities.Add(entity);
await RefreshPage(); await RefreshPage();
} }
@@ -17,7 +17,7 @@
<MudStack Class="pa-3" Spacing="2"> <MudStack Class="pa-3" Spacing="2">
<!--<editor-fold desc="Options">--> <!--<editor-fold desc="Options">-->
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween"> <MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween">
<MudText Typo="Typo.h6" Style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">@PrivateEntity.GlobalEntity.Title</MudText> <MudText Typo="Typo.h6">@PrivateEntity.GlobalEntity.Title</MudText>
<MudMenu Icon="@Icons.Material.Filled.MoreVert" Color="Color.Default" Dense="true"> <MudMenu Icon="@Icons.Material.Filled.MoreVert" Color="Color.Default" Dense="true">
<MudMenuItem>Edit</MudMenuItem> <MudMenuItem>Edit</MudMenuItem>
<MudMenuItem OnClick="@(() => OnRemove.InvokeAsync())">Remove</MudMenuItem> <MudMenuItem OnClick="@(() => OnRemove.InvokeAsync())">Remove</MudMenuItem>
@@ -40,50 +40,45 @@
</MudSelect> </MudSelect>
<!--</editor-fold>--> <!--</editor-fold>-->
<!-- @if (PrivateEntity.GlobalEntity.MediaType.Name == "Series" || PrivateEntity.GlobalEntity.MediaType.Name == "Anime") --> <!--<editor-fold desc="Dropdown-Season">-->
<!--{--> <MudSelect
<!--<editor-fold desc="Dropdown-Season">--> T="int?"
<MudSelect Value="PrivateEntity.Season"
T="int?" ValueChanged="@(newSeason => OnSeasonChange.InvokeAsync(newSeason))"
Value="PrivateEntity.Season" Dense="true"
ValueChanged="@(newSeason => OnSeasonChange.InvokeAsync(newSeason))" Variant="Variant.Outlined"
Dense="true" Label="">
Variant="Variant.Outlined" @{
Label="" int? currentSeason = PrivateEntity.Season ?? 1;
Class="@(PrivateEntity.GlobalEntity.MediaType.Name == "Series" ? "" : "invisible")"> int? startOffsetSeason = currentSeason > 1 ? -1 : 0;
@{ }
int? currentSeason = PrivateEntity.Season ?? 1; @for (int? i = startOffsetSeason; i <= 5; i++)
int? startOffsetSeason = currentSeason > 1 ? -1 : 0; {
} int? season = currentSeason + i;
@for (int? i = startOffsetSeason; i <= 5; i++) <MudSelectItem Value="@season">Staffel @season</MudSelectItem>
{ }
int? season = currentSeason + i; </MudSelect>
<MudSelectItem Value="@season">Staffel @season</MudSelectItem> <!--</editor-fold>-->
}
</MudSelect>
<!--</editor-fold>-->
<!--<editor-fold desc="Dropdown-Episode">--> <!--<editor-fold desc="Dropdown-Episode">-->
<MudSelect <MudSelect
T="int?" T="int?"
Value="PrivateEntity.Episode" Value="PrivateEntity.Episode"
ValueChanged="@(newEpisode => OnEpisodeChange.InvokeAsync(newEpisode))" ValueChanged="@(newEpisode => OnEpisodeChange.InvokeAsync(newEpisode))"
Dense="true" Dense="true"
Variant="Variant.Outlined" Variant="Variant.Outlined"
Label="" Label="">
Class="@(PrivateEntity.GlobalEntity.MediaType.Name == "Series" ? "" : "invisible")"> @{
@{ int? currentEpisode = PrivateEntity.Episode ?? 1;
int? currentEpisode = PrivateEntity.Episode ?? 1; int? startOffsetEpisode = currentEpisode > 1 ? -1 : 0;
int? startOffsetEpisode = currentEpisode > 1 ? -1 : 0; }
} @for (int? i = startOffsetEpisode; i <= 5; i++)
@for (int? i = startOffsetEpisode; i <= 5; i++) {
{ int? episode = currentEpisode + i;
int? episode = currentEpisode + i; <MudSelectItem Value="@episode">Episode @episode</MudSelectItem>
<MudSelectItem Value="@episode">Episode @episode</MudSelectItem> }
} </MudSelect>
</MudSelect> <!--</editor-fold>-->
<!--</editor-fold>-->
<!--}-->
<!--<editor-fold desc="Details Button">--> <!--<editor-fold desc="Details Button">-->
<MudStack Row="true" Justify="Justify.FlexEnd"> <MudStack Row="true" Justify="Justify.FlexEnd">