feat: use custom state manager

This commit is contained in:
TrèsAbhi committed 2025-09-01 18:03:07 -05:00
1 parent cf38cb3a6e
commit 87b6a36520
11 files changed
+84 -36

No files matched your search

+5 -16
View File
@@ -1,8 +1,6 @@
import { enableMapSet } from 'immer';
import { create } from 'zustand';
import { subscribeWithSelector } from 'zustand/middleware';
import { Varuna } from 'varuna';
import { tierListRows } from '../components/TierList/Table/constants';
import { createContextualStore } from '../core/zustand/createContextualStore';
export interface TierList {
dragging: boolean;
@@ -10,19 +8,10 @@ export interface TierList {
placedTanks: Set<number>;
}
enableMapSet();
export const tierListInitialState: TierList = {
export const TierList = new Varuna<TierList>({
dragging: false,
rows: tierListRows.map((row) => ({
name: row.name,
tanks: [],
})),
rows: tierListRows.map((row) => ({ name: row.name, tanks: [] })),
placedTanks: new Set(),
};
});
export const TierList = createContextualStore(() =>
create<TierList>()(
subscribeWithSelector<TierList>(() => tierListInitialState),
),
);
enableMapSet();