Skip to content

Commit

Permalink
1.8.1-beta.8 created a new component version with new reeleased compo…
Browse files Browse the repository at this point in the history
…nents (#322)

* took the core module changes from the ui-libraries

* took the latest changes

* 1.8.1-beta.8 created a new component version with new reeleased components
  • Loading branch information
jagankumar-egov authored Apr 17, 2024
1 parent 597cf3a commit b41dba8
Show file tree
Hide file tree
Showing 48 changed files with 1,350 additions and 498 deletions.
4 changes: 2 additions & 2 deletions micro-ui/web/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
],
"homepage": "/core-ui",
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.1-beta.1",
"@egovernments/digit-ui-libraries": "1.8.1-beta.4",
"@egovernments/digit-ui-module-workbench": "1.0.1-beta.9",
"@egovernments/digit-ui-module-core": "1.8.1-beta.6",
"@egovernments/digit-ui-module-core": "1.8.1-beta.8",
"@egovernments/digit-ui-module-hrms": "1.8.0",
"@egovernments/digit-ui-module-pgr": "1.7.5",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.1",
Expand Down
4 changes: 2 additions & 2 deletions micro-ui/web/micro-ui-internals/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"start": "react-scripts start"
},
"devDependencies": {
"@egovernments/digit-ui-libraries": "1.8.1-beta.2",
"@egovernments/digit-ui-libraries": "1.8.1-beta.4",
"@egovernments/digit-ui-module-workbench": "1.0.1-beta.9",
"@egovernments/digit-ui-module-pgr": "1.7.5",
"@egovernments/digit-ui-module-dss": "1.8.0",
"@egovernments/digit-ui-module-core": "1.8.1-beta.7",
"@egovernments/digit-ui-module-core": "1.8.1-beta.8",
"@egovernments/digit-ui-module-common": "1.8.0",
"@egovernments/digit-ui-module-hrms": "1.8.0",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.1",
Expand Down
2 changes: 2 additions & 0 deletions micro-ui/web/micro-ui-internals/packages/libraries/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export default App;
### Changelog

```bash
1.8.1-beta.4: Enhanced to load screen even if mdms is failing
1.8.1-beta.3: other fixes
1.8.1-beta.2: Enhanced `useCustomMdms` hook to support version 2 of MDMS API calls.
1.8.1-beta.1 Republished after merging with Master due to version issues.
1.8.0 Released as part of workbench v1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-libraries",
"version": "1.8.1-beta.3",
"version": "1.8.1-beta.4",
"main": "dist/index.js",
"module": "dist/index.modern.js",
"source": "src/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const StoreService = {
bannerUrl: stateInfo.bannerUrl,
},
localizationModules: stateInfo.localizationModules,
modules: MdmsRes?.tenant?.citymodule?.filter((module) => module?.active)?.filter((module) => enabledModules?.includes(module?.code))?.sort((x,y)=>x?.order-y?.order),
modules: MdmsRes?.tenant?.citymodule?.filter((module) => module?.active)?.filter((module) => enabledModules?.includes(module?.code))?.sort((x,y)=>x?.order-y?.order)|| [],
uiHomePage: uiHomePage
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const ULBService = {
getCurrentUlb: () => {
const initData = StoreService.getInitData();
const tenantId = ULBService.getCurrentTenantId();
return initData.tenants.find((tenant) => tenant.code === tenantId);
return initData?.tenants?.find((tenant) => tenant?.code === tenantId)||ULBService.getStateId();
}
/**
* Custom method to get citizen's current selected city
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ and add its related functions
### Changelog

```bash
1.8.1-beta.8: Enhanced to load screen even if mdms is failing
1.8.1-beta.7 Added custom support for all svg icons to be used in sidebar by specifiying icon as svg:localairport (svg:iconname)
1.8.1-beta.6 Resolved duplicacy issue in the Sidebar
1.8.1-beta.5 Fixed Sidebar Path issue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-module-core",
"version": "1.8.1-beta.7",
"version": "1.8.1-beta.8",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand All @@ -14,8 +14,8 @@
"prepublish": "yarn build"
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.1-beta.9",
"@egovernments/digit-ui-react-components": "1.8.1-beta.9",
"@egovernments/digit-ui-components": "0.0.1-beta.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.16.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Body, Loader } from "@egovernments/digit-ui-react-components";
import { BodyContainer } from "@egovernments/digit-ui-components";
import { Loader } from "@egovernments/digit-ui-components";
import React from "react";
import { getI18n } from "react-i18next";
import { QueryClient, QueryClientProvider } from "react-query";
Expand All @@ -12,17 +13,18 @@ import { useState } from "react";
import ErrorBoundary from "./components/ErrorBoundaries";
import getStore from "./redux/store";

const DigitUIWrapper = ({ stateCode, enabledModules, moduleReducers,defaultLanding }) => {
const { isLoading, data: initData } = Digit.Hooks.useInitStore(stateCode, enabledModules);
const DigitUIWrapper = ({ stateCode, enabledModules, moduleReducers, defaultLanding }) => {
const { isLoading, data: initData={} } = Digit.Hooks.useInitStore(stateCode, enabledModules);
if (isLoading) {
return <Loader page={true} />;
}
const data=getStore(initData, moduleReducers(initData)) || {};

const i18n = getI18n();
return (
<Provider store={getStore(initData, moduleReducers(initData))}>
<Provider store={data}>
<Router>
<Body>
<BodyContainer>
<DigitApp
initData={initData}
stateCode={stateCode}
Expand All @@ -31,13 +33,13 @@ const DigitUIWrapper = ({ stateCode, enabledModules, moduleReducers,defaultLandi
logoUrl={initData?.stateInfo?.logoUrl}
defaultLanding={defaultLanding}
/>
</Body>
</BodyContainer>
</Router>
</Provider>
);
};

export const DigitUI = ({ stateCode, registry, enabledModules, moduleReducers ,defaultLanding}) => {
export const DigitUI = ({ stateCode, registry, enabledModules, moduleReducers, defaultLanding }) => {
const [privacy, setPrivacy] = useState(Digit.Utils.getPrivacyObject() || {});
const userType = Digit.UserService.getType();
const queryClient = new QueryClient({
Expand Down Expand Up @@ -99,7 +101,7 @@ export const DigitUI = ({ stateCode, registry, enabledModules, moduleReducers ,d
},
}}
>
<DigitUIWrapper stateCode={stateCode} enabledModules={enabledModules} moduleReducers={moduleReducers} defaultLanding={defaultLanding}/>
<DigitUIWrapper stateCode={stateCode} enabledModules={enabledModules} moduleReducers={moduleReducers} defaultLanding={defaultLanding} />
</PrivacyProvider.Provider>
</ComponentProvider.Provider>
</QueryClientProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dropdown } from "@egovernments/digit-ui-react-components";
import { Dropdown } from "@egovernments/digit-ui-components";
import React, { useEffect, useState } from "react";
import { useHistory } from "react-router-dom";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CustomButton, Dropdown } from "@egovernments/digit-ui-react-components";
import { Button, Dropdown } from "@egovernments/digit-ui-components";
import React, { useState } from "react";

const ChangeLanguage = (prop) => {
Expand Down Expand Up @@ -34,11 +34,7 @@ const ChangeLanguage = (prop) => {
<div className="language-selector">
{languages.map((language, index) => (
<div className="language-button-container" key={index}>
<CustomButton
selected={language.value === selected}
text={language.label}
onClick={() => handleChangeLanguage(language)}
></CustomButton>
<Button label={language.label} onClick={() => handleChangeLanguage(language)} variation={language.value === selected ? "primary" : ""} />
</div>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CardText, CloseSvg, Modal } from "@egovernments/digit-ui-react-components";
import {CardText, SVG, Modal} from "@egovernments/digit-ui-components";
import React from "react";
import { useTranslation } from "react-i18next";

Expand All @@ -15,11 +15,10 @@ const CloseBtn = (props) => {
return (
<div onClick={props?.onClick} style={props?.isMobileView ? { padding: 5 } : null}>
{props?.isMobileView ? (
<CloseSvg />
<SVG.Close />
) : (
<div className={"icon-bg-secondary"} style={{ backgroundColor: "#505A5F" }}>
{" "}
<Close />{" "}
<Close />
</div>
)}
</div>
Expand Down Expand Up @@ -69,7 +68,7 @@ const LogoutDialog = ({ onSelect, onCancel, onDismiss }) => {
position: "absolute",
left: 0,
bottom: 0,
padding: "18px",
padding: "5px",
}}
style={{
flex: 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Loader } from "@egovernments/digit-ui-components";
import React from "react";
import { useTranslation } from "react-i18next";
import { Loader } from "@egovernments/digit-ui-react-components"

const Header = () => {
const { data: storeData, isLoading } = Digit.Hooks.useStore.getInitData();
Expand All @@ -12,7 +12,7 @@ const Header = () => {
return (
<div className="bannerHeader">
<img className="bannerLogo" src={stateInfo?.logoUrl} />
<p>{t(`TENANT_TENANTS_${stateInfo?.code.toUpperCase()}`)}</p>
<p>{t(`TENANT_TENANTS_${stateInfo?.code?.toUpperCase()}`)}</p>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import {
BackButton,
BillsIcon,
CitizenHomeCard,
CitizenInfoLabel,
FSMIcon,
Loader,
FSMIcon,
MCollectIcon,
OBPSIcon,
PGRIcon,
PTIcon,
TLIcon,
WSICon,
} from "@egovernments/digit-ui-react-components";
BillsIcon
} from "@egovernments/digit-ui-components";

import React, { Fragment } from "react";
import { useTranslation } from "react-i18next";

Expand Down Expand Up @@ -79,7 +75,12 @@ const iconSelector = (code) => {
return <PTIcon className="fill-path-primary-main" />;
}
};
const CitizenHome = ({ modules, getCitizenMenu, fetchedCitizen, isLoading }) => {
const CitizenHome = ({
modules,
getCitizenMenu,
fetchedCitizen,
isLoading,
}) => {
const paymentModule = modules.filter(({ code }) => code === "Payment")[0];
const moduleArr = modules.filter(({ code }) => code !== "Payment");
const moduleArray = [paymentModule, ...moduleArr];
Expand All @@ -91,26 +92,37 @@ const CitizenHome = ({ modules, getCitizenMenu, fetchedCitizen, isLoading }) =>
return (
<React.Fragment>
<div className="citizen-all-services-wrapper">
{location.pathname.includes("sanitation-ui/citizen/all-services") ? null : <BackButton />}
{location.pathname.includes(
"sanitation-ui/citizen/all-services"
) ? null : (
<BackButton />
)}
<div className="citizenAllServiceGrid">
{moduleArray
.filter((mod) => mod)
.map(({ code }, index) => {
let mdmsDataObj;
if (fetchedCitizen) mdmsDataObj = fetchedCitizen ? processLinkData(getCitizenMenu, code, t) : undefined;
if (fetchedCitizen)
mdmsDataObj = fetchedCitizen
? processLinkData(getCitizenMenu, code, t)
: undefined;
if (mdmsDataObj?.links?.length > 0) {
return (
<CitizenHomeCard
header={t(mdmsDataObj?.header)}
links={mdmsDataObj?.links?.filter((ele) => ele?.link)?.sort((x, y) => x?.orderNumber - y?.orderNumber)}
links={mdmsDataObj?.links
?.filter((ele) => ele?.link)
?.sort((x, y) => x?.orderNumber - y?.orderNumber)}
Icon={() => iconSelector(code)}
Info={
code === "OBPS"
? () => (
<CitizenInfoLabel
style={{ margin: "0px", padding: "10px" }}
info={t("CS_FILE_APPLICATION_INFO_LABEL")}
text={t(`BPA_CITIZEN_HOME_STAKEHOLDER_INCLUDES_INFO_LABEL`)}
text={t(
`BPA_CITIZEN_HOME_STAKEHOLDER_INCLUDES_INFO_LABEL`
)}
/>
)
: null
Expand All @@ -132,7 +144,9 @@ const EmployeeHome = ({ modules, additionalComponent }) => {
<div className="employee-app-container">
<div className="ground-container moduleCardWrapper gridModuleWrapper">
{modules.map(({ code }, index) => {
const Card = Digit.ComponentRegistryService.getComponent(`${code}Card`) || (() => <React.Fragment />);
const Card =
Digit.ComponentRegistryService.getComponent(`${code}Card`) ||
(() => <React.Fragment />);
return <Card key={index} />;
})}
</div>
Expand All @@ -141,7 +155,10 @@ const EmployeeHome = ({ modules, additionalComponent }) => {
{additionalComponent &&
additionalComponent?.length > 0 &&
additionalComponent.map((i) => {
const Component = typeof i === "string" ? Digit.ComponentRegistryService.getComponent(i) : null;
const Component =
typeof i === "string"
? Digit.ComponentRegistryService.getComponent(i)
: null;
return Component ? (
<div className="additional-component-wrapper">
<Component />
Expand All @@ -152,9 +169,25 @@ const EmployeeHome = ({ modules, additionalComponent }) => {
);
};

export const AppHome = ({ userType, modules, getCitizenMenu, fetchedCitizen, isLoading, additionalComponent }) => {
export const AppHome = ({
userType,
modules,
getCitizenMenu,
fetchedCitizen,
isLoading,
additionalComponent,
}) => {
if (userType === "citizen") {
return <CitizenHome modules={modules} getCitizenMenu={getCitizenMenu} fetchedCitizen={fetchedCitizen} isLoading={isLoading} />;
return (
<CitizenHome
modules={modules}
getCitizenMenu={getCitizenMenu}
fetchedCitizen={fetchedCitizen}
isLoading={isLoading}
/>
);
}
return <EmployeeHome modules={modules} additionalComponent={additionalComponent} />;
return (
<EmployeeHome modules={modules} additionalComponent={additionalComponent} />
);
};
Loading

0 comments on commit b41dba8

Please sign in to comment.