feat: start of charts

This commit is contained in:
TrèsAbhi committed 2024-10-21 21:03:49 -05:00
1 parent 221492c645
commit 973d24a615
11 files changed
+98 -55

No files matched your search

@@ -0,0 +1,28 @@
import { create } from 'zustand';
import { createContextualStore } from '../core/zustand/createContextualStore';
export interface TankPerformanceEphemeral {
playerCountPeriod: PlayerCountPeriod;
mode: TankPerformanceMode;
}
export enum TankPerformanceMode {
Table,
Charts,
}
export enum PlayerCountPeriod {
Past120Days = 'd_120',
Past90Days = 'd_90',
Past60Days = 'd_60',
ThisMonth = 'd_30',
ThisWeek = 'd_7',
Yesterday = 'd_1',
}
export const TankPerformanceEphemeral = createContextualStore(() =>
create<TankPerformanceEphemeral>()(() => ({
playerCountPeriod: PlayerCountPeriod.ThisMonth,
mode: TankPerformanceMode.Table,
})),
);
@@ -1,8 +0,0 @@
export enum PlayerCountPeriod {
Past120Days = 'd_120',
Past90Days = 'd_90',
Past60Days = 'd_60',
ThisMonth = 'd_30',
ThisWeek = 'd_7',
Yesterday = 'd_1',
}
@@ -1,20 +0,0 @@
import * as lodash from 'lodash-es';
import { create } from 'zustand';
import { persist, subscribeWithSelector } from 'zustand/middleware';
import { createContextualStore } from '../../core/zustand/createContextualStore';
import { PlayerCountPeriod } from './constants';
export interface TankPerformancePersistent {
playerCountPeriod: PlayerCountPeriod;
}
export const TankPerformancePersistent = createContextualStore(() =>
create<TankPerformancePersistent>()(
persist(
subscribeWithSelector<TankPerformancePersistent>(() => ({
playerCountPeriod: PlayerCountPeriod.ThisMonth,
})),
{ name: 'tank-performance', merge: (a, b) => lodash.merge(b, a) },
),
),
);