{
+ if (selected) {
+ draft.nations = draft.nations.filter((n) => n !== nation);
+ } else {
+ draft.nations = [...draft.nations, nation];
+ }
+ });
}}
- />
+ checked={selected}
+ key={nation}
+ >
+
+
+
- {
- strings.common.nations[
- nation as keyof typeof strings.common.nations
- ]
- }
-
- );
- })}
+
-
+ {
+ strings.common.nations[
+ nation as keyof typeof strings.common.nations
+ ]
+ }
+
+ );
+ })}
-
{
- event.preventDefault();
+
- TankFilters.mutate((draft) => {
- draft.nations = [];
- });
- }}
- >
- {strings.website.common.tank_search.clear}
+ {
+ event.preventDefault();
-
-
-
+ TankFilters.mutate((draft) => {
+ draft.nations = [];
+ });
+ }}
+ >
+ {strings.website.common.tank_search.clear}
+
+
+
+
+
);
}
@@ -371,56 +377,58 @@ function ClassFilter() {
-
- {tankClassOrder.map((tankClass) => {
- const selected = rawClasses.includes(tankClass);
+
+
+ {tankClassOrder.map((tankClass) => {
+ const selected = rawClasses.includes(tankClass);
- return (
- {
- event.preventDefault();
+ return (
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- if (selected) {
- draft.classes = draft.classes.filter(
- (c) => c !== tankClass,
- );
- } else {
- draft.classes = [...draft.classes, tankClass];
- }
- });
- }}
- checked={selected}
- >
-
-
-
+ TankFilters.mutate((draft) => {
+ if (selected) {
+ draft.classes = draft.classes.filter(
+ (c) => c !== tankClass,
+ );
+ } else {
+ draft.classes = [...draft.classes, tankClass];
+ }
+ });
+ }}
+ checked={selected}
+ >
+
+
+
- {strings.common.tank_class_medium[tankClass]}
+ {strings.common.tank_class_medium[tankClass]}
-
-
- );
- })}
+
+
+ );
+ })}
-
+
- {
- event.preventDefault();
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- draft.classes = [];
- });
- }}
- >
- {strings.website.common.tank_search.clear}
+ TankFilters.mutate((draft) => {
+ draft.classes = [];
+ });
+ }}
+ >
+ {strings.website.common.tank_search.clear}
-
-
-
+
+
+
+
);
}
@@ -447,54 +455,58 @@ function GunTypeFilter() {
-
- {gunTypeOrder.map((gunType) => {
- const selected = rawGunTypes.includes(gunType);
+
+
+ {gunTypeOrder.map((gunType) => {
+ const selected = rawGunTypes.includes(gunType);
- return (
- {
- event.preventDefault();
+ return (
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- if (selected) {
- draft.gunType = draft.gunType.filter((c) => c !== gunType);
- } else {
- draft.gunType = [...draft.gunType, gunType];
- }
- });
- }}
- checked={selected}
- key={gunType}
- >
-
-
-
+ TankFilters.mutate((draft) => {
+ if (selected) {
+ draft.gunType = draft.gunType.filter(
+ (c) => c !== gunType,
+ );
+ } else {
+ draft.gunType = [...draft.gunType, gunType];
+ }
+ });
+ }}
+ checked={selected}
+ key={gunType}
+ >
+
+
+
- {strings.common.gun_types[gunType]}
+ {strings.common.gun_types[gunType]}
-
-
- );
- })}
+
+
+ );
+ })}
-
+
- {
- event.preventDefault();
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- draft.gunType = [];
- });
- }}
- >
- {strings.website.common.tank_search.clear}
+ TankFilters.mutate((draft) => {
+ draft.gunType = [];
+ });
+ }}
+ >
+ {strings.website.common.tank_search.clear}
-
-
-
+
+
+
+
);
}
@@ -525,60 +537,62 @@ function TypeFilter() {
-
- {treeTypeOrder.map((tankType) => {
- const selected = rawTypes.includes(tankType);
+
+
+ {treeTypeOrder.map((tankType) => {
+ const selected = rawTypes.includes(tankType);
- return (
- {
- event.preventDefault();
+ return (
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- if (selected) {
- draft.types = draft.types.filter((c) => c !== tankType);
- } else {
- draft.types = [...draft.types, tankType];
- }
- });
- }}
- checked={selected}
- key={tankType}
- >
-
-
-
-
- {strings.common.tree_type[tankType]}
-
- {
+ if (selected) {
+ draft.types = draft.types.filter((c) => c !== tankType);
+ } else {
+ draft.types = [...draft.types, tankType];
+ }
+ });
}}
- />
-
- );
- })}
+ checked={selected}
+ key={tankType}
+ >
+
+
+
-
+ {strings.common.tree_type[tankType]}
- {
- event.preventDefault();
+
+
+ );
+ })}
- TankFilters.mutate((draft) => {
- draft.types = [];
- });
- }}
- >
- {strings.website.common.tank_search.clear}
+
-
-
-
+ {
+ event.preventDefault();
+
+ TankFilters.mutate((draft) => {
+ draft.types = [];
+ });
+ }}
+ >
+ {strings.website.common.tank_search.clear}
+
+
+
+
+
);
}
@@ -624,76 +638,78 @@ function IndividualShellFilter({
-
-
- {Object.values(ShellType).map((shellType) => {
- if (typeof shellType === "string") return null;
+
+
+
+ {Object.values(ShellType).map((shellType) => {
+ if (typeof shellType === "string") return null;
- const selected = shells[index] === shellType;
+ const selected = shells[index] === shellType;
- return (
- {
- event.preventDefault();
+ return (
+ {
+ event.preventDefault();
- const mutated = [...shells] as TankFilters["shells"];
+ const mutated = [...shells] as TankFilters["shells"];
- mutated[index] = selected ? null : shellType;
+ mutated[index] = selected ? null : shellType;
- TankFilters.mutate((draft) => {
- draft.shells = mutated;
- });
- }}
- color={selected ? undefined : "gray"}
- >
-
-
-
+ TankFilters.mutate((draft) => {
+ draft.shells = mutated;
+ });
+ }}
+ color={selected ? undefined : "gray"}
+ >
+
+
+
- {
- strings.common.shells[
- shellTypeIcons[
- shellType
- ] as keyof typeof strings.common.shells
- ]
- }
+ {
+ strings.common.shells[
+ shellTypeIcons[
+ shellType
+ ] as keyof typeof strings.common.shells
+ ]
+ }
-
-
- );
- })}
+
+
+ );
+ })}
-
+
- {
- event.preventDefault();
+ {
+ event.preventDefault();
- const mutated = [...shells] as TankFilters["shells"];
+ const mutated = [...shells] as TankFilters["shells"];
- mutated[index] = null;
+ mutated[index] = null;
- TankFilters.mutate((draft) => {
- draft.shells = mutated;
- });
- }}
- >
- {strings.website.common.tank_search.clear}
+ TankFilters.mutate((draft) => {
+ draft.shells = mutated;
+ });
+ }}
+ >
+ {strings.website.common.tank_search.clear}
-
-
-
-
+
+
+
+
+
);
}
@@ -825,60 +841,62 @@ function ConsumablesFilter() {
-
- {consumablesArray.map((consumable) => {
- const selected = rawConsumables.includes(consumable);
- const consumableDefinition =
- consumableDefinitions.consumables[consumable];
+
+
+ {consumablesArray.map((consumable) => {
+ const selected = rawConsumables.includes(consumable);
+ const consumableDefinition =
+ consumableDefinitions.consumables[consumable];
- return (
- {
- event.preventDefault();
+ return (
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- if (selected) {
- draft.consumables = draft.consumables.filter(
- (n) => n !== consumable,
- );
- } else {
- draft.consumables = [...draft.consumables, consumable];
- }
- });
- }}
- checked={selected}
- key={consumable}
- >
-
-
-
+ TankFilters.mutate((draft) => {
+ if (selected) {
+ draft.consumables = draft.consumables.filter(
+ (n) => n !== consumable,
+ );
+ } else {
+ draft.consumables = [...draft.consumables, consumable];
+ }
+ });
+ }}
+ checked={selected}
+ key={consumable}
+ >
+
+
+
- {unwrap(consumableDefinition.name!)}
+ {unwrap(consumableDefinition.name!)}
-
-
- );
- })}
+
+
+ );
+ })}
-
+
- {
- event.preventDefault();
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- draft.consumables = [];
- });
- }}
- >
- {strings.website.common.tank_search.clear}
+ TankFilters.mutate((draft) => {
+ draft.consumables = [];
+ });
+ }}
+ >
+ {strings.website.common.tank_search.clear}
-
-
-
+
+
+
+
);
}
@@ -912,60 +930,62 @@ function ProvisionsFilter() {
-
- {provisionsArray.map((provision) => {
- const selected = rawProvisions.includes(provision);
- const provisionDefinition =
- provisionDefinitions.provisions[provision];
+
+
+ {provisionsArray.map((provision) => {
+ const selected = rawProvisions.includes(provision);
+ const provisionDefinition =
+ provisionDefinitions.provisions[provision];
- return (
- {
- event.preventDefault();
+ return (
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- if (selected) {
- draft.provisions = draft.provisions.filter(
- (n) => n !== provision,
- );
- } else {
- draft.provisions = [...draft.provisions, provision];
- }
- });
- }}
- checked={selected}
- key={provision}
- >
-
-
-
+ TankFilters.mutate((draft) => {
+ if (selected) {
+ draft.provisions = draft.provisions.filter(
+ (n) => n !== provision,
+ );
+ } else {
+ draft.provisions = [...draft.provisions, provision];
+ }
+ });
+ }}
+ checked={selected}
+ key={provision}
+ >
+
+
+
- {unwrap(provisionDefinition.name!)}
+ {unwrap(provisionDefinition.name!)}
-
-
- );
- })}
+
+
+ );
+ })}
-
+
- {
- event.preventDefault();
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- draft.provisions = [];
- });
- }}
- >
- {strings.website.common.tank_search.clear}
+ TankFilters.mutate((draft) => {
+ draft.provisions = [];
+ });
+ }}
+ >
+ {strings.website.common.tank_search.clear}
-
-
-
+
+
+
+
);
}
@@ -1010,141 +1030,146 @@ function GameModeAbilitiesFilter() {
-
- {gameModeRoles.map(({ gameModeId, consumables, provisions }) => {
- const gameMode = gameDefinitions.gameModes[gameModeId];
- const hasNeither =
- consumables.length === 0 && provisions.length === 0;
+
+
+ {gameModeRoles.map(({ gameModeId, consumables, provisions }) => {
+ const gameMode = gameDefinitions.gameModes[gameModeId];
+ const hasNeither =
+ consumables.length === 0 && provisions.length === 0;
- if (hasNeither) return null;
+ if (hasNeither) return null;
- const hasBoth = consumables.length > 0 && provisions.length > 0;
+ const hasBoth = consumables.length > 0 && provisions.length > 0;
- return (
-
- {consumables.length > 0 && (
-
- {hasBoth
- ? literals(strings.website.common.tank_search.active, {
- name: unwrap(gameMode.name!),
- })
- : unwrap(gameMode.name!)}
-
- )}
+ return (
+
+ {consumables.length > 0 && (
+
+ {hasBoth
+ ? literals(strings.website.common.tank_search.active, {
+ name: unwrap(gameMode.name!),
+ })
+ : unwrap(gameMode.name!)}
+
+ )}
- {consumables.map((consumable) => {
- {
- const selected = rawAbilities.includes(consumable);
- const abilityDefinition =
- consumableDefinitions.consumables[consumable];
+ {consumables.map((consumable) => {
+ {
+ const selected = rawAbilities.includes(consumable);
+ const abilityDefinition =
+ consumableDefinitions.consumables[consumable];
- return (
- {
- event.preventDefault();
+ return (
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- if (selected) {
- draft.abilities = draft.abilities.filter(
- (n) => n !== consumable,
- );
- } else {
- draft.abilities = [...draft.abilities, consumable];
- }
- });
- }}
- checked={selected}
- key={consumable}
- >
-
-
-
+ TankFilters.mutate((draft) => {
+ if (selected) {
+ draft.abilities = draft.abilities.filter(
+ (n) => n !== consumable,
+ );
+ } else {
+ draft.abilities = [
+ ...draft.abilities,
+ consumable,
+ ];
+ }
+ });
+ }}
+ checked={selected}
+ key={consumable}
+ >
+
+
+
- {unwrap(abilityDefinition.name!)}
+ {unwrap(abilityDefinition.name!)}
-
-
- );
- }
- })}
+
+
+ );
+ }
+ })}
- {provisions.length > 0 && (
-
- {hasBoth
- ? literals(strings.website.common.tank_search.passive, {
- name: unwrap(gameMode.name!),
- })
- : unwrap(gameMode.name!)}
-
- )}
+ {provisions.length > 0 && (
+
+ {hasBoth
+ ? literals(strings.website.common.tank_search.passive, {
+ name: unwrap(gameMode.name!),
+ })
+ : unwrap(gameMode.name!)}
+
+ )}
- {provisions.map((provision) => {
- {
- const selected = rawPowers.includes(provision);
- const powerDefinition =
- provisionDefinitions.provisions[provision];
+ {provisions.map((provision) => {
+ {
+ const selected = rawPowers.includes(provision);
+ const powerDefinition =
+ provisionDefinitions.provisions[provision];
- return (
- {
- event.preventDefault();
+ return (
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- if (selected) {
- draft.powers = draft.powers.filter(
- (n) => n !== provision,
- );
- } else {
- draft.powers = [...draft.powers, provision];
- }
- });
- }}
- checked={selected}
- key={provision}
- >
-
-
-
+ TankFilters.mutate((draft) => {
+ if (selected) {
+ draft.powers = draft.powers.filter(
+ (n) => n !== provision,
+ );
+ } else {
+ draft.powers = [...draft.powers, provision];
+ }
+ });
+ }}
+ checked={selected}
+ key={provision}
+ >
+
+
+
- {unwrap(powerDefinition.name!)}
+ {unwrap(powerDefinition.name!)}
-
-
- );
- }
- })}
-
- );
- })}
+
+
+ );
+ }
+ })}
+
+ );
+ })}
-
+
- {
- event.preventDefault();
+ {
+ event.preventDefault();
- TankFilters.mutate((draft) => {
- draft.abilities = [];
- draft.powers = [];
- });
- }}
- >
- {strings.website.common.tank_search.clear}
+ TankFilters.mutate((draft) => {
+ draft.abilities = [];
+ draft.powers = [];
+ });
+ }}
+ >
+ {strings.website.common.tank_search.clear}
-
-
-
+
+
+
+
);
}