Skip to content

Commit

Permalink
Add a settings slice.
Browse files Browse the repository at this point in the history
  • Loading branch information
chmac committed Dec 10, 2024
1 parent ec1eb0b commit 00f156b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions nr-app/src/redux/slices/settings.slice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { createSlice } from "@reduxjs/toolkit";

type SettingsState = {
areTestFeaturesEnabled: boolean;
};

const initialState: SettingsState = {
areTestFeaturesEnabled: false,
};

export const settingsSlice = createSlice({
name: "settings",
initialState,
reducers: {
toggleTestFeatures: (state, action) => {
state.areTestFeaturesEnabled = !state.areTestFeaturesEnabled;
},
},
selectors: {
selectAreTestFeaturesEnabled: (state) => state.areTestFeaturesEnabled,
},
});

export const settingsActions = settingsSlice.actions;

export const settingsSelectors = settingsSlice.selectors;
2 changes: 2 additions & 0 deletions nr-app/src/redux/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { eventsSlice } from "./slices/events.slice";
import { mapSlice } from "./slices/map.slice";
import { relaysSlice } from "./slices/relays.slice";
import { keystoreSlice } from "./slices/keystore.slice";
import { settingsSlice } from "./slices/settings.slice";

const isOnDevice = Platform.OS !== "web";

Expand All @@ -21,6 +22,7 @@ const reducer = combineSlices(
keystoreSlice,
mapSlice,
relaysSlice,
settingsSlice,
);

export const store = configureStore({
Expand Down

0 comments on commit 00f156b

Please sign in to comment.