diff --git a/android/app/src/androidTest/java/com/pksx/app/ControllerNavigationTest.java b/android/app/src/androidTest/java/com/pksx/app/ControllerNavigationTest.java index 7a211925..e9a407c5 100644 --- a/android/app/src/androidTest/java/com/pksx/app/ControllerNavigationTest.java +++ b/android/app/src/androidTest/java/com/pksx/app/ControllerNavigationTest.java @@ -468,6 +468,10 @@ public void controllerHighlightSurvivesRepeatedMainMenuNavigation() throws Excep KeyEvent.KEYCODE_DPAD_DOWN, controllerHighlightExpression("main-menu-entry-1") ); + pressGamepadKey( + KeyEvent.KEYCODE_DPAD_DOWN, + controllerHighlightExpression("main-menu-entry-2") + ); pressGamepadKey( KeyEvent.KEYCODE_BUTTON_A, "location.pathname.endsWith('/trainer')" diff --git a/engine/Pksx.Pkhex.Engine/EngineContracts.cs b/engine/Pksx.Pkhex.Engine/EngineContracts.cs index ea7a62c6..0e82e929 100644 --- a/engine/Pksx.Pkhex.Engine/EngineContracts.cs +++ b/engine/Pksx.Pkhex.Engine/EngineContracts.cs @@ -58,6 +58,7 @@ public static SaveSummary From(SaveFile save, string? fileName) => public sealed record PartySlotSummary( int Slot, ushort SpeciesId, + string SpeciesName, byte Form, byte Format, int Level, @@ -92,6 +93,7 @@ public static PartySlotSummary From(PKM pokemon, SaveFile save, int slot) => new( slot, pokemon.Species, + SlotDetailProjection.SpeciesName(pokemon), pokemon.Form, pokemon.Format, pokemon.Species == 0 ? 0 : pokemon.CurrentLevel, @@ -127,6 +129,7 @@ public sealed record BoxSlotSummary( int Box, int Slot, ushort SpeciesId, + string SpeciesName, byte Form, byte Format, int Level, @@ -162,6 +165,7 @@ public static BoxSlotSummary From(PKM pokemon, SaveFile save, int box, int slot) box, slot, pokemon.Species, + SlotDetailProjection.SpeciesName(pokemon), pokemon.Form, pokemon.Format, pokemon.Species == 0 ? 0 : pokemon.CurrentLevel, @@ -874,6 +878,11 @@ internal static class SlotDetailProjection 0.16, 0.15, 0.17, 0.16, 0.20, 0.07, 0.21, 0.05, 0.11 ]; + public static string SpeciesName(PKM pokemon) => SpeciesName(pokemon.Species); + + public static string SpeciesName(ushort speciesId) => + speciesId == 0 ? "" : NameAt(GameInfo.Strings.Species, speciesId) ?? $"Species {speciesId}"; + public static string? Gender(PKM pokemon) => pokemon.Species == 0 ? null : pokemon.Gender switch { diff --git a/src/lib/components/pksx/MainMenu.svelte b/src/lib/components/pksx/MainMenu.svelte index ad270200..a10c7824 100644 --- a/src/lib/components/pksx/MainMenu.svelte +++ b/src/lib/components/pksx/MainMenu.svelte @@ -2,7 +2,7 @@ export const MAIN_MENU_SEARCH_INSERTION_INDEX = 1; export type MainMenuEntry = { - key: 'boxes' | 'trainer' | 'bag' | 'saves' | 'settings' | 'backup-browser'; + key: 'boxes' | 'search' | 'trainer' | 'bag' | 'saves' | 'settings' | 'backup-browser'; label: string; description: string; }; @@ -13,7 +13,7 @@ interface Props { entries: MainMenuEntry[]; - activeDestination: Exclude; + activeDestination: Exclude; activeIndex: number; onFocusEntry: (index: number) => void; onSelectEntry: (entry: MainMenuEntry) => void; diff --git a/src/lib/components/pksx/QuickSearch.svelte b/src/lib/components/pksx/QuickSearch.svelte new file mode 100644 index 00000000..a1a1329d --- /dev/null +++ b/src/lib/components/pksx/QuickSearch.svelte @@ -0,0 +1,347 @@ + + + + + + + + + diff --git a/src/lib/components/pksx/TakeoverFrame.svelte b/src/lib/components/pksx/TakeoverFrame.svelte index dd47595c..93d5f77f 100644 --- a/src/lib/components/pksx/TakeoverFrame.svelte +++ b/src/lib/components/pksx/TakeoverFrame.svelte @@ -6,11 +6,21 @@ labelledby: string; describedby?: string; busy?: boolean; + variant?: 'takeover' | 'command'; + commandRows?: number; onBack: () => void; children: Snippet; } - let { labelledby, describedby, busy = false, onBack, children }: Props = $props(); + let { + labelledby, + describedby, + busy = false, + variant = 'takeover', + commandRows = 1, + onBack, + children + }: Props = $props(); const fade = layerFade('.takeover-backdrop'); const settle = panelSettle( @@ -30,9 +40,11 @@ in:fade|global out:fade|global > -
+