diff --git a/apps/front-end/package.json b/apps/front-end/package.json index 997ea21ba..d3e32fac8 100644 --- a/apps/front-end/package.json +++ b/apps/front-end/package.json @@ -39,7 +39,7 @@ "react-native-safe-area-context": "^3.4.1", "react-native-web": "^0.17.7", "react-qr-reader": "3.0.0-beta-1", - "react-redux": "^9.1.0", + "react-redux": "8.0.0", "react-router-dom": "^6.15.0", "react-scripts": "5.0.0", "react-zoom-pan-pinch": "^3.1.0", diff --git a/apps/front-end/src/bootstrap.js b/apps/front-end/src/bootstrap.js index 5d029cfd3..718645c60 100644 --- a/apps/front-end/src/bootstrap.js +++ b/apps/front-end/src/bootstrap.js @@ -4,11 +4,13 @@ import "./index.css"; import App from "./App"; import * as serviceWorkerRegistration from "./serviceWorkerRegistration"; import reportWebVitals from "./reportWebVitals"; +import { Provider } from "react-redux"; +import store from "store/store"; ReactDOM.render( - + - , + , document.getElementById("root") ); diff --git a/apps/front-end/src/pages/front-end/BenificiaryListView.js b/apps/front-end/src/pages/front-end/BenificiaryListView.js index da604fb83..e3446180d 100644 --- a/apps/front-end/src/pages/front-end/BenificiaryListView.js +++ b/apps/front-end/src/pages/front-end/BenificiaryListView.js @@ -11,12 +11,14 @@ import { CardComponent, } from "@shiksha/common-lib"; import { HStack, VStack, Box, Select, Pressable } from "native-base"; -import React from "react"; +import React, { useEffect } from "react"; import { useNavigate } from "react-router-dom"; import { ChipStatus } from "component/BeneficiaryStatus"; import InfiniteScroll from "react-infinite-scroll-component"; import Clipboard from "component/Clipboard"; import Chip from "component/Chip"; +import { useDispatch } from "react-redux"; +import { fetchLearnerData } from "store/Slices/LearnerSlice"; const LearnerMessage = ({ program_beneficiaries }) => { const [reason, setReason] = React.useState({}); @@ -242,6 +244,12 @@ export default function PrerakListView({ userTokenInfo, footerLinks }) { const ref = React.useRef(null); const fa_id = localStorage.getItem("id"); + const dispatch = useDispatch(); + + useEffect(() => { + dispatch(fetchLearnerData()); + }, []); + React.useEffect(async () => { const data = await benificiaryRegistoryService.getStatusList(); if (data.length > 0) { diff --git a/apps/front-end/src/pages/front-end/Dashboard.js b/apps/front-end/src/pages/front-end/Dashboard.js index 38e8de50b..7c11e7e36 100644 --- a/apps/front-end/src/pages/front-end/Dashboard.js +++ b/apps/front-end/src/pages/front-end/Dashboard.js @@ -25,16 +25,23 @@ import { Alert, Modal, CloseIcon, - Menu, - Pressable, Select, - BodyLarge, CheckIcon, } from "native-base"; import React, { useState, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; import moment from "moment"; +import { + fetchEnumListData, + selectenumData, +} from "store/Slices/commonSlices/enumListSlice"; +import { useDispatch, useSelector } from "react-redux"; +import { + fetchLearnerData, + selectedLearnerData, +} from "store/Slices/LearnerSlice"; +// import { useLanguage } from "component/common_components/i18n-new"; const styles = { inforBox: { @@ -54,7 +61,6 @@ const styles = { }; export default function Dashboard({ userTokenInfo, footerLinks }) { - const { t } = useTranslation(); const [facilitator, setFacilitator] = React.useState({ notLoaded: true }); const [certificateData, setCertificateData] = React.useState({}); const [loading, setLoading] = React.useState(true); @@ -63,7 +69,7 @@ export default function Dashboard({ userTokenInfo, footerLinks }) { const [modalVisible, setModalVisible] = React.useState(false); const fa_id = localStorage.getItem("id"); const [isEventActive, setIsEventActive] = React.useState(false); - const [lmsDEtails, setLmsDetails] = React.useState(); + const [lmsDetails, setLmsDetails] = React.useState(); const { id } = userTokenInfo?.authUser || []; const [random, setRandom] = React.useState(); const [events, setEvents] = React.useState(""); @@ -81,6 +87,19 @@ export default function Dashboard({ userTokenInfo, footerLinks }) { const [selectCohortForm, setSelectCohortForm] = useState(false); const [academicYear, setAcademicYear] = useState(null); const [academicData, setAcademicData] = useState([]); + const dispatch = useDispatch(); + const data = useSelector(selectenumData); + // const { selectedLanguage, changeLanguage } = useLanguage(); + const { t } = useTranslation(); + + const userInfoLearner = useSelector(selectedLearnerData); + + useEffect(() => { + if (!data?.data) { + dispatch(fetchEnumListData()); + } + dispatch(fetchLearnerData()); + }, []); useEffect(() => { async function fetchData() { @@ -369,6 +388,13 @@ export default function Dashboard({ userTokenInfo, footerLinks }) { > + {/* */} {facilitator?.status === "applied" && ( )} @@ -416,7 +442,7 @@ export default function Dashboard({ userTokenInfo, footerLinks }) { ) - : lmsDEtails?.id && ( + : lmsDetails?.id && ( - {lmsDEtails === undefined && ( + {lmsDetails === undefined && ( {t(events)} )} - {lmsDEtails?.certificate_status === null ? ( + {lmsDetails?.certificate_status === null ? ( {t("CERTIFICATION_IS_PENDING")} - ) : lmsDEtails?.certificate_status === false && - lmsDEtails?.score >= floatValue ? ( + ) : lmsDetails?.certificate_status === false && + lmsDetails?.score >= floatValue ? ( {t(`TRAINING_INCOMPLETE`)} - {lmsDEtails.score + "%"} + {lmsDetails.score + "%"} - ) : lmsDEtails?.certificate_status === true ? ( + ) : lmsDetails?.certificate_status === true ? ( {t(`TRAINING_TEST_DOWNLOAD_CERTIFICATE`)} - {lmsDEtails.score + "%"} + {lmsDetails.score + "%"} - ) : lmsDEtails?.certificate_status === false ? ( + ) : lmsDetails?.certificate_status === false ? ( {t("TRAINING_NOT_PASSED")} @@ -475,8 +501,8 @@ export default function Dashboard({ userTokenInfo, footerLinks }) { - {lmsDEtails === undefined || - (lmsDEtails?.certificate_status === true && ( + {lmsDetails === undefined || + (lmsDetails?.certificate_status === true && ( { @@ -486,7 +512,7 @@ export default function Dashboard({ userTokenInfo, footerLinks }) { {t("GO_BACK")} ))} - {lmsDEtails?.certificate_status === false && ( + {lmsDetails?.certificate_status === false && ( { @@ -496,7 +522,7 @@ export default function Dashboard({ userTokenInfo, footerLinks }) { {t("OK")} )} - {lmsDEtails === undefined && + {lmsDetails === undefined && !( certificateData?.params?.do_id == null || (Array.isArray(certificateData?.params?.do_id) && @@ -509,7 +535,7 @@ export default function Dashboard({ userTokenInfo, footerLinks }) { {t("START_TEST")} )} - {lmsDEtails?.certificate_status === true && ( + {lmsDetails?.certificate_status === true && ( { diff --git a/apps/front-end/src/pages/front-end/FacilitatorOffline/FacilitatorOnboarding/FacilitatorOnboarding.jsx b/apps/front-end/src/pages/front-end/FacilitatorOffline/FacilitatorOnboarding/FacilitatorOnboarding.jsx index 020bee874..37d365db2 100644 --- a/apps/front-end/src/pages/front-end/FacilitatorOffline/FacilitatorOnboarding/FacilitatorOnboarding.jsx +++ b/apps/front-end/src/pages/front-end/FacilitatorOffline/FacilitatorOnboarding/FacilitatorOnboarding.jsx @@ -4,6 +4,7 @@ import React, { useState, useCallback, useEffect } from "react"; import validator from "@rjsf/validator-ajv8"; import { get, set } from "idb-keyval"; import moment from "moment"; +import { useDispatch, useSelector } from "react-redux"; import { widgets, templates, @@ -19,7 +20,10 @@ import { useNavigate } from "react-router-dom"; import * as formSchemas from "./onboarding.schema"; -import { debounce } from "lodash"; +import { + fetchIpUserData, + selectedIpData, +} from "../../../../store/Slices/ipUserInfoSlice"; const { dateOfBirthSchema, @@ -53,23 +57,25 @@ const FacilitatorOnboarding = () => { const [countLoad, setCountLoad] = useState(0); + const dispatch = useDispatch(); + const ipData = useSelector(selectedIpData); + + useEffect(() => { + dispatch(fetchIpUserData()); + }, []); + useEffect(() => { const fetchData = async () => { try { - console.log("Fetching data from IndexedDB..."); let userData = await get("user_data"); - console.log("Fetched data:", userData); - // Update form data states here setUserData(userData); - // Example of updating date of birth state if (userData?.users?.dob) { set_date_of_birth({ dob: userData.users.dob, mobile: userData.users.mobile, alternative_mobile_number: userData.users.alternative_mobile_number, - // Add other properties as needed }); } @@ -86,15 +92,12 @@ const FacilitatorOnboarding = () => { }); } if (userData?.users?.gender) { - // Example of updating basic details state setFormDataBasicDetails({ gender: userData.users.gender, - marital_status: userData.extended_users?.marital_status || "", // Add other properties as needed + marital_status: userData.extended_users?.marital_status || "", }); } - // Update other form data states in a similar way - setCountLoad(2); } catch (error) { console.error("Error fetching data from IndexedDB:", error); @@ -231,17 +234,14 @@ const FacilitatorOnboarding = () => { const experienceArray = Array.isArray(user_data.experience) ? user_data.experience : []; - console.log(experienceArray, "Experience"); const updatedUserData = { ...user_data, experience: [...experienceArray, ...newExperiences], }; - console.log(updatedUserData.experience, "After Update"); await set("user_data", updatedUserData); setUserData(updatedUserData); setPage((prevPage) => prevPage + 1); - console.log("hi"); handleNextScreen("jobExperience"); }; diff --git a/apps/front-end/src/store/Slices/LearnerSlice.jsx b/apps/front-end/src/store/Slices/LearnerSlice.jsx new file mode 100644 index 000000000..4763ca488 --- /dev/null +++ b/apps/front-end/src/store/Slices/LearnerSlice.jsx @@ -0,0 +1,39 @@ +import { benificiaryRegistoryService } from "@shiksha/common-lib"; +import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"; +import { get, set } from "idb-keyval"; + +export const fetchLearnerData = createAsyncThunk("learnerData", async () => { + const data = await benificiaryRegistoryService.getBeneficiariesList(); + return data; +}); + +const learnerSlice = createSlice({ + name: "learnerData", + initialState: { + data: (await get("learnerData")) || null, + status: "idle", + error: null, + }, + reducers: {}, + extraReducers: (builder) => { + builder + .addCase(fetchLearnerData.pending, (state) => { + state.status = "loading"; + }) + .addCase(fetchLearnerData.fulfilled, (state, action) => { + state.status = "succeeded"; + state.data = action.payload; + set("learnerData", action.payload) + .then(() => console.log("Data stored successfully in IndexedDB")) + .catch((error) => console.error("Error setting data:", error)); + }) + .addCase(fetchLearnerData.rejected, (state, action) => { + state.status = "failed"; + state.error = action.error.message; + }); + }, +}); +export const getData = learnerSlice.actions; +export const selectedLearnerData = (state) => state?.learnerData; + +export default learnerSlice.reducer; diff --git a/apps/front-end/src/store/Slices/commonSlices/enumListSlice.jsx b/apps/front-end/src/store/Slices/commonSlices/enumListSlice.jsx new file mode 100644 index 000000000..197fb1c3c --- /dev/null +++ b/apps/front-end/src/store/Slices/commonSlices/enumListSlice.jsx @@ -0,0 +1,45 @@ +import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"; +import { enumRegistryService } from "@shiksha/common-lib"; +import { get, set } from "idb-keyval"; + +export const fetchEnumListData = createAsyncThunk( + "enum/fetchEnumListData", + async () => { + const result = await enumRegistryService.listOfEnum(); + const data = await result?.data; + return data; + } +); + +const enumListSlice = createSlice({ + name: "enumData", + initialState: { + data: (await get("enumData")) || null, + status: "idle", + error: null, + }, + + reducers: {}, + extraReducers: (builder) => { + builder + .addCase(fetchEnumListData.pending, (state) => { + state.status = "loading"; + }) + .addCase(fetchEnumListData.fulfilled, (state, action) => { + state.status = "succeeded"; + state.data = action.payload; + set("enumData", action.payload).catch((error) => { + console.error("Error setting data:", error); + }); + }) + .addCase(fetchEnumListData.rejected, (state, action) => { + state.status = "failed"; + state.error = action.error.message; + }); + }, +}); + +export const { getData } = enumListSlice.actions; +export const selectenumData = (state) => state?.enumData; + +export default enumListSlice.reducer; diff --git a/apps/front-end/src/store/Slices/ipUserInfoSlice.jsx b/apps/front-end/src/store/Slices/ipUserInfoSlice.jsx new file mode 100644 index 000000000..a5649058f --- /dev/null +++ b/apps/front-end/src/store/Slices/ipUserInfoSlice.jsx @@ -0,0 +1,45 @@ +import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"; +import { facilitatorRegistryService } from "@shiksha/common-lib"; +import { get, set } from "idb-keyval"; + +export const fetchIpUserData = createAsyncThunk( + "ipData/fetchIpUserData", + async () => { + const result = facilitatorRegistryService.getInfo(); + const data = await result; + return data; + } +); + +const ip_ListSlice = createSlice({ + name: "ipData", + initialState: { + data: (await get("ipData")) || null, + status: "idle", + error: null, + }, + + reducers: {}, + extraReducers: (builder) => { + builder + .addCase(fetchIpUserData.pending, (state) => { + state.status = "loading"; + }) + .addCase(fetchIpUserData.fulfilled, (state, action) => { + state.status = "succeeded"; + state.data = action.payload; + set("ipData", action.payload).catch((error) => { + console.error("Error setting data:", error); + }); + }) + .addCase(fetchIpUserData.rejected, (state, action) => { + state.status = "failed"; + state.error = action.error.message; + }); + }, +}); + +export const getData = ip_ListSlice.actions; +export const selectedIpData = (state) => state?.ipData; + +export default ip_ListSlice.reducer; diff --git a/apps/front-end/src/store/Slices/userSlice.jsx b/apps/front-end/src/store/Slices/userSlice.jsx new file mode 100644 index 000000000..f80d0a5fd --- /dev/null +++ b/apps/front-end/src/store/Slices/userSlice.jsx @@ -0,0 +1,24 @@ +// userSlice.js +import { createSlice } from '@reduxjs/toolkit'; +import { get, set } from 'idb-keyval'; + +const userSlice = createSlice({ + name: 'user', + initialState: {data: await get("data") || {} }, + reducers: { + setUser: (state, action) => { + state.data = action.payload; + set('data', action.payload) + .then(() => { + console.log('Data set successfully'); + }) + .catch((error) => { + console.error('Error setting data:', error); + }); + }, + }, +}); + +export const { setUser } = userSlice.actions; +export const selectUser = (state) => state?.user?.data; +export default userSlice.reducer; diff --git a/apps/front-end/src/store/rootReducer.jsx b/apps/front-end/src/store/rootReducer.jsx new file mode 100644 index 000000000..45b4bea5a --- /dev/null +++ b/apps/front-end/src/store/rootReducer.jsx @@ -0,0 +1,14 @@ +import { combineReducers } from "@reduxjs/toolkit"; +import userReducer from "./Slices/userSlice"; +import IpUserInfoSlice from "./Slices/ipUserInfoSlice"; +import enumListSlice from "./Slices/commonSlices/enumListSlice"; +import LearnerSlice from "./Slices/LearnerSlice"; + +const rootReducer = combineReducers({ + user: userReducer, + enumData: enumListSlice, + ipUserInfo: IpUserInfoSlice, + lernerData: LearnerSlice, +}); + +export default rootReducer; diff --git a/apps/front-end/src/store/store.jsx b/apps/front-end/src/store/store.jsx new file mode 100644 index 000000000..15b69bb15 --- /dev/null +++ b/apps/front-end/src/store/store.jsx @@ -0,0 +1,9 @@ +// store.js +import { configureStore } from "@reduxjs/toolkit"; +import rootReducer from "./rootReducer"; + +const store = configureStore({ + reducer: rootReducer, +}); + +export default store; diff --git a/lib/common-lib/src/components/layout/AppBar.js b/lib/common-lib/src/components/layout/AppBar.js index 84117e7af..4450522b3 100644 --- a/lib/common-lib/src/components/layout/AppBar.js +++ b/lib/common-lib/src/components/layout/AppBar.js @@ -12,7 +12,8 @@ import { InputRightAddon, Button, Modal, - Image + Image, + Alert // Divider } from 'native-base' import 'react-modern-drawer/dist/index.css' diff --git a/package-lock.json b/package-lock.json index 72143afc0..645455c5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,9 @@ "": { "name": "root", "dependencies": { + "@reduxjs/toolkit": "^2.0.1", "rc-time-picker": "^3.7.3", + "react-redux": "8.0.0", "react-simple-image-slider": "^2.4.1" }, "devDependencies": { @@ -64,7 +66,7 @@ "react-native-safe-area-context": "^3.4.1", "react-native-web": "^0.17.7", "react-qr-reader": "3.0.0-beta-1", - "react-redux": "^9.1.0", + "react-redux": "8.0.0", "react-router-dom": "^6.15.0", "react-scripts": "5.0.0", "react-zoom-pan-pinch": "^3.1.0", @@ -102,38 +104,6 @@ "webpack": "^5.69.1" } }, - "apps/front-end/node_modules/@reduxjs/toolkit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.0.1.tgz", - "integrity": "sha512-fxIjrR9934cmS8YXIGd9e7s1XRsEU++aFc9DVNMFMRTM5Vtsg2DCRMj21eslGtDt43IUf9bJL3h5bwUlZleibA==", - "dependencies": { - "immer": "^10.0.3", - "redux": "^5.0.0", - "redux-thunk": "^3.1.0", - "reselect": "^5.0.1" - }, - "peerDependencies": { - "react": "^16.9.0 || ^17.0.0 || ^18", - "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "react-redux": { - "optional": true - } - } - }, - "apps/front-end/node_modules/immer": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/immer/-/immer-10.0.3.tgz", - "integrity": "sha512-pwupu3eWfouuaowscykeckFmVTpqbzW+rXFCX8rQLkZzM9ftBmU/++Ra+o+L27mz03zJTlyV4UUr+fdKNffo4A==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/immer" - } - }, "lib/common-lib": { "name": "@shiksha/common-lib", "version": "1.0.0", @@ -8110,6 +8080,38 @@ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0" } }, + "node_modules/@reduxjs/toolkit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.0.1.tgz", + "integrity": "sha512-fxIjrR9934cmS8YXIGd9e7s1XRsEU++aFc9DVNMFMRTM5Vtsg2DCRMj21eslGtDt43IUf9bJL3h5bwUlZleibA==", + "dependencies": { + "immer": "^10.0.3", + "redux": "^5.0.0", + "redux-thunk": "^3.1.0", + "reselect": "^5.0.1" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, + "node_modules/@reduxjs/toolkit/node_modules/immer": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.0.3.tgz", + "integrity": "sha512-pwupu3eWfouuaowscykeckFmVTpqbzW+rXFCX8rQLkZzM9ftBmU/++Ra+o+L27mz03zJTlyV4UUr+fdKNffo4A==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, "node_modules/@remix-run/router": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.8.0.tgz", @@ -15226,6 +15228,15 @@ "@types/unist": "^2" } }, + "node_modules/@types/hoist-non-react-statics": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz", + "integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==", + "dependencies": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, "node_modules/@types/html-minifier-terser": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", @@ -15505,7 +15516,8 @@ }, "node_modules/@types/prop-types": { "version": "15.7.11", - "dev": true, + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", + "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==", "license": "MIT" }, "node_modules/@types/q": { @@ -15537,7 +15549,6 @@ "version": "17.0.65", "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.65.tgz", "integrity": "sha512-oxur785xZYHvnI7TRS61dXbkIhDPnGfsXKv0cNXR/0ml4SipRIFpSMzA7HMEfOywFwJ5AOnPrXYTEiTRUQeGlQ==", - "dev": true, "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -15587,7 +15598,6 @@ "version": "0.16.3", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz", "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==", - "dev": true, "license": "MIT" }, "node_modules/@types/semver": { @@ -37330,23 +37340,31 @@ } }, "node_modules/react-redux": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.1.0.tgz", - "integrity": "sha512-6qoDzIO+gbrza8h3hjMA9aq4nwVFCKFtY2iLxCtVT38Swyy2C/dJCGBXHeHLtx6qlg/8qzc2MrhOeduf5K32wQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.0.tgz", + "integrity": "sha512-zBwWgosy/MD2KKr1CtZyAzAaUa1xifJNt2mNszaBF7TtNlst5dooofVz7Djo7cxxkYZn+010Fqef/O4yxlW3cA==", "dependencies": { + "@babel/runtime": "^7.12.1", + "@types/hoist-non-react-statics": "^3.3.1", "@types/use-sync-external-store": "^0.0.3", + "hoist-non-react-statics": "^3.3.2", + "react-is": "^18.0.0", "use-sync-external-store": "^1.0.0" }, "peerDependencies": { - "@types/react": "^18.2.25", - "react": "^18.0", - "react-native": ">=0.69", - "redux": "^5.0.0" + "@types/react": "^16.8 || ^17.0 || ^18.0", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0", + "react-native": ">=0.59", + "redux": "^4" }, "peerDependenciesMeta": { "@types/react": { "optional": true }, + "react-dom": { + "optional": true + }, "react-native": { "optional": true }, @@ -37355,6 +37373,11 @@ } } }, + "node_modules/react-redux/node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" + }, "node_modules/react-refresh": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", diff --git a/package.json b/package.json index fbcb1234c..6fd214654 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,9 @@ "prettier": "^2.6.0" }, "dependencies": { + "@reduxjs/toolkit": "^2.0.1", "rc-time-picker": "^3.7.3", + "react-redux": "8.0.0", "react-simple-image-slider": "^2.4.1" } } diff --git a/yarn.lock b/yarn.lock index 4fa0bbdbe..9a4f78b3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1243,7 +1243,7 @@ core-js-pure "^3.30.2" regenerator-runtime "^0.14.0" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.0", "@babel/runtime@^7.14.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.7", "@babel/runtime@^7.5.0", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.0", "@babel/runtime@^7.14.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.7", "@babel/runtime@^7.5.0", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": version "7.23.5" resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.5.tgz" integrity sha512-NdUTHcPe4C99WxPub+K9l9tK5/lV4UXIoaHSYgzco9BCyjKAAwzdBI+wWtYqHt7LJdbo74ZjRPJgzVweq1sz0w== @@ -5579,6 +5579,14 @@ dependencies: "@types/unist" "^2" +"@types/hoist-non-react-statics@^3.3.1": + version "3.3.5" + resolved "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz" + integrity sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg== + dependencies: + "@types/react" "*" + hoist-non-react-statics "^3.3.0" + "@types/html-minifier-terser@^5.0.0": version "5.1.2" resolved "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-5.1.2.tgz" @@ -5768,6 +5776,8 @@ "@types/prop-types@*": version "15.7.11" + resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz" + integrity sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng== "@types/q@^1.5.1": version "1.5.6" @@ -5796,19 +5806,19 @@ dependencies: "@types/react" "^16" -"@types/react@^16": - version "16.14.46" - resolved "https://registry.npmjs.org/@types/react/-/react-16.14.46.tgz" - integrity sha512-Am4pyXMrr6cWWw/TN3oqHtEZl0j+G6Up/O8m65+xF/3ZaUgkv1GAtTPWw4yNRmH0HJXmur6xKCKoMo3rBGynuw== +"@types/react@*", "@types/react@^17.0.39": + version "17.0.65" + resolved "https://registry.npmjs.org/@types/react/-/react-17.0.65.tgz" + integrity sha512-oxur785xZYHvnI7TRS61dXbkIhDPnGfsXKv0cNXR/0ml4SipRIFpSMzA7HMEfOywFwJ5AOnPrXYTEiTRUQeGlQ== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" csstype "^3.0.2" -"@types/react@^17.0.39": - version "17.0.65" - resolved "https://registry.npmjs.org/@types/react/-/react-17.0.65.tgz" - integrity sha512-oxur785xZYHvnI7TRS61dXbkIhDPnGfsXKv0cNXR/0ml4SipRIFpSMzA7HMEfOywFwJ5AOnPrXYTEiTRUQeGlQ== +"@types/react@^16": + version "16.14.46" + resolved "https://registry.npmjs.org/@types/react/-/react-16.14.46.tgz" + integrity sha512-Am4pyXMrr6cWWw/TN3oqHtEZl0j+G6Up/O8m65+xF/3ZaUgkv1GAtTPWw4yNRmH0HJXmur6xKCKoMo3rBGynuw== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -11473,6 +11483,7 @@ from2@^2.1.0: react-native-safe-area-context "^3.4.1" react-native-web "^0.17.7" react-qr-reader "3.0.0-beta-1" + react-redux "^9.1.0" react-router-dom "^6.15.0" react-scripts "5.0.0" react-zoom-pan-pinch "^3.1.0" @@ -12259,7 +12270,7 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2: +hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -18413,12 +18424,16 @@ react-qr-reader@3.0.0-beta-1: "@zxing/library" "^0.18.3" rollup "^2.67.2" -react-redux@^9.1.0: - version "9.1.0" - resolved "https://registry.npmjs.org/react-redux/-/react-redux-9.1.0.tgz" - integrity sha512-6qoDzIO+gbrza8h3hjMA9aq4nwVFCKFtY2iLxCtVT38Swyy2C/dJCGBXHeHLtx6qlg/8qzc2MrhOeduf5K32wQ== +react-redux@8.0.0: + version "8.0.0" + resolved "https://registry.npmjs.org/react-redux/-/react-redux-8.0.0.tgz" + integrity sha512-zBwWgosy/MD2KKr1CtZyAzAaUa1xifJNt2mNszaBF7TtNlst5dooofVz7Djo7cxxkYZn+010Fqef/O4yxlW3cA== dependencies: + "@babel/runtime" "^7.12.1" + "@types/hoist-non-react-statics" "^3.3.1" "@types/use-sync-external-store" "^0.0.3" + hoist-non-react-statics "^3.3.2" + react-is "^18.0.0" use-sync-external-store "^1.0.0" react-refresh@^0.11.0: