feat: new rating stat style

This commit is contained in:
TrèsAbhi committed 2024-03-21 22:32:01 -05:00
1 parent 3b94034767
commit 298b89b227
5 files changed
+40 -28

No files matched your search

@@ -17,7 +17,7 @@ import { CommandRegistry } from '../events/interactionCreate';
export const ratingStatsCommand = new Promise<CommandRegistry>((resolve) => { export const ratingStatsCommand = new Promise<CommandRegistry>((resolve) => {
resolve({ resolve({
command: command:
createLocalizedCommand('rating-stats').addStringOption( createLocalizedCommand('rating-session').addStringOption(
addUsernameChoices, addUsernameChoices,
), ),
@@ -43,12 +43,13 @@ export const ratingStatsCommand = new Promise<CommandRegistry>((resolve) => {
const [statsB2] = (await getRatingNeighbors(region, id, 0)).neighbors; const [statsB2] = (await getRatingNeighbors(region, id, 0)).neighbors;
if (!statsA) { if (!statsA) {
return t`bot.commands.rating_stats.errors.unrecorded_stats`; return t`bot.commands.rating_session.errors.unrecorded_stats`;
} }
if (!statsB1) { if (!statsB1) {
return translate('bot.commands.rating_stats.errors.no_participation', [ return translate(
markdownEscape(accountInfo.nickname), 'bot.commands.rating_session.errors.no_participation',
]); [markdownEscape(accountInfo.nickname)],
);
} }
const delta = deltaBkrlBlitzStats(statsA, accountInfo.statistics.rating!); const delta = deltaBkrlBlitzStats(statsA, accountInfo.statistics.rating!);
@@ -58,7 +59,7 @@ export const ratingStatsCommand = new Promise<CommandRegistry>((resolve) => {
<TitleBar <TitleBar
title={accountInfo.nickname} title={accountInfo.nickname}
// image={clanImage} // TODO: add league icon here // image={clanImage} // TODO: add league icon here
description={t`bot.commands.rating_stats.body.subtitle`} description={t`bot.commands.rating_session.body.subtitle`}
/> />
{delta.battles === 0 && ( {delta.battles === 0 && (
@@ -19,7 +19,6 @@ export function HeroStat({ stats, locale }: WN8DisplayProps) {
let color: string; let color: string;
let heroStat: string | number; let heroStat: string | number;
let subtitle: string | number | undefined; let subtitle: string | number | undefined;
let subtitleImage: string | undefined;
if (stats.type === 'random') { if (stats.type === 'random') {
const percentile = const percentile =
@@ -44,41 +43,52 @@ export function HeroStat({ stats, locale }: WN8DisplayProps) {
flexDirection: 'column', flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
gap: -16, gap: stats.type === 'rating' ? -20 : -16,
}} }}
> >
<Glow color={color} /> <Glow color={color} />
<div <div
style={{ style={{
width: 128, width: stats.type === 'rating' ? 112 : 128,
height: 80, height: stats.type === 'rating' ? 112 : 80,
backgroundColor: color, backgroundColor: color,
borderRadius: 40, borderRadius: stats.type === 'rating' ? 8 : 40,
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
gap: -4, gap: -4,
transform: stats.type === 'rating' ? 'rotate(45deg)' : '',
}} }}
> >
<span <div
style={{ style={{
fontWeight: 900, transform: stats.type === 'rating' ? 'rotate(-45deg)' : '',
fontSize: 32, display: 'flex',
color: theme.colors.textHighContrast, flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
}} }}
> >
{heroStat} <span
</span> style={{
<span fontWeight: 900,
style={{ fontSize: 32,
fontSize: 16, color: theme.colors.textHighContrast,
color: theme.colors.textHighContrast, }}
}} >
> {heroStat}
{subtitle} </span>
</span> <span
style={{
fontSize: 16,
color: theme.colors.textHighContrast,
}}
>
{subtitle}
</span>
</div>
</div> </div>
<Glow color={color} direction="reverse" /> <Glow color={color} direction="reverse" />
@@ -33,6 +33,7 @@ export default function AllStatsOverview({
<div <div
style={{ style={{
display: 'flex', display: 'flex',
alignItems: 'center',
gap: -64, gap: -64,
width: '100%', width: '100%',
}} }}
+1 -1
View File
@@ -26,7 +26,7 @@ import { permissionsCommand } from '../../commands/permissions';
import { pingCommand } from '../../commands/ping'; import { pingCommand } from '../../commands/ping';
import { playerInfoCommand } from '../../commands/playerInfo'; import { playerInfoCommand } from '../../commands/playerInfo';
import { ratingLeaderboardCommand } from '../../commands/ratingLeaderboard'; import { ratingLeaderboardCommand } from '../../commands/ratingLeaderboard';
import { ratingStatsCommand } from '../../commands/ratingStats'; import { ratingStatsCommand } from '../../commands/ratingSession';
import { researchCommand } from '../../commands/research'; import { researchCommand } from '../../commands/research';
import { searchClansCommand } from '../../commands/searchClans'; import { searchClansCommand } from '../../commands/searchClans';
import { searchPlayersCommand } from '../../commands/searchPlayers'; import { searchPlayersCommand } from '../../commands/searchPlayers';
+2 -2
View File
@@ -541,8 +541,8 @@
} }
}, },
"rating_stats": { "rating_session": {
"$": "rating-stats", "$": "rating-session",
"description": "Rating player's statistics", "description": "Rating player's statistics",
"body": { "body": {