Add missing space
This commit is contained in:
parent
7a7a401114
commit
76df515b57
4 changed files with 63 additions and 3 deletions
|
@ -53,6 +53,7 @@
|
|||
"fs-extra": "7.0.1",
|
||||
"html-webpack-plugin": "4.0.0-beta.5",
|
||||
"identity-obj-proxy": "3.0.0",
|
||||
"immer": "^8.0.1",
|
||||
"is-wsl": "^1.1.0",
|
||||
"jest": "24.9.0",
|
||||
"jest-environment-jsdom-fourteen": "0.1.0",
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { combineReducers } from "@reduxjs/toolkit";
|
||||
|
||||
import { persistReducer, PersistConfig } from "redux-persist";
|
||||
import {
|
||||
persistReducer,
|
||||
PersistConfig,
|
||||
createMigrate,
|
||||
PersistedState,
|
||||
} from "redux-persist";
|
||||
import webStorage from "redux-persist/lib/storage";
|
||||
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
|
||||
|
||||
|
@ -11,6 +16,7 @@ import sessionReducer from "./session/state";
|
|||
import NavbarReducer from "./navbar/state";
|
||||
import OptionsMenuReducer from "./optionsMenu/state";
|
||||
import SettingsState from "./optionsMenu/settingsState";
|
||||
import produce from "immer";
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
showplan: ShowplanReducer,
|
||||
|
@ -22,15 +28,28 @@ const rootReducer = combineReducers({
|
|||
settings: SettingsState,
|
||||
});
|
||||
|
||||
export type RootState = ReturnType<typeof rootReducer>;
|
||||
const persistMigrations = createMigrate({
|
||||
0: (state) =>
|
||||
produce(
|
||||
state,
|
||||
(x: PersistedState & Pick<_InternalRootState, "settings">) => {
|
||||
x.settings.saveShowPlanChanges = true;
|
||||
}
|
||||
),
|
||||
});
|
||||
|
||||
const persistenceConfig: PersistConfig<RootState> = {
|
||||
type _InternalRootState = ReturnType<typeof rootReducer>;
|
||||
|
||||
const persistenceConfig: PersistConfig<_InternalRootState> = {
|
||||
key: "root",
|
||||
storage: webStorage,
|
||||
whitelist: ["settings"],
|
||||
stateReconciler: autoMergeLevel2,
|
||||
version: 0,
|
||||
migrate: persistMigrations,
|
||||
};
|
||||
|
||||
const persistedReducer = persistReducer(persistenceConfig, rootReducer);
|
||||
|
||||
export type RootState = ReturnType<typeof persistedReducer>;
|
||||
export default persistedReducer;
|
||||
|
|
|
@ -3,6 +3,8 @@ import Modal from "react-modal";
|
|||
import { getLatestNewsItem, NewsEntry } from "../api";
|
||||
import { Button } from "reactstrap";
|
||||
import { FaTimes } from "react-icons/fa";
|
||||
import { RootState } from "../rootReducer";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
function DevWarning() {
|
||||
if (process.env.REACT_APP_PRODUCTION === "true") {
|
||||
|
@ -29,6 +31,38 @@ function DevWarning() {
|
|||
);
|
||||
}
|
||||
|
||||
function PersistNotice() {
|
||||
const stateVersion = useSelector(
|
||||
(state: RootState) => state._persist.version
|
||||
);
|
||||
const saving = useSelector(
|
||||
(state: RootState) => state.settings.saveShowPlanChanges
|
||||
);
|
||||
if (stateVersion !== 0 || !saving) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div className="p-2 alert-primary">
|
||||
<h2>Welcome to WebStudio {process.env.REACT_APP_VERSION}!</h2>
|
||||
<p>
|
||||
As of this version,{" "}
|
||||
<strong>
|
||||
changes to your show plan will be saved automatically.
|
||||
</strong>
|
||||
You no longer need to use Show Planner to save changes to your
|
||||
show.
|
||||
</p>
|
||||
<p>
|
||||
If you encounter any issues with saving changes, please let the
|
||||
Computing Team know in #computing on URY Slack. Thanks, and have fun!
|
||||
</p>
|
||||
</div>
|
||||
<hr />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function PisModal({
|
||||
close,
|
||||
isOpen,
|
||||
|
@ -67,6 +101,7 @@ export function PisModal({
|
|||
</Button>
|
||||
<hr className="mt-1 mb-3" />
|
||||
<DevWarning />
|
||||
<PersistNotice />
|
||||
{(news === "loading" || news === "not_loaded") && (
|
||||
<p>Loading the news...</p>
|
||||
)}
|
||||
|
|
|
@ -6134,6 +6134,11 @@ immer@^6.0.1:
|
|||
resolved "https://registry.yarnpkg.com/immer/-/immer-6.0.5.tgz#77187d13b71c6cee40dde3b8e87a50a7a636d630"
|
||||
integrity sha512-Q2wd90qrgFieIpLzAO2q9NLEdmyp/sr76Ml4Vm5peUKgyTa2CQa3ey8zuzwSKOlKH7grCeGBGUcLLVCVW1aguA==
|
||||
|
||||
immer@^8.0.1:
|
||||
version "8.0.1"
|
||||
resolved "https://registry.yarnpkg.com/immer/-/immer-8.0.1.tgz#9c73db683e2b3975c424fb0572af5889877ae656"
|
||||
integrity sha512-aqXhGP7//Gui2+UrEtvxZxSquQVXTpZ7KDxfCcKAF3Vysvw0CViVaW9RZ1j1xlIYqaaaipBoqdqeibkc18PNvA==
|
||||
|
||||
import-cwd@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9"
|
||||
|
|
Loading…
Reference in a new issue