make settings open/close local

This commit is contained in:
David Lechner
2021-02-01 10:26:05 -06:00
parent dd951bd4fc
commit ad6e2b73cc
7 changed files with 36 additions and 71 deletions
-2
View File
@@ -7,7 +7,6 @@ import { useDispatch, useSelector } from 'react-redux';
import SplitterLayout from 'react-splitter-layout';
import Editor from '../editor/Editor';
import { RootState } from '../reducers';
import SettingsDrawer from '../settings/SettingsDrawer';
import { toggleBoolean } from '../settings/actions';
import { SettingId } from '../settings/defaults';
import StatusBar from '../status-bar/StatusBar';
@@ -163,7 +162,6 @@ function App(): JSX.Element {
</div>
</SplitterLayout>
<StatusBar />
<SettingsDrawer />
</div>
);
}
+1 -23
View File
@@ -24,10 +24,6 @@ export enum AppActionType {
DidInstall = 'app.action.didInstallPrompt',
/** The app has just ben started. */
DidStart = 'app.action.didStart',
/** Open settings dialog. */
OpenSettings = 'app.action.openSettings',
/** Close settings dialog. */
CloseSettings = 'app.action.closeSettings',
}
/** Action that requests the app to reload. */
@@ -108,22 +104,6 @@ export function didStart(): AppDidStartAction {
return { type: AppActionType.DidStart };
}
/** Action to open the settings dialog. */
export type AppOpenSettingsAction = Action<AppActionType.OpenSettings>;
/** Creates an action to open the settings dialog. */
export function openSettings(): AppOpenSettingsAction {
return { type: AppActionType.OpenSettings };
}
/** Action to close the settings dialog. */
export type AppCloseSettingsAction = Action<AppActionType.CloseSettings>;
/** Creates an action to close the settings dialog. */
export function closeSettings(): AppCloseSettingsAction {
return { type: AppActionType.CloseSettings };
}
/** common type for all app actions. */
export type AppAction =
| AppReloadAction
@@ -133,6 +113,4 @@ export type AppAction =
| AppInstallPromptAction
| AppDidInstallPromptAction
| AppDidInstallAction
| AppDidStartAction
| AppOpenSettingsAction
| AppCloseSettingsAction;
| AppDidStartAction;
-12
View File
@@ -6,13 +6,11 @@ import { didSucceed, didUpdate } from '../service-worker/actions';
import { BeforeInstallPromptEvent } from '../utils/dom';
import {
checkForUpdate,
closeSettings,
didBeforeInstallPrompt,
didCheckForUpdate,
didInstall,
didInstallPrompt,
installPrompt,
openSettings,
} from './actions';
import reducers from './reducers';
@@ -26,21 +24,11 @@ test('initial state', () => {
"promptingInstall": false,
"readyForOfflineUse": false,
"serviceWorker": null,
"showSettings": false,
"updateAvailable": false,
}
`);
});
test('showSettings', () => {
expect(
reducers({ showSettings: false } as State, openSettings()).showSettings,
).toBe(true);
expect(
reducers({ showSettings: true } as State, closeSettings()).showSettings,
).toBe(false);
});
test('serviceWorker', () => {
const registration = {} as ServiceWorkerRegistration;
expect(
-12
View File
@@ -9,17 +9,6 @@ import { ServiceWorkerActionType } from '../service-worker/actions';
import { BeforeInstallPromptEvent } from '../utils/dom';
import { AppActionType } from './actions';
const showSettings: Reducer<boolean, Action> = (state = false, action) => {
switch (action.type) {
case AppActionType.OpenSettings:
return true;
case AppActionType.CloseSettings:
return false;
default:
return state;
}
};
const serviceWorker: Reducer<ServiceWorkerRegistration | null, Action> = (
state = null,
action,
@@ -93,7 +82,6 @@ const readyForOfflineUse: Reducer<boolean, Action> = (state = false, action) =>
};
export default combineReducers({
showSettings,
serviceWorker,
checkingForUpdate,
updateAvailable,