Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tahierhussain committed Jan 28, 2025
1 parent e7162cf commit 9300ab0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import task from "../../../assets/task.svg";
import VectorDbIcon from "../../../assets/vector-db.svg";
import TextExtractorIcon from "../../../assets/text-extractor.svg";
import { useSessionStore } from "../../../store/session-store";
import { useMemo } from "react";
import { useEffect, useMemo } from "react";

let getMenuItem;
try {
Expand Down Expand Up @@ -194,7 +194,7 @@ const SideNavBar = ({ collapsed }) => {

const shouldDisableAll = useMemo(() => {
if (!unstractSubscriptionPlan || !UNSTRACT_SUBSCRIPTION_PLANS) {
return undefined;
return false;
}

return (
Expand All @@ -203,7 +203,7 @@ const SideNavBar = ({ collapsed }) => {
);
}, [unstractSubscriptionPlan]);

if (shouldDisableAll === false) {
if (shouldDisableAll) {
data.forEach((mainMenuItem) => {
mainMenuItem.subMenu.forEach((subMenuItem) => {
subMenuItem.disable = true;
Expand Down
24 changes: 12 additions & 12 deletions frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ try {
}

let unstractSubscriptionPlan;
let unstractSubscriptionPlanStore;
let useUnstractSubscriptionPlanStore;
let UNSTRACT_SUBSCRIPTION_PLANS;
try {
unstractSubscriptionPlanStore = require("../../../plugins/store/unstract-subscription-plan-store");
useUnstractSubscriptionPlanStore =
require("../../../plugins/store/unstract-subscription-plan-store").useUnstractSubscriptionPlanStore;
UNSTRACT_SUBSCRIPTION_PLANS =
require("../../../plugins/unstract-subscription/helper/constants").UNSTRACT_SUBSCRIPTION_PLANS;
} catch (err) {
Expand Down Expand Up @@ -101,19 +102,18 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
}

try {
if (unstractSubscriptionPlanStore?.useUnstractSubscriptionPlanStore) {
unstractSubscriptionPlan =
unstractSubscriptionPlanStore?.useUnstractSubscriptionPlanStore(
(state) => state?.unstractSubscriptionPlan
);
if (useUnstractSubscriptionPlanStore) {
unstractSubscriptionPlan = useUnstractSubscriptionPlanStore(
(state) => state?.unstractSubscriptionPlan
);
}
} catch (error) {
// Do nothing
}

const shouldDisableRouting = useMemo(() => {
if (!unstractSubscriptionPlan || !UNSTRACT_SUBSCRIPTION_PLANS) {
return undefined;
return false;
}

return (
Expand Down Expand Up @@ -218,7 +218,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
<Button
onClick={() => navigate(`/${orgName}/profile`)}
className="logout-button"
disabled={shouldDisableRouting === false}
disabled={shouldDisableRouting}
>
<UserOutlined /> Profile
</Button>
Expand Down Expand Up @@ -257,7 +257,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
<Button
onClick={() => navigate(`/${orgName}/review`)}
className="logout-button"
disabled={shouldDisableRouting === false}
disabled={shouldDisableRouting}
>
<FileProtectOutlined /> Review
</Button>
Expand All @@ -273,7 +273,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
<Button
onClick={() => navigate(`/${orgName}/review/approve`)}
className="logout-button"
disabled={shouldDisableRouting === false}
disabled={shouldDisableRouting}
>
<LikeOutlined /> Approve
</Button>
Expand All @@ -286,7 +286,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
<Button
onClick={() => navigate(`/${orgName}/review/download_and_sync`)}
className="logout-button"
disabled={shouldDisableRouting === false}
disabled={shouldDisableRouting}
>
<DownloadOutlined /> Download and Sync Manager
</Button>
Expand Down

0 comments on commit 9300ab0

Please sign in to comment.