Skip to content

Commit

Permalink
Merge pull request #162 from SSchulze1989/develop
Browse files Browse the repository at this point in the history
v 0.14.5
  • Loading branch information
SSchulze1989 authored Oct 24, 2024
2 parents 6f2e074 + f932222 commit 3ed28bc
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{
<ResultTableHeader Text="Team" Sort="@(x => x.TeamName)" />
}
<ResultTableHeader Text="RacePoints" Sort="@(x => x.RacePoints)" Direction="SortDirection.Descending" />
<ResultTableHeader Text="Points" Sort="@(x => x.RacePoints)" Direction="SortDirection.Descending" />
<ResultTableHeader Text="Penalties" Sort="@(x => x.PenaltyPoints)" />
<ResultTableHeader Text="Total Points" Sort="@(x => x.TotalPoints)" Direction="SortDirection.Descending" />
<ResultTableHeader Text="Races" Sort="@(x => x.Races)" Direction="SortDirection.Descending" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<td rowspan="2" class="py-2" width="15%">
Name
</td>
<td rowspan="2" class="py-2">
Total
</td>
@for (int i = 0; i < columnsCount; i++)
{
var @event = Events.ElementAtOrDefault(i);
Expand Down Expand Up @@ -51,6 +54,8 @@
</td>
<td rowspan="2" class="py-0">
</td>
<td rowspan="2" class="py-0">
</td>
@for (int i = 0; i < columnsCount; i++)
{
<td colspan="3" class="px-0 py-0" style="text-align: center">
Expand Down Expand Up @@ -101,6 +106,9 @@
@row.Firstname @row.Lastname
}
</td>
<td rowspan="2" class="py-0">
@(row.TotalPoints)
</td>
@foreach (var race in columns)
{
<td class="@($"col-3 py-0 {(race?.IsScored == false ? "dropped" : "")}")" colspan="3" style="text-align: center">
Expand Down
36 changes: 35 additions & 1 deletion src/iRLeagueManager.Web/Pages/Results.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@
<MudContainer MaxWidth="MaxWidth.ExtraLarge">
<LoadingHeader Loading=@Bind(vm, x => x.Loading)>
<HeaderText>
<MudText Typo="Typo.h5">Results</MudText>
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="0" Style="margin-left: -0.5em">
<MudMenu Icon="@Icons.Material.Outlined.Link" AnchorOrigin="Origin.BottomLeft">
<MudMenuItem OnClick="@(() => CopyToClipboard(GetCurrentResultLink()))">Current Result</MudMenuItem>
@if (Shared.SeasonName is not null)
{
<MudMenuItem OnClick="@(() => CopyToClipboard(GetCurrentSeasonLatestResultLink()))">Latest Result (@Shared.SeasonName)</MudMenuItem>
}
<MudMenuItem OnClick="@(() => CopyToClipboard(GetLatestResultLink()))">Latest Result (All seasons)</MudMenuItem>
</MudMenu>
<MudText Typo="Typo.h5">Results</MudText>
</MudStack>
</HeaderText>
<HeaderActions>
<EventSelect />
Expand Down Expand Up @@ -242,4 +252,28 @@
await vm.DeleteEventResults();
}
}


private string GetLatestResultLink()
{
return $"{NavigationManager.BaseUri}{LeagueName}/Results";
}

private string GetCurrentSeasonLatestResultLink()
{
if (Shared.SeasonName == null)
{
return GetLatestResultLink();
}
return $"{NavigationManager.BaseUri}{LeagueName}/Results/Seasons/{Shared.SeasonId}";
}

private string GetCurrentResultLink()
{
if (Event is null)
{
return GetCurrentSeasonLatestResultLink();
}
return $"{NavigationManager.BaseUri}{LeagueName}/Results/Events/{Event.EventId}";
}
}
35 changes: 34 additions & 1 deletion src/iRLeagueManager.Web/Pages/Reviews.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@
<MudContainer MaxWidth="MaxWidth.Large">
<LoadingHeader Loading=@Bind(ReviewsVm, x => x.Loading)>
<HeaderText>
<MudText Typo="Typo.h5">Reviews</MudText>
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="0" Style="margin-left: -0.5em">
<MudMenu Icon="@Icons.Material.Outlined.Link" AnchorOrigin="Origin.BottomLeft">
<MudMenuItem OnClick="@(() => CopyToClipboard(GetCurrentReviewLink()))">Current Race Reviews</MudMenuItem>
@if (Shared.SeasonName is not null)
{
<MudMenuItem OnClick="@(() => CopyToClipboard(GetCurrentSeasonLatestReviewLink()))">Latest Race Reviews (@Shared.SeasonName)</MudMenuItem>
}
<MudMenuItem OnClick="@(() => CopyToClipboard(GetLatestStandingsLink()))">Latest Race Reviews (All seasons)</MudMenuItem>
</MudMenu>
<MudText Typo="Typo.h5">Reviews</MudText>
</MudStack>
</HeaderText>
<HeaderActions>
<EventSelect />
Expand Down Expand Up @@ -369,4 +379,27 @@
NavigationManager.LocationChanged -= OnLocationChanged;
base.Dispose(disposing);
}

private string GetLatestStandingsLink()
{
return $"{NavigationManager.BaseUri}{LeagueName}/Reviews";
}

