From c565f6e08712e56ca00117324e8a2c825bb232ea Mon Sep 17 00:00:00 2001 From: Cody Date: Sun, 31 May 2026 04:08:56 -0600 Subject: [PATCH 1/3] feat(compare): add /compare command with bedwars subcommand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Extract getBedWarsTable() from BedWarsProfile into a StatColumn[][] descriptor so stat layout is defined once and consumed by both the normal profile and the new compare profile - Add SplitPill component: split value box with per-player coloring (§a better / §c worse / §f equal) and ▲/▼ delta row - Add generic CompareProfile driven purely by the descriptor; no per-game renderer files needed - Add CompareCommand with @SubCommand bedwars; player2 defaults to the caller's linked account via existing missingSelfVerification logic - Add compare / compare-command / compare-bedwars i18n keys (en-US) - pnpm lint and pnpm test:types pass Co-Authored-By: Claude Sonnet 4.6 --- .../src/commands/bedwars/bedwars.profile.tsx | 88 +++++++-------- .../src/commands/compare/compare.command.tsx | 102 ++++++++++++++++++ .../src/commands/compare/compare.profile.tsx | 82 ++++++++++++++ apps/discord-bot/src/components/SplitPill.tsx | 76 +++++++++++++ apps/discord-bot/src/components/index.ts | 1 + locales/en-US/default.json | 3 + 6 files changed, 310 insertions(+), 42 deletions(-) create mode 100644 apps/discord-bot/src/commands/compare/compare.command.tsx create mode 100644 apps/discord-bot/src/commands/compare/compare.profile.tsx create mode 100644 apps/discord-bot/src/components/SplitPill.tsx diff --git a/apps/discord-bot/src/commands/bedwars/bedwars.profile.tsx b/apps/discord-bot/src/commands/bedwars/bedwars.profile.tsx index 452699499..ba92c73a9 100644 --- a/apps/discord-bot/src/commands/bedwars/bedwars.profile.tsx +++ b/apps/discord-bot/src/commands/bedwars/bedwars.profile.tsx @@ -6,17 +6,44 @@ * https://github.com/Statsify/statsify/blob/main/LICENSE */ -import { BedWarsModes, FormattedGame, type GameMode } from "@statsify/schemas"; +import { BedWarsMode, BedWarsModes, FormattedGame, type GameMode } from "@statsify/schemas"; import { Container, Footer, Header, Historical, SidebarItem, + StatColumn, Table, formatProgression, } from "#components"; import type { BaseProfileProps } from "#commands/base.hypixel-command"; +import type { LocalizeFunction } from "@statsify/discord"; + +export function getBedWarsTable(stats: BedWarsMode, t: LocalizeFunction): StatColumn[][] { + return [ + [ + { title: t("stats.wins"), color: "§a", value: stats.wins }, + { title: t("stats.losses"), color: "§c", value: stats.losses, lowerIsBetter: true }, + { title: t("stats.wlr"), color: "§6", value: stats.wlr }, + ], + [ + { title: t("stats.finalKills"), color: "§a", value: stats.finalKills }, + { title: t("stats.finalDeaths"), color: "§c", value: stats.finalDeaths, lowerIsBetter: true }, + { title: t("stats.fkdr"), color: "§6", value: stats.fkdr }, + ], + [ + { title: t("stats.kills"), color: "§a", value: stats.kills }, + { title: t("stats.deaths"), color: "§c", value: stats.deaths, lowerIsBetter: true }, + { title: t("stats.kdr"), color: "§6", value: stats.kdr }, + ], + [ + { title: t("stats.bedsBroken"), color: "§a", value: stats.bedsBroken }, + { title: t("stats.bedsLost"), color: "§c", value: stats.bedsLost, lowerIsBetter: true }, + { title: t("stats.bblr"), color: "§6", value: stats.bblr }, + ], + ]; +} export interface BedWarsProfileProps extends BaseProfileProps { mode: GameMode; @@ -71,47 +98,24 @@ export const BedWarsProfile = ({ time={time} /> - - - - - - - - - - - - - - - - - - - - - + {[ + ...getBedWarsTable(stats, t).map((row) => ( + + {row.map((col) => ( + + ))} + + )), + , + ]}