From 0579fc451f48795aa41f7253cb17592aa669ed31 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 5 May 2024 13:38:54 -0400 Subject: [PATCH] feat: add support for guarding_pokemon_display --- packages/types/lib/scanner.d.ts | 12 ++++++++++++ server/src/graphql/typeDefs/scanner.graphql | 1 + server/src/models/Gym.js | 1 + src/features/gym/GymPopup.jsx | 14 +++++++++++++- src/services/queries/gym.js | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/types/lib/scanner.d.ts b/packages/types/lib/scanner.d.ts index f6c2216a4..89b51563f 100644 --- a/packages/types/lib/scanner.d.ts +++ b/packages/types/lib/scanner.d.ts @@ -28,6 +28,17 @@ export interface Device { export type FullDevice = FullModel +export interface PokemonDisplay { + form: number + costume: number + gender: number + shiny: boolean + temp_evolution: number + alignment: number + badge: number + location_card: number +} + export interface Gym { id: string lat: number @@ -41,6 +52,7 @@ export interface Gym { raid_pokemon_id: number updated: number guarding_pokemon_id: number + guarding_pokemon_display: PokemonDisplay available_slots: number team_id: number raid_level: number diff --git a/server/src/graphql/typeDefs/scanner.graphql b/server/src/graphql/typeDefs/scanner.graphql index 1fff195a7..bb9a8ecc9 100644 --- a/server/src/graphql/typeDefs/scanner.graphql +++ b/server/src/graphql/typeDefs/scanner.graphql @@ -23,6 +23,7 @@ type Gym { raid_pokemon_id: Int updated: Int guarding_pokemon_id: Int + guarding_pokemon_display: JSON available_slots: Int team_id: Int raid_level: Int diff --git a/server/src/models/Gym.js b/server/src/models/Gym.js index f05089286..2638608e1 100644 --- a/server/src/models/Gym.js +++ b/server/src/models/Gym.js @@ -28,6 +28,7 @@ const gymFields = [ 'team_id', 'in_battle', 'guarding_pokemon_id', + 'guarding_pokemon_display', 'total_cp', 'power_up_points', 'power_up_level', diff --git a/src/features/gym/GymPopup.jsx b/src/features/gym/GymPopup.jsx index 923c3202b..7bdd25d59 100644 --- a/src/features/gym/GymPopup.jsx +++ b/src/features/gym/GymPopup.jsx @@ -634,6 +634,7 @@ const ExtraGymInfo = ({ updated, total_cp, guarding_pokemon_id, + guarding_pokemon_display, }) => { const { t, i18n } = useTranslation() const Icons = useMemory((s) => s.Icons) @@ -643,12 +644,23 @@ const ExtraGymInfo = ({ ) const numFormatter = new Intl.NumberFormat(i18n.language) + guarding_pokemon_display ||= {} return ( {!!guarding_pokemon_id && updated > gymValidDataLimit && ( - + {t(`poke_${guarding_pokemon_id}`)} diff --git a/src/services/queries/gym.js b/src/services/queries/gym.js index f12eaa5f9..5de1818c2 100644 --- a/src/services/queries/gym.js +++ b/src/services/queries/gym.js @@ -20,6 +20,7 @@ const gym = gql` team_id in_battle guarding_pokemon_id + guarding_pokemon_display total_cp badge power_up_level