Finish prototype for web interface

Only unlock unlockable songs at first write
This commit is contained in:
Yuchen Ji
2022-06-21 03:40:42 +08:00
parent d3265dbc02
commit c8b8a2816e
13 changed files with 111 additions and 49 deletions
+16 -1
View File
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@@ -6,6 +6,14 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<RunAOTCompilation>False</RunAOTCompilation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<RunAOTCompilation>False</RunAOTCompilation>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GenFu" Version="1.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.4" />
@@ -17,5 +25,12 @@
<ProjectReference Include="..\SharedProject\SharedProject.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
</ItemGroup>
</Project>
+2 -21
View File
@@ -1,6 +1,7 @@
@page "/user/{CardId:long}"
@using SharedProject.models
@using SharedProject.enums
@using SharedProject.common
@inject HttpClient Client
@inject IDialogService DialogService
@inject ILogger<User> Logger
@@ -147,18 +148,6 @@ else
private bool isSavingOptions;
private static readonly ScoreGradeMap[] GRADES =
{
new(0, "E"),
new(300000, "D"),
new(500000, "C"),
new(700000, "B"),
new(800000, "A"),
new(900000, "S"),
new(950000, "S+"),
new(990000, "S++"),
};
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
@@ -186,17 +175,9 @@ else
isSavingOptions = false;
}
public record ScoreGradeMap(int Score, string Grade)
{
public override string ToString()
{
return $"{{ Score = {Score}, Grade = {Grade} }}";
}
}
private static string CalculateRating(int score)
{
var grade = GRADES.Where(g => g.Score <= score).Select(g => g.Grade).Last();
var grade = SharedConstants.GRADES.Where(g => g.Score <= score).Select(g => g.Grade).Last();
return grade;
}