aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/components/Gaming/ScoreBar.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app/components/Gaming/ScoreBar.tsx')
-rw-r--r--frontend/app/components/Gaming/ScoreBar.tsx48
1 files changed, 24 insertions, 24 deletions
diff --git a/frontend/app/components/Gaming/ScoreBar.tsx b/frontend/app/components/Gaming/ScoreBar.tsx
index 6a291cd..50a2402 100644
--- a/frontend/app/components/Gaming/ScoreBar.tsx
+++ b/frontend/app/components/Gaming/ScoreBar.tsx
@@ -1,30 +1,30 @@
type Props = {
- scoreA: number | null;
- scoreB: number | null;
- bgA: string;
- bgB: string;
+ scoreA: number | null;
+ scoreB: number | null;
+ bgA: string;
+ bgB: string;
};
export default function ScoreBar({ scoreA, scoreB, bgA, bgB }: Props) {
- let scoreRatio;
- if (scoreA === null && scoreB === null) {
- scoreRatio = 50;
- } else if (scoreA === null) {
- scoreRatio = 0;
- } else if (scoreB === null) {
- scoreRatio = 100;
- } else {
- const rawRatio = scoreB / (scoreA + scoreB);
- const k = 3.0;
- const emphasizedRatio =
- Math.pow(rawRatio, k) /
- (Math.pow(rawRatio, k) + Math.pow(1 - rawRatio, k));
- scoreRatio = emphasizedRatio * 100;
- }
+ let scoreRatio;
+ if (scoreA === null && scoreB === null) {
+ scoreRatio = 50;
+ } else if (scoreA === null) {
+ scoreRatio = 0;
+ } else if (scoreB === null) {
+ scoreRatio = 100;
+ } else {
+ const rawRatio = scoreB / (scoreA + scoreB);
+ const k = 3.0;
+ const emphasizedRatio =
+ Math.pow(rawRatio, k) /
+ (Math.pow(rawRatio, k) + Math.pow(1 - rawRatio, k));
+ scoreRatio = emphasizedRatio * 100;
+ }
- return (
- <div className={`w-full ${bgB}`}>
- <div className={`h-10 ${bgA}`} style={{ width: `${scoreRatio}%` }}></div>
- </div>
- );
+ return (
+ <div className={`w-full ${bgB}`}>
+ <div className={`h-10 ${bgA}`} style={{ width: `${scoreRatio}%` }}></div>
+ </div>
+ );
}