mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: multi-select
This commit is contained in:
1 parent
3542cb1ece
commit
ac243a3cdd
11 files changed
+142
-115
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { produce } from 'immer';
|
||||
import { create } from 'zustand';
|
||||
import { TankClass, TreeType } from '../components/Tanks';
|
||||
import { Tier } from '../core/blitzkit/tankDefinitions';
|
||||
|
||||
export interface TankFilters {
|
||||
tiers: Tier[];
|
||||
nations: string[];
|
||||
classes: TankClass[];
|
||||
types: TreeType[];
|
||||
testing: 'include' | 'exclude' | 'only';
|
||||
search?: string;
|
||||
searching: boolean;
|
||||
}
|
||||
|
||||
export const useTankFilters = create<TankFilters>()(() => ({
|
||||
testing: 'include',
|
||||
searching: false,
|
||||
classes: [],
|
||||
nations: [],
|
||||
tiers: [],
|
||||
types: [],
|
||||
}));
|
||||
|
||||
export function mutateTankFilters(recipe: (draft: TankFilters) => void) {
|
||||
useTankFilters.setState(produce(recipe));
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { produce } from 'immer';
|
||||
import { create } from 'zustand';
|
||||
import { TankClass, TreeType } from '../components/Tanks';
|
||||
import { Tier } from '../core/blitzkit/tankDefinitions';
|
||||
|
||||
export interface TankopediaFilters {
|
||||
tier?: Tier;
|
||||
nation?: string;
|
||||
class?: TankClass;
|
||||
type?: TreeType;
|
||||
testing: 'include' | 'exclude' | 'only';
|
||||
search?: string;
|
||||
searching: boolean;
|
||||
}
|
||||
|
||||
export const useTankopediaFilters = create<TankopediaFilters>()(() => ({
|
||||
testing: 'include',
|
||||
searching: false,
|
||||
}));
|
||||
|
||||
export function mutateTankopediaFilters(
|
||||
recipe: (draft: TankopediaFilters) => void,
|
||||
) {
|
||||
useTankopediaFilters.setState(produce(recipe));
|
||||
}
|
||||
Reference in new issue
Block a user