Skip to content

Commit

Permalink
change the navigation logic in quick setup (#1592)
Browse files Browse the repository at this point in the history
* fix

* fix

* fix

* fix

* fix
  • Loading branch information
aaradhya-egov authored Oct 21, 2024
1 parent 573611d commit 140f4ed
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useHistory } from "react-router-dom";
const Home = () => {
const { t } = useTranslation();
const history = useHistory();
const tenantId = Digit.ULBService.getCitizenCurrentTenant(true);
const tenantId = Digit.Utils.getMultiRootTenant()? Digit.ULBService.getStateId() : Digit.ULBService.getCitizenCurrentTenant(true);
const {
data: { stateInfo, uiHomePage } = {},
isLoading,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ const QuickSetupConfigComponent = ({ onSelect, formData, control, formState, ...
{
label: "SANDBOX_FAQ_ANS_5_LABEL_4",
description: "SANDBOX_FAQ_ANS_5_DESCRIPTION_4",
},
{
label: "SANDBOX_FAQ_ANS_5_LABEL_5",
description: "SANDBOX_FAQ_ANS_5_DESCRIPTION_5",
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import{ useState } from "react";
import { useTranslation } from "react-i18next";
import { CardText, CardHeader, LinkLabel, Card } from "@egovernments/digit-ui-components";
import { CardText, CardHeader, LinkLabel, Card, Button } from "@egovernments/digit-ui-components";
import { ArrowForward } from "@egovernments/digit-ui-svg-components";
import { CardSubHeader, CardSectionHeader, BreakLine, CardSectionSubText } from "@egovernments/digit-ui-react-components";

Expand All @@ -11,12 +11,6 @@ const FaqComponent = (props) => {
const { t } = useTranslation();
const tenantId = Digit.ULBService.getStateId();
const ListTag = type === "number" ? "ol" : "ul";
const handleClick = (e, link) => {
e.stopPropagation(); // Stop the event from bubbling up to the parent div
if (link) {
window.open(link, '_blank', 'noopener noreferrer');
}
};
return (
<div className="faqs border-none" onClick={() => toggleOpen(!isOpen)}>
<div className="faq-question" style={{ justifyContent: "space-between", display: "flex" }}>
Expand All @@ -34,13 +28,17 @@ const FaqComponent = (props) => {
<li key={index} style={{ listStyleType: ListTag === "ul" ? "disc" : "auto", margin: "8px 0" }}>
{isLabelLink ? (
action?.label ? (
<a
className="quickLink"
href="#"
onClick={(e) => handleClick(e, `${window.location.host}/${window?.globalPath}/${tenantId}/${action?.link}`)}
>
{t(action?.label)}:
</a>
<Button
variation="teritiary"
label={t(action?.label)}
type="button"
size={"medium"}
onClick={() => {
const baseURL = `https://${window.location.hostname}/${window?.globalPath}/${tenantId}`;
window.open(`${baseURL}/${action?.link}`, "_blank");
}}
style={{ padding: "0px" }}
/>
) : null
) : (
action?.label ? <strong>{t(action?.label)}:</strong> : null
Expand Down Expand Up @@ -140,4 +138,4 @@ const QuickSetup = ({ cardConfig }) => {
);
};

export default QuickSetup;
export default QuickSetup;
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import TimeLine from "../../components/TimeLine";

const WorkflowComponent = ({ complaintDetails, id, getWorkFlow, zoomImage }) => {
const tenantId = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code || complaintDetails.service.tenantId;
const tenantId = Digit.Utils.getMultiRootTenant()? Digit.ULBService.getStateId() : Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code || complaintDetails.service.tenantId;
let workFlowDetails = Digit.Hooks.useWorkflowDetails({ tenantId: tenantId, id, moduleCode: "PGR" });
// const { data: ComplainMaxIdleTime, isLoading: ComplainMaxIdleTimeLoading } = Digit.Hooks.pgr.useMDMS.ComplainClosingTime(tenantId?.split(".")[0]);

Expand Down Expand Up @@ -53,7 +53,7 @@ const ComplaintDetailsPage = (props) => {
let { t } = useTranslation();
let { id } = useParams();

let tenantId = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code || Digit.ULBService.getCurrentTenantId(); // ToDo: fetch from state
let tenantId = Digit.Utils.getMultiRootTenant()? Digit.ULBService.getStateId() : Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code || Digit.ULBService.getCurrentTenantId(); // ToDo: fetch from state
const { isLoading, error, isError, complaintDetails, revalidate } = Digit.Hooks.pgr.useComplaintDetails({ tenantId, id });

const [imageShownBelowComplaintDetails, setImageToShowBelowComplaintDetails] = useState({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Complaint from "../../components/Complaint";
export const ComplaintsList = (props) => {
const User = Digit.UserService.getUser();
const mobileNumber = User.mobileNumber || User?.info?.mobileNumber || User?.info?.userInfo?.mobileNumber;
const tenantId = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code || Digit.ULBService.getCurrentTenantId();
const tenantId = Digit.Utils.getMultiRootTenant()? Digit.ULBService.getStateId() : Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code || Digit.ULBService.getCurrentTenantId();
const { t } = useTranslation();
const { path, url } = useRouteMatch();
let { isLoading, error, data, revalidate } = Digit.Hooks.pgr.useComplaintsListByMobile(tenantId, mobileNumber);
Expand Down

0 comments on commit 140f4ed

Please sign in to comment.