mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-10 16:28:17 +03:00
feat: gitadora frontend
This commit is contained in:
@@ -21,6 +21,7 @@ export default function DefaultSongChartInfoFormat({
|
||||
<h5>({FormatDifficulty(chart, game)})</h5>
|
||||
<h6>
|
||||
<DisplayLevelNum
|
||||
game={game}
|
||||
level={chart.level}
|
||||
levelNum={chart.levelNum}
|
||||
prefix="Internal Level: "
|
||||
|
||||
@@ -3,6 +3,7 @@ import Divider from "components/util/Divider";
|
||||
import Loading from "components/util/Loading";
|
||||
import React from "react";
|
||||
import { ImportStates } from "types/import";
|
||||
import ManageImport from "components/tables/dropdowns/components/ManageImport";
|
||||
import ImportInfo from "./ImportInfo";
|
||||
|
||||
export default function ImportStateRenderer({ state: s }: { state: ImportStates }) {
|
||||
@@ -35,6 +36,11 @@ export default function ImportStateRenderer({ state: s }: { state: ImportStates
|
||||
Your import was successful!
|
||||
<Divider />
|
||||
<ImportInfo importID={s.import.importID} />
|
||||
<Divider />
|
||||
<div>
|
||||
<h4>Messed up?</h4>
|
||||
<ManageImport importDoc={s.import} />
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
|
||||
@@ -54,6 +54,7 @@ export default function DifficultyCell({
|
||||
style={{
|
||||
backgroundColor: ChangeOpacity(gptConfig.difficultyColours[chart.difficulty]!, 0.2),
|
||||
minWidth: "80px",
|
||||
maxWidth: "100px",
|
||||
}}
|
||||
>
|
||||
{!alwaysShort && (
|
||||
@@ -62,7 +63,7 @@ export default function DifficultyCell({
|
||||
<div className={!alwaysShort ? "d-lg-none" : ""}>
|
||||
{FormatDifficultyShort(chart, game)}
|
||||
</div>
|
||||
<DisplayLevelNum level={chart.level} levelNum={chart.levelNum} />
|
||||
<DisplayLevelNum game={game} level={chart.level} levelNum={chart.levelNum} />
|
||||
{"isHot" in chart.data && chart.data.isHot && (
|
||||
<QuickTooltip tooltipContent="This chart is from the latest version of the game!">
|
||||
<div>
|
||||
@@ -88,10 +89,12 @@ export function DisplayLevelNum({
|
||||
level,
|
||||
levelNum,
|
||||
prefix,
|
||||
game,
|
||||
}: {
|
||||
levelNum: number;
|
||||
level: string;
|
||||
prefix?: string;
|
||||
game: Game;
|
||||
}) {
|
||||
// Don't display levelnum if its identical to the level, the decimal places in the
|
||||
// level end with .0, or the levelNum itself is 0.
|
||||
@@ -99,6 +102,11 @@ export function DisplayLevelNum({
|
||||
return null;
|
||||
}
|
||||
|
||||
// or if it's gitadora
|
||||
if (game === "gitadora") {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Muted>
|
||||
{prefix}
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import React from "react";
|
||||
import { PBScoreDocument, ScoreDocument } from "tachi-common";
|
||||
import GitadoraJudgementCell from "../cells/GitadoraJudgementCell";
|
||||
import LampCell from "../cells/LampCell";
|
||||
import RatingCell from "../cells/RatingCell";
|
||||
import ScoreCell from "../cells/ScoreCell";
|
||||
|
||||
export default function GitadoraCoreCells({
|
||||
sc,
|
||||
rating,
|
||||
}: {
|
||||
sc:
|
||||
| ScoreDocument<"gitadora:Gita" | "gitadora:Dora">
|
||||
| PBScoreDocument<"gitadora:Gita" | "gitadora:Dora">;
|
||||
rating: keyof ScoreDocument["calculatedData"];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<ScoreCell showScore={false} score={sc} />
|
||||
<GitadoraJudgementCell score={sc} />
|
||||
<LampCell score={sc} />
|
||||
<RatingCell score={sc} rating={rating} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -2,9 +2,6 @@ import React from "react";
|
||||
import { PBScoreDocument, ScoreDocument } from "tachi-common";
|
||||
import ITGJudgementCell from "../cells/ITGJudgementCell";
|
||||
import LampCell from "../cells/LampCell";
|
||||
import MillionsScoreCell from "../cells/MillionsScoreCell";
|
||||
import PopnJudgementCell from "../cells/PopnJudgementCell";
|
||||
import PopnLampCell from "../cells/PopnLampCell";
|
||||
import RatingCell from "../cells/RatingCell";
|
||||
import ScoreCell from "../cells/ScoreCell";
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import PMSCoreCells from "./PMSCoreCells";
|
||||
import PopnCoreCells from "./PopnCoreCells";
|
||||
import SDVXScoreCoreCells from "./SDVXCoreCells";
|
||||
import WACCACoreCells from "./WACCACoreCells";
|
||||
import GitadoraCoreCells from "./GitadoraCoreCells";
|
||||
|
||||
export default function ScoreCoreCells({
|
||||
game,
|
||||
@@ -32,40 +33,42 @@ export default function ScoreCoreCells({
|
||||
}) {
|
||||
const sc = score as any; // lazy hack
|
||||
|
||||
if (game === "iidx") {
|
||||
return (
|
||||
<IIDXCoreCells
|
||||
rating={rating as ScoreCalculatedDataLookup["iidx:SP" | "iidx:DP"]}
|
||||
chart={chart as ChartDocument<"iidx:SP" | "iidx:DP">}
|
||||
sc={sc}
|
||||
/>
|
||||
);
|
||||
} else if (game === "bms") {
|
||||
return <BMSCoreCells sc={sc} rating={rating} />;
|
||||
} else if (game === "sdvx" || game === "usc") {
|
||||
return (
|
||||
<SDVXScoreCoreCells
|
||||
sc={sc}
|
||||
chart={chart as ChartDocument<"sdvx:Single" | "usc:Controller" | "usc:Keyboard">}
|
||||
/>
|
||||
);
|
||||
} else if (game === "museca") {
|
||||
return <MusecaCoreCells sc={sc} rating={rating} />;
|
||||
} else if (game === "wacca") {
|
||||
return <WACCACoreCells sc={sc} rating={rating} />;
|
||||
} else if (game === "popn") {
|
||||
return <PopnCoreCells sc={sc} rating={rating} />;
|
||||
} else if (game === "jubeat") {
|
||||
return <JubeatCoreCells sc={sc} rating={rating} />;
|
||||
} else if (game === "chunithm") {
|
||||
return <CHUNITHMCoreCells sc={sc} rating={rating} />;
|
||||
} else if (game === "gitadora") {
|
||||
return <GenericCoreCells sc={sc} rating={rating} />;
|
||||
} else if (game === "pms") {
|
||||
return <PMSCoreCells sc={sc} rating={rating} />;
|
||||
} else if (game === "itg") {
|
||||
return <ITGCoreCells sc={sc} rating={rating} />;
|
||||
switch (game) {
|
||||
case "iidx":
|
||||
return (
|
||||
<IIDXCoreCells
|
||||
rating={rating as ScoreCalculatedDataLookup["iidx:SP" | "iidx:DP"]}
|
||||
chart={chart as ChartDocument<"iidx:SP" | "iidx:DP">}
|
||||
sc={sc}
|
||||
/>
|
||||
);
|
||||
case "bms":
|
||||
return <BMSCoreCells sc={sc} rating={rating} />;
|
||||
case "sdvx":
|
||||
case "usc":
|
||||
return (
|
||||
<SDVXScoreCoreCells
|
||||
sc={sc}
|
||||
chart={
|
||||
chart as ChartDocument<"sdvx:Single" | "usc:Controller" | "usc:Keyboard">
|
||||
}
|
||||
/>
|
||||
);
|
||||
case "museca":
|
||||
return <MusecaCoreCells sc={sc} rating={rating} />;
|
||||
case "wacca":
|
||||
return <WACCACoreCells sc={sc} rating={rating} />;
|
||||
case "popn":
|
||||
return <PopnCoreCells sc={sc} rating={rating} />;
|
||||
case "jubeat":
|
||||
return <JubeatCoreCells sc={sc} rating={rating} />;
|
||||
case "chunithm":
|
||||
return <CHUNITHMCoreCells sc={sc} rating={rating} />;
|
||||
case "gitadora":
|
||||
return <GitadoraCoreCells sc={sc} rating={rating} />;
|
||||
case "pms":
|
||||
return <PMSCoreCells sc={sc} rating={rating} />;
|
||||
case "itg":
|
||||
return <ITGCoreCells sc={sc} rating={rating} />;
|
||||
}
|
||||
|
||||
return <GenericCoreCells sc={sc} rating={rating} />;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { UppercaseFirst } from "util/misc";
|
||||
import { useProfileRatingAlg } from "components/util/useScoreRatingAlg";
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { IDStrings, integer, UGSRatingsLookup } from "tachi-common";
|
||||
import { IDStrings, integer, ProfileRatingLookup } from "tachi-common";
|
||||
import { GamePT } from "types/react";
|
||||
|
||||
export default function RankingData({
|
||||
@@ -11,7 +11,7 @@ export default function RankingData({
|
||||
userID,
|
||||
playtype,
|
||||
}: {
|
||||
rankingData: Record<UGSRatingsLookup[IDStrings], { ranking: number; outOf: integer }>;
|
||||
rankingData: Record<ProfileRatingLookup[IDStrings], { ranking: number; outOf: integer }>;
|
||||
userID: integer;
|
||||
} & GamePT) {
|
||||
const alg = useProfileRatingAlg(game, playtype);
|
||||
@@ -19,7 +19,7 @@ export default function RankingData({
|
||||
const extendData = [];
|
||||
|
||||
for (const k in rankingData) {
|
||||
const key = k as UGSRatingsLookup[IDStrings];
|
||||
const key = k as ProfileRatingLookup[IDStrings];
|
||||
|
||||
if (key !== alg) {
|
||||
extendData.push(
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
GetGamePTConfig,
|
||||
IDStrings,
|
||||
ScoreCalculatedDataLookup,
|
||||
UGSRatingsLookup,
|
||||
ProfileRatingLookup,
|
||||
UserGameStats,
|
||||
} from "tachi-common";
|
||||
import { GameClassSets } from "tachi-common/game-classes";
|
||||
@@ -16,7 +16,7 @@ import { GameClassSets } from "tachi-common/game-classes";
|
||||
export default function UGPTRatingsTable({ ugs }: { ugs: UserGameStats }) {
|
||||
const gptConfig = GetGamePTConfig(ugs.game, ugs.playtype);
|
||||
|
||||
const ratings = Object.entries(ugs.ratings) as [UGSRatingsLookup[IDStrings], number][];
|
||||
const ratings = Object.entries(ugs.ratings) as [ProfileRatingLookup[IDStrings], number][];
|
||||
|
||||
return (
|
||||
<MiniTable className="table-sm text-center" headers={["Player Stats"]} colSpan={2}>
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
IDStrings,
|
||||
ScoreCalculatedDataLookup,
|
||||
SessionCalculatedDataLookup,
|
||||
UGSRatingsLookup,
|
||||
ProfileRatingLookup,
|
||||
} from "tachi-common";
|
||||
import { Playtype } from "tachi-common";
|
||||
import useLUGPTSettings from "./useLUGPTSettings";
|
||||
@@ -42,14 +42,14 @@ export function useSessionRatingAlg<I extends IDStrings = IDStrings>(
|
||||
export function useProfileRatingAlg<I extends IDStrings = IDStrings>(
|
||||
game: Game,
|
||||
playtype: Playtype
|
||||
): UGSRatingsLookup[I] {
|
||||
): ProfileRatingLookup[I] {
|
||||
const { settings } = useLUGPTSettings();
|
||||
|
||||
if (!settings?.preferences.preferredProfileAlg) {
|
||||
const gptConfig = GetGamePTConfig(game, playtype);
|
||||
|
||||
return gptConfig.defaultProfileRatingAlg as UGSRatingsLookup[I];
|
||||
return gptConfig.defaultProfileRatingAlg as ProfileRatingLookup[I];
|
||||
}
|
||||
|
||||
return settings.preferences.preferredProfileAlg as UGSRatingsLookup[I];
|
||||
return settings.preferences.preferredProfileAlg as ProfileRatingLookup[I];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user