From ab830154189b9c82715f483e78be23f97f4a5d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 22 Oct 2024 15:14:10 -0500 Subject: [PATCH] feat: filters --- ...ersNivo.tsx => BattleDistributionAcrossTiers.tsx} | 12 +++++++++++- .../src/components/Performance/Charts/index.tsx | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) rename packages/website/src/components/Performance/Charts/components/{BattleDistributionAcrossTiersNivo.tsx => BattleDistributionAcrossTiers.tsx} (86%) diff --git a/packages/website/src/components/Performance/Charts/components/BattleDistributionAcrossTiersNivo.tsx b/packages/website/src/components/Performance/Charts/components/BattleDistributionAcrossTiers.tsx similarity index 86% rename from packages/website/src/components/Performance/Charts/components/BattleDistributionAcrossTiersNivo.tsx rename to packages/website/src/components/Performance/Charts/components/BattleDistributionAcrossTiers.tsx index 5a1b196e2..ccbd13c05 100644 --- a/packages/website/src/components/Performance/Charts/components/BattleDistributionAcrossTiersNivo.tsx +++ b/packages/website/src/components/Performance/Charts/components/BattleDistributionAcrossTiers.tsx @@ -8,8 +8,11 @@ import { TIERS, } from '@blitzkit/core'; import strings from '@blitzkit/core/lang/en-US.json'; +import { useStore } from '@nanostores/react'; import { Box, Flex, Heading } from '@radix-ui/themes'; +import { filterTank } from '../../../../core/blitzkit/filterTank'; import { useAveragesExclusionRatio } from '../../../../hooks/useAveragesExclusionRatio'; +import { $tankFilters } from '../../../../stores/tankFilters'; import { TankPerformanceEphemeral } from '../../../../stores/tankPerformanceEphemeral'; import { ThemedBar } from '../../../Nivo/ThemedBar'; @@ -22,6 +25,7 @@ export function BattleDistributionAcrossTiers() { (state) => state.playerCountPeriod, ); const ratio = useAveragesExclusionRatio(); + const filters = useStore($tankFilters); return ( @@ -40,7 +44,13 @@ export function BattleDistributionAcrossTiers() { const id = Number(idString); const tank = tankDefinitions.tanks[id]; - if (tank === undefined || tank.tier !== tier) return; + if ( + tank === undefined || + tank.tier !== tier || + !filterTank(filters, tank) + ) { + return; + } players[tank.class] += entry.samples[playerCountPeriod] * ratio; }); diff --git a/packages/website/src/components/Performance/Charts/index.tsx b/packages/website/src/components/Performance/Charts/index.tsx index a30184d18..a5517a681 100644 --- a/packages/website/src/components/Performance/Charts/index.tsx +++ b/packages/website/src/components/Performance/Charts/index.tsx @@ -1,5 +1,5 @@ import { Flex } from '@radix-ui/themes'; -import { BattleDistributionAcrossTiers } from './components/BattleDistributionAcrossTiersNivo'; +import { BattleDistributionAcrossTiers } from './components/BattleDistributionAcrossTiers'; export function Charts() { return (