mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: safe sort
This commit is contained in:
1 parent
4d99e61bfb
commit
f0fc23712a
13 files changed
+73
-65
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { TankPerformanceSortType } from '.';
|
||||
|
||||
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[];
|
||||
@@ -0,0 +1,17 @@
|
||||
'use client';
|
||||
|
||||
import { createNextSafeStore } from '../../core/zustand/createNextSafeStore';
|
||||
import { tankPerformanceSortTypeNames } from './constants';
|
||||
|
||||
export type TankPerformanceSortType = keyof typeof tankPerformanceSortTypeNames;
|
||||
|
||||
export interface TankPerformanceSort {
|
||||
type: TankPerformanceSortType;
|
||||
direction: -1 | 1;
|
||||
}
|
||||
|
||||
export const { Provider, use, useMutation, useStore } =
|
||||
createNextSafeStore<TankPerformanceSort>({
|
||||
type: 'winrate',
|
||||
direction: -1,
|
||||
});
|
||||
Reference in new issue
Block a user