mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
Merge pull request #193 from Hitjack007/filter-by-provision
This commit is contained in:
5 files changed
+468
-593
No files matched your search
@@ -759,11 +759,13 @@
|
||||
"count_singular": "1 tank",
|
||||
"count_plural": "{count} tanks",
|
||||
"sorting_by": "Sorting by {name}",
|
||||
|
||||
"no_tanks_found": {
|
||||
"body": "No tanks found.",
|
||||
"search_again": "Try searching again.",
|
||||
"clear_filters": "Try clearing filters."
|
||||
},
|
||||
|
||||
"sort": {
|
||||
"meta.none": "none",
|
||||
"survivability.health": "health",
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -429,7 +429,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
}, [tankFilters, tankopediaSort]);
|
||||
|
||||
return (
|
||||
<Flex direction="column" gap="4" flexGrow="1" {...props}>
|
||||
<Flex direction="column" gap="2" flexGrow="1" {...props}>
|
||||
<SearchBar
|
||||
skeleton={skeleton}
|
||||
topResult={tanks?.[0]}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import type { TankDefinition } from "@blitzkit/core";
|
||||
import { checkConsumableProvisionInclusivity } from "@blitzkit/core/src/blitzkit/checkConsumableProvisionInclusivity";
|
||||
import { times } from "lodash-es";
|
||||
import { awaitableConsumableDefinitions } from "../../core/awaitables/consumableDefinitions";
|
||||
import type { TankFilters } from "../../stores/tankFilters";
|
||||
|
||||
const SHELLS = times(3, (index) => index);
|
||||
|
||||
const consumableDefinitions = await awaitableConsumableDefinitions;
|
||||
|
||||
export async function filterTank(
|
||||
filters: TankFilters,
|
||||
tank: TankDefinition,
|
||||
@@ -40,6 +44,18 @@ export async function filterTank(
|
||||
gun.shells[index].type === filters.shells[index]
|
||||
)
|
||||
)
|
||||
)
|
||||
) &&
|
||||
(filters.consumables.length === 0 ||
|
||||
filters.consumables.every((consumableId) =>
|
||||
tank.turrets.some((turret) =>
|
||||
turret.guns.some((gun) =>
|
||||
checkConsumableProvisionInclusivity(
|
||||
consumableDefinitions.consumables[consumableId],
|
||||
tank,
|
||||
gun
|
||||
)
|
||||
)
|
||||
)
|
||||
))
|
||||
);
|
||||
}
|
||||
@@ -21,6 +21,7 @@ export interface TankFilters {
|
||||
searching: boolean;
|
||||
gunType: CaseType<GunDefinition>[];
|
||||
shells: [ShellType | null, ShellType | null, ShellType | null];
|
||||
consumables: number[];
|
||||
|
||||
showTesting: boolean;
|
||||
showNonTesting: boolean;
|
||||
@@ -37,6 +38,7 @@ export const TankFilters = new Varuna<TankFilters>({
|
||||
searching: false,
|
||||
gunType: [],
|
||||
shells: [null, null, null],
|
||||
consumables: [],
|
||||
|
||||
showTesting: true,
|
||||
showNonTesting: true,
|
||||
|
||||
Reference in new issue
Block a user