@asaleh37/ui-base 25.8.1-5.4 → 25.8.1-5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/BaseApp.tsx +21 -8
package/package.json
CHANGED
|
@@ -18,16 +18,28 @@ import i18n from "../locales/i18n";
|
|
|
18
18
|
import { initReactI18next } from "react-i18next";
|
|
19
19
|
import { ENGLISH_TRANS } from "../locales/english";
|
|
20
20
|
import { ARABIC_TRANS } from "../locales/arabic";
|
|
21
|
-
import { useEffect } from "react";
|
|
21
|
+
import { useEffect, useState } from "react";
|
|
22
22
|
|
|
23
23
|
library.add(fab);
|
|
24
24
|
library.add(far);
|
|
25
25
|
library.add(fas);
|
|
26
26
|
|
|
27
27
|
export const BaseApp: React.FC<AppInfo> = (props) => {
|
|
28
|
-
let store = null;
|
|
28
|
+
// let store = null;
|
|
29
|
+
const [systemReducers, setSystemReducers] = useState<any>({
|
|
30
|
+
AppLayout: AppLayoutReducer,
|
|
31
|
+
UserSession: UserSessionReducer,
|
|
32
|
+
loadingMask: LoadingMaskReducer,
|
|
33
|
+
commonStores: CommonStoreReducer,
|
|
34
|
+
SideBar: SideBarReducer,
|
|
35
|
+
AppInfo: AppInfoReducer,
|
|
36
|
+
});
|
|
37
|
+
const store = configureStore({
|
|
38
|
+
reducer: systemReducers,
|
|
39
|
+
});
|
|
40
|
+
const [isAppInitialized, setIsAppInitialized] = useState<boolean>(false);
|
|
29
41
|
const initializeApp = () => {
|
|
30
|
-
const
|
|
42
|
+
const reducers = {
|
|
31
43
|
AppLayout: AppLayoutReducer,
|
|
32
44
|
UserSession: UserSessionReducer,
|
|
33
45
|
loadingMask: LoadingMaskReducer,
|
|
@@ -36,8 +48,8 @@ export const BaseApp: React.FC<AppInfo> = (props) => {
|
|
|
36
48
|
AppInfo: AppInfoReducer,
|
|
37
49
|
...props?.businessReduxReducers,
|
|
38
50
|
};
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
setSystemReducers((state) => {
|
|
52
|
+
return { ...reducers };
|
|
41
53
|
});
|
|
42
54
|
const resources = {
|
|
43
55
|
en: { translation: { ...ENGLISH_TRANS, ...props?.businessLocals?.en } },
|
|
@@ -48,15 +60,16 @@ export const BaseApp: React.FC<AppInfo> = (props) => {
|
|
|
48
60
|
lng: localStorage.getItem("language") || "en", // Set the initial language of the App
|
|
49
61
|
fallbackLng: "en",
|
|
50
62
|
});
|
|
63
|
+
setIsAppInitialized(true);
|
|
51
64
|
};
|
|
52
65
|
useEffect(() => {
|
|
53
66
|
initializeApp();
|
|
54
67
|
}, [props]);
|
|
55
|
-
return
|
|
56
|
-
<></>
|
|
57
|
-
) : (
|
|
68
|
+
return isAppInitialized ? (
|
|
58
69
|
<Provider store={store}>
|
|
59
70
|
<App {...props} />
|
|
60
71
|
</Provider>
|
|
72
|
+
) : (
|
|
73
|
+
<></>
|
|
61
74
|
);
|
|
62
75
|
};
|