Fixed a bunch of warnings

This commit is contained in:
Andre Beging
2022-05-31 15:08:55 +02:00
parent cd22c2f215
commit 7208f1e86d
21 changed files with 202 additions and 140 deletions

View File

@@ -1,46 +1,5 @@
@using FoodsharingSiegen.Contracts.Entity
@code {
[Parameter]
public Prospect Prospect { get; set; }
[Parameter]
public InteractionType Type { get; set; }
[Parameter]
public EventCallback AddClick { get; set; }
[Parameter]
public EventCallback<Guid> RemoveClick { get; set; }
[Parameter]
public string Caption { get; set; }
[Parameter]
public string ButtonText { get; set; }
[Parameter]
public string IconClass { get; set; }
[Parameter]
public bool Multiple { get; set; }
[Parameter]
public int Minimum { get; set; } = 1;
[Parameter]
public bool AllowAddInteraction { get; set; }
private List<Interaction> Interactions => Prospect?.Interactions?.Where(x => x.Type == Type).ToList() ?? new List<Interaction>();
private bool Done => Interactions.Count >= Minimum;
private bool NotNeeded => Interactions.Any(x => x.NotNeeded);
private bool Alert => Interactions.Any(x => x.Alert);
}
@{
var rowClass = "";
if (Done) rowClass += " done";
@@ -65,7 +24,7 @@
<span>(<i>@interaction.Info</i>)</span>
}
@if ((!Prospect.Complete || interaction.Type == InteractionType.Complete) && AllowAddInteraction)
@if ((Prospect is not {Complete: true } || interaction.Type == InteractionType.Complete) && AllowAddInteraction)
{
<span>&nbsp;<a href=""><i class="fa-solid fa-square-xmark" @onclick="async () => await RemoveClick.InvokeAsync(interaction.Id)" @onclick:preventDefault></i></a></span>
}
@@ -74,7 +33,7 @@
}
}
@if (!Prospect.Complete && (Interactions.Count == 0 || Multiple) && AllowAddInteraction)
@if (Prospect is not {Complete: true } && (Interactions.Count == 0 || Multiple) && AllowAddInteraction)
{
if (Multiple) ButtonText = "+";
<Button Size="Size.Small" Clicked="AddClick">@ButtonText</Button>