Revert "feat: rating-based colored text for cells (#1126)"

This reverts commit 7060728584.
This commit is contained in:
zkldi
2024-07-14 15:39:59 +01:00
parent 8e89face2f
commit 1f3df6bb4c
8 changed files with 40 additions and 331 deletions
@@ -1,56 +0,0 @@
import React from "react";
import { PBScoreDocument, ScoreDocument } from "tachi-common";
export default function CHUNITHMRatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) {
let color: undefined | string = undefined;
const rating = score.calculatedData.rating;
if (rating === null || rating === undefined) {
color = undefined;
} else if (rating >= 16.0) {
color =
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)";
return (
<td>
<div
style={{
background: color,
backgroundClip: "text",
outline: "white",
WebkitTextFillColor: "transparent",
}}
>
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong>
</div>
</td>
);
} else if (rating >= 15.25) {
color = "silver";
} else if (rating >= 14.5) {
color = "var(--bs-warning)";
} else if (rating >= 13.25) {
color = "gray";
} else if (rating >= 12.0) {
color = "sienna";
} else if (rating >= 10.0) {
color = "purple";
} else if (rating >= 7.0) {
color = "red";
} else if (rating >= 4.0) {
color = "orange";
} else if (rating >= 0) {
color = "green";
}
return (
<td
style={{
color,
outline: "white",
}}
>
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong>
</td>
);
}
@@ -0,0 +1,35 @@
import { IsNullish } from "util/misc";
import React from "react";
import { COLOUR_SET, PBScoreDocument, ScoreDocument } from "tachi-common";
export default function GitadoraJudgementCell({
score,
}: {
score:
| ScoreDocument<"gitadora:Dora" | "gitadora:Gita">
| PBScoreDocument<"gitadora:Dora" | "gitadora:Gita">;
}) {
const judgements = score.scoreData.judgements;
if (
IsNullish(judgements.perfect) ||
IsNullish(judgements.great) ||
IsNullish(judgements.good) ||
IsNullish(judgements.ok) ||
IsNullish(judgements.miss)
) {
return <td>No Data.</td>;
}
return (
<td>
<strong>
<span style={{ color: COLOUR_SET.gold }}>{judgements.perfect}</span>-
<span style={{ color: COLOUR_SET.green }}>{judgements.great}</span>-
<span style={{ color: COLOUR_SET.blue }}>{judgements.good}</span>-
<span style={{ color: COLOUR_SET.purple }}>{judgements.ok}</span>-
<span style={{ color: COLOUR_SET.red }}>{judgements.miss}</span>
</strong>
</td>
);
}
@@ -1,60 +0,0 @@
import React from "react";
import { PBScoreDocument, ScoreDocument } from "tachi-common";
export default function MaimaiDXRatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) {
let color: undefined | string = undefined;
const rating = score.calculatedData.rate;
if (rating === null || rating === undefined) {
color = undefined;
} else if (rating >= 300) {
color =
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)";
return (
<td>
<div
style={{
background: color,
backgroundClip: "text",
outline: "white",
WebkitTextFillColor: "transparent",
}}
>
<strong>{score.calculatedData.rate ?? "N/A"}</strong>
</div>
</td>
);
} else if (rating >= 290) {
color = "lightgoldenrodyellow";
} else if (rating >= 280) {
color = "var(--bs-warning)";
} else if (rating >= 260) {
color = "gray";
} else if (rating >= 240) {
color = "brown";
} else if (rating >= 200) {
color = "purple";
} else if (rating >= 140) {
color = "red";
} else if (rating >= 80) {
color = "yellow";
} else if (rating >= 40) {
color = "green";
} else if (rating >= 20) {
color = "blue";
} else if (rating >= 0) {
color = undefined;
}
return (
<td
style={{
color,
outline: "white",
}}
>
<strong>{score.calculatedData.rate ?? "N/A"}</strong>
</td>
);
}
@@ -1,59 +0,0 @@
import React from "react";
import { PBScoreDocument, ScoreDocument } from "tachi-common";
export default function MaimaiRatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) {
let color: undefined | string = undefined;
const rating = score.calculatedData.rate;
if (rating === null || rating === undefined) {
color = undefined;
} else if (rating >= 15.0) {
color =
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)";
return (
<td>
<div
style={{
background: color,
backgroundClip: "text",
outline: "white",
WebkitTextFillColor: "transparent",
}}
>
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong>
</div>
</td>
);
} else if (rating >= 14.5) {
color = "var(--bs-warning)";
} else if (rating >= 14.0) {
color = "gray";
} else if (rating >= 13.0) {
color = "brown";
} else if (rating >= 12.0) {
color = "purple";
} else if (rating >= 10.0) {
color = "red";
} else if (rating >= 7.0) {
color = "yellow";
} else if (rating >= 4.0) {
color = "green";
} else if (rating >= 2.0) {
color = "cyan";
} else if (rating >= 0.0) {
// undefining so the rating text isn't permanently white on light mode
color = undefined;
}
return (
<td
style={{
color,
outline: "white",
}}
>
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong>
</td>
);
}
@@ -1,58 +0,0 @@
import React from "react";
import { PBScoreDocument, ScoreDocument } from "tachi-common";
export default function OngekiRatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) {
let color: undefined | string = undefined;
const rating = score.calculatedData.rating;
if (rating === null || rating === undefined) {
color = undefined;
} else if (rating >= 15.0) {
color =
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)";
return (
<td>
<div
style={{
background: color,
backgroundClip: "text",
outline: "white",
WebkitTextFillColor: "transparent",
}}
>
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong>
</div>
</td>
);
} else if (rating >= 14.5) {
color = "silver";
} else if (rating >= 14.0) {
color = "var(--bs-warning)";
} else if (rating >= 13.0) {
color = "gray";
} else if (rating >= 12.0) {
color = "sienna";
} else if (rating >= 10.0) {
color = "purple";
} else if (rating >= 7.0) {
color = "red";
} else if (rating >= 4.0) {
color = "orange";
} else if (rating >= 2.0) {
color = "green";
} else if (rating >= 0.0) {
color = "var(--bs-info)";
}
return (
<td
style={{
color,
outline: "white",
}}
>
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong>
</td>
);
}
+1 -34
View File
@@ -5,7 +5,6 @@ import React, { useContext } from "react";
import { Volforce } from "rg-stats";
import {
ChartDocument,
COLOUR_SET,
GetGPTString,
GetSpecificGPTConfig,
PBScoreDocument,
@@ -62,40 +61,8 @@ export default function VF6Cell({
const maxVF = Volforce.calculateVF6(10_000_000, "PERFECT ULTIMATE CHAIN", chart.levelNum);
let color = undefined;
const vf = score.calculatedData.VF6;
if (vf === null || vf === undefined) {
color = undefined;
} else if (vf >= 0.4) {
color = COLOUR_SET.vibrantPurple;
} else if (vf >= 0.38) {
color = COLOUR_SET.vibrantRed;
} else if (vf >= 0.36) {
color = "var(--bs-warning)";
} else if (vf >= 0.34) {
color = COLOUR_SET.white;
} else if (vf >= 0.32) {
color = COLOUR_SET.pink;
} else if (vf >= 0.3) {
color = COLOUR_SET.vibrantPink;
} else if (vf >= 0.28) {
color = COLOUR_SET.teal;
} else if (vf >= 0.24) {
color = COLOUR_SET.gold;
} else if (vf >= 0.2) {
color = COLOUR_SET.paleBlue;
} else if (vf >= 0) {
color = COLOUR_SET.red;
}
return (
<td
style={{
color,
outline: "white",
}}
>
<td>
<strong className="underline-on-hover">{score.calculatedData.VF6}</strong>
{vf6Target !== 0 && vf6Target && user?.id === score.userID && (
@@ -1,56 +0,0 @@
import React from "react";
import { PBScoreDocument, ScoreDocument } from "tachi-common";
export default function WACCARatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) {
let color: undefined | string = undefined;
const rating = score.calculatedData.rate;
if (rating === null || rating === undefined) {
color = undefined;
} else if (rating >= 50) {
color =
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)";
return (
<td>
<div
style={{
background: color,
backgroundClip: "text",
outline: "white",
WebkitTextFillColor: "transparent",
}}
>
<strong>{score.calculatedData.rate ?? "N/A"}</strong>
</div>
</td>
);
} else if (rating >= 44) {
color = "var(--bs-warning)";
} else if (rating >= 38) {
color = "silver";
} else if (rating >= 32) {
color = "var(--bs-info)";
} else if (rating >= 26) {
color = "purple";
} else if (rating >= 20) {
color = "red";
} else if (rating >= 12) {
color = "orange";
} else if (rating >= 6) {
color = "darkblue";
} else if (rating >= 0) {
color = "var(--bs-secondary)";
}
return (
<td
style={{
color,
outline: "white",
}}
>
<strong>{score.calculatedData.rate ?? "N/A"}</strong>
</td>
);
}
+4 -8
View File
@@ -20,10 +20,6 @@ import OngekiJudgementCell from "components/tables/cells/OngekiJudgementCell";
import React from "react";
import OngekiLampCell from "components/tables/cells/OngekiLampCell";
import OngekiPlatinumCell from "components/tables/cells/OngekiPlatinumCell";
import CHUNITHMRatingCell from "components/tables/cells/CHUNITHMRatingCell";
import MaimaiDXRatingCell from "components/tables/cells/MaimaiDXRatingCell";
import MaimaiRatingCell from "components/tables/cells/MaimaiRatingCell";
import OngekiRatingCell from "components/tables/cells/OngekiRatingCell";
import { CreateRatingSys, bgc } from "./games/_util";
import { BMS_14K_IMPL, BMS_7K_IMPL, PMS_IMPL } from "./games/bms-pms";
import { IIDX_DP_IMPL, IIDX_SP_IMPL } from "./games/iidx";
@@ -130,7 +126,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = {
<LampCell lamp={sc.scoreData.lamp} colour={GetEnumColour(sc, "lamp")} />
</>
),
ratingCell: ({ sc }) => <CHUNITHMRatingCell score={sc} />,
ratingCell: ({ sc, rating }) => <RatingCell score={sc} rating={rating} />,
},
"jubeat:Single": {
sessionImportantScoreCount: 30,
@@ -290,7 +286,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = {
<LampCell lamp={sc.scoreData.lamp} colour={GetEnumColour(sc, "lamp")} />
</>
),
ratingCell: ({ sc }) => <MaimaiRatingCell score={sc} />,
ratingCell: ({ sc, rating }) => <RatingCell score={sc} rating={rating} />,
},
"maimaidx:Single": {
sessionImportantScoreCount: 30,
@@ -433,7 +429,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = {
<LampCell lamp={sc.scoreData.lamp} colour={GetEnumColour(sc, "lamp")} />
</>
),
ratingCell: ({ sc }) => <MaimaiDXRatingCell score={sc} />,
ratingCell: ({ sc, rating }) => <RatingCell score={sc} rating={rating} />,
},
"museca:Single": {
sessionImportantScoreCount: 20,
@@ -831,7 +827,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = {
/>
</>
),
ratingCell: ({ sc }) => <OngekiRatingCell score={sc} />,
ratingCell: ({ sc, rating }) => <RatingCell score={sc} rating={rating} />,
},
"arcaea:Touch": ARCAEA_TOUCH_IMPL,
"gitadora:Dora": GITADORA_DORA_IMPL,