Skip to content

Commit

Permalink
Merge pull request #133 from SSchulze1989/develop
Browse files Browse the repository at this point in the history
v 0.11.4
  • Loading branch information
SSchulze1989 authored Feb 20, 2024
2 parents f3feb94 + 49ce2d7 commit 1f1dc1c
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 53 deletions.
64 changes: 38 additions & 26 deletions src/iRLeagueManager.Web/Components/Results/DisplayResult.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<MudElement HtmlTag="div" Class="@Class" Style="@Style">
<MudStack Class="px-2 pt-2" AlignItems="AlignItems.Center" Row="true">
<MudText Typo="Typo.h6">@Result.SessionName</MudText>
<MudSpacer/>
<MudIconButton Icon="@Icons.Material.Filled.Info" Title="Show penalties" OnClick=ShowBonusesPenaltiesClick/>
</MudStack>
@{
<MudSpacer />
<MudIconButton Icon="@Icons.Material.Filled.Info" Title="Show penalties" OnClick=ShowBonusesPenaltiesClick />
</MudStack>
@{
var resultRows = Result.ResultRows;
var displayBonusPoints = resultRows.Any(x => x.BonusPoints != 0);
var displayStartPos = resultRows.Any(x => x.StartPosition != 0);
Expand All @@ -21,20 +21,20 @@
}
<ResultTable Data=Result.ResultRows>
<HeaderTemplate>
<ResultTableHeader Text="Pos." Sort=@(x => x.FinalPosition) Default=true/>
<ResultTableHeader Text="Pos." Sort=@(x => x.FinalPosition) Default=true />
@if (isTeamResult == false)
{
@if (displayStartPos)
{
<ResultTableHeader Text="Start" Sort=@(x => x.StartPosition) />
<ResultTableHeader Text="Start" Sort=@(x => x.StartPosition) />
}
<ResultTableHeader Text="Name" Sort="@(x => x.Firstname)" />
}
<ResultTableHeader Text="Team" Sort=@(x => x.TeamName)/>
<ResultTableHeader Text="Team" Sort=@(x => x.TeamName) />
@if (displayQualyLap)
{
<ResultTableHeader Text="Qualy Lap" Sort="@(x => x.QualifyingTime == TimeSpan.Zero ? TimeSpan.MaxValue : x.QualifyingTime)" />

}
<ResultTableHeader Text="Fastest Lap" Sort="@(x => x.FastestLapTime == TimeSpan.Zero ? TimeSpan.MaxValue : x.FastestLapTime)" />
<ResultTableHeader Text="Avg. Lap" Sort="@(x => x.AvgLapTime == TimeSpan.Zero ? TimeSpan.MaxValue : x.AvgLapTime)" />
Expand All @@ -53,13 +53,14 @@
<ResultTableHeader Text="@($"IR ({EvenStrengthOfField(Result)})")" Sort="@(x => x.OldIrating)" Direction="SortDirection.Descending" />
}
<ResultTableHeader Text="Incs." Sort="@(x => x.Incidents)" />
<th style="width: 1em"></th>
@if (CanEdit)
{
<th style="width: 1em"></th>
}
</HeaderTemplate>
<RowTemplate Context=Row>
<td class="px-2 py-2">
<td class="px-2 py-1">
<ValueChange Value=Row.FinalPosition Change=@(displayChange ? Row.FinalPositionChange : 0)>
<ValueTemplate Context=Value>
@Value.
Expand All @@ -70,14 +71,14 @@
{
@if (displayStartPos)
{
<td class="px-1 py-2">@Row.StartPosition.</td>
<td class="px-1 py-1">@Row.StartPosition.</td>
}
<td class="px-1 py-1" style="white-space: nowrap">@Row.Firstname @Row.Lastname</td>
}
<td class="px-1 py-1" style="color: @(Row.TeamColor); white-space: nowrap">@(Row.TeamName)</td>
@if (displayQualyLap)
{
<td class="px-1 py-1 @(IsFastestLap(resultRows, Row, x => x.QualifyingTime) ? "fw-bold" : "")">@Row.QualifyingTime.LapTimeString()</td>
<td class="px-1 py-1 @(IsFastestLap(resultRows, Row, x => x.QualifyingTime) ? "fw-bold" : "")">@Row.QualifyingTime.LapTimeString()</td>
}
<td class="px-1 py-1 @(IsFastestLap(resultRows, Row, x => x.FastestLapTime) ? "fw-bold" : "")">@Row.FastestLapTime.LapTimeString() @(Row.FastLapNr != 0 ? $"({Row.FastLapNr})" : "")</td>
<td class="px-1 py-1 @(IsFastestLap(resultRows, Row, x => x.AvgLapTime) ? "fw-bold" : "")">@Row.AvgLapTime.LapTimeString()</td>
Expand All @@ -95,11 +96,21 @@
<td class="px-1 py-1">@Row.TotalPoints</td>
@if (isTeamResult == false)
{
<td class="px-1 py-1">@Row.OldIrating</td>

<td class="px-1 py-1">@Row.OldIrating</td>

}
<td class="px-1 py-1">@Row.Incidents</td>
<td class="pa-0">
@if (Row.Status == RaceStatus.Disqualified)
{
<MudElement HtmlTag="div" Class="d-flex justify-center">
<MudTooltip Text="Disqualified">
<MudIcon Icon="@Icons.Material.Filled.Flag" Style="color: black;" Size="Size.Small" />
</MudTooltip>
</MudElement>
}
</td>
@if (CanEdit)
{
<td class="pa-0">
Expand All @@ -118,7 +129,7 @@
private EventListViewModel EventList { get; set; } = default!;
[Parameter, EditorRequired]
public SessionResultViewModel Result { get; set; } = default!;
[Parameter]
[Parameter]
public string Class { get; set; } = string.Empty;
[Parameter]
public string Style { get; set; } = string.Empty;
Expand Down Expand Up @@ -155,7 +166,7 @@

private async Task AddBonusPentalyClick(ResultRowModel row)
{
var parameters = new DialogParameters<EditAddPenaltyModal>()
var parameters = new DialogParameters<EditAddPenaltyDialog>()
{
{x => x.Model, new()},
{x => x.AvailableSessions, Result.EventResult?.GetModel().SessionResults ?? Array.Empty<ResultModel>()},
Expand All @@ -166,7 +177,7 @@
{x => x.IsTeamResult, isTeamResult},
};

var result = await DialogService.Show<EditAddPenaltyModal>("Add Bonus/Penalty", parameters).Result;
var result = await DialogService.Show<EditAddPenaltyDialog>("Add Bonus/Penalty", parameters).Result;
}

private Task ShowBonusesPenaltiesClick()
Expand All @@ -180,7 +191,8 @@
{
return;
}
async Task<IEnumerable<PenaltyModel>> GetPenalties() {
async Task<IEnumerable<PenaltyModel>> GetPenalties()
{
var penalties = await Result.EventResult.GetPenalties();
if (penalties.IsSuccess == false || penalties.Content is null)
{
Expand All @@ -193,19 +205,19 @@
}
return getPenalties;
}
var parameters = new DialogParameters<ShowPenaltiesModal>()
var parameters = new DialogParameters<ShowPenaltiesDialog>()
{
{x => x.GetPenalties, GetPenalties},
{x => x.CanEdit, CanEdit},
{x => x.IsTeamResult, isTeamResult},
};
var options = new DialogOptions()
{
DisableBackdropClick = false,
Position = DialogPosition.Center,
FullWidth = true,
CloseButton = true,
};
await DialogService.Show<ShowPenaltiesModal>("Bonuses/Penalties", parameters, options).Result;
{
DisableBackdropClick = false,
Position = DialogPosition.Center,
FullWidth = true,
CloseButton = true,
};
await DialogService.Show<ShowPenaltiesDialog>("Bonuses/Penalties", parameters, options).Result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<FormValidationMessage TValue=string Message=@ResultValidator?.ErrorMessage />
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">Cancel</MudButton>
<MudButton OnClick="Cancel" Color="Color.Secondary">Cancel</MudButton>
<MudButton OnClick="Submit" Color="Color.Primary">Submit</MudButton>
</DialogActions>
</MudDialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,19 @@
<MudCardContent>
<MudGrid>
<MudItem xs="6">
<MudText Typo="Typo.caption">Driver</MudText>
<MudText>@penalty.Member?.FirstName @penalty.Member?.LastName</MudText>
</MudItem>
<MudItem xs="3">
@if (string.IsNullOrWhiteSpace(penalty.Lap) == false)
@if (IsTeamResult)
{
<MudText Typo="Typo.caption">Team</MudText>
<MudText>@penalty.Team?.Name</MudText>
}
else
{
<MudText Typo="Typo.caption">Driver</MudText>
<MudText>@penalty.Member?.FirstName @penalty.Member?.LastName</MudText>
}
</MudItem>
<MudItem xs="3">
@if (string.IsNullOrWhiteSpace(penalty.Lap) == false)
{
<MudText Typo="Typo.caption">Lap</MudText>
<MudText>@penalty.Lap</MudText>
Expand Down Expand Up @@ -77,7 +85,7 @@
case { Type: PenaltyType.Disqualification }:
<MudStack Row="true" AlignItems="AlignItems.Center">
<MudText>DSQ</MudText>
<MudIcon Icon="@Icons.Material.Filled.Flag" Style="color: black;" Size="Size.Small"/>
<MudIcon Icon="@Icons.Material.Filled.Flag" Style="color: black;" Size="Size.Small" />
</MudStack>
break;
}
Expand All @@ -93,7 +101,7 @@
</MudStack>
</DialogContent>
<DialogActions>
<MudButton OnClick="@(() => DialogInstance.Close())">Close</MudButton>
<MudButton OnClick="@(() => DialogInstance.Close())" Color="Color.Secondary">Close</MudButton>
</DialogActions>
</MudDialog>

Expand Down Expand Up @@ -132,20 +140,20 @@

private string GetPenaltyColor(PenaltyModel penalty) => penalty switch
{
{ Type: PenaltyType.Points, Points: >= 0 } or { Type: PenaltyType.Position} => "red",
{ Type: PenaltyType.Points, Points: >= 0 } or { Type: PenaltyType.Position } => "red",
_ => "inherit",
};

private async Task EditAddPenaltyAsync(PenaltyModel penalty)
{
var parameters = new DialogParameters<EditAddPenaltyModal>()
var parameters = new DialogParameters<EditAddPenaltyDialog>()
{
{x => x.Model, penalty},
{x => x.CanSelectSession, false},
{x => x.CanSelectDriver, false},
{x => x.OnSubmit, async (p, ct) => await p.SaveChanges(ct)},
};
await DialogService.Show<EditAddPenaltyModal>("Edit penalty", parameters).Result;
await DialogService.Show<EditAddPenaltyDialog>("Edit penalty", parameters).Result;
}

private async Task DeleteAddPenaltyAsync(PenaltyModel penalty)
Expand Down
22 changes: 11 additions & 11 deletions src/iRLeagueManager.Web/Components/Standings/DisplayStanding.razor
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@
<ResultTableHeader Text="Incidents" Sort="@(x => x.Incidents)" />
</HeaderTemplate>
<RowTemplate Context=Row>
<td><ValueChange Value=Row.Position Change=Row.PositionChange /></td>
<td class="px-1 py-1"><ValueChange Value=Row.Position Change=Row.PositionChange /></td>
@if (showDriver)
{
<td>@Row.Firstname @Row.Lastname</td>
<td class="px-1 py-1">@Row.Firstname @Row.Lastname</td>
}
@if (hasTeam)
{
<td style="color:@Row.TeamColor">@Row.TeamName</td>
<td class="px-1 py-1" style="color:@Row.TeamColor">@Row.TeamName</td>
}
<td><ValueChange Value=Row.RacePoints Change=Row.RacePointsChange /></td>
<td style="@(@Row.PenaltyPoints != 0 ? "color:red" : "")">
<td class="px-1 py-1"><ValueChange Value=Row.RacePoints Change=Row.RacePointsChange /></td>
<td class="px-1 py-1" style="@(@Row.PenaltyPoints != 0 ? "color:red" : "")">
@(Row.PenaltyPoints != 0 ? "-" : "")@Row.PenaltyPoints
</td>
<td><ValueChange Value=Row.TotalPoints Change=Row.TotalPointsChange /></td>
<td>
<td class="px-1 py-1"><ValueChange Value=Row.TotalPoints Change=Row.TotalPointsChange /></td>
<td class="px-1 py-1">
@Row.RacesCounted@(Row.RacesCounted != Row.Races ? $" ({Row.Races})" : "")
</td>
<td><ValueChange Value=Row.PolePositions Change=Row.PolePositionsChange /></td>
<td><ValueChange Value=Row.Wins Change=Row.WinsChange /></td>
<td>@Row.Top3</td>
<td>@Row.Incidents</td>
<td class="px-1 py-1"><ValueChange Value=Row.PolePositions Change=Row.PolePositionsChange /></td>
<td class="px-1 py-1"><ValueChange Value=Row.Wins Change=Row.WinsChange /></td>
<td class="px-1 py-1">@Row.Top3</td>
<td class="px-1 py-1">@Row.Incidents</td>
</RowTemplate>
</ResultTable>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/iRLeagueManager.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
}
},
"AllowedHosts": "*",
"APIServer": "http://localhost:5000",
//"APIServer": "https://irleaguemanager.net/api/",
//"APIServer": "http://localhost:5000",
"APIServer": "https://irleaguemanager.net/api/",
"DefaultUser": "testuser",
"DefaultPassword": "TestPass123!"
}
6 changes: 3 additions & 3 deletions src/iRLeagueManager.Web/iRLeagueManager.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Version>0.11.3</Version>
<Version>0.11.4</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-iRLeagueManager.Web-2B05F9DC-55A3-49D1-BD64-31507000EDF3</UserSecretsId>
Expand Down Expand Up @@ -137,7 +137,7 @@

<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="HtmlSanitizer" Version="8.0.811" />
<PackageReference Include="HtmlSanitizer" Version="8.0.843" />
<PackageReference Include="iRLeagueApiCore.Client" Version="0.11.2" />
<PackageReference Include="iRLeagueApiCore.Common" Version="0.11.0" />
<PackageReference Include="Markdig" Version="0.31.0" />
Expand All @@ -146,7 +146,7 @@
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.3" />
<PackageReference Include="MudBlazor" Version="6.15.0" />
<PackageReference Include="MudBlazor" Version="6.16.0" />
<PackageReference Include="MvvmBlazor" Version="6.0.6" />
</ItemGroup>

Expand Down

0 comments on commit 1f1dc1c

Please sign in to comment.