From 6009832864a82ef35bfce486b7b46907a44f4f0d Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Tue, 20 Jan 2026 20:41:28 +0200 Subject: [PATCH] Add remove all/add all to damage combo filtering --- .../components/DamageComboBar.module.css | 28 ++++++++++++++++ .../components/DamageComboBar.tsx | 29 +++++++++++++++++ .../comp-analyzer/core/damage-combinations.ts | 32 +++++++++++++++++++ locales/da/analyzer.json | 4 ++- locales/de/analyzer.json | 4 ++- locales/en/analyzer.json | 4 ++- locales/es-ES/analyzer.json | 4 ++- locales/es-US/analyzer.json | 4 ++- locales/fr-CA/analyzer.json | 4 ++- locales/fr-EU/analyzer.json | 4 ++- locales/he/analyzer.json | 4 ++- locales/it/analyzer.json | 4 ++- locales/ja/analyzer.json | 4 ++- locales/ko/analyzer.json | 4 ++- locales/nl/analyzer.json | 4 ++- locales/pl/analyzer.json | 4 ++- locales/pt-BR/analyzer.json | 4 ++- locales/ru/analyzer.json | 4 ++- locales/zh/analyzer.json | 4 ++- 19 files changed, 137 insertions(+), 16 deletions(-) diff --git a/app/features/comp-analyzer/components/DamageComboBar.module.css b/app/features/comp-analyzer/components/DamageComboBar.module.css index 3a69fd517..59a9e6cb0 100644 --- a/app/features/comp-analyzer/components/DamageComboBar.module.css +++ b/app/features/comp-analyzer/components/DamageComboBar.module.css @@ -167,6 +167,34 @@ color: var(--text-lighter); } +.filterControlsRow { + display: flex; + gap: var(--s-2); + padding-block-end: var(--s-2); + border-block-end: 1px solid var(--border); + margin-block-end: var(--s-1); +} + +.filterControlButton { + padding: var(--s-1) var(--s-2); + background: var(--bg-lighter); + border: 1px solid var(--border); + border-radius: var(--rounded-sm); + font-size: var(--fonts-xs); + color: var(--text); + cursor: pointer; + transition: background-color 0.15s ease; +} + +.filterControlButton:hover:not(:disabled) { + background: var(--bg-lightest); +} + +.filterControlButton:disabled { + opacity: 0.5; + cursor: not-allowed; +} + .filteredItemsRow { display: flex; flex-wrap: wrap; diff --git a/app/features/comp-analyzer/components/DamageComboBar.tsx b/app/features/comp-analyzer/components/DamageComboBar.tsx index 2ab9cdbf8..fb70547a8 100644 --- a/app/features/comp-analyzer/components/DamageComboBar.tsx +++ b/app/features/comp-analyzer/components/DamageComboBar.tsx @@ -19,6 +19,7 @@ import { calculateDamageCombos, calculateInkTimeToKill, type ExcludedDamageKey, + getAllDamageKeys, } from "../core/damage-combinations"; import styles from "./DamageComboBar.module.css"; @@ -273,6 +274,8 @@ export function DamageComboList({ weaponIds }: DamageComboListProps) { return null; } + const allDamageKeys = getAllDamageKeys(weaponIds, targetSubDefenseAp); + const handleToggleFilter = (key: ExcludedDamageKey) => { const keyString = filterKeyToString(key); const exists = excludedKeys.some((k) => filterKeyToString(k) === keyString); @@ -286,6 +289,14 @@ export function DamageComboList({ weaponIds }: DamageComboListProps) { } }; + const handleRemoveAll = () => { + setExcludedKeys(allDamageKeys); + }; + + const handleClearAll = () => { + setExcludedKeys([]); + }; + return (
+
+ + +
{excludedKeys.length > 0 ? (
{excludedKeys.map((key) => ( diff --git a/app/features/comp-analyzer/core/damage-combinations.ts b/app/features/comp-analyzer/core/damage-combinations.ts index ab0dc2f1e..5eb32cbd1 100644 --- a/app/features/comp-analyzer/core/damage-combinations.ts +++ b/app/features/comp-analyzer/core/damage-combinations.ts @@ -90,6 +90,38 @@ export interface ExcludedDamageKey { damageType: DamageType; } +export function getAllDamageKeys( + weaponIds: MainWeaponId[], + targetSubDefenseAp = 0, +): ExcludedDamageKey[] { + const sources = extractDamageSources(weaponIds, targetSubDefenseAp); + const seen = new Set(); + const keys: ExcludedDamageKey[] = []; + + for (const source of sources) { + for (const damage of source.damages) { + const weaponType = damage.weaponType.toLowerCase() as + | "main" + | "sub" + | "special"; + const keyString = `${source.weaponId}-${weaponType}-${damage.type}`; + + if (seen.has(keyString)) { + continue; + } + seen.add(keyString); + + keys.push({ + weaponId: source.weaponId, + weaponType, + damageType: damage.type, + }); + } + } + + return keys; +} + export function calculateDamageCombos( weaponIds: MainWeaponId[], excludedKeys: ExcludedDamageKey[] = [], diff --git a/locales/da/analyzer.json b/locales/da/analyzer.json index 77c9315d3..658c56c1e 100644 --- a/locales/da/analyzer.json +++ b/locales/da/analyzer.json @@ -200,5 +200,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/de/analyzer.json b/locales/de/analyzer.json index b953987fc..1d0c790a5 100644 --- a/locales/de/analyzer.json +++ b/locales/de/analyzer.json @@ -200,5 +200,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/en/analyzer.json b/locales/en/analyzer.json index 88a267a56..3a7b73739 100644 --- a/locales/en/analyzer.json +++ b/locales/en/analyzer.json @@ -200,5 +200,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "Global Tracking", "comp.specialCategory.AREA_CONTROL": "Area Control", "comp.specialCategory.TEAM_SHIELD": "Team Shield", - "comp.specialCategory.TEAM_BUFF": "Team Buff" + "comp.specialCategory.TEAM_BUFF": "Team Buff", + "comp.removeAll": "Remove all", + "comp.addAll": "Add all" } diff --git a/locales/es-ES/analyzer.json b/locales/es-ES/analyzer.json index 20fb8618e..e59e384e2 100644 --- a/locales/es-ES/analyzer.json +++ b/locales/es-ES/analyzer.json @@ -203,5 +203,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/es-US/analyzer.json b/locales/es-US/analyzer.json index 20fb8618e..e59e384e2 100644 --- a/locales/es-US/analyzer.json +++ b/locales/es-US/analyzer.json @@ -203,5 +203,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/fr-CA/analyzer.json b/locales/fr-CA/analyzer.json index b07757167..832c82461 100644 --- a/locales/fr-CA/analyzer.json +++ b/locales/fr-CA/analyzer.json @@ -203,5 +203,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/fr-EU/analyzer.json b/locales/fr-EU/analyzer.json index 1a6ec443b..fb78aba58 100644 --- a/locales/fr-EU/analyzer.json +++ b/locales/fr-EU/analyzer.json @@ -203,5 +203,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/he/analyzer.json b/locales/he/analyzer.json index 1d43621ad..8ed7404d5 100644 --- a/locales/he/analyzer.json +++ b/locales/he/analyzer.json @@ -203,5 +203,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/it/analyzer.json b/locales/it/analyzer.json index bfb1266e9..8d9eef055 100644 --- a/locales/it/analyzer.json +++ b/locales/it/analyzer.json @@ -203,5 +203,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/ja/analyzer.json b/locales/ja/analyzer.json index 3c5975c25..fea95db6f 100644 --- a/locales/ja/analyzer.json +++ b/locales/ja/analyzer.json @@ -194,5 +194,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/ko/analyzer.json b/locales/ko/analyzer.json index cc088b0a2..f7149eaaa 100644 --- a/locales/ko/analyzer.json +++ b/locales/ko/analyzer.json @@ -194,5 +194,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/nl/analyzer.json b/locales/nl/analyzer.json index c1b912624..245055ae8 100644 --- a/locales/nl/analyzer.json +++ b/locales/nl/analyzer.json @@ -200,5 +200,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/pl/analyzer.json b/locales/pl/analyzer.json index 4f13f6be4..48856503f 100644 --- a/locales/pl/analyzer.json +++ b/locales/pl/analyzer.json @@ -206,5 +206,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/pt-BR/analyzer.json b/locales/pt-BR/analyzer.json index 57314b9bf..5e39aad02 100644 --- a/locales/pt-BR/analyzer.json +++ b/locales/pt-BR/analyzer.json @@ -203,5 +203,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/ru/analyzer.json b/locales/ru/analyzer.json index 9cc49a554..ab5240d0a 100644 --- a/locales/ru/analyzer.json +++ b/locales/ru/analyzer.json @@ -206,5 +206,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" } diff --git a/locales/zh/analyzer.json b/locales/zh/analyzer.json index 7f5e34ceb..0b7a48abc 100644 --- a/locales/zh/analyzer.json +++ b/locales/zh/analyzer.json @@ -194,5 +194,7 @@ "comp.specialCategory.GLOBAL_TRACKING": "", "comp.specialCategory.AREA_CONTROL": "", "comp.specialCategory.TEAM_SHIELD": "", - "comp.specialCategory.TEAM_BUFF": "" + "comp.specialCategory.TEAM_BUFF": "", + "comp.removeAll": "", + "comp.addAll": "" }