mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-14 18:19:42 +03:00
feat(client): aiRating on UI
This commit is contained in:
@@ -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
@@ -805,7 +805,7 @@ interface CDDataPMS {
|
||||
}
|
||||
|
||||
type CDDataBMS = CDDataPMS & {
|
||||
aiRating: string | null;
|
||||
aiLevel: string | null;
|
||||
};
|
||||
|
||||
interface CDDataUSC {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user