Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): add collapsible interaction to sidebar #3406

Merged
merged 10 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ export default function Activity() {
return (
<>
<div className="flex w-full flex-col">
<div className="flex flex-col sm:gap-4 sm:py-4">
<div className="flex flex-col sm:gap-4">
<main className="grid flex-1 items-start gap-4 py-4 sm:py-0">
<div className="flex flex-col gap-y-2 xl:flex-row xl:items-center xl:justify-between">
<div className="flex min-h-[theme(space.9)] flex-col gap-y-2 xl:flex-row xl:items-center xl:justify-between">
<p className="text-sm text-muted-foreground">{`View raw events generated by team members' activities while interacting with Tabby.`}</p>

{members.length > 0 && (
Expand Down
23 changes: 16 additions & 7 deletions ee/tabby-ui/app/(dashboard)/components/main-content.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use client'

import { useEffect, useRef } from 'react'
import { usePathname } from 'next/navigation'

import { ScrollArea } from '@/components/ui/scroll-area'
import { SidebarInset } from '@/components/ui/sidebar'
import { BANNER_HEIGHT, useShowDemoBanner } from '@/components/demo-banner'
import { Header } from '@/components/header'
import { useShowLicenseBanner } from '@/components/license-banner'
Expand All @@ -10,6 +14,8 @@ export default function MainContent({
}: {
children: React.ReactNode
}) {
const pathname = usePathname()
const scroller = useRef<HTMLDivElement>(null)
const [isShowDemoBanner] = useShowDemoBanner()
const [isShowLicenseBanner] = useShowLicenseBanner()
const style =
Expand All @@ -21,16 +27,19 @@ export default function MainContent({
}
: { height: '100vh' }

useEffect(() => {
if (pathname && scroller.current) {
scroller.current.scrollTop = 0
}
}, [pathname])

return (
<>
<SidebarInset>
{/* Wraps right hand side into ScrollArea, making scroll bar consistent across all browsers */}
<ScrollArea
className={'flex flex-1 flex-col transition-all'}
style={style}
>
<ScrollArea ref={scroller} style={style}>
<Header />
<div className="flex-1 p-4 lg:p-10">{children}</div>
<div className="p-4 lg:p-10">{children}</div>
</ScrollArea>
</>
</SidebarInset>
)
}
Loading