Skip to content

Commit

Permalink
updated module render
Browse files Browse the repository at this point in the history
  • Loading branch information
nipunarora-eGov committed Mar 2, 2024
1 parent a32a24d commit 0dabd38
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 58 deletions.
96 changes: 42 additions & 54 deletions micro-ui/web/packages/core/src/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ import { ReactQueryDevtools } from 'react-query/devtools';
//here add react-query dev tools

const DigitUIWrapper = ({ stateCode="pg", enabledModules, moduleReducers,defaultLanding }) => {
// debugger
console.log("came till here 1");
const { isLoading, data: initData } = Digit.Hooks.useInitStore(stateCode, enabledModules);
if (isLoading) {
return <Loader page={true} />;
}

return (
<Provider store={getStore(initData, moduleReducers(initData))}>
<Router>
Expand All @@ -46,66 +45,55 @@ export const DigitUI = ({stateCode="pg", registry, enabledModules, moduleReducer
const PrivacyProvider = Digit.Contexts.PrivacyProvider;


// return (
// <div>
// <ErrorBoundary>
// <QueryClientProvider client={queryClient}>
// <ComponentProvider.Provider value={registry}>
// <PrivacyProvider.Provider
// value={{
// privacy: privacy?.[window.location.pathname],
// resetPrivacy: (_data) => {
// Digit.Utils.setPrivacyObject({});
// setPrivacy({});
// },
// getPrivacy: () => {
// const privacyObj = Digit.Utils.getPrivacyObject();
// setPrivacy(privacyObj);
// return privacyObj;
// },
// /* Descoped method to update privacy object */
// updatePrivacyDescoped: (_data) => {
// const privacyObj = Digit.Utils.getAllPrivacyObject();
// const newObj = { ...privacyObj, [window.location.pathname]: _data };
// Digit.Utils.setPrivacyObject({ ...newObj });
// setPrivacy(privacyObj?.[window.location.pathname] || {});
// },
// /**
// * Main Method to update the privacy object anywhere in the application
// *
// * @author jagankumar-egov
// *
// * Feature :: Privacy
// *
// * @example
// * const { privacy , updatePrivacy } = Digit.Hooks.usePrivacyContext();
// */
// updatePrivacy: (uuid, fieldName) => {
// setPrivacy(Digit.Utils.updatePrivacy(uuid, fieldName) || {});
// },
// }}
// >
// <DigitUIWrapper stateCode={"pg"} enabledModules={enabledModules} moduleReducers={moduleReducers} defaultLanding={defaultLanding} queryClient={queryClient}/>
// {/* <div>Core Module Dummy</div> */}
// {/* <ReactQueryDevtools initialIsOpen={false} /> */}
// </PrivacyProvider.Provider>
// </ComponentProvider.Provider>
// </QueryClientProvider>
// </ErrorBoundary>
// </div>
// );

return (<div>
return (
<div>
<ErrorBoundary>
<QueryClientProvider client={queryClient}>
<ComponentProvider.Provider value={registry}>
<DigitUIWrapper stateCode={stateCode} enabledModules={enabledModules} moduleReducers={moduleReducers} defaultLanding={defaultLanding} queryClient={queryClient}/>
<PrivacyProvider.Provider
value={{
privacy: privacy?.[window.location.pathname],
resetPrivacy: (_data) => {
Digit.Utils.setPrivacyObject({});
setPrivacy({});
},
getPrivacy: () => {
const privacyObj = Digit.Utils.getPrivacyObject();
setPrivacy(privacyObj);
return privacyObj;
},
/* Descoped method to update privacy object */
updatePrivacyDescoped: (_data) => {
const privacyObj = Digit.Utils.getAllPrivacyObject();
const newObj = { ...privacyObj, [window.location.pathname]: _data };
Digit.Utils.setPrivacyObject({ ...newObj });
setPrivacy(privacyObj?.[window.location.pathname] || {});
},
/**
* Main Method to update the privacy object anywhere in the application
*
* @author jagankumar-egov
*
* Feature :: Privacy
*
* @example
* const { privacy , updatePrivacy } = Digit.Hooks.usePrivacyContext();
*/
updatePrivacy: (uuid, fieldName) => {
setPrivacy(Digit.Utils.updatePrivacy(uuid, fieldName) || {});
},
}}
>
<DigitUIWrapper stateCode={"pg"} enabledModules={enabledModules} moduleReducers={moduleReducers} defaultLanding={defaultLanding} />
{/* <div>Core Module Dummy</div> */}
{/* <ReactQueryDevtools initialIsOpen={false} /> */}
</PrivacyProvider.Provider>
</ComponentProvider.Provider>
</QueryClientProvider>
</ErrorBoundary>
</div>)
</div>
);

};

const componentsToRegister = {
Expand Down
9 changes: 5 additions & 4 deletions micro-ui/web/packages/core/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { Redirect, Route, Switch, useHistory, useLocation } from "react-router-d
import CitizenApp from "./citizen";
import EmployeeApp from "./employee";

export const DigitApp = ({ stateCode="pg", modules, appTenants, logoUrl, initData ,defaultLanding="citizen"}) => {
// debugger

export const DigitApp = ({ stateCode="pg", modules, appTenants, logoUrl, initData ,defaultLanding="employee"}) => {
const history = useHistory();
const { pathname } = useLocation();
const innerWidth = window.innerWidth;
Expand Down Expand Up @@ -66,7 +64,10 @@ export const DigitApp = ({ stateCode="pg", modules, appTenants, logoUrl, initDat
pathname,
initData,
};
console.log("came till digit App");

return (
<div>Core Module</div>
)
return (
<Switch>
<Route path={`/${window?.contextPath}/employee`}>
Expand Down

0 comments on commit 0dabd38

Please sign in to comment.