diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 4b80fb38e..ecbb5a904 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -1,7 +1,7 @@ import { useSplitClient } from "@splitsoftware/splitio-react"; import { Button, Result } from "antd"; import LogRocket from "logrocket"; -import React, { lazy, Suspense, useEffect, useState } from "react"; +import React, { lazy, Suspense, useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { Route, Routes } from "react-router-dom"; @@ -9,7 +9,7 @@ import { createStructuredSelector } from "reselect"; import DocumentEditorContainer from "../components/document-editor/document-editor.container"; import ErrorBoundary from "../components/error-boundary/error-boundary.component"; -//Component Imports +// Component Imports import LoadingSpinner from "../components/loading-spinner/loading-spinner.component"; import DisclaimerPage from "../pages/disclaimer/disclaimer.page"; import LandingPage from "../pages/landing/landing.page"; @@ -28,15 +28,16 @@ import { ProductFruits } from "react-product-fruits"; const ResetPassword = lazy(() => import("../pages/reset-password/reset-password.component")); const ManagePage = lazy(() => import("../pages/manage/manage.page.container")); const SignInPage = lazy(() => import("../pages/sign-in/sign-in.page")); - const CsiPage = lazy(() => import("../pages/csi/csi.container.page")); const MobilePaymentContainer = lazy(() => import("../pages/mobile-payment/mobile-payment.container")); + const mapStateToProps = createStructuredSelector({ currentUser: selectCurrentUser, online: selectOnline, bodyshop: selectBodyshop, currentEula: selectCurrentEula }); + const mapDispatchToProps = (dispatch) => ({ checkUserSession: () => dispatch(checkUserSession()), setOnline: (isOnline) => dispatch(setOnline(isOnline)) @@ -47,6 +48,23 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline const [listenersAdded, setListenersAdded] = useState(false); const { t } = useTranslation(); + const workspaceCode = useMemo( + () => + InstanceRenderMgr({ + imex: null, + rome: "9BkbEseqNqxw8jUH", + promanager: "aoJoEifvezYI0Z0P" + }), + [] + ); + + const workspaceLogin = useMemo( + () => ({ + email: currentUser.email, + username: currentUser.email + }), + [currentUser.email] + ); useEffect(() => { if (!navigator.onLine) { setOnline(false); @@ -55,16 +73,12 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline checkUserSession(); }, [checkUserSession, setOnline]); - //const b = Grid.useBreakpoint(); - // console.log("Breakpoints:", b); - - // Associate event listeners, memoize to prevent multiple listeners being added useEffect(() => { - const offlineListener = (e) => { + const offlineListener = () => { setOnline(false); }; - const onlineListener = (e) => { + const onlineListener = () => { setOnline(true); }; @@ -98,7 +112,7 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline InstanceRenderMgr({ imex: "gvfvfw/bodyshopapp", rome: "rome-online/rome-online", - promanager: "" //TODO:AIO Add in log rocket for promanager instances. + promanager: "" // TODO: AIO Add in log rocket for promanager instances. }) ); } @@ -111,30 +125,25 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline handleBeta(); - if (!online) + if (!online) { return ( { - window.location.reload(); - }} - > + } /> ); + } if (currentEula && !currentUser.eulaIsAccepted) { return ; } - // Any route that is not assigned and matched will default to the Landing Page component return ( } > - + {currentUser && currentUser.email && ( + + )}