@@ -32,6 +32,8 @@ import { SidecarCopilot } from "../../components/sidecarCopilot/sidecar";
3232import homeStyles from "./home.module.scss" ;
3333import { ChatRoom } from "../../components/chat/chatRoom" ;
3434import UploadFilesButton from "../../components/uploadButton/uploadButton" ;
35+ import { PanelResizer } from "../../components/resizer/panelResizer" ;
36+ import { ChevronLeft24Regular , ChevronRight24Regular } from "@fluentui/react-icons" ;
3537
3638const useStyles = makeStyles ( {
3739 dropdown : {
@@ -64,6 +66,9 @@ export function Home({ isSearchResultsPage }: HomeProps) {
6466 const [ isLoading , setIsLoading ] = useState < boolean > ( false ) ;
6567 const [ searchParams , setSearchParams ] = useSearchParams ( ) ;
6668 const [ areFiltersVisible , setAreFiltersVisible ] = useState ( true ) ;
69+ const [ isFilterPanelCollapsed , setIsFilterPanelCollapsed ] = useState ( false ) ;
70+ const [ documentsWidth , setDocumentsWidth ] = useState ( 34 ) ; // Initial width percentage
71+ const [ chatWidth , setChatWidth ] = useState ( 51 ) ; // Initial width percentage
6772 const [ showCopilot , setShowCopilot ] = useState < boolean > ( false ) ;
6873 const [ incomingFilter , setIncomingFilter ] = useState (
6974 "(document/embedded eq false and document/translated eq false)"
@@ -236,6 +241,15 @@ export function Home({ isSearchResultsPage }: HomeProps) {
236241 setAreFiltersVisible ( ( prevAreFiltersVisible ) => ! prevAreFiltersVisible ) ;
237242 }
238243
244+ function toggleFilterPanel ( ) : void {
245+ setIsFilterPanelCollapsed ( ! isFilterPanelCollapsed ) ;
246+ }
247+
248+ const handlePanelResize = ( leftWidth : number , rightWidth : number ) => {
249+ setDocumentsWidth ( leftWidth ) ;
250+ setChatWidth ( rightWidth ) ;
251+ } ;
252+
239253 const handleSortSelected = ( sort : string ) => {
240254 setInOrderBy ( sort ) ;
241255 } ;
@@ -526,25 +540,50 @@ export function Home({ isSearchResultsPage }: HomeProps) {
526540
527541< main className = "w-full h-full flex flex-col" >
528542 < div className = "flex flex-col md:flex-row flex-grow" >
529- { /* Left Section: Filter */ }
530- < div className = { `flex flex-col w-full bg-white shadow-md p-4 ${ homeStyles [ "no-bottom-padding" ] } ${ homeStyles [ "filters-panel" ] } ` } >
531- { /* Keep the FilterButton at the top */ }
532- < div className = "mb-4" >
533- < FilterButton onFilterPress = { onFilterPress } />
543+ { /* Left Section: Filter Panel with Toggle */ }
544+ { ! isFilterPanelCollapsed && (
545+ < div className = { `flex flex-col w-full bg-white shadow-md p-4 ${ homeStyles [ "no-bottom-padding" ] } ${ homeStyles [ "filters-panel" ] } transition-all duration-300` } >
546+ { /* Filter Header with Toggle Button */ }
547+ < div className = "mb-4 flex items-center justify-between" >
548+ < FilterButton onFilterPress = { onFilterPress } />
549+ < Button
550+ appearance = "subtle"
551+ icon = { < ChevronLeft24Regular /> }
552+ onClick = { toggleFilterPanel }
553+ title = "Collapse filters"
554+ size = "small"
555+ />
556+ </ div >
557+ { areFiltersVisible && (
558+ < Filter
559+ onFilterChanged = { onFilterChanged }
560+ prevSelectedFilters = { persistedFilters }
561+ keywordFilterInfo = { data ?. keywordFilterInfo }
562+ clearFilters = { clearFilters }
563+ onFilterCleared = { handleFilterCleared }
564+ />
565+ ) }
534566 </ div >
535- { areFiltersVisible && (
536- < Filter
537- onFilterChanged = { onFilterChanged }
538- prevSelectedFilters = { persistedFilters }
539- keywordFilterInfo = { data ?. keywordFilterInfo }
540- clearFilters = { clearFilters }
541- onFilterCleared = { handleFilterCleared }
542- />
543- ) }
544- </ div >
567+ ) }
545568
546- { /* Right Section: Search Box and Fluent v2 Dropdown */ }
547- < div className = { `flex flex-col w-full bg-white shadow-md p-4 ${ homeStyles [ "no-bottom-padding" ] } ${ homeStyles [ "documents-panel" ] } ` } >
569+ { /* Collapsed Filter Toggle Button */ }
570+ { isFilterPanelCollapsed && (
571+ < div className = "flex flex-col bg-white shadow-md p-2 min-w-[50px] items-center" >
572+ < Button
573+ appearance = "subtle"
574+ icon = { < ChevronRight24Regular /> }
575+ onClick = { toggleFilterPanel }
576+ title = "Expand filters"
577+ size = "small"
578+ />
579+ </ div >
580+ ) }
581+
582+ { /* Documents Section */ }
583+ < div
584+ className = { `flex flex-col bg-white shadow-md p-4 ${ homeStyles [ "no-bottom-padding" ] } transition-all duration-300` }
585+ style = { { width : `${ documentsWidth } %` , minWidth : '300px' } }
586+ >
548587 < div className = "flex flex-row items-center space-x-2" > { /* Adjusted space between elements */ }
549588 { /* Search Box */ }
550589 < SearchBox
@@ -648,8 +687,19 @@ export function Home({ isSearchResultsPage }: HomeProps) {
648687 </ div >
649688 </ div >
650689
690+ { /* Panel Resizer */ }
691+ < PanelResizer
692+ onResize = { handlePanelResize }
693+ initialLeftWidth = { documentsWidth }
694+ minLeftWidth = { 300 }
695+ minRightWidth = { 300 }
696+ />
697+
651698 { /* Chat Room Section */ }
652- < div className = { `flex flex-col w-full bg-white shadow-md ${ homeStyles [ "chat-panel" ] } ` } >
699+ < div
700+ className = { `flex flex-col bg-white shadow-md ${ homeStyles [ "chat-panel" ] } transition-all duration-300` }
701+ style = { { width : `${ chatWidth } %` , minWidth : '300px' } }
702+ >
653703 < div className = "flex flex-col h-full" >
654704 < div className = { `flex-grow overflow-y-auto ${ homeStyles [ "no-bottom-padding" ] } ` } style = { { backgroundColor : '#f7f7f7' , overflowX : 'hidden' , overflowY : 'auto' , display : 'flex' , maxBlockSize : 'calc(100vh - 60px)' } } >
655705 < ChatRoom
0 commit comments