From 4330b5382414fc814224a7e1c8dde58f725705e4 Mon Sep 17 00:00:00 2001 From: troogs Date: Tue, 21 Apr 2026 22:24:58 +0200 Subject: [PATCH] Enhance InteractionRow and ProspectContainer: refactor layout to use grid, improve styling, and add interaction handling --- .../Controls/InteractionRow.razor | 91 +++++++++++-------- .../Controls/InteractionRow.razor.cs | 9 ++ .../Controls/ProspectContainer.razor | 21 +---- .../Controls/ProspectContainer.razor.scss | 15 +++ 4 files changed, 79 insertions(+), 57 deletions(-) diff --git a/FoodsharingSiegen.Server/Controls/InteractionRow.razor b/FoodsharingSiegen.Server/Controls/InteractionRow.razor index 8f3d7f9..76a2026 100644 --- a/FoodsharingSiegen.Server/Controls/InteractionRow.razor +++ b/FoodsharingSiegen.Server/Controls/InteractionRow.razor @@ -5,52 +5,63 @@ @inherits FsBase @{ + var colorClass = ""; + if(Done) colorClass = "interaction--color-done"; + var rowClass = ""; if (Done) rowClass += " done"; if (NotNeeded) rowClass += " notneeded"; if (Alert) rowClass += " fs-alert"; } - - - - - @Type.Translate(AppSettings): - - @if (Interactions.Count > 0) - { - foreach (var interaction in Interactions) +@if(!AllowInteraction || Prospect is {Complete: true }) +{ + +} +else +{ + @if(Interactions.Count == 0 || Multiple) + { + if (Multiple) ButtonIconClass = "fa-solid fa-plus"; + + } else { + + } +} + +
+
@Type.Translate(AppSettings)
+ + @if(Interactions.Count > 0) + { + (@Interactions.First().User.Name @Interactions.First().Date.ToShortDateString()) + } +
+ +@if(Multiple && Interactions.Count > 0) +{ + + @foreach (var interaction in Interactions) + { +
+ @if ((Prospect is not { Complete: true } || interaction.Type == InteractionType.Complete) && AllowInteraction) { -
-
- @interaction.User.Name (@interaction.Date.ToShortDateString()) - - @if ((Prospect is not { Complete: true } || interaction.Type == InteractionType.Complete) && AllowInteraction) - { -   - } -
- -
- @FeedbackBuilder(interaction) -
- -
- @if (!string.IsNullOrWhiteSpace(interaction.FeedbackInfo)) - { - (@interaction.FeedbackInfo) - } -
-
+ + } else { + } - } - - @if (Prospect is not {Complete: true } && (Interactions.Count == 0 || Multiple) && AllowInteraction) - { - if (Multiple) ButtonIconClass = "fa-solid fa-plus"; -
- +
+
+
+ @interaction.User.Name (@interaction.Date.ToShortDateString()) + @if (!string.IsNullOrWhiteSpace(interaction.FeedbackInfo)) + { + (@interaction.FeedbackInfo) + }
- } - - \ No newline at end of file + @FeedbackBuilder(interaction) +
+ } +} \ No newline at end of file diff --git a/FoodsharingSiegen.Server/Controls/InteractionRow.razor.cs b/FoodsharingSiegen.Server/Controls/InteractionRow.razor.cs index b144d37..e7d6f44 100644 --- a/FoodsharingSiegen.Server/Controls/InteractionRow.razor.cs +++ b/FoodsharingSiegen.Server/Controls/InteractionRow.razor.cs @@ -94,6 +94,15 @@ namespace FoodsharingSiegen.Server.Controls #endregion + private async Task RemoveFirstAsync(InteractionType type) + { + if (Prospect != null && RemoveClick != null) + { + var interaction = Interactions.FirstOrDefault(x => x.Type == type); + if (interaction != null) await RemoveClick(interaction.Id); + } + } + private MarkupString FeedbackBuilder(Interaction interaction) { var infoList = new List(); diff --git a/FoodsharingSiegen.Server/Controls/ProspectContainer.razor b/FoodsharingSiegen.Server/Controls/ProspectContainer.razor index 77c23e6..b644c87 100644 --- a/FoodsharingSiegen.Server/Controls/ProspectContainer.razor +++ b/FoodsharingSiegen.Server/Controls/ProspectContainer.razor @@ -51,8 +51,7 @@ } - - +
-
- - - @if (!AppSettings.DisableStepIn) { - - - - } - -
-
-
-
-
+
@if(Prospect?.Images?.Count > 0) - {
+ { +
-Prüfung möglich
} diff --git a/FoodsharingSiegen.Server/Controls/ProspectContainer.razor.scss b/FoodsharingSiegen.Server/Controls/ProspectContainer.razor.scss index 36b8a85..c631c5f 100644 --- a/FoodsharingSiegen.Server/Controls/ProspectContainer.razor.scss +++ b/FoodsharingSiegen.Server/Controls/ProspectContainer.razor.scss @@ -54,4 +54,19 @@ i.link { &:hover { color: #000; } +} + +.interaction-grid { + display: grid; + grid-template-columns: auto 1fr; + align-items: center; + gap: .5rem; + + ::deep .interaction { + &--color { + &-done{ + color: #64ae24; + } + } + } } \ No newline at end of file