From 4eeac475dea5673a66559a0366cb29be2c522c71 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 18 Sep 2022 12:00:39 +0300 Subject: [PATCH] Allow browsing analyzer in prod for a few users --- app/routes/analyzer.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/routes/analyzer.tsx b/app/routes/analyzer.tsx index 00d7041c9..fffc046cb 100644 --- a/app/routes/analyzer.tsx +++ b/app/routes/analyzer.tsx @@ -7,6 +7,7 @@ import { WeaponCombobox } from "~/components/Combobox"; import { Image } from "~/components/Image"; import { Main } from "~/components/Main"; import { Toggle } from "~/components/Toggle"; +import { ADMIN_DISCORD_ID } from "~/constants"; import { useSetTitle } from "~/hooks/useSetTitle"; import type { AnalyzedBuild, Stat } from "~/modules/analyzer"; import { MAX_LDE_INTENSITY } from "~/modules/analyzer"; @@ -19,6 +20,7 @@ import type { AbilityPoints, SpecialEffectType, } from "~/modules/analyzer/types"; +import { useUser } from "~/modules/auth"; import type { BuildAbilitiesTupleWithUnknown } from "~/modules/in-game-lists"; import { SPLASH_WALL_ID, @@ -53,7 +55,15 @@ export const handle = { i18n: ["weapons", "analyzer"], }; +const canViewInProduction = (discordId?: string) => { + const LEAN_ID = "86905636402495488"; + const SENDOU_ID = ADMIN_DISCORD_ID; + + return discordId === LEAN_ID || discordId === SENDOU_ID; +}; + export default function BuildAnalyzerPage() { + const user = useUser(); const { t } = useTranslation(["analyzer", "common", "weapons"]); useSetTitle(t("common:pages.buildAnalyzer")); const { @@ -66,7 +76,12 @@ export default function BuildAnalyzerPage() { effects, } = useAnalyzeBuild(); - if (process.env.NODE_ENV === "production") return
Coming soon :)
; + if ( + process.env.NODE_ENV === "production" && + !canViewInProduction(user?.discordId) + ) { + return
Coming soon :)
; + } return (