Skip to content

Commit f9e0b61

Browse files
author
Zyki
committed
feat(client): conditional gym defender heart lines & translate CP
1 parent a6a50ec commit f9e0b61

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

src/features/gym/GymPopup.jsx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ function DefendersModal({ gym, onClose }) {
254254
{t(`poke_${def.pokemon_id}`)}
255255
</span>
256256
<span style={{ fontSize: 13, color: '#666' }}>
257-
CP: <b>{currentCP}</b> / {fullCP}
257+
{t('cp')}: <b>{currentCP}</b> / {fullCP}
258258
</span>
259259
</div>
260260
<div
@@ -314,22 +314,27 @@ function DefendersModal({ gym, onClose }) {
314314
pointerEvents: 'none',
315315
}}
316316
>
317-
{/* Crack at 1/3 height (top) */}
318-
<path
319-
d="M2,9 Q7,11 14,9 Q21,11 26,9"
320-
stroke="white"
321-
strokeWidth={1.5}
322-
fill="none"
323-
strokeLinejoin="round"
324-
/>
325-
{/* Crack at 2/3 height (bottom, improved to fit heart) */}
326-
<path
327-
d="M7,19 Q11,17 14,19 Q17,17 21,19"
328-
stroke="white"
329-
strokeWidth={1.5}
330-
fill="none"
331-
strokeLinejoin="round"
332-
/>
317+
{/* Show cracks based on health: */}
318+
{percent <= 2 / 3 && (
319+
// Always show top crack if percent <= 2/3
320+
<path
321+
d="M2,9 Q7,11 14,9 Q21,11 26,9"
322+
stroke="white"
323+
strokeWidth={1.5}
324+
fill="none"
325+
strokeLinejoin="round"
326+
/>
327+
)}
328+
{percent <= 1 / 3 && (
329+
// Show bottom crack only if percent <= 1/3
330+
<path
331+
d="M7,19 Q11,17 14,19 Q17,17 21,19"
332+
stroke="white"
333+
strokeWidth={1.5}
334+
fill="none"
335+
strokeLinejoin="round"
336+
/>
337+
)}
333338
</svg>
334339
</div>
335340
</div>

0 commit comments

Comments
 (0)