Files
zkldi_Tachi/client/src/lib/games/_util.ts
T
nairobiandzk 0a0fc57134 feat: O.N.G.E.K.I. Re:Fresh rating algorithm (#1263)
* feat: Re:Fresh support, rebased for the 6th time

* fix: migration

* fix: seeds

* fix: add tests and make them work

* fix: misc corrections

* rebased

* chore: bump rg-stats

* maybe a better migration

* attempt manual lint

* fix: star formatters

* fix: re-add name overrides

* rename them again, more consistently

* revert rbreak

* finish renaming

* i may be stupid

* refresh insights

* insight fixes

* fix: re-add platinum graphs

* delete score._id

* fix: server test

* fix: tiebreaks

* fix: what

* fix: don't kill p-score if migration is reapplied

I wonder why this could be needed

* fix: maybe notify about any errors

* docs: redefine starRating

* docs: typo

* fix(client): shrink graphs when necessary

* fix(client): use compact starfield in the insight

* feat(client): separate column for hits

* fix(client): add vertical-align

* fix: validate p-score properly

* fix: recolor AB+ to blue, actually

* fix(client): insight readability improvements

* feat(client): nicer insight lamps

* feat(client): OngekiScoreRatingCell

* fix(client): use OngekiScoreRatingCell in insight

---------

Co-authored-by: zk <ktchidev@gmail.com>
2025-07-06 19:24:30 +01:00

49 lines
1.4 KiB
TypeScript

import { GPTRatingSystem } from "lib/types";
import { CSSProperties } from "react";
import { GPTString } from "tachi-common";
export function CreateRatingSys<GPT extends GPTString>(
name: string,
description: string,
enumName: string,
toNumber: GPTRatingSystem<GPT>["toNumber"],
toString: GPTRatingSystem<GPT>["toString"],
idvDifference: GPTRatingSystem<GPT>["idvDifference"] = () => false,
achievementFn: GPTRatingSystem<GPT>["achievementFn"] = undefined
): GPTRatingSystem<GPT> {
return {
description,
enumName,
name,
toNumber,
toString,
idvDifference,
achievementFn,
};
}
export function bg(bgColour: string): CSSProperties {
return { backgroundColor: bgColour };
}
export function bgc(bgColour: string, colour: string): CSSProperties {
return { backgroundColor: bgColour, color: colour };
}
export const RAINBOW_GRADIENT = {
background:
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)",
color: "var(--bs-dark)",
} as const;
export const RAINBOW_SHINY_GRADIENT = {
background:
"linear-gradient(-45deg, #ff8697, #ff9dbf, #9e81d0, #87caff, #7dae80, #ffffa7, #ffd88a, #ffab8d, #ff8697)",
color: "var(--bs-dark)",
} as const;
export const RAINBOW_EX_GRADIENT = {
background: "linear-gradient(-45deg, #0fa091, #0f98d5, #67087f, #d9007e, #f56e06)",
color: "var(--bs-light)",
} as const;