Skip to content

Commit

Permalink
feat: add tutorial slice and global UI store interface
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelVR17 committed Feb 24, 2025
1 parent b3c635b commit 728d522
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/core/store/ui/@types/tutorial.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface TutorialGlobalUIStore {
run: boolean;
setRun: (run: boolean) => void;
}
6 changes: 5 additions & 1 deletion src/core/store/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ import { LoaderGlobalUIStore } from "./@types/loader.entity";
import { useLoaderSlice } from "./slices/loader.slice";
import { StepsGlobalUIStore } from "./@types/steps.entity";
import { useStepsSlice } from "./slices/steps.slice";
import { useTutorialSlice } from "./slices/tutorial.slice";
import { TutorialGlobalUIStore } from "./@types/tutorial.entity";

type GlobalUIState = ThemeGlobalUIStore &
LoaderGlobalUIStore &
StepsGlobalUIStore;
StepsGlobalUIStore &
TutorialGlobalUIStore;

const devtoolsOptions: DevtoolsOptions = {
name: "Global UI State",
Expand Down Expand Up @@ -51,6 +54,7 @@ export const useGlobalUIBoundedStore = create<GlobalUIState>()(
...useThemeSlice(...a),
...useLoaderSlice(...a),
...useStepsSlice(...a),
...useTutorialSlice(...a),
}),
devtoolsOptions,
),
Expand Down
19 changes: 19 additions & 0 deletions src/core/store/ui/slices/tutorial.slice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { StateCreator } from "zustand";
import { TutorialGlobalUIStore } from "../@types/tutorial.entity";

export const useTutorialSlice: StateCreator<
TutorialGlobalUIStore,
[["zustand/devtools", never]],
[],
TutorialGlobalUIStore
> = (set) => {
return {
// Stores
run: false,

// Modifiers
setRun: (run: boolean) => {
set({ run });
},
};
};

0 comments on commit 728d522

Please sign in to comment.