UNPKG

scrabble-solver

Version:

Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Crossplay, Literaki, and Kelimelik. Quickly find the top-scoring words using the given board and tiles.

52 lines (41 loc) 1.74 kB
import { createSlice, type PayloadAction } from '@reduxjs/toolkit'; import { type Game, type Locale, type ShowCoordinates } from '@scrabble-solver/types'; import type { AutoGroupTiles, InputMode, RemoveCellFilters } from '@/types'; import { settingsInitialState } from './initialState'; export const settingsSlice = createSlice({ initialState: settingsInitialState, name: 'settings', reducers: { changeAutoGroupTiles: (state, action: PayloadAction<AutoGroupTiles>) => { const autoGroupTiles = action.payload; return { ...state, autoGroupTiles }; }, changeGame: (state, action: PayloadAction<Game>) => { const game = action.payload; return { ...state, game }; }, changeHighlightUnreachableCells: (state, action: PayloadAction<boolean>) => { const highlightUnreachableCells = action.payload; return { ...state, highlightUnreachableCells }; }, changeInputMode: (state, action: PayloadAction<InputMode>) => { const inputMode = action.payload; return { ...state, inputMode }; }, changeLocale: (state, action: PayloadAction<Locale>) => { const locale = action.payload; return { ...state, locale }; }, changeShowCoordinates: (state, action: PayloadAction<ShowCoordinates>) => { const showCoordinates = action.payload; return { ...state, showCoordinates }; }, changeRemoveCellFilters: (state, action: PayloadAction<RemoveCellFilters>) => { const removeCellFilters = action.payload; return { ...state, removeCellFilters }; }, init: (state, action: PayloadAction<Partial<Pick<typeof settingsInitialState, 'game' | 'locale'>>>) => { return { ...state, ...action.payload }; }, }, });