mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: tank performance filters
This commit is contained in:
1 parent
4b46eb59e0
commit
4c6369b8b4
9 files changed
+106
-85
No files matched your search
@@ -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,
|
||||
}));
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
Reference in new issue
Block a user