Skip to content

Commit

Permalink
Moving redux to src/redux + pod changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NotChristianGarcia committed Oct 11, 2024
1 parent 608001b commit 92fad50
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/app/Pods/_Layout/Layout.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/app/Pods/_components/Modals/DeleteSnapshotModal.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/app/Pods/_components/Modals/DeleteVolumeModal.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions src/app/Pods/_components/NavTemplates/NavTemplates.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions src/app/Pods/_components/PageImages/PageImages.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions src/app/Pods/_components/PagePods/PagePods.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions src/app/Pods/_components/PageSnapshots/PageSnapshots.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions src/app/Pods/_components/PageTemplates/PageTemplates.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions src/app/Pods/_components/PageVolumes/PageVolumes.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions src/app/Pods/_components/PodsLoadingText/PodsLoadingText.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions src/app/Pods/_components/PodsNavigation/PodsNavigation.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions src/app/Pods/redux/store.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/redux/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// src/redux/index.ts
export { default as store, useAppDispatch, useAppSelector, useAppStore } from './store';
export { updateState, type PodsState } from './podsSlice';
8 changes: 7 additions & 1 deletion src/app/Pods/redux/podsSlice.tsx → src/redux/podsSlice.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { set } from 'date-fns';

interface PodsState {
export interface PodsState {
// arctiveXxxId: string; // Active item ID, used to store state when moving in and out of specific items.
// Tab bars, used to store state when moving in and out of specific tabs.
podTab: string;
Expand Down Expand Up @@ -62,3 +62,9 @@ const podsSlice = createSlice({

export const { updateState } = podsSlice.actions;
export default podsSlice.reducer;

// GET
// const { podTab, podRootTab } = useAppSelector((state) => state.pods);

// POST
// dispatch(updateState({"podTab": tabValue, "podRootTab": rootTabValue}));
20 changes: 20 additions & 0 deletions src/redux/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { configureStore } from '@reduxjs/toolkit';
import type { TypedUseSelectorHook } from 'react-redux';
import { useDispatch, useSelector, useStore } from 'react-redux';
import podsReducer from './podsSlice';
// import systemsReducer from './systemsSlice';

const store = configureStore({
reducer: {
pods: podsReducer,
// systems: systemsReducer
},
});

export type AppStore = typeof store;
export type RootState = ReturnType<AppStore['getState']>;
export type AppDispatch = typeof store.dispatch;
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
export const useAppStore: () => AppStore = useStore;
export const useAppDispatch = useDispatch.withTypes<AppDispatch>(); // Export a hook that can be reused to resolve types
export default store;
4 changes: 4 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"compilerOptions": {
"target": "esnext",
"paths": {
"@redux": ["./redux/index.tsx"],
"@redux/*": ["./redux/*"]
},
"lib": ["dom", "dom.iterable", "esnext"],
// "lib": ["es6", "dom"],
"noImplicitAny": true,
Expand Down

0 comments on commit 92fad50

Please sign in to comment.