From 96b6270b5ce6b1bdeb9a9fbb049ef780609368f7 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 13 Aug 2023 11:04:01 +0300 Subject: [PATCH] Hide seasons tab for now --- app/routes/u.$identifier.tsx | 6 +++++- app/routes/u.$identifier/seasons.tsx | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/routes/u.$identifier.tsx b/app/routes/u.$identifier.tsx index df1493dc3..71fd42019 100644 --- a/app/routes/u.$identifier.tsx +++ b/app/routes/u.$identifier.tsx @@ -13,6 +13,7 @@ import { Main } from "~/components/Main"; import { SubNav, SubNavLink } from "~/components/SubNav"; import { db } from "~/db"; import { countArtByUserId } from "~/features/art"; +import { currentSeason } from "~/features/mmr"; import { userTopPlacements } from "~/features/top-search"; import { findVods } from "~/features/vods"; import { useTranslation } from "~/hooks/useTranslation"; @@ -132,7 +133,10 @@ export default function UserPageLayout() {
{t("header.profile")} - Seasons + {/* TODO: show also when not current season */} + {currentSeason(new Date()) ? ( + Seasons + ) : null} {isOwnPage && ( {t("actions.edit")} diff --git a/app/routes/u.$identifier/seasons.tsx b/app/routes/u.$identifier/seasons.tsx index ae274d2c0..7f83d9644 100644 --- a/app/routes/u.$identifier/seasons.tsx +++ b/app/routes/u.$identifier/seasons.tsx @@ -15,7 +15,7 @@ import { import { db } from "~/db"; import { ordinalToSp } from "~/features/mmr"; import { seasonAllMMRByUserId } from "~/features/mmr/queries/seasonAllMMRByUserId.server"; -import { seasonObject } from "~/features/mmr/season"; +import { currentSeason, seasonObject } from "~/features/mmr/season"; import { userSkills } from "~/features/mmr/tiered.server"; import { useIsMounted } from "~/hooks/useIsMounted"; import { notFoundIfFalsy } from "~/utils/remix"; @@ -55,6 +55,9 @@ export const loader = async ({ params, request }: LoaderArgs) => { ? parsedSearchParams.data : seasonsSearchParamsSchema.parse({}); + // TODO: handle it not being current season ("freshUserSkills" has ! that throws) + notFoundIfFalsy(currentSeason(new Date())); + const user = notFoundIfFalsy(db.users.findByIdentifier(identifier)); const { tier } = (await userSkills()).userSkills[user.id] ?? {