Skip to content

Commit c98eb2c

Browse files
UI chat fix horizontal overflow (#726)
* feat(chat): improve UX with auto-scroll, scroll-to-bottom button, and responsive header * Fix horizontal overflow in chat messages with long links * chore: resolve merge conflicts with upstream main
1 parent 8764989 commit c98eb2c

File tree

2 files changed

+266
-79
lines changed

2 files changed

+266
-79
lines changed

application/frontend/src/pages/chatbot/chatbot.scss

Lines changed: 159 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
.chat-container {
66
margin: 3rem auto;
7+
margin-top: 1.5rem;
78
max-width: 960px;
89
display: flex;
910
flex-direction: column;
11+
position: relative;
1012
}
1113
.chat-container.chat-active {
1214
height: calc(100vh - 179px);
@@ -50,14 +52,35 @@
5052
Header
5153
========================= */
5254

53-
h1.ui.header {
54-
margin-bottom: 1rem !important;
55+
/* =========================
56+
Chatbot title
57+
========================= */
58+
59+
h1.ui.header.chatbot-title {
60+
font-weight: 600;
61+
line-height: 1.25;
62+
63+
/* Fluid scaling */
64+
font-size: clamp(1.4rem, 3vw, 2.2rem);
65+
66+
/* Desktop spacing */
5567
margin-top: 2rem;
68+
margin-bottom: 1rem !important;
5669
}
5770

71+
/* Tablet & below */
5872
@media (max-width: 768px) {
59-
h1.ui.header {
60-
margin-top: 1.5rem;
73+
h1.ui.header.chatbot-title {
74+
margin-top: 2.75rem;
75+
margin-bottom: 0.75rem !important;
76+
font-size: clamp(1.35rem, 4vw, 1.8rem);
77+
}
78+
}
79+
80+
/* Very small phones */
81+
@media (max-width: 360px) {
82+
h1.ui.header.chatbot-title {
83+
margin-top: 3rem; /* extra breathing room */
6184
}
6285
}
6386

@@ -155,6 +178,11 @@ h1.ui.header {
155178
font-size: 0.95rem;
156179
text-align: left;
157180

181+
/* NEW: prevent horizontal overflow */
182+
word-wrap: break-word;
183+
overflow-wrap: anywhere;
184+
max-width: 100%;
185+
158186
p {
159187
margin: 0.5rem 0;
160188
}
@@ -163,11 +191,26 @@ h1.ui.header {
163191
padding-left: 1.25rem;
164192
}
165193

194+
/* NEW: inline + block code safety */
166195
code {
167196
background: #f4f4f4;
168197
padding: 0.2rem 0.4rem;
169198
border-radius: 4px;
170199
font-size: 0.85rem;
200+
201+
white-space: pre-wrap;
202+
word-break: break-word;
203+
}
204+
205+
/* NEW: prevent long URLs from breaking layout */
206+
a {
207+
word-break: break-all;
208+
}
209+
210+
/* NEW: keep code blocks from overflowing */
211+
pre {
212+
max-width: 100%;
213+
overflow-x: auto;
171214
}
172215
}
173216

@@ -222,14 +265,18 @@ h1.ui.header {
222265
bottom: 0;
223266
z-index: 5;
224267

225-
margin-top: 1.5rem;
226-
background-color: #d3ead4;
227-
padding: 1rem;
268+
margin-top: 1rem;
269+
background-color: #daebdb;
270+
// background: transparent;
271+
border: 1px solid rgb(190, 214, 232);
272+
padding: 0.75rem;
228273
border-radius: 12px;
229274
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
230275
}
231276

232277
.chat-input .ui.input input {
278+
height: 40px;
279+
line-height: 40px;
233280
border-radius: 10px !important;
234281
}
235282

@@ -275,6 +322,104 @@ h1.ui.header {
275322
animation-delay: 0.4s;
276323
}
277324

325+
/* =========================
326+
Page layout overrides
327+
========================= */
328+
329+
.chatbot-layout {
330+
min-height: 100vh;
331+
}
332+
333+
@media (max-width: 768px) {
334+
.chatbot-layout {
335+
min-height: auto;
336+
padding-top: 2rem;
337+
}
338+
}
339+
340+
@media (max-width: 768px) {
341+
.chatbot-layout.ui.grid {
342+
align-items: flex-start !important;
343+
}
344+
}
345+
346+
/* =========================
347+
Scroll to bottom button
348+
========================= */
349+
350+
.scroll-to-bottom {
351+
position: absolute;
352+
bottom: 160px;
353+
left: 50%;
354+
transform: translateX(-50%);
355+
z-index: 10;
356+
width: 34px;
357+
height: 34px;
358+
border-radius: 50%;
359+
border: none;
360+
background: rgb(47, 128, 189);
361+
color: #c5f0c9;
362+
cursor: pointer;
363+
display: flex;
364+
align-items: center;
365+
justify-content: center;
366+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
367+
border: #1976d2;
368+
opacity: 1;
369+
backdrop-filter: none;
370+
transition: transform 0.2s ease;
371+
animation: fadeIn 0.15s ease-out;
372+
}
373+
374+
.scroll-to-bottom:hover {
375+
opacity: 1;
376+
transform: translateX(-50%) translateY(-2px);
377+
}
378+
.scroll-icon {
379+
margin: 0 !important;
380+
display: flex !important;
381+
align-items: center;
382+
justify-content: center;
383+
}
384+
385+
@media (max-width: 768px) {
386+
.scroll-to-bottom {
387+
bottom: 160px;
388+
}
389+
}
390+
.chat-surface {
391+
display: flex;
392+
flex-direction: column;
393+
height: 100%;
394+
395+
background: #fcfcfa; // same palette as input
396+
backdrop-filter: blur(6px);
397+
398+
border-radius: 18px;
399+
border: 1px solid rgba(0, 0, 0, 0.05);
400+
401+
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.4);
402+
403+
padding: 1.25rem;
404+
}
405+
.chat-landing-state {
406+
text-align: center;
407+
margin: auto;
408+
padding: 3rem 1rem;
409+
410+
h2 {
411+
font-size: 1.6rem;
412+
font-weight: 600;
413+
margin-bottom: 0.5rem;
414+
}
415+
416+
p {
417+
font-size: 0.95rem;
418+
color: #555;
419+
max-width: 480px;
420+
margin: 0 auto;
421+
}
422+
}
278423
/* =========================
279424
Animations
280425
========================= */
@@ -302,24 +447,13 @@ h1.ui.header {
302447
transform: translateY(0);
303448
}
304449
}
305-
306-
/* =========================
307-
Page layout overrides
308-
========================= */
309-
310-
.chatbot-layout {
311-
min-height: 100vh;
312-
}
313-
314-
@media (max-width: 768px) {
315-
.chatbot-layout {
316-
min-height: auto;
317-
padding-top: 2rem;
450+
@keyframes fadeIn {
451+
from {
452+
opacity: 0;
453+
transform: translateX(-50%) translateY(6px);
318454
}
319-
}
320-
321-
@media (max-width: 768px) {
322-
.chatbot-layout.ui.grid {
323-
align-items: flex-start !important;
455+
to {
456+
opacity: 0.85;
457+
transform: translateX(-50%) translateY(0);
324458
}
325459
}

0 commit comments

Comments
 (0)