1- import * as React from "react"
21import { Label } from "@components/ui/label"
32import {
43 SidebarContent ,
@@ -14,9 +13,10 @@ import { ChannelListItem } from "@raven/types/common/ChannelListItem"
1413import { useActiveWorkspace } from "../contexts/ActiveWorkspaceContext"
1514import { SidebarShell } from "@components/layout/SidebarShell"
1615import _ from "@lib/translate"
16+ import { useState } from "react"
1717
1818export function AppSidebar ( props : React . ComponentProps < typeof SidebarShell > ) {
19- const [ activeChannel , setActiveChannel ] = React . useState < { id : string ; name : string ; type : string ; unread : number } | null > ( null )
19+ const [ activeChannel , setActiveChannel ] = useState < { id : string ; name : string ; type : string ; unread : number } | null > ( null )
2020 const navigate = useNavigate ( )
2121 const location = useLocation ( )
2222 const { activeWorkspaceName } = useActiveWorkspace ( )
@@ -43,40 +43,40 @@ export function AppSidebar(props: React.ComponentProps<typeof SidebarShell>) {
4343 return (
4444 < SidebarShell collapsible = "icon" className = "overflow-hidden h-full" { ...props } >
4545 < div className = "flex-1 flex flex-col overflow-hidden" >
46- { location . pathname === "/threads" || location . pathname === "/notifications" ? null : location . pathname . startsWith ( "/dm-channel" ) || activeWorkspaceName === "Direct Messages" ? (
47- < DMSidebar
48- workspaceName = "Direct Messages"
49- activeDMChannelId = { null }
50- onDMClick = { ( dmChannelId ) =>
51- navigate ( `/dm-channel/${ encodeURIComponent ( dmChannelId ) } ` )
52- }
53- />
54- ) : (
55- < >
56- < SidebarHeader className = "h-[36px] gap-2 px-3 border-b flex items-center" >
57- < div className = "flex items-center justify-between w-full" >
58- < div className = "text-sm font-medium text-foreground truncate" >
59- { activeWorkspaceName }
46+ { location . pathname === "/threads" || location . pathname === "/notifications" ? null : location . pathname . startsWith ( "/dm-channel" ) || activeWorkspaceName === "Direct Messages" ? (
47+ < DMSidebar
48+ workspaceName = "Direct Messages"
49+ activeDMChannelId = { null }
50+ onDMClick = { ( dmChannelId ) =>
51+ navigate ( `/dm-channel/${ encodeURIComponent ( dmChannelId ) } ` )
52+ }
53+ />
54+ ) : (
55+ < >
56+ < SidebarHeader className = "h-[36px] gap-2 px-3 border-b flex items-center" >
57+ < div className = "flex items-center justify-between w-full" >
58+ < div className = "text-sm font-medium text-foreground truncate" >
59+ { activeWorkspaceName }
60+ </ div >
61+ < Label className = "flex items-center gap-2 text-[12px]" >
62+ < span > { _ ( "Unreads" ) } </ span >
63+ < Switch className = "shadow-none" />
64+ </ Label >
6065 </ div >
61- < Label className = "flex items-center gap-2 text-[12px]" >
62- < span > { _ ( "Unreads" ) } </ span >
63- < Switch className = "shadow-none" />
64- </ Label >
65- </ div >
66- </ SidebarHeader >
66+ </ SidebarHeader >
6767
68- < SidebarContent >
69- < SidebarGroup className = "p-0" >
70- < SidebarGroupContent >
71- < ChannelSidebar
72- activeChannelId = { activeChannel ?. name }
73- onChannelClick = { handleChannelClick }
74- />
75- </ SidebarGroupContent >
76- </ SidebarGroup >
77- </ SidebarContent >
78- </ >
79- ) }
68+ < SidebarContent className = "overflow-hidden" >
69+ < SidebarGroup className = "p-0 flex-1 min-h -0" >
70+ < SidebarGroupContent className = "flex-1 min-h-0 flex flex-col" >
71+ < ChannelSidebar
72+ activeChannelId = { activeChannel ?. name }
73+ onChannelClick = { handleChannelClick }
74+ />
75+ </ SidebarGroupContent >
76+ </ SidebarGroup >
77+ </ SidebarContent >
78+ </ >
79+ ) }
8080 </ div >
8181 </ SidebarShell >
8282 )
0 commit comments