feat: tank performance filters

This commit is contained in:
TrèsAbhi committed 2024-07-02 19:19:15 -05:00
1 parent 4b46eb59e0
commit 4c6369b8b4
9 files changed
+106 -85

No files matched your search

-9
View File
@@ -2,7 +2,6 @@ import { produce } from 'immer';
import { create } from 'zustand';
import { TankClass, TreeType } from '../components/Tanks';
import { Tier } from '../core/blitzkit/tankDefinitions';
import { TankopediaSortBy, TankopediaSortDirection } from './tankopedia';
export interface TankopediaFilters {
tier?: Tier;
@@ -11,19 +10,11 @@ export interface TankopediaFilters {
type?: TreeType;
testing: 'include' | 'exclude' | 'only';
search?: string;
sort: {
by: TankopediaSortBy;
direction: TankopediaSortDirection;
};
searching: boolean;
}
export const useTankopediaFilters = create<TankopediaFilters>()(() => ({
testing: 'include',
sort: {
by: 'meta.none',
direction: 'descending',
},
searching: false,
}));
+17
View File
@@ -0,0 +1,17 @@
import { produce } from 'immer';
import { create } from 'zustand';
import { TankopediaSortBy, TankopediaSortDirection } from './tankopedia';
export interface TankopediaSort {
by: TankopediaSortBy;
direction: TankopediaSortDirection;
}
export const useTankopediaSort = create<TankopediaSort>()(() => ({
by: 'meta.none',
direction: 'descending',
}));
export function mutateTankopediaSort(recipe: (draft: TankopediaSort) => void) {
useTankopediaSort.setState(produce(recipe));
}