From 86e369af1912e0e21bd39ad604137bb1ca06eb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:12:20 -0500 Subject: [PATCH] feat: use latest url for cached rating images --- src/app/tools/rating/page.tsx | 60 +++++++++++++++++------------------ 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/src/app/tools/rating/page.tsx b/src/app/tools/rating/page.tsx index 465c43e26..3979ca91d 100644 --- a/src/app/tools/rating/page.tsx +++ b/src/app/tools/rating/page.tsx @@ -74,6 +74,10 @@ const useScoreCache = create(() => ({ eu: {}, })); +function toLatestURL(url: string) { + return url.replace(/(\d+\.)+\d+/, 'latest'); +} + export default function Page() { const [region, setRegion] = useState('com'); const [season, setSeason] = useState(0); @@ -958,9 +962,7 @@ export default function Page() { Position Player - {season === 0 && ( - Reward - )} + Reward Percentile @@ -1030,34 +1032,30 @@ export default function Page() { )} - {season === 0 && ( - - {reward ? ( - - { - - {reward.count === 1 ? '' : `x ${reward.count}`} - - - ) : null} - - )} + + {reward ? ( + + {toLatestURL( + + {reward.count === 1 ? '' : `x ${reward.count}`} + + + ) : null} + {totalPlayers ? ( `${Math.ceil(((index + 1) / totalPlayers) * 100)}%`