mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-06-02 22:26:57 -05:00
Tiers page show current SP criteria for each
This commit is contained in:
parent
b2a401a746
commit
b1b4e928ca
|
|
@ -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<typeof loader>();
|
||||
|
||||
return (
|
||||
<Main halfWidth className="stack md">
|
||||
{TIERS.map((tier) => {
|
||||
const neededOrdinal = data.intervals.find(
|
||||
(i) => !i.isPlus && i.name === tier.name,
|
||||
)?.neededOrdinal;
|
||||
return (
|
||||
<div key={tier.name} className="stack horizontal sm items-center">
|
||||
<TierImage tier={{ isPlus: false, name: tier.name }} width={150} />
|
||||
|
|
@ -18,6 +36,16 @@ export default function TiersPage() {
|
|||
<div className="text-lg font-bold text-lighter">
|
||||
{tier.percentile}%
|
||||
</div>
|
||||
{neededOrdinal ? (
|
||||
<>
|
||||
<div className="text-xs font-semi-bold text-lighter">
|
||||
Current criteria
|
||||
</div>
|
||||
<div className="text-sm font-semi-bold text-lighter">
|
||||
{ordinalToSp(neededOrdinal)}SP
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user