feat: added options

This commit is contained in:
TrèsAbhi committed 2023-10-01 18:43:40 -05:00
1 parent 8264f19ad4
commit 7f431b07e1
7 files changed
+305 -142

No files matched your search

+19
View File
@@ -1,5 +1,7 @@
import { produce } from 'immer';
import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware';
import { CustomColumnDisplay } from '../app/tools/session/components/CustomColumn';
import { Region } from '../constants/regions';
import { NormalizedTankStats } from '../types/tanksStats';
@@ -18,6 +20,11 @@ type Session = (
}
) & {
promptBeforeReset: boolean;
customColumns: {
display: CustomColumnDisplay;
showDelta: boolean;
}[] & { length: 4 };
showTotal: boolean;
};
export const useSession = create<Session>()(
@@ -26,6 +33,14 @@ export const useSession = create<Session>()(
(set) => ({
isTracking: false,
promptBeforeReset: true,
showTotal: true,
customColumns: [
{ display: 'battles', showDelta: false },
{ display: 'winrate', showDelta: true },
{ display: 'wn8', showDelta: false },
{ display: 'damage', showDelta: true },
],
}),
{
name: 'session',
@@ -33,3 +48,7 @@ export const useSession = create<Session>()(
),
),
);
export default function mutateSession(recipe: (draft: Session) => void) {
useSession.setState(produce(recipe));
}