From 29c3066e2342cc5ad88fe94f5148594a5b4f1862 Mon Sep 17 00:00:00 2001 From: prvncodz Date: Wed, 18 Nov 2026 13:47:01 +0530 Subject: [PATCH 1/2] feat(chatbot): redesign chat input into pill layout and refine UI spacing - Replace Semantic UI Form.Input and button with a modern rounded pill input container and icon send button - Add auto-expanding multi-line textarea support with Enter to send and Shift+Enter for newlines - Improve chatbot container width and active chat border radius for better visual hierarchy - Refine message container shadows and typography - Rebuild production bundle (bundle.js) Signed-off-by: prvncodz --- .../frontend/src/pages/chatbot/chatbot.scss | 129 ++++++++++++++---- .../frontend/src/pages/chatbot/chatbot.tsx | 60 ++++++-- application/frontend/www/bundle.js | 2 +- .../frontend/www/bundle.js.LICENSE.txt | 6 +- 4 files changed, 161 insertions(+), 36 deletions(-) diff --git a/application/frontend/src/pages/chatbot/chatbot.scss b/application/frontend/src/pages/chatbot/chatbot.scss index efd733b3a..8cee0b408 100644 --- a/application/frontend/src/pages/chatbot/chatbot.scss +++ b/application/frontend/src/pages/chatbot/chatbot.scss @@ -5,7 +5,7 @@ .chat-container { margin: 3rem auto; margin-top: 1.5rem; - max-width: 960px; + max-width: 700px; display: flex; flex-direction: column; position: relative; @@ -13,6 +13,8 @@ .chat-container.chat-active { height: calc(100vh - 179px); + max-width: 900px; + border-radius:18px; overflow: hidden; } @@ -178,7 +180,7 @@ h1.ui.header.chatbot-title { } .message-body { - font-size: 0.95rem; + font-size: 0.98rem; text-align: left; /* NEW: prevent horizontal overflow */ @@ -259,28 +261,113 @@ h1.ui.header.chatbot-title { color: #b71c1c; } -/* ========================= - Chat input - ========================= */ +/* =========== + Chat input + ===========*/ .chat-input { position: sticky; bottom: 0; z-index: 5; - margin-top: 1rem; - background-color: #daebdb; -/* background: transparent; */ - border: 1px solid rgb(190, 214, 232); - padding: 0.75rem; - border-radius: 12px; - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); + + display: flex; + align-items: center; + gap: 0.5rem; + + background: #ffffff; + border: 1px solid rgba(0, 0, 0, 0.08); + border-radius: 14px; + padding: 0.55rem 0.55rem 0.55rem 1rem; + box-shadow: none; + transition: border-color 0.2s ease, box-shadow 0.2s ease; + + &:focus-within { + border-color: rgba(0, 0, 0, 0.15); + } +} + +.chat-container.chat-active .chat-input { + box-shadow: + 0 2px 4px rgba(0, 0, 0, 0.02), + 0 8px 24px rgba(0, 0, 0, 0.06); + + &:focus-within { + border-color: rgba(0, 0, 0, 0.16); + box-shadow: + 0 2px 6px rgba(0, 0, 0, 0.03), + 0 12px 28px rgba(0, 0, 0, 0.08); + } +} + +.chat-textarea { + flex: 1; + background: transparent; + border: none; + outline: none; + resize: none; + font-family: inherit; + font-size: 1.05rem; + line-height: 1.55; + color: #111; + min-height: 28px; + max-height: 200px; + overflow-y: auto; + scrollbar-width: thin; + padding: 2px 0; + + &::placeholder { + color: #9ca3af; + transition: color 0.2s ease; + } + + &:focus::placeholder { + color: #6b7280; + } } -.chat-input .ui.input input { - height: 40px; - line-height: 40px; - border-radius: 10px !important; +.chat-send-btn { + flex-shrink: 0; + width: 32px; + height: 32px; + border-radius: 10px; + border: none; + cursor: pointer; + background: #2185d0; + color: #fff; + display: flex; + align-items: center; + justify-content: center; + transition: background 0.18s ease, transform 0.12s ease; + + svg { + width: 15px; + height: 15px; + } + + &:hover:not(:disabled) { + background: #1a6fad; + transform: translateY(-1px); + } + + &:focus { + outline: none; + } + + &:focus-visible:not(:disabled) { + outline: 2px solid rgba(33, 133, 208, 0.4); + outline-offset: 2px; + } + + &:active:not(:disabled) { + transform: translateY(0); + } + + &:disabled { + background: #2185d0; + color: #fff; + cursor: not-allowed; + } } /* ========================= @@ -398,15 +485,11 @@ h1.ui.header.chatbot-title { display: flex; flex-direction: column; height: 100%; - - background: #fcfcfa; /* same palette as input */ + background: #fcfcfa; /* same palette as input */ backdrop-filter: blur(6px); - border-radius: 18px; border: 1px solid rgba(0, 0, 0, 0.05); - - box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.4); - + box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.4); padding: 1.25rem; } @@ -470,4 +553,4 @@ h1.ui.header.chatbot-title { opacity: 0.85; transform: translateX(-50%) translateY(0); } -} \ No newline at end of file +} diff --git a/application/frontend/src/pages/chatbot/chatbot.tsx b/application/frontend/src/pages/chatbot/chatbot.tsx index 79a175632..049025f62 100644 --- a/application/frontend/src/pages/chatbot/chatbot.tsx +++ b/application/frontend/src/pages/chatbot/chatbot.tsx @@ -5,7 +5,7 @@ import { marked } from 'marked'; import React, { useEffect, useRef, useState } from 'react'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; import { oneLight } from 'react-syntax-highlighter/dist/esm/styles/prism'; -import { Button, Container, Form, GridRow, Header, Icon } from 'semantic-ui-react'; +import { Container, Header, Icon } from 'semantic-ui-react'; import { Grid } from 'semantic-ui-react'; import { useEnvironment } from '../../hooks'; @@ -40,6 +40,14 @@ export const Chatbot = () => { const [chat, setChat] = useState(DEFAULT_CHAT_STATE); const [user, setUser] = useState(''); const [modelName, setModelName] = useState(''); + const textareaRef = useRef(null); + + function growTextarea() { + const el = textareaRef.current; + if (!el) return; + el.style.height = 'auto'; + el.style.height = `${Math.min(el.scrollHeight, 200)}px`; + } function getModelDisplayName(modelName: string): string { if (!modelName) { @@ -142,6 +150,10 @@ export const Chatbot = () => { const currentTerm = chat.term; setChat({ ...chat, term: '' }); setLoading(true); + if (textareaRef.current) { + textareaRef.current.style.height = 'auto'; + textareaRef.current.focus(); + } setChatMessages((prev) => [ ...prev, @@ -191,11 +203,13 @@ export const Chatbot = () => { accurate: data.accurate, }, ]); + textareaRef.current?.focus(); }) .catch((error) => { console.error('Error fetching answer:', error); setError(error instanceof Error ? error.message : 'An unexpected network error occurred'); setLoading(false); + textareaRef.current?.focus(); }); } @@ -300,17 +314,43 @@ export const Chatbot = () => { )} -
- +