From e3c0fc5a8a8e9c61146b19f3fe449aecd347c05b Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 18 Jul 2022 00:55:23 +0100 Subject: [PATCH] feat(client): aiRating on UI --- .../tables/cells/BMSDifficultyCell.tsx | 18 ++++++++++++++++-- common/src/types.ts | 2 +- server/src/lib/jobs/bms-ai-table-sync.ts | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/client/src/components/tables/cells/BMSDifficultyCell.tsx b/client/src/components/tables/cells/BMSDifficultyCell.tsx index a9498fd90..e137f1362 100644 --- a/client/src/components/tables/cells/BMSDifficultyCell.tsx +++ b/client/src/components/tables/cells/BMSDifficultyCell.tsx @@ -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 ( - {levelText} + {!hasLevel && aiLevel ? ( + +
AI{aiLevel}
+
+ ) : ( + {levelText} + )} + {!chart.isPrimary && ( diff --git a/common/src/types.ts b/common/src/types.ts index 7cc1872fa..f7b82ddfc 100644 --- a/common/src/types.ts +++ b/common/src/types.ts @@ -805,7 +805,7 @@ interface CDDataPMS { } type CDDataBMS = CDDataPMS & { - aiRating: string | null; + aiLevel: string | null; }; interface CDDataUSC { diff --git a/server/src/lib/jobs/bms-ai-table-sync.ts b/server/src/lib/jobs/bms-ai-table-sync.ts index e9ba03266..a38ffa217 100644 --- a/server/src/lib/jobs/bms-ai-table-sync.ts +++ b/server/src/lib/jobs/bms-ai-table-sync.ts @@ -22,7 +22,7 @@ export async function UpdateAILevels() { await repo.MutateCollection>("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;