Skip to content
Prev Previous commit
Next Next commit
[autofix.ci] apply automated fixes
  • Loading branch information
autofix-ci[bot] authored Sep 5, 2025
commit e5e914a8bd4806696e8a9aebf281dbaea6daba57
12 changes: 8 additions & 4 deletions src/frontend/src/components/ui/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use client";

import { useIsMobile } from "@/hooks/use-mobile";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { PanelLeft } from "lucide-react";
import * as React from "react";
import { useHotkeys } from "react-hotkeys-hook";
import { useIsMobile } from "@/hooks/use-mobile";
import isWrappedWithClass from "../../pages/FlowPage/components/PageComponent/utils/is-wrapped-with-class";
import { useShortcutsStore } from "../../stores/shortcuts";
import { cn } from "../../utils/utils";
Expand All @@ -23,7 +23,12 @@ const SIDEBAR_WIDTH = "19rem";
const SIDEBAR_WIDTH_ICON = "4rem";
const SEGMENTED_SIDEBAR_ICON_WIDTH = "40px";

export type SidebarSection = "search" | "components" | "bundles" | "mcp" | "add_note";
export type SidebarSection =
| "search"
| "components"
| "bundles"
| "mcp"
| "add_note";

// Helper function to get cookie value
function getCookie(name: string): string | null {
Expand Down Expand Up @@ -865,6 +870,5 @@ export {
SidebarRail,
SidebarSeparator,
SidebarTrigger,
useSidebar
useSidebar,
};

46 changes: 23 additions & 23 deletions src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
import { DefaultEdge } from "@/CustomEdges";
import NoteNode from "@/CustomNodes/NoteNode";
import FlowToolbar from "@/components/core/flowToolbarComponent";
import {
COLOR_OPTIONS,
NOTE_NODE_MIN_HEIGHT,
NOTE_NODE_MIN_WIDTH,
} from "@/constants/constants";
import { useGetBuildsQuery } from "@/controllers/API/queries/_builds";
import CustomLoader from "@/customization/components/custom-loader";
import { track } from "@/customization/utils/analytics";
import useAutoSaveFlow from "@/hooks/flows/use-autosave-flow";
import useUploadFlow from "@/hooks/flows/use-upload-flow";
import { useAddComponent } from "@/hooks/use-add-component";
import { nodeColorsName } from "@/utils/styleUtils";
import { isSupportedNodeTypes } from "@/utils/utils";
import {
type Connection,
type Edge,
Expand All @@ -35,6 +19,22 @@ import {
} from "react";
import { useHotkeys } from "react-hotkeys-hook";
import { useShallow } from "zustand/react/shallow";
import { DefaultEdge } from "@/CustomEdges";
import NoteNode from "@/CustomNodes/NoteNode";
import FlowToolbar from "@/components/core/flowToolbarComponent";
import {
COLOR_OPTIONS,
NOTE_NODE_MIN_HEIGHT,
NOTE_NODE_MIN_WIDTH,
} from "@/constants/constants";
import { useGetBuildsQuery } from "@/controllers/API/queries/_builds";
import CustomLoader from "@/customization/components/custom-loader";
import { track } from "@/customization/utils/analytics";
import useAutoSaveFlow from "@/hooks/flows/use-autosave-flow";
import useUploadFlow from "@/hooks/flows/use-upload-flow";
import { useAddComponent } from "@/hooks/use-add-component";
import { nodeColorsName } from "@/utils/styleUtils";
import { isSupportedNodeTypes } from "@/utils/utils";
import GenericNode from "../../../../CustomNodes/GenericNode";
import {
INVALID_SELECTION_ERROR_ALERT,
Expand Down Expand Up @@ -63,21 +63,21 @@ import {
validateSelection,
} from "../../../../utils/reactflowUtils";
import ConnectionLineComponent from "../ConnectionLineComponent";
import FlowBuildingComponent from "../flowBuildingComponent";
import SelectionMenu from "../SelectionMenuComponent";
import UpdateAllComponents from "../UpdateAllComponents";
import FlowBuildingComponent from "../flowBuildingComponent";
import {
MemoizedBackground,
MemoizedCanvasControls,
MemoizedLogCanvasControls,
MemoizedSidebarTrigger,
} from "./MemoizedComponents";
import HelperLines from "./components/helper-lines";
import {
getHelperLines,
getSnapPosition,
type HelperLinesState,
} from "./helpers/helper-lines";
import {
MemoizedBackground,
MemoizedCanvasControls,
MemoizedLogCanvasControls,
MemoizedSidebarTrigger,
} from "./MemoizedComponents";
import getRandomName from "./utils/get-random-name";
import isWrappedWithClass from "./utils/is-wrapped-with-class";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { type DragEventHandler, forwardRef, useRef, useState } from "react";
import IconComponent, {
ForwardedIconComponent,
} from "@/components/common/genericIconComponent";
Expand All @@ -22,7 +23,6 @@ import {
getNodeId,
} from "@/utils/reactflowUtils";
import { cn, removeCountFromString } from "@/utils/utils";
import { type DragEventHandler, forwardRef, useRef, useState } from "react";

export const SidebarDraggableComponent = forwardRef(
(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect, useState } from "react";
import ForwardedIconComponent from "@/components/common/genericIconComponent";
import ShadTooltip from "@/components/common/shadTooltipComponent";
import { Separator } from "@/components/ui/separator";
Expand All @@ -9,7 +10,6 @@ import {
useSidebar,
} from "@/components/ui/sidebar";
import { cn } from "@/utils/utils";
import { useEffect, useState } from "react";
import { useSearchContext } from "../index";

export type { SidebarSection };
Expand Down Expand Up @@ -99,16 +99,27 @@ const SidebarSegmentedNav = () => {
}
}
}}
isActive={item.id === "add_note" ? isAddNoteActive : activeSection === item.id}
isActive={
item.id === "add_note"
? isAddNoteActive
: activeSection === item.id
}
className={cn(
"flex h-8 w-8 items-center justify-center rounded-md p-0 transition-all duration-200",
(item.id === "add_note" ? isAddNoteActive : activeSection === item.id)
(
item.id === "add_note"
? isAddNoteActive
: activeSection === item.id
)
? "bg-accent text-accent-foreground"
: "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
)}
data-testid={`sidebar-nav-${item.id}`}
>
<ForwardedIconComponent name={item.icon} className="h-5 w-5" />
<ForwardedIconComponent
name={item.icon}
className="h-5 w-5"
/>
<span className="sr-only">{item.label}</span>
</SidebarMenuButton>
</ShadTooltip>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
import Fuse from "fuse.js";
import { cloneDeep } from "lodash";
import {
createContext,
memo,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import { useHotkeys } from "react-hotkeys-hook";
import { useShallow } from "zustand/react/shallow";
import ForwardedIconComponent from "@/components/common/genericIconComponent";
import { Button } from "@/components/ui/button";
import {
Expand All @@ -18,20 +32,6 @@ import {
SIDEBAR_CATEGORIES,
} from "@/utils/styleUtils";
import { cn, getBooleanFromStorage } from "@/utils/utils";
import Fuse from "fuse.js";
import { cloneDeep } from "lodash";
import {
createContext,
memo,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import { useHotkeys } from "react-hotkeys-hook";
import { useShallow } from "zustand/react/shallow";
import useFlowStore from "../../../../stores/flowStore";
import { useTypesStore } from "../../../../stores/typesStore";
import type { APIClassType } from "../../../../types/api";
Expand Down