Spaces:
Sleeping
Sleeping
Girish Jeswani commited on
Commit ·
a4ac46b
1
Parent(s): 88f0a64
fix scrolling and dynamic tiling issues
Browse files
phd-advisor-frontend/src/pages/ChatPage.js
CHANGED
|
@@ -560,6 +560,12 @@ const handleNewChat = async (sessionId = null) => {
|
|
| 560 |
setReplyingTo(null);
|
| 561 |
};
|
| 562 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 563 |
const hasMessages = messages.length > 0;
|
| 564 |
const hasConversationMessages = messages.filter(m => m.type !== 'system' && m.type !== 'document_upload').length > 0;
|
| 565 |
|
|
@@ -573,9 +579,10 @@ const handleNewChat = async (sessionId = null) => {
|
|
| 573 |
onNewChat={handleNewChat}
|
| 574 |
onSignOut={onSignOut}
|
| 575 |
authToken={authToken}
|
|
|
|
| 576 |
/>
|
| 577 |
|
| 578 |
-
<div className=
|
| 579 |
<div className="modern-chat-page">
|
| 580 |
{/* Floating Header */}
|
| 581 |
<div className="floating-header">
|
|
@@ -661,7 +668,9 @@ const handleNewChat = async (sessionId = null) => {
|
|
| 661 |
{/* Main Content */}
|
| 662 |
<div className="chat-content">
|
| 663 |
{!hasMessages ? (
|
| 664 |
-
<
|
|
|
|
|
|
|
| 665 |
) : (
|
| 666 |
<div className="messages-container">
|
| 667 |
{/* Add loading session indicator */}
|
|
|
|
| 560 |
setReplyingTo(null);
|
| 561 |
};
|
| 562 |
|
| 563 |
+
const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(false);
|
| 564 |
+
|
| 565 |
+
const handleSidebarToggle = (isCollapsed) => {
|
| 566 |
+
setIsSidebarCollapsed(isCollapsed);
|
| 567 |
+
};
|
| 568 |
+
|
| 569 |
const hasMessages = messages.length > 0;
|
| 570 |
const hasConversationMessages = messages.filter(m => m.type !== 'system' && m.type !== 'document_upload').length > 0;
|
| 571 |
|
|
|
|
| 579 |
onNewChat={handleNewChat}
|
| 580 |
onSignOut={onSignOut}
|
| 581 |
authToken={authToken}
|
| 582 |
+
onSidebarToggle={handleSidebarToggle}
|
| 583 |
/>
|
| 584 |
|
| 585 |
+
<div className={`main-chat-area ${isSidebarCollapsed ? 'sidebar-collapsed' : ''}`}>
|
| 586 |
<div className="modern-chat-page">
|
| 587 |
{/* Floating Header */}
|
| 588 |
<div className="floating-header">
|
|
|
|
| 668 |
{/* Main Content */}
|
| 669 |
<div className="chat-content">
|
| 670 |
{!hasMessages ? (
|
| 671 |
+
<div className="welcome-state">
|
| 672 |
+
<SuggestionsPanel onSuggestionClick={handleSendMessage} />
|
| 673 |
+
</div>
|
| 674 |
) : (
|
| 675 |
<div className="messages-container">
|
| 676 |
{/* Add loading session indicator */}
|
phd-advisor-frontend/src/styles/ChatPage.css
CHANGED
|
@@ -1,12 +1,9 @@
|
|
| 1 |
-
|
| 2 |
/* Modern Chat Page Layout */
|
| 3 |
.modern-chat-page {
|
| 4 |
-
height:
|
| 5 |
-
background: var(--bg-gradient);
|
| 6 |
display: flex;
|
| 7 |
flex-direction: column;
|
| 8 |
-
|
| 9 |
-
overflow: hidden; /* Prevent body overflow */
|
| 10 |
}
|
| 11 |
|
| 12 |
[data-theme="dark"] .modern-chat-page {
|
|
@@ -159,11 +156,12 @@
|
|
| 159 |
display: flex;
|
| 160 |
flex-direction: column;
|
| 161 |
padding-top: 24px;
|
| 162 |
-
padding-bottom: 140px;
|
| 163 |
padding-left: 16px;
|
| 164 |
padding-right: 16px;
|
| 165 |
-
overflow:
|
| 166 |
-
min-height: 0;
|
|
|
|
| 167 |
}
|
| 168 |
|
| 169 |
.export-dropdown {
|
|
@@ -174,14 +172,20 @@
|
|
| 174 |
.welcome-state {
|
| 175 |
flex: 1;
|
| 176 |
display: flex;
|
| 177 |
-
|
| 178 |
-
justify-content:
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
}
|
| 181 |
|
| 182 |
.suggestions-container {
|
| 183 |
width: 100%;
|
| 184 |
max-width: 1200px;
|
|
|
|
|
|
|
| 185 |
}
|
| 186 |
|
| 187 |
/* Chat State */
|
|
@@ -191,6 +195,17 @@
|
|
| 191 |
flex-direction: column;
|
| 192 |
overflow: hidden;
|
| 193 |
min-height: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
}
|
| 195 |
|
| 196 |
.messages-area {
|
|
@@ -200,14 +215,15 @@
|
|
| 200 |
}
|
| 201 |
|
| 202 |
.messages-scroll {
|
| 203 |
-
height: 100%;
|
| 204 |
overflow-y: auto;
|
| 205 |
overflow-x: hidden;
|
| 206 |
padding: 20px;
|
| 207 |
padding-bottom: 40px;
|
| 208 |
-
/* Ensure smooth scrolling with proper background */
|
| 209 |
background: var(--bg-gradient);
|
| 210 |
scroll-behavior: smooth;
|
|
|
|
|
|
|
| 211 |
}
|
| 212 |
|
| 213 |
.messages-container {
|
|
@@ -215,16 +231,19 @@
|
|
| 215 |
display: flex;
|
| 216 |
flex-direction: column;
|
| 217 |
overflow: hidden;
|
| 218 |
-
min-height: 0;
|
| 219 |
-
|
|
|
|
| 220 |
}
|
| 221 |
|
| 222 |
.messages-list {
|
| 223 |
flex: 1;
|
| 224 |
overflow: hidden;
|
| 225 |
-
min-height: 0;
|
|
|
|
| 226 |
}
|
| 227 |
|
|
|
|
| 228 |
[data-theme="dark"] .messages-scroll,
|
| 229 |
[data-theme="dark"] .messages-container,
|
| 230 |
[data-theme="dark"] .main-content {
|
|
@@ -521,6 +540,7 @@
|
|
| 521 |
color: var(--text-secondary);
|
| 522 |
}
|
| 523 |
|
|
|
|
| 524 |
.chat-page-with-sidebar {
|
| 525 |
display: flex;
|
| 526 |
height: 100vh;
|
|
@@ -530,7 +550,7 @@
|
|
| 530 |
|
| 531 |
.main-chat-area {
|
| 532 |
flex: 1;
|
| 533 |
-
margin-left: 300px; /* Width of sidebar */
|
| 534 |
display: flex;
|
| 535 |
flex-direction: column;
|
| 536 |
height: 100vh;
|
|
@@ -538,6 +558,11 @@
|
|
| 538 |
overflow: hidden;
|
| 539 |
}
|
| 540 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 541 |
/* Session title display in header */
|
| 542 |
.session-title-display {
|
| 543 |
display: flex;
|
|
@@ -904,4 +929,8 @@
|
|
| 904 |
.main-chat-area {
|
| 905 |
margin-left: 0;
|
| 906 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 907 |
}
|
|
|
|
|
|
|
| 1 |
/* Modern Chat Page Layout */
|
| 2 |
.modern-chat-page {
|
| 3 |
+
height: 100vh;
|
|
|
|
| 4 |
display: flex;
|
| 5 |
flex-direction: column;
|
| 6 |
+
overflow: hidden;
|
|
|
|
| 7 |
}
|
| 8 |
|
| 9 |
[data-theme="dark"] .modern-chat-page {
|
|
|
|
| 156 |
display: flex;
|
| 157 |
flex-direction: column;
|
| 158 |
padding-top: 24px;
|
| 159 |
+
padding-bottom: 140px;
|
| 160 |
padding-left: 16px;
|
| 161 |
padding-right: 16px;
|
| 162 |
+
overflow: visible;
|
| 163 |
+
min-height: 0;
|
| 164 |
+
height: 100vh;
|
| 165 |
}
|
| 166 |
|
| 167 |
.export-dropdown {
|
|
|
|
| 172 |
.welcome-state {
|
| 173 |
flex: 1;
|
| 174 |
display: flex;
|
| 175 |
+
flex-direction: column;
|
| 176 |
+
justify-content: flex-start;
|
| 177 |
+
padding-top: 40px;
|
| 178 |
+
overflow-y: auto;
|
| 179 |
+
overflow-x: hidden;
|
| 180 |
+
scroll-behavior: smooth;
|
| 181 |
+
-webkit-overflow-scrolling: touch;
|
| 182 |
}
|
| 183 |
|
| 184 |
.suggestions-container {
|
| 185 |
width: 100%;
|
| 186 |
max-width: 1200px;
|
| 187 |
+
margin: 0 auto;
|
| 188 |
+
flex-shrink: 0;
|
| 189 |
}
|
| 190 |
|
| 191 |
/* Chat State */
|
|
|
|
| 195 |
flex-direction: column;
|
| 196 |
overflow: hidden;
|
| 197 |
min-height: 0;
|
| 198 |
+
height: 100%;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
.chat-content {
|
| 202 |
+
flex: 1;
|
| 203 |
+
display: flex;
|
| 204 |
+
flex-direction: column;
|
| 205 |
+
overflow: hidden;
|
| 206 |
+
min-height: 0;
|
| 207 |
+
/* Add bottom padding to prevent content being hidden behind floating input */
|
| 208 |
+
padding-bottom: 140px;
|
| 209 |
}
|
| 210 |
|
| 211 |
.messages-area {
|
|
|
|
| 215 |
}
|
| 216 |
|
| 217 |
.messages-scroll {
|
| 218 |
+
height: 100%;
|
| 219 |
overflow-y: auto;
|
| 220 |
overflow-x: hidden;
|
| 221 |
padding: 20px;
|
| 222 |
padding-bottom: 40px;
|
|
|
|
| 223 |
background: var(--bg-gradient);
|
| 224 |
scroll-behavior: smooth;
|
| 225 |
+
-webkit-overflow-scrolling: touch;
|
| 226 |
+
scrollbar-width: thin;
|
| 227 |
}
|
| 228 |
|
| 229 |
.messages-container {
|
|
|
|
| 231 |
display: flex;
|
| 232 |
flex-direction: column;
|
| 233 |
overflow: hidden;
|
| 234 |
+
min-height: 0;
|
| 235 |
+
height: 100%;
|
| 236 |
+
background: var(--bg-gradient);
|
| 237 |
}
|
| 238 |
|
| 239 |
.messages-list {
|
| 240 |
flex: 1;
|
| 241 |
overflow: hidden;
|
| 242 |
+
min-height: 0;
|
| 243 |
+
height: 100%;
|
| 244 |
}
|
| 245 |
|
| 246 |
+
|
| 247 |
[data-theme="dark"] .messages-scroll,
|
| 248 |
[data-theme="dark"] .messages-container,
|
| 249 |
[data-theme="dark"] .main-content {
|
|
|
|
| 540 |
color: var(--text-secondary);
|
| 541 |
}
|
| 542 |
|
| 543 |
+
/* MAIN LAYOUT WITH SIDEBAR - FIXED */
|
| 544 |
.chat-page-with-sidebar {
|
| 545 |
display: flex;
|
| 546 |
height: 100vh;
|
|
|
|
| 550 |
|
| 551 |
.main-chat-area {
|
| 552 |
flex: 1;
|
| 553 |
+
margin-left: 300px; /* Width of sidebar when expanded */
|
| 554 |
display: flex;
|
| 555 |
flex-direction: column;
|
| 556 |
height: 100vh;
|
|
|
|
| 558 |
overflow: hidden;
|
| 559 |
}
|
| 560 |
|
| 561 |
+
/* FIXED: Chat area expansion when sidebar is collapsed */
|
| 562 |
+
.main-chat-area.sidebar-collapsed {
|
| 563 |
+
margin-left: 70px; /* Width of sidebar when collapsed */
|
| 564 |
+
}
|
| 565 |
+
|
| 566 |
/* Session title display in header */
|
| 567 |
.session-title-display {
|
| 568 |
display: flex;
|
|
|
|
| 929 |
.main-chat-area {
|
| 930 |
margin-left: 0;
|
| 931 |
}
|
| 932 |
+
|
| 933 |
+
.main-chat-area.sidebar-collapsed {
|
| 934 |
+
margin-left: 0;
|
| 935 |
+
}
|
| 936 |
}
|