diff --git a/app/features/sendouq/routes/tiers.tsx b/app/features/sendouq/routes/tiers.tsx index b1b1c1e75..953a325e1 100644 --- a/app/features/sendouq/routes/tiers.tsx +++ b/app/features/sendouq/routes/tiers.tsx @@ -1,15 +1,33 @@ +import { useLoaderData } from "@remix-run/react"; import { TierImage } from "~/components/Image"; import { Main } from "~/components/Main"; +import { ordinalToSp } from "~/features/mmr"; import { TEAM_LEADERBOARD_MIN_ENTRIES_FOR_LEVIATHAN, TIERS, USER_LEADERBOARD_MIN_ENTRIES_FOR_LEVIATHAN, } from "~/features/mmr/mmr-constants"; +import { currentOrPreviousSeason } from "~/features/mmr/season"; +import { userSkills } from "~/features/mmr/tiered.server"; + +export const loader = async () => { + const season = currentOrPreviousSeason(new Date()); + const { intervals } = await userSkills(season!.nth); + + return { + intervals, + }; +}; export default function TiersPage() { + const data = useLoaderData(); + return (
{TIERS.map((tier) => { + const neededOrdinal = data.intervals.find( + (i) => !i.isPlus && i.name === tier.name, + )?.neededOrdinal; return (
@@ -18,6 +36,16 @@ export default function TiersPage() {
{tier.percentile}%
+ {neededOrdinal ? ( + <> +
+ Current criteria +
+
+ {ordinalToSp(neededOrdinal)}SP +
+ + ) : null}
);