From a3b8427258721b3eec6bbc4c087380b66ec97db3 Mon Sep 17 00:00:00 2001 From: eduardozgz <eduardozgz@protonmail.com> Date: Mon, 13 Jan 2025 20:10:48 +0100 Subject: [PATCH] remove assertions --- apps/website/src/app/status/BotStats.tsx | 5 +---- apps/website/src/app/status/ServerInfo.tsx | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/website/src/app/status/BotStats.tsx b/apps/website/src/app/status/BotStats.tsx index 5838ad5cb..f2037b177 100644 --- a/apps/website/src/app/status/BotStats.tsx +++ b/apps/website/src/app/status/BotStats.tsx @@ -1,4 +1,3 @@ -import assert from "assert"; import { useMemo } from "react"; import Image from "next/image"; import { useTranslation } from "react-i18next"; @@ -18,8 +17,6 @@ export function BotStatus({ const icon = id === "main" ? mainBotIcon : id === "premium" ? premiumBotIcon : null; - assert(icon); - const name = id === "main" ? "Member Counter" @@ -50,7 +47,7 @@ export function BotStatus({ return ( <article className="flex w-full max-w-[1200px] flex-col gap-2"> <h1 className="flex items-center gap-2 text-lg font-bold"> - <Image {...icon} alt="" className="h-6 w-6 rounded-md" /> + {icon && <Image {...icon} alt="" className="h-6 w-6 rounded-md" />} {name} </h1> <div className="grid gap-2 md:grid-cols-3"> diff --git a/apps/website/src/app/status/ServerInfo.tsx b/apps/website/src/app/status/ServerInfo.tsx index 9183663c9..f2567bd3d 100644 --- a/apps/website/src/app/status/ServerInfo.tsx +++ b/apps/website/src/app/status/ServerInfo.tsx @@ -1,4 +1,3 @@ -import assert from "assert"; import { CpuIcon, MemoryStickIcon, ServerIcon } from "lucide-react"; import prettyBytes from "pretty-bytes"; import { useTranslation } from "react-i18next"; @@ -12,8 +11,7 @@ export function ServerInfo({ host: { name, cpus, freeMemory, memory, loadAvg }, }: NonNullable<RouterOutputs["bot"]["getStatus"][number]["stats"]>[number]) { const { t, i18n } = useTranslation(); - const recentLoadAvg = loadAvg[0]; - assert(recentLoadAvg); + const recentLoadAvg = loadAvg[0] ?? 0; const memoryUsage = ((memory - freeMemory) / memory) * 100;