-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The sidebar now uses the ShadCN component. This reduces code complexity by a lot. Throughout the applications the various components for this are used and overall styling has changed quite a bit. As such, the old sidebar components are no longer needed and are deleted. Signed-off-by: tylerslaton <[email protected]>
- Loading branch information
1 parent
9e05bbe
commit 86f375e
Showing
17 changed files
with
972 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,97 @@ | ||
import React from "react"; | ||
import { Link } from "@remix-run/react"; | ||
import { BotIcon, MessageSquare, User } from "lucide-react"; | ||
import { $path } from "remix-routes"; | ||
|
||
import { cn } from "~/lib/utils"; | ||
|
||
import { SidebarFull } from "~/components/sidebar/SidebarFull"; | ||
import { | ||
Sidebar, | ||
SidebarContent, | ||
SidebarFooter, | ||
SidebarGroup, | ||
SidebarGroupContent, | ||
SidebarHeader, | ||
SidebarMenu, | ||
SidebarMenuButton, | ||
SidebarMenuItem, | ||
SidebarRail, | ||
useSidebar, | ||
} from "~/components/ui/sidebar"; | ||
|
||
import { useLayout } from "../layout/LayoutProvider"; | ||
import { SidebarCollapsed } from "./SidebarCollapsed"; | ||
import { OttoLogo } from "../branding/OttoLogo"; | ||
import { UserMenu } from "../user/UserMenu"; | ||
|
||
type SidebarProps = React.HTMLAttributes<HTMLDivElement>; | ||
|
||
export function Sidebar({ className, ...props }: SidebarProps) { | ||
const { isExpanded, sidebarWidth } = useLayout(); | ||
// Menu items. | ||
const items = [ | ||
{ | ||
title: "Agents", | ||
url: $path("/agents"), | ||
icon: BotIcon, | ||
}, | ||
{ | ||
title: "Threads", | ||
url: $path("/threads"), | ||
icon: MessageSquare, | ||
}, | ||
{ | ||
title: "Users", | ||
url: $path("/users"), | ||
icon: User, | ||
}, | ||
]; | ||
|
||
export function AppSidebar() { | ||
const { state } = useSidebar(); | ||
return ( | ||
<div | ||
className={cn("h-full overflow-hidden", sidebarWidth, className)} | ||
{...props} | ||
> | ||
<div className="relative h-full"> | ||
<div | ||
className={cn( | ||
"absolute inset-y-0 left-0 w-64 transition-transform duration-300 ease-in-out", | ||
isExpanded | ||
? "translate-x-0 z-20" | ||
: "-translate-x-48 z-10" | ||
)} | ||
> | ||
<div className="h-full border-r"> | ||
<SidebarFull /> | ||
</div> | ||
</div> | ||
|
||
<Sidebar className="" collapsible="icon"> | ||
<SidebarRail /> | ||
<SidebarHeader | ||
className={cn("pt-4", state === "collapsed" ? "" : "px-4")} | ||
> | ||
<div | ||
className={cn( | ||
"absolute inset-y-0 left-0 w-16 transition-opacity duration-300 ease-in-out", | ||
isExpanded | ||
? "opacity-0 pointer-events-none" | ||
: "opacity-100 z-20" | ||
"flex justify-start", | ||
state === "collapsed" ? "pl-1" : "pl-3" | ||
)} | ||
> | ||
<div className="h-full flex flex-col items-center border-r"> | ||
<SidebarCollapsed /> | ||
</div> | ||
<OttoLogo | ||
classNames={{ | ||
image: | ||
state === "collapsed" ? "w-6 h-6" : "w-8 h-8", | ||
root: "text-foreground", | ||
}} | ||
hideText={state === "collapsed"} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</SidebarHeader> | ||
<SidebarContent className={cn(state === "collapsed" ? "" : "px-4")}> | ||
<SidebarGroup> | ||
<SidebarGroupContent> | ||
<SidebarMenu> | ||
{items.map((item) => ( | ||
<SidebarMenuItem key={item.title}> | ||
<SidebarMenuButton asChild> | ||
<Link to={item.url}> | ||
<item.icon /> | ||
<span>{item.title}</span> | ||
</Link> | ||
</SidebarMenuButton> | ||
</SidebarMenuItem> | ||
))} | ||
</SidebarMenu> | ||
</SidebarGroupContent> | ||
</SidebarGroup> | ||
</SidebarContent> | ||
<SidebarFooter | ||
className={cn("pb-4", state === "collapsed" ? "" : "")} | ||
> | ||
<UserMenu | ||
className={cn({ | ||
"p-2 rounded-lg border border-muted-foreground/20": | ||
state === "expanded", | ||
})} | ||
/> | ||
</SidebarFooter> | ||
</Sidebar> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { Sidebar } from "~/components/sidebar/Sidebar"; | ||
export { AppSidebar as Sidebar } from "~/components/sidebar/Sidebar"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.