Skip to content

Commit

Permalink
Define UNDO/REDO actions.
Browse files Browse the repository at this point in the history
Part of #65.
  • Loading branch information
jkomoros committed Sep 20, 2023
1 parent 7690da3 commit c1eafd4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export const SEED_EVENT = 'SEED_EVENT';
export const SEED_FINISHED = 'SEED_FINISHED';
export const SEED_ERRORED = 'SEED_ERRORED';
export const CLOSE_RUN_DIALOG = 'CLOSE_RUN_DIALOG';
export const UNDO = 'UNDO';
export const REDO = 'REDO';

const actionUpdatePage = z.object({
type: z.literal(UPDATE_PAGE),
Expand Down Expand Up @@ -219,6 +221,14 @@ const actionCloseRunDialog = z.object({
type: z.literal(CLOSE_RUN_DIALOG)
});

const actionUndo = z.object({
type: z.literal(UNDO)
});

const actionRedo = z.object({
type: z.literal(REDO)
});

const someAction = z.discriminatedUnion('type', [
actionUpdatePage,
actionUpdateOffline,
Expand Down Expand Up @@ -246,7 +256,9 @@ const someAction = z.discriminatedUnion('type', [
actionSeedEvent,
actionSeedFinished,
actionSeedErrored,
actionCloseRunDialog
actionCloseRunDialog,
actionUndo,
actionRedo
]);

export type SomeAction = z.infer<typeof someAction>;

0 comments on commit c1eafd4

Please sign in to comment.