Skip to content

Commit 1acbd6a

Browse files
committed
refactor(ui): split chat renderers and styles
1 parent 50a5b4d commit 1acbd6a

13 files changed

Lines changed: 1380 additions & 1327 deletions

File tree

‎ui/src/styles/chat.css‎

Lines changed: 6 additions & 789 deletions
Large diffs are not rendered by default.

‎ui/src/styles/chat/grouped.css‎

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/* =============================================
2+
GROUPED CHAT LAYOUT (Slack-style)
3+
============================================= */
4+
5+
/* Chat Group Layout - default (assistant/other on left) */
6+
.chat-group {
7+
display: flex;
8+
gap: 12px;
9+
align-items: flex-start;
10+
margin-bottom: 16px;
11+
margin-left: 16px;
12+
margin-right: 16px;
13+
}
14+
15+
/* User messages on right */
16+
.chat-group.user {
17+
flex-direction: row-reverse;
18+
justify-content: flex-start;
19+
}
20+
21+
.chat-group-messages {
22+
display: flex;
23+
flex-direction: column;
24+
gap: 2px;
25+
max-width: min(900px, calc(100% - 60px));
26+
}
27+
28+
/* User messages align content right */
29+
.chat-group.user .chat-group-messages {
30+
align-items: flex-end;
31+
}
32+
33+
.chat-group.user .chat-group-footer {
34+
justify-content: flex-end;
35+
}
36+
37+
/* Footer at bottom of message group (role + time) */
38+
.chat-group-footer {
39+
display: flex;
40+
gap: 8px;
41+
align-items: baseline;
42+
margin-top: 6px;
43+
}
44+
45+
.chat-sender-name {
46+
font-weight: 500;
47+
font-size: 12px;
48+
color: var(--muted);
49+
}
50+
51+
.chat-group-timestamp {
52+
font-size: 11px;
53+
color: var(--muted);
54+
opacity: 0.7;
55+
}
56+
57+
/* Avatar Styles */
58+
.chat-avatar {
59+
width: 40px;
60+
height: 40px;
61+
border-radius: 8px;
62+
background: var(--panel-strong);
63+
display: grid;
64+
place-items: center;
65+
font-weight: 600;
66+
font-size: 14px;
67+
flex-shrink: 0;
68+
align-self: flex-end; /* Align with last message in group */
69+
margin-bottom: 4px; /* Optical alignment */
70+
}
71+
72+
.chat-avatar.user {
73+
background: rgba(245, 159, 74, 0.2);
74+
color: rgba(245, 159, 74, 1);
75+
}
76+
77+
.chat-avatar.assistant {
78+
background: rgba(52, 199, 183, 0.2);
79+
color: rgba(52, 199, 183, 1);
80+
}
81+
82+
.chat-avatar.other {
83+
background: rgba(150, 150, 150, 0.2);
84+
color: rgba(150, 150, 150, 1);
85+
}
86+
87+
/* Minimal Bubble Design - dynamic width based on content */
88+
.chat-bubble {
89+
display: inline-block;
90+
border: 1px solid var(--border);
91+
background: rgba(0, 0, 0, 0.12);
92+
border-radius: 12px;
93+
padding: 10px 14px;
94+
box-shadow: none;
95+
transition: background 150ms ease-out, border-color 150ms ease-out;
96+
max-width: 100%;
97+
word-wrap: break-word;
98+
}
99+
100+
.chat-bubble:hover {
101+
background: rgba(0, 0, 0, 0.18);
102+
}
103+
104+
/* User bubbles have different styling */
105+
.chat-group.user .chat-bubble {
106+
background: rgba(245, 159, 74, 0.15);
107+
border-color: rgba(245, 159, 74, 0.3);
108+
}
109+
110+
.chat-group.user .chat-bubble:hover {
111+
background: rgba(245, 159, 74, 0.22);
112+
}
113+
114+
/* Streaming animation */
115+
.chat-bubble.streaming {
116+
animation: pulsing-border 1.5s ease-out infinite;
117+
}
118+
119+
@keyframes pulsing-border {
120+
0%, 100% {
121+
border-color: var(--border);
122+
}
123+
50% {
124+
border-color: var(--accent);
125+
}
126+
}
127+
128+
/* Fade-in animation for new messages */
129+
.chat-bubble.fade-in {
130+
animation: fade-in 200ms ease-out;
131+
}
132+
133+
@keyframes fade-in {
134+
from {
135+
opacity: 0;
136+
transform: translateY(4px);
137+
}
138+
to {
139+
opacity: 1;
140+
transform: translateY(0);
141+
}
142+
}
143+

