mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: variable player count
This commit is contained in:
1 parent
d6fc037d4f
commit
03ce75c15d
15 files changed
+149
-28
No files matched your search
@@ -0,0 +1,8 @@
|
||||
export enum PlayerCountPeriod {
|
||||
Past120Days = 'd_120',
|
||||
Past90Days = 'd_90',
|
||||
Past60Days = 'd_60',
|
||||
ThisMonth = 'd_30',
|
||||
ThisWeek = 'd_7',
|
||||
Yesterday = 'd_1',
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
'use client';
|
||||
|
||||
import { merge } from 'lodash';
|
||||
import { create } from 'zustand';
|
||||
import { persist, subscribeWithSelector } from 'zustand/middleware';
|
||||
import { createNextSafeStore } from '../../core/zustand/createNextSafeStore';
|
||||
import { PlayerCountPeriod } from './constants';
|
||||
|
||||
export interface TankPerformancePersistent {
|
||||
playerCountPeriod: PlayerCountPeriod;
|
||||
}
|
||||
|
||||
export const { Provider, use, useMutation, useStore } = createNextSafeStore(
|
||||
() =>
|
||||
create<TankPerformancePersistent>()(
|
||||
persist(
|
||||
subscribeWithSelector<TankPerformancePersistent>(() => ({
|
||||
playerCountPeriod: PlayerCountPeriod.ThisMonth,
|
||||
})),
|
||||
{ name: 'tank-performance', merge: (a, b) => merge(b, a) },
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1,9 +1,9 @@
|
||||
import { TankPerformanceSortType } from '.';
|
||||
|
||||
export const tankPerformanceSortTypeNames = {
|
||||
export const TankPerformanceSortTypeNames = {
|
||||
winrate: 'Winrate',
|
||||
players: 'Players (30d)',
|
||||
battles: 'Battles (career)',
|
||||
players: 'Players',
|
||||
battles: 'Battles (total)',
|
||||
damage: 'Damage',
|
||||
survival: 'Survival',
|
||||
xp: 'XP',
|
||||
@@ -16,6 +16,7 @@ export const tankPerformanceSortTypeNames = {
|
||||
damageTaken: 'Dmg. taken',
|
||||
capturePoints: 'Cap points',
|
||||
} as const;
|
||||
export const tankPerformanceSortTypeNamesArray = Object.keys(
|
||||
tankPerformanceSortTypeNames,
|
||||
|
||||
export const TankPerformanceSortTypeNamesArray = Object.keys(
|
||||
TankPerformanceSortTypeNames,
|
||||
) as TankPerformanceSortType[];
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
import { create } from 'zustand';
|
||||
import { createNextSafeStore } from '../../core/zustand/createNextSafeStore';
|
||||
import { tankPerformanceSortTypeNames } from './constants';
|
||||
import { TankPerformanceSortTypeNames } from './constants';
|
||||
|
||||
export type TankPerformanceSortType = keyof typeof tankPerformanceSortTypeNames;
|
||||
export type TankPerformanceSortType = keyof typeof TankPerformanceSortTypeNames;
|
||||
|
||||
export interface TankPerformanceSort {
|
||||
type: TankPerformanceSortType;
|
||||
|
||||
Reference in new issue
Block a user