Skip to content

Commit

Permalink
Move Hidden Power dropdown to own component
Browse files Browse the repository at this point in the history
  • Loading branch information
codemonkey85 committed Nov 19, 2024
1 parent 0f4d1b6 commit 4743eec
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 65 deletions.
39 changes: 39 additions & 0 deletions Pkmds.Web/Components/EditForms/HiddenPowerChooser.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@if (Pokemon is not null)
{
<MudStack Spacing="1">
<MudAlert Severity="@MudBlazor.Severity.Info">
Changing Hidden Power type might change the IVs of the Pokémon.
</MudAlert>
<MudStack Row
AlignItems="@AlignItems.Center">
<MudSelect Label="Hidden Power Type"
Variant="@Variant.Outlined"
@bind-Value="@Pokemon.HPType">
@foreach (var type in Util.GetCBList(GameInfo.Strings.Types.ToArray().AsSpan(1, 16)).DistinctBy(type => type.Value))
{
<MudSelectItem Value="@type.Value"
@key="@type.Value">
<MudStack Row>
<MudImage Src="@SpriteHelper.GetTypeSquareSpriteFileName(type.Value + 1)"
Alt="@GameInfo.Strings.Types[type.Value + 1]"
title="@GameInfo.Strings.Types[type.Value + 1]"
ObjectFit="@ObjectFit.Contain"
ObjectPosition="@ObjectPosition.Center"
Width="30" />
<MudText>
@type.Text
</MudText>
</MudStack>
</MudSelectItem>
}
</MudSelect>
<MudText>
@Pokemon.HPPower
</MudText>
</MudStack>
</MudStack>
}

@code {
[Parameter] public PKM? Pokemon { get; set; }
}
33 changes: 1 addition & 32 deletions Pkmds.Web/Components/EditForms/Tabs/MovesTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -107,38 +107,7 @@ AppState.SelectedSlotsAreValid)

@if (GameInfo.FilteredSources.Moves.Any(m => m.Value == (int)Move.HiddenPower) && Pokemon is not { Context: EntityContext.Gen8 or EntityContext.Gen9 })
{
<MudStack Spacing="1">
<MudAlert Severity="@MudBlazor.Severity.Info">
Changing Hidden Power type might change the IVs of the Pokémon.
</MudAlert>
<MudStack Row
AlignItems="@AlignItems.Center">
<MudSelect Label="Hidden Power Type"
Variant="@Variant.Outlined"
@bind-Value="@Pokemon.HPType">
@foreach (var type in Util.GetCBList(GameInfo.Strings.Types.ToArray().AsSpan(1, 16)).DistinctBy(type => type.Value))
{
<MudSelectItem Value="@type.Value"
@key="@type.Value">
<MudStack Row>
<MudImage Src="@SpriteHelper.GetTypeSquareSpriteFileName(type.Value + 1)"
Alt="@GameInfo.Strings.Types[type.Value + 1]"
title="@GameInfo.Strings.Types[type.Value + 1]"
ObjectFit="@ObjectFit.Contain"
ObjectPosition="@ObjectPosition.Center"
Width="30" />
<MudText>
@type.Text
</MudText>
</MudStack>
</MudSelectItem>
}
</MudSelect>
<MudText>
@Pokemon.HPPower
</MudText>
</MudStack>
</MudStack>
<HiddenPowerChooser Pokemon="@Pokemon" />
}

</MudStack>
Expand Down
33 changes: 1 addition & 32 deletions Pkmds.Web/Components/EditForms/Tabs/StatsTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -598,38 +598,7 @@ AppState.SelectedSlotsAreValid)

@if (GameInfo.FilteredSources.Moves.Any(m => m.Value == (int)Move.HiddenPower) && Pokemon is not { Context: EntityContext.Gen8 or EntityContext.Gen9 })
{
<MudStack Spacing="1">
<MudAlert Severity="@MudBlazor.Severity.Info">
Changing Hidden Power type might change the IVs of the Pokémon.
</MudAlert>
<MudStack Row
AlignItems="@AlignItems.Center">
<MudSelect Label="Hidden Power Type"
Variant="@Variant.Outlined"
@bind-Value="@Pokemon.HPType">
@foreach (var type in Util.GetCBList(GameInfo.Strings.Types.ToArray().AsSpan(1, 16)).DistinctBy(type => type.Value))
{
<MudSelectItem Value="@type.Value"
@key="@type.Value">
<MudStack Row>
<MudImage Src="@SpriteHelper.GetTypeSquareSpriteFileName(type.Value + 1)"
Alt="@GameInfo.Strings.Types[type.Value + 1]"
title="@GameInfo.Strings.Types[type.Value + 1]"
ObjectFit="@ObjectFit.Contain"
ObjectPosition="@ObjectPosition.Center"
Width="30" />
<MudText>
@type.Text
</MudText>
</MudStack>
</MudSelectItem>
}
</MudSelect>
<MudText>
@Pokemon.HPPower
</MudText>
</MudStack>
</MudStack>
<HiddenPowerChooser Pokemon="@Pokemon"/>
}

@if (saveGeneration >= 4)
Expand Down
2 changes: 1 addition & 1 deletion Pkmds.sln
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# 17
# Visual Studio Version 17
VisualStudioVersion = 17.10.34902.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4C388A5C-FFB8-4330-A263-64B6CA1B2496}"
Expand Down

0 comments on commit 4743eec

Please sign in to comment.