‎ui/src/styles/chat/layout.css‎

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
/* =============================================
2+
CHAT CARD LAYOUT - Flex container with sticky compose
3+
============================================= */
4+
5+
/* Main chat card - flex column layout, transparent background */
6+
.chat {
7+
position: relative;
8+
display: flex;
9+
flex-direction: column;
10+
flex: 1 1 0;
11+
height: 100%;
12+
min-height: 0; /* Allow flex shrinking */
13+
overflow: hidden;
14+
background: transparent !important;
15+
border: none !important;
16+
box-shadow: none !important;
17+
}
18+
19+
/* Chat header - fixed at top, transparent */
20+
.chat-header {
21+
display: flex;
22+
justify-content: space-between;
23+
align-items: center;
24+
gap: 12px;
25+
flex-wrap: nowrap;
26+
flex-shrink: 0;
27+
padding-bottom: 12px;
28+
margin-bottom: 12px;
29+
background: transparent;
30+
}
31+
32+
.chat-header__left {
33+
display: flex;
34+
align-items: center;
35+
gap: 12px;
36+
flex-wrap: wrap;
37+
min-width: 0;
38+
}
39+
40+
.chat-header__right {
41+
display: flex;
42+
align-items: center;
43+
gap: 8px;
44+
}
45+
46+
.chat-session {
47+
min-width: 180px;
48+
}
49+
50+
/* Chat thread - scrollable middle section, transparent */
51+
.chat-thread {
52+
flex: 1 1 0; /* Grow, shrink, and use 0 base for proper scrolling */
53+
overflow-y: auto;
54+
overflow-x: hidden;
55+
padding: 12px;
56+
margin: 0 -12px;
57+
min-height: 0; /* Allow shrinking for flex scroll behavior */
58+
border-radius: 12px;
59+
background: transparent;
60+
}
61+
62+
/* Focus mode exit button */
63+
.chat-focus-exit {
64+
position: absolute;
65+
top: 12px;
66+
right: 12px;
67+
z-index: 100;
68+
width: 32px;
69+
height: 32px;
70+
border-radius: 50%;
71+
border: 1px solid var(--border);
72+
background: var(--panel);
73+
color: var(--muted);
74+
font-size: 20px;
75+
line-height: 1;
76+
cursor: pointer;
77+
display: flex;
78+
align-items: center;
79+
justify-content: center;
80+
transition: background 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
81+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
82+
}
83+
84+
.chat-focus-exit:hover {
85+
background: var(--panel-strong);
86+
color: var(--text);
87+
border-color: var(--accent);
88+
}
89+
90+
/* Chat compose - sticky at bottom */
91+
.chat-compose {
92+
position: sticky;
93+
bottom: 0;
94+
flex-shrink: 0;
95+
display: flex;
96+
align-items: flex-end;
97+
gap: 12px;
98+
margin-top: auto; /* Push to bottom of flex container */
99+
padding: 16px 0 4px;
100+
background: linear-gradient(to bottom, transparent, var(--bg) 20%);
101+
z-index: 10;
102+
}
103+
104+
.chat-compose__field {
105+
flex: 1 1 auto;
106+
min-width: 0;
107+
}
108+
109+
/* Hide the "Message" label - keep textarea only */
110+
.chat-compose__field > span {
111+
display: none;
112+
}
113+
114+
/* Override .field textarea min-height (180px) from components.css */
115+
.chat-compose .chat-compose__field textarea {
116+
width: 100%;
117+
min-height: 36px;
118+
max-height: 150px;
119+
padding: 8px 12px;
120+
border-radius: 10px;
121+
resize: vertical;
122+
white-space: pre-wrap;
123+
font-family: var(--font-body);
124+
font-size: 14px;
125+
line-height: 1.45;
126+
}
127+
128+
.chat-compose__field textarea:disabled {
129+
opacity: 0.7;
130+
cursor: not-allowed;
131+
}
132+
133+
.chat-compose__actions {
134+
flex-shrink: 0;
135+
display: flex;
136+
align-items: stretch;
137+
}
138+
139+
.chat-compose .chat-compose__actions .btn {
140+
padding: 8px 16px;
141+
font-size: 13px;
142+
min-height: 36px;
143+
white-space: nowrap;
144+
}
145+
146+
/* Chat controls - moved to content-header area, left aligned */
147+
.chat-controls {
148+
display: flex;
149+
align-items: center;
150+
justify-content: flex-start;
151+
gap: 12px;
152+
flex-wrap: wrap;
153+
}
154+
155+
.chat-controls__session {
156+
min-width: 140px;
157+
}
158+
159+
.chat-controls__thinking {
160+
display: flex;
161+
align-items: center;
162+
gap: 6px;
163+
font-size: 13px;
164+
}
165+
166+
/* Icon button style */
167+
.btn--icon {
168+
padding: 8px !important;
169+
min-width: 36px;
170+
height: 36px;
171+
display: inline-flex;
172+
align-items: center;
173+
justify-content: center;
174+
border: 1px solid var(--border);
175+
background: rgba(255, 255, 255, 0.06);
176+
}
177+
178+
/* Controls separator */
179+
.chat-controls__separator {
180+
color: rgba(255, 255, 255, 0.4);
181+
font-size: 18px;
182+
margin: 0 8px;
183+
font-weight: 300;
184+
}
185+
186+
:root[data-theme="light"] .chat-controls__separator {
187+
color: rgba(16, 24, 40, 0.3);
188+
}
189+
190+
.btn--icon:hover {
191+
background: rgba(255, 255, 255, 0.12);
192+
border-color: rgba(255, 255, 255, 0.2);
193+
}
194+
195+
/* Light theme icon button overrides */
196+
:root[data-theme="light"] .btn--icon {
197+
background: rgba(255, 255, 255, 0.9);
198+
border-color: rgba(16, 24, 40, 0.2);
199+
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
200+
color: rgba(16, 24, 40, 0.7);
201+
}
202+
203+
:root[data-theme="light"] .btn--icon:hover {
204+
background: rgba(255, 255, 255, 1);
205+
border-color: rgba(16, 24, 40, 0.3);
206+
color: rgba(16, 24, 40, 0.9);
207+
}
208+
209+
.btn--icon svg {
210+
display: block;
211+
}
212+
213+
.chat-controls__session select {
214+
padding: 6px 10px;
215+
font-size: 13px;
216+
}
217+
218+
.chat-controls__thinking {
219+
display: flex;
220+
align-items: center;
221+
gap: 4px;
222+
font-size: 12px;
223+
padding: 4px 10px;
224+
background: rgba(255, 255, 255, 0.04);
225+
border-radius: 6px;
226+
border: 1px solid var(--border);
227+
}
228+
229+
/* Light theme thinking indicator override */
230+
:root[data-theme="light"] .chat-controls__thinking {
231+
background: rgba(255, 255, 255, 0.9);
232+
border-color: rgba(16, 24, 40, 0.15);
233+
}
234+
235+
@media (max-width: 640px) {
236+
.chat-session {
237+
min-width: 140px;
238+
}
239+
240+
.chat-compose {
241+
grid-template-columns: 1fr;
242+
}
243+
244+
.chat-controls {
245+
flex-wrap: wrap;
246+
gap: 8px;
247+
}
248+
249+
.chat-controls__session {
250+
min-width: 120px;
251+
}
252+
}
253+

0 commit comments

Comments
 (0)