Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
mapmeld committed Nov 9, 2024
1 parent 9457b94 commit fcfc893
Show file tree
Hide file tree
Showing 2 changed files with 260 additions and 254 deletions.
8 changes: 5 additions & 3 deletions app/src/app/components/sidebar/UndoRedoButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { Button } from "@radix-ui/themes";
import { ResetIcon } from "@radix-ui/react-icons";
import type { TemporalState } from "zundo";

import type { MapStore } from "../../store/mapStore";

export function UndoRedoButton({ isRedo = false }) {
const mapStore = useMapStore.getState() as TemporalState;
const mapStore = useMapStore.temporal.getState() as TemporalState<MapStore>;

const handleClickUndoRedo = () => {
if (isRedo) {
mapStore.redo(1);
mapStore.redo();
} else {
mapStore.undo(1);
mapStore.undo();
}
};

Expand Down
Loading

0 comments on commit fcfc893

Please sign in to comment.