private string GetCurrentSeasonLatestReviewLink()
{
if (Shared.SeasonName == null)
{
return GetLatestStandingsLink();
}
return $"{NavigationManager.BaseUri}{LeagueName}/Reviews/Seasons/{Shared.SeasonId}";
}

private string GetCurrentReviewLink()
{
if (Event is null)
{
return GetCurrentSeasonLatestReviewLink();
}
return $"{NavigationManager}{LeagueName}/Reviews/Events/{Event.EventId}";
}
}
23 changes: 22 additions & 1 deletion src/iRLeagueManager.Web/Pages/Schedules.razor
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
<MudStack Spacing="2">
<LoadingHeader Loading=@Bind(vm, x => x.Loading)>
<HeaderText>
<MudText Typo="Typo.h5">Schedule</MudText>
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="0" Style="margin-left: -0.5em">
<MudMenu Icon="@Icons.Material.Outlined.Link" AnchorOrigin="Origin.BottomLeft">
<MudMenuItem OnClick="@(() => CopyToClipboard(GetCurrentScheduleLink()))">Current Schedule</MudMenuItem>
<MudMenuItem OnClick="@(() => CopyToClipboard(GetActiveScheduleLink()))">Latest Season Schedule</MudMenuItem>
</MudMenu>
<MudText Typo="Typo.h5">Schedule</MudText>
</MudStack>
</HeaderText>
</LoadingHeader>

Expand Down Expand Up @@ -49,4 +55,19 @@
{
await vm.Load();
}

private string GetActiveScheduleLink()
{
var url = $"{NavigationManager.BaseUri}{LeagueName}/Schedules";
return url;
}

private string GetCurrentScheduleLink()
{
if (SeasonId == null)
{
return GetActiveScheduleLink();
}
return $"{NavigationManager.BaseUri}{LeagueName}/Schedules/Seasons/{SeasonId}";
}
}
29 changes: 26 additions & 3 deletions src/iRLeagueManager.Web/Pages/Standings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@
<MudContainer MaxWidth="MaxWidth.ExtraLarge">
<LoadingHeader Loading=@Bind(vm, x => x.Loading)>
<HeaderText>
<MudText Typo="Typo.h5">Standings</MudText>
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="0" Style="margin-left: -0.5em">
<MudMenu Icon="@Icons.Material.Outlined.Link" AnchorOrigin="Origin.BottomLeft">
@if (Shared.SeasonName is not null)
{
<MudMenuItem OnClick="@(() => CopyToClipboard(GetCurrentSeasonLatestStandingsLink()))">Latest Standings (@Shared.SeasonName)</MudMenuItem>
}
<MudMenuItem OnClick="@(() => CopyToClipboard(GetLatestStandingsLink()))">Latest Standings (All seasons)</MudMenuItem>
</MudMenu>
<MudText Typo="Typo.h5">Standings</MudText>
</MudStack>
</HeaderText>
<HeaderActions>
<EventSelect />
Expand All @@ -41,15 +50,15 @@
@foreach ((var standing, var i) in @Bind(vm, x => x.Standings).Select((x, i) => (x, i)))
{
<MudTabPanel Text="@standing.Name">
<DisplayStanding class="px-0 mt-2 mb-2 mx-0" Standing="standing"/>
<DisplayStanding class="px-0 mt-2 mb-2 mx-0" Standing="standing" />
</MudTabPanel>
}
</MudTabs>
}
else
{
var standing = vm.Standings.First();
<DisplayStanding class="px-0 mt-2 mb-2 mx-0" Standing="standing"/>
<DisplayStanding class="px-0 mt-2 mb-2 mx-0" Standing="standing" />
}
}
</MudElement>
Expand Down Expand Up @@ -111,4 +120,18 @@
}
base.Dispose(disposing);
}

private string GetLatestStandingsLink()
{
return $"{NavigationManager.BaseUri}{LeagueName}/Results";
}

private string GetCurrentSeasonLatestStandingsLink()
{
if (Shared.SeasonName == null)
{
return GetLatestStandingsLink();
}
return $"{NavigationManager.BaseUri}{LeagueName}/Results/Seasons/{Shared.SeasonId}";
}
}
2 changes: 1 addition & 1 deletion src/iRLeagueManager.Web/Pages/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
window.clipboardCopy = {
copyText: function (text) {
navigator.clipboard.writeText(text).then(function () {
alert("Copied to clipboard!");
alert('"' + text + '"' + '\nCopied to clipboard!');
})
.catch(function (error) {
alert(error);
Expand Down
5 changes: 5 additions & 0 deletions src/iRLeagueManager.Web/Shared/LeagueComponentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,9 @@ protected string GetRoleString(params string[] roleNames)
{
return GetRoleString(Shared.LeagueName, roleNames);
}

protected async void CopyToClipboard(string text)
{
await JsRuntime.InvokeVoidAsync("clipboardCopy.copyText", text);
}
}
2 changes: 1 addition & 1 deletion 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.12.4</Version>
<Version>0.12.5</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-iRLeagueManager.Web-2B05F9DC-55A3-49D1-BD64-31507000EDF3</UserSecretsId>
Expand Down

0 comments on commit 3ed28bc

Please sign in to comment.