Skip to content

Commit 4c755b2

Browse files
Merge pull request #3 from lenisko/gym_defenders_fixes
feat(client): drop defenders from extra info, fix defenders hearth
2 parents 39726eb + 6604029 commit 4c755b2

File tree

1 file changed

+6
-46
lines changed

1 file changed

+6
-46
lines changed

src/features/gym/GymPopup.jsx

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ import { useMemory } from '@store/useMemory'
2020
import { useLayoutStore } from '@store/useLayoutStore'
2121
import { setDeepStore, useStorage } from '@store/useStorage'
2222
import { ErrorBoundary } from '@components/ErrorBoundary'
23-
import { Img, TextWithIcon } from '@components/Img'
23+
import { Img } from '@components/Img'
2424
import { Title } from '@components/popups/Title'
2525
import { PowerUp } from '@components/popups/PowerUp'
2626
import { GenderIcon } from '@components/popups/GenderIcon'
2727
import { Navigation } from '@components/popups/Navigation'
2828
import { Coords } from '@components/popups/Coords'
2929
import { TimeStamp } from '@components/popups/TimeStamps'
30-
import { ExtraInfo } from '@components/popups/ExtraInfo'
3130
import { useAnalytics } from '@hooks/useAnalytics'
3231
import { getTimeUntil } from '@utils/getTimeUntil'
3332
import { formatInterval } from '@utils/formatInterval'
@@ -191,7 +190,10 @@ function DefendersModal({ gym, onClose }) {
191190
{defenders.map((def) => {
192191
const fullCP = def.cp_when_deployed
193192
const currentCP = def.cp_now
194-
const percent = Math.max(0, Math.min(1, currentCP / fullCP))
193+
const percent = Math.max(
194+
0,
195+
Math.min(1, (currentCP / fullCP) * 1.25 - 0.25),
196+
)
195197

196198
return (
197199
<div
@@ -947,55 +949,13 @@ const GymFooter = ({ lat, lon, hasRaid, gym, setShowDefenders }) => {
947949
* @param {import('@rm/types').Gym} props
948950
* @returns
949951
*/
950-
const ExtraGymInfo = ({
951-
last_modified_timestamp,
952-
lat,
953-
lon,
954-
updated,
955-
total_cp,
956-
guarding_pokemon_id,
957-
guarding_pokemon_display,
958-
}) => {
959-
const { t, i18n } = useTranslation()
960-
const Icons = useMemory((s) => s.Icons)
961-
const gymValidDataLimit = useMemory((s) => s.gymValidDataLimit)
952+
const ExtraGymInfo = ({ last_modified_timestamp, lat, lon, updated }) => {
962953
const enableGymPopupCoords = useStorage(
963954
(s) => s.userSettings.gyms.enableGymPopupCoords,
964955
)
965956

966-
const numFormatter = new Intl.NumberFormat(i18n.language)
967-
/** @type {Partial<import('@rm/types').PokemonDisplay>} */
968-
const gpd = guarding_pokemon_display || {}
969-
970957
return (
971958
<Grid container alignItems="center" justifyContent="center">
972-
{!!guarding_pokemon_id && updated > gymValidDataLimit && (
973-
<ExtraInfo title="defender">
974-
<TextWithIcon
975-
src={Icons.getPokemonByDisplay(guarding_pokemon_id, gpd)}
976-
>
977-
{gpd.badge === 1 && (
978-
<>
979-
<Img
980-
src={Icons.getMisc('bestbuddy')}
981-
alt={t('best_buddy')}
982-
maxHeight={15}
983-
maxWidth={15}
984-
/>
985-
&nbsp;
986-
</>
987-
)}
988-
{t(`poke_${guarding_pokemon_id}`)}
989-
</TextWithIcon>
990-
</ExtraInfo>
991-
)}
992-
{!!total_cp && updated > gymValidDataLimit && (
993-
<ExtraInfo title="total_cp">{numFormatter.format(total_cp)}</ExtraInfo>
994-
)}
995-
<Divider
996-
flexItem
997-
style={{ width: '100%', height: 2, margin: '10px 0' }}
998-
/>
999959
<TimeStamp time={updated}>last_seen</TimeStamp>
1000960
<TimeStamp time={last_modified_timestamp}>last_modified</TimeStamp>
1001961
{enableGymPopupCoords && (

0 commit comments

Comments
 (0)