Skip to content

Commit a480c23

Browse files
Filter section Auto cehck changes and chat section white space cover All Ui Changes only
1 parent 3730ec5 commit a480c23

5 files changed

Lines changed: 114 additions & 13 deletions

File tree

App/frontend-app/src/components/chat/chatRoom.module.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@
3636
max-width: 100% !important;
3737
}
3838

39+
/* Debug: Force full width for ALL elements on chat page */
40+
:global([data-testid="chat-page"]) * {
41+
max-width: 100% !important;
42+
box-sizing: border-box !important;
43+
}
44+
45+
/* Debug: Override any grid or flex constraints */
46+
:global(div) {
47+
max-width: none !important;
48+
}
49+
50+
/* Debug: Force full viewport width */
51+
:global(body) {
52+
overflow-x: hidden !important;
53+
}
54+
3955
/* Ensure no white space in chat area */
4056
.no-white-space {
4157
margin: 0 !important;

App/frontend-app/src/components/filter/filter.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export function Filter({
6565
};
6666

6767
const [selectedKeywords, setSelectedKeywords] = useState<{ [key: string]: string[] }>(getInitialSelectedKeywords);
68+
const [openItems, setOpenItems] = useState<string[]>([]);
6869
const isInitialMount = useRef(true);
6970

7071
useEffect(() => {
@@ -84,11 +85,28 @@ export function Filter({
8485
useEffect(() => {
8586
if (clearFilters) {
8687
setSelectedKeywords({});
88+
setOpenItems([]); // Close all accordion items when clearing filters
8789
localStorage.removeItem(localStorageKey);
8890
onFilterCleared(); // Notify parent that filters have been cleared
8991
}
9092
}, [clearFilters, onFilterCleared]);
9193

94+
// Effect to automatically expand/collapse accordion items based on selections
95+
useEffect(() => {
96+
if (!keywordFilterInfo) return;
97+
98+
const categoriesWithSelections: string[] = [];
99+
100+
Object.entries(keywordFilterInfo).forEach(([category], index) => {
101+
// Check if this category has any selected keywords
102+
if (selectedKeywords[category] && selectedKeywords[category].length > 0) {
103+
categoriesWithSelections.push(index.toString());
104+
}
105+
});
106+
107+
setOpenItems(categoriesWithSelections);
108+
}, [selectedKeywords, keywordFilterInfo]);
109+
92110
const handleCheckboxChange = (checked: boolean, category: string, keyword: string) => {
93111
setSelectedKeywords((prevKeywords) => {
94112
const newKeywords = { ...prevKeywords };
@@ -113,10 +131,19 @@ export function Filter({
113131
});
114132
};
115133

134+
const handleAccordionToggle = (_event: any, data: { openItems: string[] }) => {
135+
setOpenItems(data.openItems);
136+
};
137+
116138
return (
117139
<div className={`${className || ""} flex flex-col`}>
118140
<div className={classes.accordionWrapper}>
119-
<Accordion multiple collapsible>
141+
<Accordion
142+
multiple
143+
collapsible
144+
openItems={openItems}
145+
onToggle={handleAccordionToggle}
146+
>
120147
{keywordFilterInfo && Object.entries(keywordFilterInfo).slice(0,10).map(([category, keywords], index) => (
121148
<AccordionItem key={index} value={index.toString()}>
122149
<AccordionHeader inline>{category}</AccordionHeader>

App/frontend-app/src/pages/chat/chatPage.tsx

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,35 @@ export function ChatPage() {
3131
};
3232

3333
return (
34-
<div className="flex w-full flex-1 flex-col bg-neutral-100" style={{ width: '100vw', maxWidth: '100vw', margin: 0, padding: 0 }}>
34+
<div
35+
data-testid="chat-page"
36+
className="flex w-full flex-1 flex-col bg-neutral-100"
37+
style={{
38+
width: '100vw',
39+
maxWidth: '100vw',
40+
margin: 0,
41+
padding: 0,
42+
backgroundColor: 'red', // Debug: should show red background
43+
border: '2px solid blue' // Debug: blue border to see container boundaries
44+
}}
45+
>
3546
<Header className="flex flex-col justify-between bg-contain bg-right-bottom bg-no-repeat" size="small">
3647
<div className="-ml-8">
3748
<HeaderBar location={NavLocation.Home} />
3849
</div>
3950
</Header>
40-
<main className="flex flex-1 flex-col w-full" style={{ width: '100%', maxWidth: '100%' }}>
41-
<div className="flex flex-1 flex-col w-full" style={{ width: '100%', maxWidth: '100%' }}>
51+
<main className="flex flex-1 flex-col w-full" style={{
52+
width: '100%',
53+
maxWidth: '100%',
54+
backgroundColor: 'yellow', // Debug: should show yellow background
55+
border: '2px solid green' // Debug: green border to see main boundaries
56+
}}>
57+
<div className="flex flex-1 flex-col w-full" style={{
58+
width: '100%',
59+
maxWidth: '100%',
60+
backgroundColor: 'lightblue', // Debug: should show light blue background
61+
border: '2px solid purple' // Debug: purple border to see inner div boundaries
62+
}}>
4263
<HeaderMenuTabs
4364
className=""
4465
searchResultDocuments={searchResultDocuments}
@@ -47,10 +68,17 @@ export function ChatPage() {
4768
updateSelectedDocuments={updateSelectedDocuments}
4869
/>
4970
<div className="absolute left-0 right-0 mt-11 w-full border-b border-b-neutral-300"></div>
50-
<ChatRoom
51-
searchResultDocuments={searchResultDocuments}
52-
selectedDocuments={selectedDocuments}
53-
chatWithDocument={chatWithSingleSelectedDocument ? chatWithSingleSelectedDocument : []} clearChatFlag={false} />
71+
<div style={{
72+
width: '100%',
73+
maxWidth: '100%',
74+
backgroundColor: 'orange', // Debug: should show orange background
75+
border: '2px solid red' // Debug: red border around ChatRoom
76+
}}>
77+
<ChatRoom
78+
searchResultDocuments={searchResultDocuments}
79+
selectedDocuments={selectedDocuments}
80+
chatWithDocument={chatWithSingleSelectedDocument ? chatWithSingleSelectedDocument : []} clearChatFlag={false} />
81+
</div>
5482
</div>
5583
</main>
5684
</div>

App/frontend-app/src/pages/home/home.module.scss

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,22 @@
3838
width: 15% !important;
3939
min-width: 229px;
4040
transition: width 0.3s ease-in-out;
41+
flex-shrink: 0; /* Prevent shrinking */
4142
}
4243

4344
.documents-panel {
4445
width: 34% !important;
45-
min-width: 410px;
46+
min-width: 300px; /* Reduced from 410px for better responsiveness */
4647
transition: width 0.3s ease-in-out;
48+
flex-grow: 1; /* Allow growing to fill space */
4749
}
4850

4951
.chat-panel {
50-
width: 51% !important;
52+
width: 51%;
5153
min-width: 300px;
5254
transition: width 0.3s ease-in-out;
5355
overflow: hidden; /* Prevent content from spilling out */
56+
flex-grow: 1; /* Allow growing to fill space */
5457
}
5558

5659
/* Full width override for chat page */
@@ -66,6 +69,7 @@
6669
width: 50px !important;
6770
min-width: 50px;
6871
transition: width 0.3s ease-in-out;
72+
flex-shrink: 0; /* Prevent shrinking */
6973
}
7074
}
7175

@@ -75,6 +79,7 @@
7579
flex-direction: row;
7680
flex-grow: 1;
7781
overflow: hidden;
82+
width: 100%; /* Ensure full width */
7883
}
7984

8085
.resizable-panel {
@@ -84,6 +89,15 @@
8489
overflow: hidden;
8590
}
8691

92+
/* Main container for panels to prevent white space */
93+
.panels-container {
94+
display: flex;
95+
flex-direction: row;
96+
width: 100%;
97+
height: 100%;
98+
overflow: hidden;
99+
}
100+
87101
/* Filter panel transitions */
88102
.filter-panel-enter {
89103
opacity: 0;

App/frontend-app/src/pages/home/home.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,23 @@ export function Home({ isSearchResultsPage }: HomeProps) {
242242
}
243243

244244
function toggleFilterPanel(): void {
245+
const wasCollapsed = isFilterPanelCollapsed;
245246
setIsFilterPanelCollapsed(!isFilterPanelCollapsed);
247+
248+
if (wasCollapsed) {
249+
// Expanding: Reduce documents and chat widths to make room for filter panel
250+
// Filter panel takes ~15%, so documents and chat should take ~85% total
251+
setDocumentsWidth(34); // 34% of total width
252+
setChatWidth(51); // 51% of total width
253+
} else {
254+
// Collapsing: Expand documents and chat to fill the space
255+
// Distribute the extra ~15% proportionally
256+
const currentTotal = documentsWidth + chatWidth;
257+
const expansionFactor = 100 / currentTotal; // Scale to fill 100%
258+
259+
setDocumentsWidth(Math.round(documentsWidth * expansionFactor));
260+
setChatWidth(Math.round(chatWidth * expansionFactor));
261+
}
246262
}
247263

248264
const handlePanelResize = (leftWidth: number, rightWidth: number) => {
@@ -539,10 +555,10 @@ export function Home({ isSearchResultsPage }: HomeProps) {
539555
</Header>
540556

541557
<main className="w-full h-full flex flex-col">
542-
<div className="flex flex-col md:flex-row flex-grow">
558+
<div className={`flex flex-col md:flex-row flex-grow ${homeStyles["panels-container"]}`}>
543559
{/* Left Section: Filter Panel with Toggle */}
544560
{!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`}>
561+
<div className={`flex flex-col bg-white shadow-md p-4 ${homeStyles["no-bottom-padding"]} ${homeStyles["filters-panel"]} transition-all duration-300`}>
546562
{/* Filter Header with Toggle Button */}
547563
<div className="mb-4 flex items-center justify-between">
548564
<FilterButton onFilterPress={onFilterPress} />
@@ -568,7 +584,7 @@ export function Home({ isSearchResultsPage }: HomeProps) {
568584

569585
{/* Collapsed Filter Toggle Button */}
570586
{isFilterPanelCollapsed && (
571-
<div className="flex flex-col bg-white shadow-md p-2 min-w-[50px] items-center">
587+
<div className={`flex flex-col bg-white shadow-md p-2 ${homeStyles["filters-panel-collapsed"]} items-center transition-all duration-300`}>
572588
<Button
573589
appearance="subtle"
574590
icon={<ChevronRight24Regular />}

0 commit comments

Comments
 (0)