mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: sort
This commit is contained in:
1 parent
16bee48989
commit
2dcfd13457
5 files changed
+199
-65
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import { produce } from 'immer';
|
||||
import { create } from 'zustand';
|
||||
|
||||
export const tankPerformanceSortTypeNames = {
|
||||
winrate: 'Winrate',
|
||||
players: 'Players (30d)',
|
||||
battles: 'Battles (career)',
|
||||
damage: 'Damage',
|
||||
survival: 'Survival',
|
||||
xp: 'XP',
|
||||
kills: 'Kills',
|
||||
spots: 'Spots',
|
||||
accuracy: 'Accuracy',
|
||||
shots: 'Shots',
|
||||
hits: 'Hits',
|
||||
damageRatio: 'Dmg. ratio',
|
||||
damageTaken: 'Dmg. taken',
|
||||
capturePoints: 'Cap points',
|
||||
} as const;
|
||||
|
||||
export const tankPerformanceSortTypeNamesArray = Object.keys(
|
||||
tankPerformanceSortTypeNames,
|
||||
) as TankPerformanceSortType[];
|
||||
|
||||
type TankPerformanceSortType = keyof typeof tankPerformanceSortTypeNames;
|
||||
|
||||
export interface TankPerformanceSort {
|
||||
type: TankPerformanceSortType;
|
||||
direction: -1 | 1;
|
||||
}
|
||||
|
||||
export const useTankPerformanceSort = create<TankPerformanceSort>()(() => ({
|
||||
type: 'battles',
|
||||
direction: -1,
|
||||
}));
|
||||
|
||||
export function mutateTankPerformanceSort(
|
||||
recipe: (draft: TankPerformanceSort) => void,
|
||||
) {
|
||||
useTankPerformanceSort.setState(produce(recipe));
|
||||
}
|
||||
Reference in new issue
Block a user