Files
blitzkit/src/stores/tankopediaSort.ts
T

17 lines
489 B
TypeScript
Raw Normal View History

2024-07-02 19:19:15 -05:00
import { produce } from 'immer';
import { create } from 'zustand';
import { TankopediaSortBy, TankopediaSortDirection } from './tankopedia';
export interface TankopediaSort {
by: TankopediaSortBy;
direction: TankopediaSortDirection;
}
export const useTankopediaSort = create<TankopediaSort>()(() => ({
by: 'meta.none',
direction: 'descending',
}));
export function mutateTankopediaSort(recipe: (draft: TankopediaSort) => void) {
useTankopediaSort.setState(produce(recipe));
}