Skip to content

Commit

Permalink
code updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay-aot committed Oct 8, 2024
1 parent ed0b95c commit 79f9f50
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 45 deletions.
10 changes: 5 additions & 5 deletions forms-flow-nav/src/root.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import Sidebar from "./sidenav/Sidebar";
import React, { useState } from "react";
import "./Navbar.scss";
import HamburgerMenu from "./sidenav/hamburgerMenu";
import TenantHeader from "./sidenav/TenantHeader";
import {
MULTITENANCY_ENABLED,
} from "./constants/constants";
// import TenantHeader from "./sidenav/TenantHeader";
// import {
// MULTITENANCY_ENABLED,
// } from "./constants/constants";

export default function Root(props) {
return (
<Router>
{/* <NavBar props={props} /> */}
<>
{MULTITENANCY_ENABLED && <TenantHeader props={props} />}
{/* {MULTITENANCY_ENABLED && <TenantHeader props={props} />} */}
<HamburgerMenu props={props} />
<div className="main-sidenav">
<Sidebar props={props} />
Expand Down
8 changes: 4 additions & 4 deletions forms-flow-nav/src/sidenav/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const Sidebar = React.memo(({ props }) => {
isViewSubmissions &&
ENABLE_APPLICATIONS_MODULE && (
<MenuComponent
eventKey="3"
eventKey="1"
optionsCount="1"
mainMenu="Submit"
subMenu={[
Expand All @@ -236,7 +236,7 @@ const Sidebar = React.memo(({ props }) => {
)}
{(isViewTask || isManageTask) && ENABLE_TASKS_MODULE && (
<MenuComponent
eventKey="4"
eventKey="2"
optionsCount="1"
mainMenu="Review"
subMenu={[
Expand All @@ -251,7 +251,7 @@ const Sidebar = React.memo(({ props }) => {
)}
{isViewDashboard && ENABLE_DASHBOARDS_MODULE && (
<MenuComponent
eventKey="5"
eventKey="3"
optionsCount="2"
mainMenu="Analyze"
subMenu={[
Expand All @@ -275,7 +275,7 @@ const Sidebar = React.memo(({ props }) => {
)}
{isAdmin && (
<MenuComponent
eventKey="6"
eventKey="4"
optionsCount="3"
mainMenu="Manage"
subMenu={[
Expand Down
6 changes: 3 additions & 3 deletions forms-flow-nav/src/sidenav/Sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
display: flex;
align-items: center;
justify-content: center;
padding: 0 var(--spacer-100);
padding: var(--spacer-050) 0;
}

.multitenancy-logo {
Expand All @@ -209,8 +209,8 @@
}

.multitenancy-app-name {
font-size: var(--font-size-md);
font-weight: var(--font-weight-lg);
font-size: var(--font-size-sm);
font-weight: var(--font-weight-sm);
color: var(--ff-gray-800);
}

Expand Down
67 changes: 34 additions & 33 deletions forms-flow-nav/src/sidenav/TenantHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
import React, { useEffect } from "react";
import { StorageService } from "@formsflow/service";
import { MULTITENANCY_ENABLED } from "../constants/constants";
// import React, { useEffect } from "react";
// import { StorageService } from "@formsflow/service";
// import { MULTITENANCY_ENABLED } from "../constants/constants";
// import "./Sidebar.scss";

const TenantHeader = React.memo(({ props }) => {
const [tenantLogo, setTenantLogo] = React.useState("");
const [tenantName, setTenantName] = React.useState("");
const [tenant, setTenant] = React.useState({});
// const TenantHeader = React.memo(({ props }) => {
// const [tenantLogo, setTenantLogo] = React.useState("");
// const [tenantName, setTenantName] = React.useState("");
// const [tenant, setTenant] = React.useState({});

useEffect(() => {
props.subscribe("ES_TENANT", (msg, data) => {
if (data) {
setTenant(data);
if (!JSON.parse(StorageService.get("TENANT_DATA"))?.name) {
StorageService.save("TENANT_DATA", JSON.stringify(data.tenantData));
}
}
});
}, []);
// useEffect(() => {
// props.subscribe("ES_TENANT", (msg, data) => {
// if (data) {
// setTenant(data);
// if (!JSON.parse(StorageService.get("TENANT_DATA"))?.name) {
// StorageService.save("TENANT_DATA", JSON.stringify(data.tenantData));
// }
// }
// });
// }, []);

useEffect(() => {
const data = JSON.parse(StorageService.get("TENANT_DATA"));
if (MULTITENANCY_ENABLED && data?.details) {
setTenantName(data?.details?.applicationTitle);
const logo = data?.details?.customLogo?.logo;
setTenantLogo(logo);
}
}, [tenant]);
// useEffect(() => {
// const data = JSON.parse(StorageService.get("TENANT_DATA"));
// if (MULTITENANCY_ENABLED && data?.details) {
// setTenantName(data?.details?.applicationTitle);
// const logo = data?.details?.customLogo?.logo;
// setTenantLogo(logo);
// }
// }, [tenant]);

return (
<div className="multitenancy-header">
<img className="multitenancy-logo" src={tenantLogo} alt="custom logo" />
<span className="multitenancy-app-name">{tenantName}</span>
</div>
);
});
export default TenantHeader;
// return (
// <div className="multitenancy-header">
// <img className="multitenancy-logo" src={tenantLogo} alt="custom logo" />
// <span className="multitenancy-app-name">{tenantName}</span>
// </div>
// );
// });
// export default TenantHeader;

0 comments on commit 79f9f50

Please sign in to comment.