Skip to content

Commit 8254095

Browse files
authored
chore: zustand store adoption (#398)
1 parent 4081ec5 commit 8254095

16 files changed

Lines changed: 188 additions & 436 deletions

package-lock.json

Lines changed: 38 additions & 101 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
}
3939
},
4040
"dependencies": {
41-
"@reduxjs/toolkit": "^1.9.5",
4241
"accessible-autocomplete": "^3.0.1",
4342
"axios": "^1.7.9",
4443
"bootstrap": "^4.6.0",
@@ -60,12 +59,12 @@
6059
"react-hook-form-persist": "^3.0.0",
6160
"react-i18next": "^13.0.0",
6261
"react-jss": "^10.10.0",
63-
"react-redux": "^8.1.1",
6462
"react-resizable-panels": "^2.1.7",
6563
"react-widgets": "^5.8.4",
6664
"type-fest": "^4.10.3",
6765
"validator": "^13.9.0",
68-
"yaml": "^2.4.1"
66+
"yaml": "^2.4.1",
67+
"zustand": "^5.0.3"
6968
},
7069
"devDependencies": {
7170
"@eslint/js": "^9.13.0",

src/app/App.tsx

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,39 @@ import "bootstrap-italia/dist/css/bootstrap-italia.min.css";
22
import { NotificationManager } from "design-react-kit";
33
import { useState } from "react";
44
import { useTranslation } from "react-i18next";
5-
import { Provider } from "react-redux";
65
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
76
import "react-widgets/styles.css";
87
import "../assets/main.css";
98
import Editor from "./components/Editor";
109
import Head from "./components/Head";
1110
import Layout from "./components/Layout";
12-
import WarningBox, { Warning } from "./components/WarningBox";
13-
import YamlPreview from "./components/YamlPreview";
14-
import PublicCode, {
15-
PublicCodeWithDeprecatedFields,
16-
} from "./contents/publiccode";
17-
import { getYaml, useIsMobile } from "./lib/utils";
18-
import store from "./store";
1911
import SettingsPanel from "./components/SettingsPanel";
12+
import WarningBox from "./components/WarningBox";
13+
import YamlPreview from "./components/YamlPreview";
14+
import { useIsMobile } from "./lib/utils";
2015

2116
const NOTIFICATION_TIMEOUT = 4_000;
2217
export const App = () => {
2318
const isMobile = useIsMobile();
2419
const [isSettingsOpen, setIsSettingsOpen] = useState(false);
2520
const [isLoading] = useState(false);
26-
const [isPublicCodeImported, setPublicCodeImported] = useState(false);
27-
const [warnings, setWarnings] = useState<Warning[]>([]);
28-
const [publicCodeData, setPublicCodeData] = useState<
29-
PublicCode | PublicCodeWithDeprecatedFields | undefined
30-
>();
3121
const { t } = useTranslation();
3222

3323
const leftPanel = (
3424
<div className="content__wrapper">
35-
<Editor
36-
setData={(d) => {
37-
setPublicCodeData(d);
38-
}}
39-
setWarnings={setWarnings}
40-
setPublicCodeImported={setPublicCodeImported}
41-
isPublicCodeImported={isPublicCodeImported}
42-
/>
25+
<Editor />
4326
</div>
4427
);
4528

4629
const rightPanel = (
4730
<div className="content__sidebar" id="content-sidebar">
48-
{warnings?.length > 0 && (
49-
<WarningBox
50-
warnings={warnings}
51-
setWarnings={(items) => setWarnings(items as Warning[])}
52-
/>
53-
)}
54-
<YamlPreview yaml={getYaml(publicCodeData as PublicCode) as string} />
31+
<WarningBox />
32+
<YamlPreview />
5533
</div>
5634
);
5735

5836
return (
59-
<Provider store={store}>
37+
<div>
6038
{isLoading && (
6139
<div className="d-flex align-items-center col-12 position-absolute h-100 w-100">
6240
<div className="mr-auto ml-auto">
@@ -100,7 +78,7 @@ export const App = () => {
10078
</div>
10179
</div>
10280
</Layout>
103-
</Provider>
81+
</div>
10482
);
10583
};
10684

0 commit comments

Comments
 (0)