Skip to content

Commit

Permalink
update -> set
Browse files Browse the repository at this point in the history
  • Loading branch information
npinsker committed Jan 25, 2025
1 parent 78ca99b commit 62228f3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions hunts/src/GlobalFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { useStore } from "./store";

function GlobalFilter() {
const { filterValue, updateFilterValue } = useStore(
const { filterValue, setFilterValue } = useStore(
(state) => state.filterSlice
);
return (
Expand All @@ -11,7 +11,7 @@ function GlobalFilter() {
type="search"
value={filterValue || ""}
onChange={(e) => {
updateFilterValue(e.target.value);
setFilterValue(e.target.value);
}}
placeholder="Search by name, answer, tag, etc."
style={{
Expand Down
6 changes: 3 additions & 3 deletions hunts/src/chatSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useStore } from "./store";
import { CHAT_VERSION_OPTIONS } from "./chatSlice";

export const ChatVersionSelector = () => {
const { version, updateChatVersion } = useStore((state) => state.chatSlice);
const { version, setChatVersion } = useStore((state) => state.chatSlice);

return (
<div className="">
Expand All @@ -17,7 +17,7 @@ export const ChatVersionSelector = () => {
checked={version === CHAT_VERSION_OPTIONS.APP}
onChange={(evt) => {
if (evt.target.checked) {
updateChatVersion(CHAT_VERSION_OPTIONS.APP);
setChatVersion(CHAT_VERSION_OPTIONS.APP);
}
}}
/>
Expand All @@ -33,7 +33,7 @@ export const ChatVersionSelector = () => {
checked={version === CHAT_VERSION_OPTIONS.WEB}
onChange={(evt) => {
if (evt.target.checked) {
updateChatVersion(CHAT_VERSION_OPTIONS.WEB);
setChatVersion(CHAT_VERSION_OPTIONS.WEB);
}
}}
/>
Expand Down
4 changes: 2 additions & 2 deletions hunts/src/chatSlice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ChatSlice {
chatSlice: {
version: CHAT_VERSION_OPTIONS;

updateChatVersion: (version: CHAT_VERSION_OPTIONS) => void;
setChatVersion: (version: CHAT_VERSION_OPTIONS) => void;
};
}

Expand All @@ -23,7 +23,7 @@ export const chatSlice: StateCreator<
> = (set, get) => ({
chatSlice: {
version: CHAT_VERSION_OPTIONS.APP,
updateChatVersion: (version: CHAT_VERSION_OPTIONS) => {
setChatVersion: (version: CHAT_VERSION_OPTIONS) => {
set((state) => {
state.chatSlice.version = version;
});
Expand Down
8 changes: 4 additions & 4 deletions hunts/src/filterSlice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export interface FilterSlice {
solveStateFilter: SOLVE_STATE_FILTER_OPTIONS;
tags: PuzzleTag[];

updateFilterValue: (filterValue: string) => void;
updateSolveStateFilter: (
setFilterValue: (filterValue: string) => void;
setSolveStateFilter: (
solveStateFilter: SOLVE_STATE_FILTER_OPTIONS
) => void;
toggleFilterTag: (newTag: PuzzleTag) => void;
Expand All @@ -35,12 +35,12 @@ export const filterSlice: StateCreator<
solveStateFilter: SOLVE_STATE_FILTER_OPTIONS.ALL,
tags: [] as PuzzleTag[],

updateFilterValue: (filterValue: string) => {
setFilterValue: (filterValue: string) => {
set((state) => {
state.filterSlice.filterValue = filterValue;
});
},
updateSolveStateFilter: (solveStateFilter: SOLVE_STATE_FILTER_OPTIONS) => {
setSolveStateFilter: (solveStateFilter: SOLVE_STATE_FILTER_OPTIONS) => {
set((state) => {
state.filterSlice.solveStateFilter = solveStateFilter;
});
Expand Down
10 changes: 5 additions & 5 deletions hunts/src/solveStateFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function filterSolvedPuzzlesFn(
filterSolvedPuzzlesFn.autoRemove = (val: any) => !val;

export const SolvedStateFilter = () => {
const { solveStateFilter, updateSolveStateFilter } = useStore(
const { solveStateFilter, setSolveStateFilter } = useStore(
(store) => store.filterSlice
);
return (
Expand All @@ -77,7 +77,7 @@ export const SolvedStateFilter = () => {
checked={solveStateFilter === SOLVE_STATE_FILTER_OPTIONS.ALL}
onChange={(evt) => {
if (evt.target.checked) {
updateSolveStateFilter(SOLVE_STATE_FILTER_OPTIONS.ALL);
setSolveStateFilter(SOLVE_STATE_FILTER_OPTIONS.ALL);
}
}}
/>
Expand All @@ -94,7 +94,7 @@ export const SolvedStateFilter = () => {
}
onChange={(evt) => {
if (evt.target.checked) {
updateSolveStateFilter(SOLVE_STATE_FILTER_OPTIONS.UNSOLVED);
setSolveStateFilter(SOLVE_STATE_FILTER_OPTIONS.UNSOLVED);
}
}}
/>
Expand All @@ -113,11 +113,11 @@ export const SolvedStateFilter = () => {
}
onChange={(evt) => {
if (evt.target.checked) {
updateSolveStateFilter(
setSolveStateFilter(
SOLVE_STATE_FILTER_OPTIONS.UNSOLVED_WITH_SOLVED_METAS
);
} else {
updateSolveStateFilter(SOLVE_STATE_FILTER_OPTIONS.UNSOLVED);
setSolveStateFilter(SOLVE_STATE_FILTER_OPTIONS.UNSOLVED);
}
}}
/>
Expand Down

0 comments on commit 62228f3

Please sign in to comment.