Skip to content

Commit

Permalink
Fix setting Nature on stats tab as well
Browse files Browse the repository at this point in the history
  • Loading branch information
codemonkey85 committed Mar 17, 2024
1 parent d1a16af commit c21fc6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Pkmds.Web/Components/EditForms/Tabs/StatsTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ EntityContext.MaxInvalid &&
<MudSelect Label="Nature"
T="@Nature"
Variant="@Variant.Outlined"
@bind-Value="@Pokemon.Nature"
@bind-Value:after="@(() => AppService.LoadPokemonStats(Pokemon))"
@bind-Value:get="@Pokemon.Nature"
@bind-Value:set="@OnNatureSet"
For="@(() => Pokemon.Nature)">
@foreach (var nature in GameInfo.FilteredSources.Natures)
{
Expand Down
11 changes: 11 additions & 0 deletions Pkmds.Web/Components/EditForms/Tabs/StatsTab.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,15 @@ public string GetCharacteristic(PKM? pokemon) =>
characteristicIndex < characteristics.Length
? characteristics[characteristicIndex]
: string.Empty;

private void OnNatureSet(Nature nature)
{
if (Pokemon is null)
{
return;
}

Pokemon.SetNature(nature);
AppService.LoadPokemonStats(Pokemon);
}
}

0 comments on commit c21fc6c

Please sign in to comment.