mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: use custom state manager
This commit is contained in:
1 parent
cf38cb3a6e
commit
87b6a36520
11 files changed
+84
-36
No files matched your search
@@ -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();
|
||||
Reference in new issue
Block a user