feat(client): aiRating on UI

This commit is contained in:
zkldi
2022-07-18 00:55:27 +01:00
parent ac00d1bfb3
commit e3c0fc5a8a
3 changed files with 18 additions and 4 deletions
@@ -4,6 +4,7 @@ import QuickTooltip from "components/layout/misc/QuickTooltip";
import Icon from "components/util/Icon";
import React from "react";
import { ChartDocument, COLOUR_SET } from "tachi-common";
import Muted from "components/util/Muted";
import TierlistInfoPart from "./TierlistInfoPart";
export default function BMSPMSDifficultyCell({
@@ -15,14 +16,27 @@ export default function BMSPMSDifficultyCell({
}) {
const hasLevel = chart.data.tableFolders.length > 0;
const levelText = hasLevel ? FormatTables(chart.data.tableFolders) : "No Level";
const aiLevel = game === "bms" && (chart as ChartDocument<"bms:7K" | "bms:14K">).data.aiLevel;
let levelText = "No Rating";
if (hasLevel) {
levelText = FormatTables(chart.data.tableFolders);
}
return (
<td
style={{
backgroundColor: ChangeOpacity(hasLevel ? COLOUR_SET.red : COLOUR_SET.gray, 0.2),
}}
>
<span>{levelText}</span>
{!hasLevel && aiLevel ? (
<QuickTooltip tooltipContent="This rating has been generated by AI. Don't put too much trust into it.">
<div>AI{aiLevel}</div>
</QuickTooltip>
) : (
<span>{levelText}</span>
)}
<TierlistInfoPart chart={chart} game={game} />
{!chart.isPrimary && (
<QuickTooltip tooltipContent="This chart is an alternate, old chart.">
+1 -1
View File
@@ -805,7 +805,7 @@ interface CDDataPMS {
}
type CDDataBMS = CDDataPMS & {
aiRating: string | null;
aiLevel: string | null;
};
interface CDDataUSC {
+1 -1
View File
@@ -22,7 +22,7 @@ export async function UpdateAILevels() {
await repo.MutateCollection<ChartDocument<"bms:7K">>("charts-bms", (charts) => {
for (const chart of charts) {
chart.data.aiRating = map[chart.data.hashMD5] ?? null;
chart.data.aiLevel = map[chart.data.hashMD5] ?? null;
}
return charts;