Skip to content

Commit

Permalink
feat(AWCRankingPage): edit decimal point position
Browse files Browse the repository at this point in the history
  • Loading branch information
ppapman1 committed Dec 21, 2022
1 parent 4da1427 commit 1f974dc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/routes/awc2023/AWCRankingPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import styled from 'styled-components';
import axios from 'axios';
import { useLocation } from 'react-router-dom';

const apiEndpoint = 'https://api.awc.enak.kr/measure/rank';
const apiEndpoint =
'https://cors-anywhere.herokuapp.com/https://api.awc.enak.kr/measure/rank';

const RankingItemBox = styled.div`
display: flex;
Expand Down Expand Up @@ -77,6 +78,7 @@ const ItemHitMargin = ({ color, label, content }) => {
};

const ItemXAccuracyWrapper = styled.div`
font-family: var(--monospace-font);
display: flex;
align-items: center;
gap: 6px;
Expand All @@ -88,13 +90,16 @@ const ItemXAccuracyWrapper = styled.div`
* @param {Number} props.xAccuracy
*/
const ItemXAccuracy = ({ xAccuracy }) => {
const formattedXAccuracy =
xAccuracy >= 1 ? '100.0000' : (xAccuracy * 100).toFixed(5);

return (
<ItemXAccuracyWrapper>
<img
src={'https://adofai.gg/other_icons/xaccuracy.svg'}
alt='X Accurancy: '
/>
{(xAccuracy * 100).toFixed(2)}%
{formattedXAccuracy}%
</ItemXAccuracyWrapper>
);
};
Expand Down Expand Up @@ -221,7 +226,9 @@ const AWCRankingPage = () => {
return (
<RankingItem
rank={index}
playerName={showAsId ? i.playerId : i.discordUsername ?? i.playerName}
playerName={
showAsId ? i.playerId : i.discordUsername ?? i.playerName
}
hitMargins={i.hitMargins}
xAccuracy={i.xacc}
key={index}
Expand Down

0 comments on commit 1f974dc

Please sign in to comment.