Skip to content

Commit

Permalink
Merge pull request #296 from LiamMorrow/fix-stats-filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
LiamMorrow authored Oct 15, 2024
2 parents 3d65160 + d313e1d commit d78f44c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LiftLog.Ui/Pages/StatsPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ else if (!StatsState.Value.IsLoading && StatsState.Value.OverallView is not null
<Card class=@CardClass>
<StatGraphCardContent Title="Sessions" Statistics="overallStats.SessionStats" RenderDelay="TimeSpan.FromMilliseconds(200)"/>
</Card>
<CardList Items="@(UnpinnedExercisesToShow.IndexedTuples())">
<CardList KeySelector="context=>context.Item.ExerciseName" Items="@(UnpinnedExercisesToShow.IndexedTuples())" >
<StatGraphCardContent Title="@context.Item.ExerciseName" Statistics="[context.Item.Statistics, context.Item.OneRepMaxStatistics]" RenderDelay="TimeSpan.FromMilliseconds(200 + context.Index * 200)"/>
</CardList>
@if(SearchTerm != "" && !UnpinnedExercisesToShow.Any())
Expand Down
6 changes: 6 additions & 0 deletions LiftLog.Ui/Shared/Presentation/CardList.razor
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
@typeparam TItem

<div @attributes="AdditionalAttributes" class=" @(AdditionalAttributes?.GetValueOrDefault("class")) flex flex-col gap-2 p-2 cardlist">
@{
var index = 0;
}
@foreach (var item in Items)
{
<Card
@key="KeySelector?.Invoke(item) ?? index++"
class="@CardClass"
Type="CardType"
OnLongPress=@(OnLongPress.HasDelegate ? ()=>OnLongPress.InvokeAsync(item) : default!)
Expand All @@ -30,6 +34,8 @@

[Parameter] public Card.CardType CardType { get; set; } = Card.CardType.Outlined;

[Parameter] public Func<TItem, object>? KeySelector { get; set; }

[Parameter(CaptureUnmatchedValues = true)]
public Dictionary<string, object>? AdditionalAttributes { get; set; }
}

0 comments on commit d78f44c

Please sign in to comment.