fix: add correctly switch case to components on sidebar (#2802)
* 📝 (headerComponent/index.tsx): Remove unnecessary width styling from header-end-division class 🔧 (sidebarComponent/index.tsx): Ensure correct import of cn function from utils/utils file 💡 (sidebarComponent/index.tsx): Refactor sidebarContent logic to cover all conditions and provide a default case if necessary * 📝 (sidebarComponent/index.tsx): remove unnecessary comment about ensuring correct import of cn function
This commit is contained in:
parent
011ebc2a5c
commit
910b9974f6
2 changed files with 14 additions and 14 deletions
|
|
@ -134,7 +134,7 @@ export default function Header(): JSX.Element {
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="header-end-division lg:w-[407px]">
|
<div className="header-end-division">
|
||||||
<div className="header-end-display">
|
<div className="header-end-display">
|
||||||
<a
|
<a
|
||||||
href="https://github.com/langflow-ai/langflow"
|
href="https://github.com/langflow-ai/langflow"
|
||||||
|
|
|
||||||
|
|
@ -34,22 +34,22 @@ export default function SidebarNav({
|
||||||
const pathValues = ["folder", "components", "flows", "all"];
|
const pathValues = ["folder", "components", "flows", "all"];
|
||||||
const isFolderPath = pathValues.some((value) => pathname.includes(value));
|
const isFolderPath = pathValues.some((value) => pathname.includes(value));
|
||||||
|
|
||||||
|
// Ensure all conditions are covered and provide a default case if necessary
|
||||||
|
const sidebarContent =
|
||||||
|
items.length > 0 ? (
|
||||||
|
<SideBarButtonsComponent items={items} pathname={pathname} />
|
||||||
|
) : !loadingFolders && folders?.length > 0 && isFolderPath ? (
|
||||||
|
<SideBarFoldersButtonsComponent
|
||||||
|
pathname={pathname}
|
||||||
|
handleChangeFolder={handleChangeFolder}
|
||||||
|
handleDeleteFolder={handleDeleteFolder}
|
||||||
|
/>
|
||||||
|
) : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className={cn(className)} {...props}>
|
<nav className={cn(className)} {...props}>
|
||||||
<HorizontalScrollFadeComponent>
|
<HorizontalScrollFadeComponent>
|
||||||
{items.length > 0 ? (
|
{sidebarContent!}
|
||||||
<SideBarButtonsComponent items={items} pathname={pathname} />
|
|
||||||
) : (
|
|
||||||
!loadingFolders &&
|
|
||||||
folders?.length > 0 &&
|
|
||||||
isFolderPath && (
|
|
||||||
<SideBarFoldersButtonsComponent
|
|
||||||
pathname={pathname}
|
|
||||||
handleChangeFolder={handleChangeFolder}
|
|
||||||
handleDeleteFolder={handleDeleteFolder}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</HorizontalScrollFadeComponent>
|
</HorizontalScrollFadeComponent>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue