diff --git a/.github/workflows/buildandtest.yml b/.github/workflows/buildandtest.yml
index b0c47fc3..2576b3c4 100644
--- a/.github/workflows/buildandtest.yml
+++ b/.github/workflows/buildandtest.yml
@@ -14,6 +14,7 @@ on:
- '**/*.yml'
pull_request:
branches: [ main ]
+ types: [opened, synchronize, reopened] # Only run when PR is created or updated
jobs:
build:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index f736aed2..766b4f16 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -60,7 +60,7 @@ jobs:
replacements: '%%CACHE_VERSION%%=${{ github.run_id }}'
- name: Commit wwwroot to GitHub Pages
- uses: JamesIves/github-pages-deploy-action@v4.7.2
+ uses: JamesIves/github-pages-deploy-action@v4.7.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
diff --git a/Pkmds.Web/Components/EditForms/PokemonEditForm.razor.cs b/Pkmds.Web/Components/EditForms/PokemonEditForm.razor.cs
index 7e92224a..7d7f85f8 100644
--- a/Pkmds.Web/Components/EditForms/PokemonEditForm.razor.cs
+++ b/Pkmds.Web/Components/EditForms/PokemonEditForm.razor.cs
@@ -44,13 +44,15 @@ void OnDeleteConfirm(bool confirmed)
return;
}
- if (AppState.SelectedPartySlotNumber is not null)
+ var selectedPokemonType = AppService.GetSelectedPokemonSlot(out var partySlot, out var boxNumber, out var boxSlot);
+ switch (selectedPokemonType)
{
- AppService.DeletePokemon(AppState.SelectedPartySlotNumber.Value);
- }
- else if (AppState.SelectedBoxNumber is not null && AppState.SelectedBoxSlotNumber is not null)
- {
- AppService.DeletePokemon(AppState.SelectedBoxNumber.Value, AppState.SelectedBoxSlotNumber.Value);
+ case Services.AppService.SelectedPokemonType.Party:
+ AppService.DeletePokemon(partySlot);
+ break;
+ case Services.AppService.SelectedPokemonType.Box:
+ AppService.DeletePokemon(boxNumber, boxSlot);
+ break;
}
}
}
@@ -90,7 +92,7 @@ void ShowPasteConfirmation()
{ nameof(ConfirmActionDialog.Title), "Paste Pokémon" },
{ nameof(ConfirmActionDialog.Message), "Are you sure you want to paste the copied Pokémon? The Pokémon in the selected slot will be replaced." },
{ nameof(ConfirmActionDialog.ConfirmText), "Paste" },
- { nameof(ConfirmActionDialog.ConfirmIcon), Icons.Material.Filled.Delete },
+ { nameof(ConfirmActionDialog.ConfirmIcon), Icons.Material.Filled.ContentPaste },
{ nameof(ConfirmActionDialog.ConfirmColor), Color.Default },
{ nameof(ConfirmActionDialog.CancelText), "Cancel" },
{ nameof(ConfirmActionDialog.CancelIcon), Icons.Material.Filled.Clear },
@@ -118,6 +120,18 @@ void PastePokemon()
{
Pokemon = AppState.CopiedPokemon.Clone();
AppService.SavePokemon(Pokemon);
+
+ var selectedPokemonType = AppService.GetSelectedPokemonSlot(out var partySlot, out var boxNumber, out var boxSlot);
+ switch (selectedPokemonType)
+ {
+ case Services.AppService.SelectedPokemonType.Party:
+ AppService.SetSelectedPartyPokemon(Pokemon, partySlot);
+ break;
+ case Services.AppService.SelectedPokemonType.Box:
+ AppService.SetSelectedBoxPokemon(Pokemon, boxNumber, boxSlot);
+ break;
+ }
+
Snackbar.Add("The copied Pokémon has been pasted.");
}
}
diff --git a/Pkmds.Web/Components/Layout/MainLayout.razor b/Pkmds.Web/Components/Layout/MainLayout.razor
index 39815463..b9f34b08 100644
--- a/Pkmds.Web/Components/Layout/MainLayout.razor
+++ b/Pkmds.Web/Components/Layout/MainLayout.razor
@@ -13,17 +13,17 @@
Edge="@Edge.Start"
OnClick="@DrawerToggle"/>
+ Class="d-none d-lg-flex">
@Constants.AppTitle
+ Class="d-none d-md-flex d-lg-none">
@(AppService.IsDrawerOpen
? Constants.AppShortTitle
: Constants.AppTitle)
+ Class="d-xs-flex d-md-none">
@Constants.AppShortTitle
@@ -35,18 +35,18 @@
: "Light")"/>
Source code on GitHub
diff --git a/Pkmds.Web/Components/Layout/MainLayout.razor.cs b/Pkmds.Web/Components/Layout/MainLayout.razor.cs
index b244c605..3d0c58d7 100644
--- a/Pkmds.Web/Components/Layout/MainLayout.razor.cs
+++ b/Pkmds.Web/Components/Layout/MainLayout.razor.cs
@@ -5,6 +5,11 @@ public partial class MainLayout : IDisposable
private bool isDarkMode;
private MudThemeProvider? mudThemeProvider;
+ [StringSyntax(StringSyntaxAttribute.Uri)]
+ private const string GitHubRepoLink = "https://github.com/codemonkey85/PKMDS-Blazor";
+
+ private const string GitHubTooltip = "Source code on GitHub";
+
protected override void OnInitialized() => RefreshService.OnAppStateChanged += StateHasChanged;
public void Dispose() => RefreshService.OnAppStateChanged -= StateHasChanged;
diff --git a/Pkmds.Web/GlobalUsings.cs b/Pkmds.Web/GlobalUsings.cs
index 9bde9f09..0ec0ac81 100644
--- a/Pkmds.Web/GlobalUsings.cs
+++ b/Pkmds.Web/GlobalUsings.cs
@@ -1,5 +1,6 @@
global using System.Collections.Generic;
global using System.Collections.ObjectModel;
+global using System.Diagnostics.CodeAnalysis;
global using System.Globalization;
global using System.Linq.Expressions;
global using System.Net;
@@ -19,3 +20,4 @@
global using Pkmds.Web.Components.Dialogs;
global using Pkmds.Web.Extensions;
global using Pkmds.Web.Services;
+global using static Pkmds.Web.Services.AppService;
diff --git a/Pkmds.Web/Services/AppService.cs b/Pkmds.Web/Services/AppService.cs
index ad242ddf..52482800 100644
--- a/Pkmds.Web/Services/AppService.cs
+++ b/Pkmds.Web/Services/AppService.cs
@@ -143,30 +143,29 @@ public void SavePokemon(PKM? pokemon)
return;
}
- if (AppState.SelectedPartySlotNumber is not null)
+ var selectedPokemonType = GetSelectedPokemonSlot(out var partySlot, out var boxNumber, out var boxSlot);
+ switch (selectedPokemonType)
{
- AppState.SaveFile.SetPartySlotAtIndex(pokemon, AppState.SelectedPartySlotNumber.Value);
-
- if (AppState.SaveFile is SAV7b)
- {
+ case SelectedPokemonType.Party:
+ AppState.SaveFile.SetPartySlotAtIndex(pokemon, partySlot);
+
+ if (AppState.SaveFile is SAV7b)
+ {
+ RefreshService.RefreshBoxAndPartyState();
+ }
+ else
+ {
+ RefreshService.RefreshPartyState();
+ }
+ break;
+ case SelectedPokemonType.Box:
+ AppState.SaveFile.SetBoxSlotAtIndex(pokemon, boxNumber, boxSlot);
+ RefreshService.RefreshBoxState();
+ break;
+ case SelectedPokemonType.None when AppState.SaveFile is SAV7b:
+ AppState.SaveFile.SetBoxSlotAtIndex(pokemon, boxSlot);
RefreshService.RefreshBoxAndPartyState();
- }
- else
- {
- RefreshService.RefreshPartyState();
- }
- }
- else if (AppState.SelectedBoxNumber is not null && AppState.SelectedBoxSlotNumber is not null)
- {
- AppState.SaveFile.SetBoxSlotAtIndex(pokemon, AppState.SelectedBoxNumber.Value,
- AppState.SelectedBoxSlotNumber.Value);
- RefreshService.RefreshBoxState();
- }
- else if (AppState.SelectedBoxNumber is null && AppState.SelectedBoxSlotNumber is not null &&
- AppState.SaveFile is SAV7b)
- {
- AppState.SaveFile.SetBoxSlotAtIndex(pokemon, AppState.SelectedBoxSlotNumber.Value);
- RefreshService.RefreshBoxAndPartyState();
+ break;
}
}
@@ -302,4 +301,27 @@ private void HandleNullOrEmptyPokemon()
EditFormPokemon.Version = saveFile.Version.GetSingleVersion();
}
}
+
+ public SelectedPokemonType GetSelectedPokemonSlot(out int partySlot, out int boxNumber, out int boxSlot)
+ {
+ const int defaultValue = -1;
+
+ partySlot = AppState.SelectedPartySlotNumber ?? defaultValue;
+ boxNumber = AppState.SelectedBoxNumber ?? defaultValue;
+ boxSlot = AppState.SelectedBoxSlotNumber ?? defaultValue;
+
+ return (partySlot, boxNumber, boxSlot) switch
+ {
+ (not defaultValue, defaultValue, defaultValue) => SelectedPokemonType.Party,
+ (defaultValue, not defaultValue, not defaultValue) => SelectedPokemonType.Box,
+ _ => SelectedPokemonType.None,
+ };
+ }
+
+ public enum SelectedPokemonType
+ {
+ None,
+ Party,
+ Box
+ }
}
diff --git a/Pkmds.Web/Services/IAppService.cs b/Pkmds.Web/Services/IAppService.cs
index 6d174092..6a24a634 100644
--- a/Pkmds.Web/Services/IAppService.cs
+++ b/Pkmds.Web/Services/IAppService.cs
@@ -44,7 +44,7 @@ ComboItem GetMetLocationComboItem(ushort metLocationId, GameVersion gameVersion,
ComboItem GetMoveComboItem(int moveId);
- public void SavePokemon(PKM? selectedPokemon);
+ void SavePokemon(PKM? selectedPokemon);
string GetCleanFileName(PKM pkm);
@@ -59,4 +59,6 @@ ComboItem GetMetLocationComboItem(ushort metLocationId, GameVersion gameVersion,
string ExportPartyAsShowdown();
string GetIdFormatString(bool isSid = false);
+
+ SelectedPokemonType GetSelectedPokemonSlot(out int partySlot, out int boxNumber, out int boxSlot);
}
diff --git a/global.json b/global.json
index 74d7e272..893b572b 100644
--- a/global.json
+++ b/global.json
@@ -2,6 +2,6 @@
"sdk": {
"allowPrerelease": false,
"rollForward": "latestMinor",
- "version": "9.0.103"
+ "version": "9.0.200"
}
}