mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: test tank filters
This commit is contained in:
1 parent
2ce083222e
commit
604e751bf4
6 files changed
+43
-5
No files matched your search
@@ -112,6 +112,7 @@ if (allTargets || targets?.includes('tankDefinitions')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tankDefinitions[id] = {
|
tankDefinitions[id] = {
|
||||||
|
id,
|
||||||
name,
|
name,
|
||||||
name_short,
|
name_short,
|
||||||
nation,
|
nation,
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ if (publish) {
|
|||||||
|
|
||||||
console.log(`Publishing to season ${info.current_season}...`);
|
console.log(`Publishing to season ${info.current_season}...`);
|
||||||
commitMultipleFiles(
|
commitMultipleFiles(
|
||||||
octokit,
|
|
||||||
'tresabhi',
|
'tresabhi',
|
||||||
'blitzkrieg-assets',
|
'blitzkrieg-assets',
|
||||||
'main',
|
'main',
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
import mutateTankopedia, {
|
import mutateTankopedia, {
|
||||||
TankopediaSortBy,
|
TankopediaSortBy,
|
||||||
TankopediaSortDirection,
|
TankopediaSortDirection,
|
||||||
|
TankopediaTestTankDisplay,
|
||||||
useTankopedia,
|
useTankopedia,
|
||||||
} from '../../../../stores/tankopedia';
|
} from '../../../../stores/tankopedia';
|
||||||
|
|
||||||
@@ -27,8 +28,8 @@ export function Options() {
|
|||||||
const tankopediaState = useTankopedia();
|
const tankopediaState = useTankopedia();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex justify="center" wrap="wrap" gap="4">
|
<Flex justify="center" wrap="wrap" gap="2">
|
||||||
<Flex gap="2">
|
<Flex gap="1">
|
||||||
<DropdownMenu.Root>
|
<DropdownMenu.Root>
|
||||||
<DropdownMenu.Trigger>
|
<DropdownMenu.Trigger>
|
||||||
<Button variant="soft">
|
<Button variant="soft">
|
||||||
@@ -78,6 +79,33 @@ export function Options() {
|
|||||||
</DropdownMenu.Root>
|
</DropdownMenu.Root>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<DropdownMenu.Root>
|
||||||
|
<DropdownMenu.Trigger>
|
||||||
|
<Button variant="soft">
|
||||||
|
Test tanks
|
||||||
|
<CaretDownIcon />
|
||||||
|
</Button>
|
||||||
|
</DropdownMenu.Trigger>
|
||||||
|
<DropdownMenu.Content>
|
||||||
|
<DropdownMenu.RadioGroup
|
||||||
|
value={tankopediaState.filters.test}
|
||||||
|
onValueChange={(value) =>
|
||||||
|
mutateTankopedia((draft) => {
|
||||||
|
draft.filters.test = value as TankopediaTestTankDisplay;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<DropdownMenu.RadioItem value="include">
|
||||||
|
Include
|
||||||
|
</DropdownMenu.RadioItem>
|
||||||
|
<DropdownMenu.RadioItem value="exclude">
|
||||||
|
Exclude
|
||||||
|
</DropdownMenu.RadioItem>
|
||||||
|
<DropdownMenu.RadioItem value="only">Only</DropdownMenu.RadioItem>
|
||||||
|
</DropdownMenu.RadioGroup>
|
||||||
|
</DropdownMenu.Content>
|
||||||
|
</DropdownMenu.Root>
|
||||||
|
|
||||||
<Flex>
|
<Flex>
|
||||||
{[...TIERS].reverse().map((tier, index) => (
|
{[...TIERS].reverse().map((tier, index) => (
|
||||||
<Button
|
<Button
|
||||||
@@ -236,6 +264,7 @@ export function Options() {
|
|||||||
tiers: [],
|
tiers: [],
|
||||||
treeTypes: [],
|
treeTypes: [],
|
||||||
types: [],
|
types: [],
|
||||||
|
test: 'include',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,12 @@ export default function Page() {
|
|||||||
: tankopediaState.filters.treeTypes.includes(tank.tree_type)) &&
|
: tankopediaState.filters.treeTypes.includes(tank.tree_type)) &&
|
||||||
(tankopediaState.filters.nations.length === 0
|
(tankopediaState.filters.nations.length === 0
|
||||||
? true
|
? true
|
||||||
: tankopediaState.filters.nations.includes(tank.nation)),
|
: tankopediaState.filters.nations.includes(tank.nation)) &&
|
||||||
|
(tankopediaState.filters.test === 'include'
|
||||||
|
? true
|
||||||
|
: tankopediaState.filters.test === 'exclude'
|
||||||
|
? !tank.testing
|
||||||
|
: tank.testing),
|
||||||
)
|
)
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
let diff = 0;
|
let diff = 0;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { TankType, TreeTypeString } from '../../../components/Tanks';
|
|||||||
import { asset } from '../asset';
|
import { asset } from '../asset';
|
||||||
|
|
||||||
export interface TankDefinition {
|
export interface TankDefinition {
|
||||||
|
id: number;
|
||||||
nation: string;
|
nation: string;
|
||||||
name: string;
|
name: string;
|
||||||
name_short?: string;
|
name_short?: string;
|
||||||
@@ -15,7 +16,7 @@ export interface TankDefinition {
|
|||||||
export type TankDefinitions = Record<number, TankDefinition>;
|
export type TankDefinitions = Record<number, TankDefinition>;
|
||||||
|
|
||||||
export const tankDefinitions = fetch(asset('definitions/tanks.json'), {
|
export const tankDefinitions = fetch(asset('definitions/tanks.json'), {
|
||||||
cache: 'no-store',
|
cache: 'no-cache',
|
||||||
}).then(async (response) => response.json() as Promise<TankDefinitions>);
|
}).then(async (response) => response.json() as Promise<TankDefinitions>);
|
||||||
|
|
||||||
const entries = new Promise<TankDefinition[]>(async (resolve) => {
|
const entries = new Promise<TankDefinition[]>(async (resolve) => {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Tier } from '../core/blitzkrieg/definitions/tanks';
|
|||||||
|
|
||||||
export type TankopediaSortBy = 'tier' | 'name';
|
export type TankopediaSortBy = 'tier' | 'name';
|
||||||
export type TankopediaSortDirection = 'ascending' | 'descending';
|
export type TankopediaSortDirection = 'ascending' | 'descending';
|
||||||
|
export type TankopediaTestTankDisplay = 'include' | 'exclude' | 'only';
|
||||||
|
|
||||||
type Tankopedia = {
|
type Tankopedia = {
|
||||||
sort: {
|
sort: {
|
||||||
@@ -17,6 +18,7 @@ type Tankopedia = {
|
|||||||
types: TankType[];
|
types: TankType[];
|
||||||
treeTypes: TreeTypeString[];
|
treeTypes: TreeTypeString[];
|
||||||
nations: string[];
|
nations: string[];
|
||||||
|
test: TankopediaTestTankDisplay;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ export const useTankopedia = create<Tankopedia>()(
|
|||||||
types: [],
|
types: [],
|
||||||
treeTypes: [],
|
treeTypes: [],
|
||||||
nations: [],
|
nations: [],
|
||||||
|
test: 'include',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: 'tankopedia' },
|
{ name: 'tankopedia' },
|
||||||
|
|||||||
Reference in new issue
Block a user