Refactor settings to use stack to allow dark theme. Move theme to app reducer to allow persistence.

This commit is contained in:
Patrick Fic
2025-10-23 13:58:33 -07:00
parent f170192008
commit b1ee922066
15 changed files with 60 additions and 23 deletions

View File

@@ -27,3 +27,8 @@ export const documentUploadFailure = (error) => ({
export const toggleDeleteAfterUpload = () => ({
type: AppActionTypes.TOGGLE_DLETE_AFTER_UPLOAD,
});
export const setTheme = (theme) => ({
type: AppActionTypes.SET_THEME,
payload: theme,
});

View File

@@ -6,6 +6,7 @@ const INITIAL_STATE = {
documentUploadInProgress: null,
documentUploadError: null,
deleteAfterUpload: false,
theme: "system",
};
const appReducer = (state = INITIAL_STATE, action) => {
@@ -43,6 +44,8 @@ const appReducer = (state = INITIAL_STATE, action) => {
...state,
deleteAfterUpload: !state.deleteAfterUpload,
};
case AppActionTypes.SET_THEME:
return { ...state, theme: action.payload };
default:
return state;
}

View File

@@ -26,3 +26,8 @@ export const selectDeleteAfterUpload = createSelector(
[selectApp],
(app) => app.deleteAfterUpload
);
export const selectTheme = createSelector(
[selectApp],
(app) => app.theme
);

View File

@@ -5,5 +5,6 @@ const AppActionTypes = {
DOCUMENT_UPLOAD_SUCCESS: "DOCUMENT_UPLOAD_SUCCESS",
DOCUMENT_UPLOAD_FAILURE: "DOCUMENT_UPLOAD_FAILURE",
TOGGLE_DLETE_AFTER_UPLOAD: "TOGGLE_DLETE_AFTER_UPLOAD",
SET_THEME: "SET_THEME",
};
export default AppActionTypes;