smh my head
This commit is contained in:
parent
448155a3c3
commit
de441b698c
@ -1,5 +1,5 @@
|
|||||||
import ScoreSaberPlayer from "./impl/scoresaber-player";
|
import ScoreSaberPlayer from "./impl/scoresaber-player";
|
||||||
import { Timeframe } from "../timeframe";
|
import { StatisticRange } from "./player";
|
||||||
|
|
||||||
export type PlayerStatValue = {
|
export type PlayerStatValue = {
|
||||||
/**
|
/**
|
||||||
@ -10,7 +10,7 @@ export type PlayerStatValue = {
|
|||||||
/**
|
/**
|
||||||
* The value of the stat.
|
* The value of the stat.
|
||||||
*/
|
*/
|
||||||
value: (player: ScoreSaberPlayer, range: Timeframe) => number | undefined;
|
value: (player: ScoreSaberPlayer, range: StatisticRange) => number | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PlayerStatChangeType =
|
export type PlayerStatChangeType =
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { PlayerHistory } from "./player-history";
|
import { PlayerHistory } from "./player-history";
|
||||||
import { Timeframe } from "../timeframe";
|
|
||||||
|
|
||||||
export default class Player {
|
export default class Player {
|
||||||
/**
|
/**
|
||||||
@ -56,8 +55,7 @@ export default class Player {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type StatisticRange = "daily" | "weekly" | "monthly";
|
||||||
export type StatisticChange = {
|
export type StatisticChange = {
|
||||||
daily: PlayerHistory;
|
[key in StatisticRange]: PlayerHistory;
|
||||||
weekly: PlayerHistory;
|
|
||||||
monthly: PlayerHistory;
|
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@ import { capitalizeFirstLetter } from "@/common/string-utils";
|
|||||||
import Tooltip from "@/components/tooltip";
|
import Tooltip from "@/components/tooltip";
|
||||||
import { ReactElement } from "react";
|
import { ReactElement } from "react";
|
||||||
import { PlayerStatValue } from "@ssr/common/player/player-stat-change";
|
import { PlayerStatValue } from "@ssr/common/player/player-stat-change";
|
||||||
import { Timeframe } from "@ssr/common/timeframe";
|
import { StatisticRange } from "@ssr/common/player/player";
|
||||||
|
|
||||||
type ChangeOverTimeProps = {
|
type ChangeOverTimeProps = {
|
||||||
/**
|
/**
|
||||||
@ -40,7 +40,7 @@ export function ChangeOverTime({ player, type, children }: ChangeOverTimeProps)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Renders the change for a given time frame
|
// Renders the change for a given time frame
|
||||||
const renderChange = (value: number | undefined, range: Timeframe) => (
|
const renderChange = (value: number | undefined, range: StatisticRange) => (
|
||||||
<p>
|
<p>
|
||||||
{capitalizeFirstLetter(range)} Change:{" "}
|
{capitalizeFirstLetter(range)} Change:{" "}
|
||||||
<span className={value === undefined ? "" : value >= 0 ? (value === 0 ? "" : "text-green-500") : "text-red-500"}>
|
<span className={value === undefined ? "" : value >= 0 ? (value === 0 ? "" : "text-green-500") : "text-red-500"}>
|
||||||
|
Reference in New Issue
Block a user