-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
side bar #1384
side bar #1384
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,16 @@ import React, { useRef, useEffect, useState } from "react"; | |
import { Sidebar, Loader } from "@egovernments/digit-ui-components"; | ||
import { useTranslation } from "react-i18next"; | ||
import { useHistory } from "react-router-dom"; | ||
import { update } from "lodash"; | ||
|
||
const DIGIT_UI_CONTEXTS = ["digit-ui", "works-ui", "workbench-ui", "health-ui", "sanitation-ui", "core-ui", "mgramseva-web", "sandbox-ui"]; | ||
|
||
const EmployeeSideBar = () => { | ||
const { isLoading, data } = Digit.Hooks.useAccessControl(); | ||
const isMultiRootTenant = Digit.Utils.getMultiRootTenant(); | ||
const { t } = useTranslation(); | ||
const history = useHistory(); | ||
const tenantId = Digit.ULBService.getCurrentTenantId(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use stateid not current tenant id There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
function extractLeftIcon(data = {}) { | ||
for (const key in data) { | ||
|
@@ -83,22 +86,29 @@ const EmployeeSideBar = () => { | |
const navigateToRespectiveURL = (history = {}, url = "") => { | ||
if (url == "/") { | ||
return; | ||
} | ||
} | ||
if (url?.indexOf(`/${window?.contextPath}`) === -1) { | ||
const hostUrl = window.location.origin; | ||
const updatedURL = DIGIT_UI_CONTEXTS?.every((e) => url?.indexOf(`/${e}`) === -1) ? hostUrl + "/employee/" + url : hostUrl + url; | ||
window.location.href = updatedURL; | ||
let updatedUrl=null; | ||
if(isMultiRootTenant){ | ||
url=url.replace("/sandbox-ui/employee", `/sandbox-ui/${tenantId}/employee`); | ||
updatedUrl = hostUrl + url; | ||
} | ||
else{ | ||
updatedUrl = DIGIT_UI_CONTEXTS?.every((e) => url?.indexOf(`/${e}`) === -1) ? hostUrl + "/employee/" + url : hostUrl + url; | ||
} | ||
window.location.href = updatedUrl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we shouldnt do this within sandbox app There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mithunhegde-egov the logic should be written for else section this section is working fine |
||
} else { | ||
history.push(url); | ||
} | ||
} | ||
}; | ||
|
||
const onItemSelect = ({ item, index, parentIndex }) => { | ||
if (item?.navigationUrl) { | ||
navigateToRespectiveURL(history, item?.navigationUrl); | ||
} else { | ||
return; | ||
} | ||
} | ||
}; | ||
|
||
function transformData(data) { | ||
|
@@ -148,4 +158,4 @@ const EmployeeSideBar = () => { | |
); | ||
}; | ||
|
||
export default EmployeeSideBar; | ||
export default EmployeeSideBar; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused import.
The
update
function imported from thelodash
library is not used anywhere in the file. Please remove this import to avoid unnecessary bundle size and potential performance issues.Apply this diff to remove the unused import:
-import { update } from "lodash";
Committable suggestion