2024-11-25 14:20:10 -06:00
|
|
|
import { enableMapSet } from 'immer';
|
2024-11-17 16:34:18 -06:00
|
|
|
import { create } from 'zustand';
|
|
|
|
|
import { subscribeWithSelector } from 'zustand/middleware';
|
|
|
|
|
import { tierListRows } from '../components/TierList/Table/constants';
|
|
|
|
|
import { createContextualStore } from '../core/zustand/createContextualStore';
|
|
|
|
|
|
|
|
|
|
export interface TierList {
|
|
|
|
|
dragging: boolean;
|
|
|
|
|
tanks: number[][];
|
2024-11-25 14:20:10 -06:00
|
|
|
placedTanks: Set<number>;
|
2024-11-17 16:34:18 -06:00
|
|
|
}
|
|
|
|
|
|
2024-11-25 14:20:10 -06:00
|
|
|
enableMapSet();
|
|
|
|
|
|
2024-11-17 16:34:18 -06:00
|
|
|
export const TierList = createContextualStore(() =>
|
|
|
|
|
create<TierList>()(
|
|
|
|
|
subscribeWithSelector<TierList>(() => ({
|
|
|
|
|
dragging: false,
|
|
|
|
|
tanks: tierListRows.map(() => []),
|
2024-11-25 14:20:10 -06:00
|
|
|
placedTanks: new Set(),
|
2024-11-17 16:34:18 -06:00
|
|
|
})),
|
|
|
|
|
),
|
|
|
|
|
);
|