mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: tier filters
This commit is contained in:
1 parent
5b4601b671
commit
7020e5641f
4 files changed
+127
-70
No files matched your search
@@ -1,21 +1,32 @@
|
||||
import { produce } from 'immer';
|
||||
import { create } from 'zustand';
|
||||
import { devtools, persist } from 'zustand/middleware';
|
||||
import { TIERS, Tier } from '../core/blitzkrieg/tankopedia';
|
||||
|
||||
export type TankopediaSortBy = 'tier' | 'name';
|
||||
export type TankopediaSortDirection = 'ascending' | 'descending';
|
||||
|
||||
type Tankopedia = {
|
||||
sortBy: TankopediaSortBy;
|
||||
sortDirection: TankopediaSortDirection;
|
||||
sort: {
|
||||
by: TankopediaSortBy;
|
||||
direction: TankopediaSortDirection;
|
||||
};
|
||||
filters: {
|
||||
tiers: Tier[];
|
||||
};
|
||||
};
|
||||
|
||||
export const useTankopedia = create<Tankopedia>()(
|
||||
devtools(
|
||||
persist(
|
||||
(set) => ({
|
||||
sortBy: 'tier',
|
||||
sortDirection: 'descending',
|
||||
sort: {
|
||||
by: 'tier',
|
||||
direction: 'descending',
|
||||
},
|
||||
filters: {
|
||||
tiers: [...TIERS],
|
||||
},
|
||||
}),
|
||||
{ name: 'tankopedia' },
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user