From 454c7bda8513ab33cd6bd1c28cf728054c1b6b94 Mon Sep 17 00:00:00 2001 From: Cody Date: Sat, 30 May 2026 16:08:12 -0600 Subject: [PATCH 1/8] Add rendering chart components --- .../src/commands/bedwars/bedwars.profile.tsx | 48 ++++- apps/discord-bot/src/components/Badge.tsx | 32 +++ apps/discord-bot/src/components/BarChart.tsx | 83 ++++++++ apps/discord-bot/src/components/Graph.tsx | 67 +++++++ apps/discord-bot/src/components/StatDelta.tsx | 34 ++++ apps/discord-bot/src/components/index.ts | 4 + docs/rendering-components-prd.md | 36 ++++ packages/rendering/src/intrinsics/Graph.ts | 182 ++++++++++++++++++ packages/rendering/src/intrinsics/index.ts | 1 + packages/rendering/src/jsx/instrinsics.ts | 4 +- 10 files changed, 489 insertions(+), 2 deletions(-) create mode 100644 apps/discord-bot/src/components/Badge.tsx create mode 100644 apps/discord-bot/src/components/BarChart.tsx create mode 100644 apps/discord-bot/src/components/Graph.tsx create mode 100644 apps/discord-bot/src/components/StatDelta.tsx create mode 100644 docs/rendering-components-prd.md create mode 100644 packages/rendering/src/intrinsics/Graph.ts diff --git a/apps/discord-bot/src/commands/bedwars/bedwars.profile.tsx b/apps/discord-bot/src/commands/bedwars/bedwars.profile.tsx index 452699499..80d7011d8 100644 --- a/apps/discord-bot/src/commands/bedwars/bedwars.profile.tsx +++ b/apps/discord-bot/src/commands/bedwars/bedwars.profile.tsx @@ -6,16 +6,20 @@ * https://github.com/Statsify/statsify/blob/main/LICENSE */ -import { BedWarsModes, FormattedGame, type GameMode } from "@statsify/schemas"; import { + Badge, + BarChart, Container, Footer, + Graph, Header, Historical, SidebarItem, + StatDelta, Table, formatProgression, } from "#components"; +import { BedWarsModes, FormattedGame, type GameMode } from "@statsify/schemas"; import type { BaseProfileProps } from "#commands/base.hypixel-command"; export interface BedWarsProfileProps extends BaseProfileProps { @@ -35,6 +39,22 @@ export const BedWarsProfile = ({ }: BedWarsProfileProps) => { const { bedwars } = player.stats; const stats = bedwars[mode.api]; + const modeWins = [ + { label: "Solo", value: bedwars.solo.wins || 0, color: "#4e79a7" }, + { label: "Doubles", value: bedwars.doubles.wins || 0, color: "#76b7b2" }, + { label: "3s", value: bedwars.threes.wins || 0, color: "#f28e2b" }, + { label: "4s", value: bedwars.fours.wins || 0, color: "#e15759" }, + { label: "4v4", value: bedwars["4v4"].wins || 0, color: "#9ca3af" }, + ]; + const ratioPoints = [ + { label: t("stats.wlr"), value: stats.wlr || 0 }, + { label: t("stats.fkdr"), value: stats.fkdr || 0 }, + { label: t("stats.kdr"), value: stats.kdr || 0 }, + { label: t("stats.bblr"), value: stats.bblr || 0 }, + ]; + const ratioAverage = + ratioPoints.reduce((total, point) => total + point.value, 0) / ratioPoints.length; + const fkdrDelta = (stats.fkdr || 0) - (bedwars.overall.fkdr || 0); const sidebar: SidebarItem[] = [ [t("stats.tokens"), t(bedwars.tokens), "§2"], @@ -113,6 +133,32 @@ export const BedWarsProfile = ({ exp={bedwars.exp} /> +
+ +
+ §lMode Wins +
+ §bVisual +
+ + + +
+ §lRatio Profile +
+ +
+ point.value))} + referenceValue={ratioAverage} + color="#9ca3af" + fillColor="rgba(156, 163, 175, 0.12)" + /> + +