@@ -38,7 +38,10 @@ import {
3838import { useAnalytics } from '@hooks/useAnalytics'
3939import { getTimeUntil } from '@utils/getTimeUntil'
4040import { formatInterval } from '@utils/formatInterval'
41- import { usePokemonBackgroundVisuals } from '@hooks/usePokemonBackgroundVisuals'
41+ import {
42+ usePokemonBackgroundVisuals ,
43+ usePokemonBackgroundVisual ,
44+ } from '@hooks/usePokemonBackgroundVisuals'
4245
4346import { useWebhook } from './useWebhook'
4447
@@ -273,16 +276,15 @@ function DefendersModal({ gym, onClose }) {
273276 const { t, i18n } = useTranslation ( )
274277 const theme = useTheme ( )
275278 const Icons = useMemory ( ( s ) => s . Icons )
276- const getPokemonBackgroundVisuals = usePokemonBackgroundVisuals ( )
279+ const resolvePokemonBackgroundVisual = usePokemonBackgroundVisuals ( )
277280 const numFormatter = new Intl . NumberFormat ( i18n . language )
278281 const defenders = gym . defenders || [ ]
279282 const updatedMs =
280283 defenders . length &&
281284 defenders [ 0 ] . deployed_ms + defenders [ 0 ] . deployed_time * 1000
282285 const now = Date . now ( )
283- const fallbackVisuals = React . useMemo (
284- ( ) => getPokemonBackgroundVisuals ( gym . guarding_pokemon_display ?. background ) ,
285- [ getPokemonBackgroundVisuals , gym . guarding_pokemon_display ?. background ] ,
286+ const fallbackVisuals = usePokemonBackgroundVisual (
287+ gym . guarding_pokemon_display ?. background ,
286288 )
287289
288290 // Fallback to basic gym data when detailed defender info isn't available
@@ -308,7 +310,6 @@ function DefendersModal({ gym, onClose }) {
308310 const rowContent = (
309311 < DefenderRowLayout
310312 borderColor = { fallbackBorderColor }
311- tooltip = { fallbackBackgroundMeta ?. tooltip }
312313 imageSrc = { fallbackImageSrc }
313314 imageAlt = { t ( `poke_${ gym . guarding_pokemon_id } ` ) }
314315 showBestBuddy = { gym . guarding_pokemon_display ?. badge === 1 }
@@ -347,7 +348,6 @@ function DefendersModal({ gym, onClose }) {
347348 fallbackRow = (
348349 < BackgroundCard
349350 visuals = { fallbackHasBackground ? fallbackVisuals : undefined }
350- tooltip = { fallbackBackgroundMeta ?. tooltip }
351351 wrapperProps = {
352352 fallbackBackgroundMeta ?. tooltip
353353 ? { style : { width : '100%' } }
@@ -431,7 +431,7 @@ function DefendersModal({ gym, onClose }) {
431431 const currentCP = Math . round (
432432 fullCP * ( 0.2 + 0.8 * predictedMotivation ) ,
433433 )
434- const visuals = getPokemonBackgroundVisuals ( def . background )
434+ const visuals = resolvePokemonBackgroundVisual ( def . background )
435435 const {
436436 borderColor,
437437 primaryColor,
@@ -638,7 +638,6 @@ function DefendersModal({ gym, onClose }) {
638638 < React . Fragment key = { rowKey } >
639639 < BackgroundCard
640640 visuals = { hasBackground ? visuals : undefined }
641- tooltip = { backgroundMeta ?. tooltip }
642641 wrapperProps = {
643642 backgroundMeta ?. tooltip
644643 ? { style : { width : '100%' } }
0 commit comments